MenuPanel.st
author Claus Gittinger <cg@exept.de>
Fri, 21 Aug 2015 14:16:45 +0200
changeset 4815 c5204a7261c1
parent 4786 7ade4c08f4eb
child 4826 75fcddc0d086
permissions -rw-r--r--
class: TerminalView class definition changed: #keyPressInLineEditMode:
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
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
    14
"{ NameSpace: Smalltalk }"
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
    15
2182
59a770bbb95a changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
    16
View subclass:#MenuPanel
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    17
	instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    18
		selection items groupSizes receiver enabled lastActiveMenu
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    19
		enteredItem prevFocusView previousPointerGrab
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    20
		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    21
		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    22
		showSeparatingLines showGroupDivider implicitGrabView
4454
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
    23
		lastPointerView openDelayedMenuBlock closeDelayedMenuBlock
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
    24
		preferredWidth application originator centerItems hideOnRelease
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
    25
		defaultHideOnRelease buttonInsetX buttonInsetY itemSpace
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
    26
		activeBackgroundColor stringOffsetX doAccessCharacterTranslation
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
    27
		lastItem hasPerformed focusComesByTab lastDrawnScrollerNextBounds
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
    28
		buttonActiveBackgroundColor buttonEnteredBackgroundColor
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
    29
		buttonPassiveBackgroundColor maxExtent sizeFixed'
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    30
	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    31
		DefaultForegroundColor DefaultBackgroundColor IconIndicationOn
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    32
		IconIndicationOff IconRadioOn IconRadioOff
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    33
		IconDisabledIndicationOn IconDisabledIndicationOff
4554
8cd2660136bc class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4552
diff changeset
    34
		IconDisabledRadioOn IconDisabledRadioOff MaxShortCutSearchLevel'
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    35
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    36
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    37
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    38
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    39
Object subclass:#Item
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    40
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    41
		disabledDisplayLabel enableChannel label activeHelpText
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    42
		flyByHelpText isVisible indication choice accessCharacter'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    43
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    44
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    45
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    46
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    47
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    48
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    49
Object subclass:#Adornment
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    50
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    51
		choice choiceValue'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    52
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    53
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    54
	privateIn:MenuPanel::Item
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    55
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    56
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    57
Object subclass:#ScrollActivity
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    58
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    59
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    60
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    61
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    62
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    63
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    64
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    65
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    66
copyright
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    67
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    68
 COPYRIGHT (c) 1997 by eXept Software AG
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    69
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    70
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    71
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    72
 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
    73
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    74
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    75
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    76
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    77
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    78
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    83
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    85
    Due to some historic leftover, there are two mechanisms for menus:
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
    86
	1) the (very) old MenuView (which inherits from SelectionInListView)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
    87
	2) this new MenuPanel.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    88
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    89
    this will eventually replace most of the MenuView and PopUpMenu stuff.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    90
    (and hopefully be ST-80 compatible...)
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    91
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    92
    To create a menu, there exists a MenuEditor which can generate
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    93
    menu specifications, from which a MenuPanel can be dynamically created.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    94
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    95
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    96
    Notice:
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
    97
	This is going to replace the obsolete MenuView.
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    98
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    99
    [author:]
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   100
	Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
    [see also:]
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   103
	Menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   104
	MenuItem
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   105
	MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   106
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   107
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   108
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   109
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   110
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   111
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
"
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   115
  a PullDownMenu
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   116
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   121
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   122
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   123
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   126
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   127
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   128
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   130
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   131
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   133
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   134
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   135
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   136
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   137
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   139
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   140
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   142
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   143
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   145
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   146
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   148
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   149
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   151
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   152
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   153
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   154
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   155
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   156
    top open.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   157
										[exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   158
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   159
  a PullDownMenu with applications
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   160
										[exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   161
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   162
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   163
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   164
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   165
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   166
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   167
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   168
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   169
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   170
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   171
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   172
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   173
    item := menu itemAt:3.
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
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   176
    view := ImageView new.
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   177
    view image:(Image fromScreen:(0@0 corner:200@200)).
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   178
    view preferredExtent:(200@200).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   179
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   180
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   181
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   182
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   183
    top open.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   184
										[exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   185
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   186
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   187
  a PopUpMenu
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   188
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   189
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   190
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   191
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   192
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   193
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   195
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   196
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   197
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   198
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   199
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   200
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   201
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   202
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   203
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   204
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   205
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   206
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   207
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   208
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   209
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   210
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   211
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   212
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   213
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   214
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   215
    mview startUp
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   216
										[exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   217
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   218
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   219
  a menu spec
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   220
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   221
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   222
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   223
    menu := MenuPanel menu:
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   224
	#(#Menu #( #(#MenuItem
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   225
		    #label: 'File'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   226
		    #submenu:
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   227
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   228
				 (#MenuItem
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   229
				    #label: 'edit'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   230
				    #submenu:
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   231
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   232
						 #(#MenuItem #label: 'close' #value:#close)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   233
					       )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   234
					       nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   235
					       nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   236
				       )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   237
				  )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   238
				 #(#MenuItem #label: 'help' #value:#help )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   239
			       )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   240
			       nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   241
			       nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   242
		       )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   243
		 )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   244
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   245
		#(#MenuItem #label: 'Bar'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   246
			    #submenu:
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   247
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   248
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   249
					)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   250
					nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   251
					nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   252
				)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   253
		 )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   254
	      )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   255
	      #( 2 )
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   256
	      nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   257
	 ) decodeAsLiteralArray.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
    Transcript showCR:(menu startUp).
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   261
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   263
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   264
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
    aSpec notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   276
	menu := Menu new.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   277
	menu receiver:aReceiver.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   278
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   291
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   292
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   295
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   297
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   301
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   302
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   303
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   304
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   309
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   313
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   314
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   315
	"/ no receiver specified in the menu; thus set the receiver immediately
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   316
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   317
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   318
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   320
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   321
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   322
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   323
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   324
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
    aReceiver notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   326
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   328
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   329
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   330
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   331
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   332
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   333
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   334
    InitialSelectionQuerySignal isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   335
	InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   336
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   337
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   338
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   339
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   340
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   341
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   342
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   343
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   344
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   345
preSnapshot
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   346
    "remove all resources"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   347
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   348
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   349
    LigthenedImages := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   350
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   351
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   352
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   353
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   354
delayedMenuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   355
    <resource: #image>
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   356
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   357
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   358
    "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
   359
     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
   360
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   361
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   362
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   363
     Icon flushCachedIcons"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   364
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   365
    ^ Icon constantNamed:#'MenuPanel class delayedMenuIndicator'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   366
	ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   367
	    (Depth1Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   368
		width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   369
		height:6;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   370
		photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   371
		bitsPerSample:(#( 1 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   372
		samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   373
		bits:(ByteArray fromPackedString:'@@@@@HCB');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   374
		colorMapFromArray:#[ 0 0 0 255 255 255 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   375
		mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   376
			    width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   377
			    height:6;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   378
			    bits:(ByteArray fromPackedString:'@J+V[C P');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   379
			    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   380
		yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   381
	]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   382
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   383
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   384
iconIndicationDisabledOff
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   385
    <resource: #image>
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   386
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   387
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   388
    "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
   389
     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
   390
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   391
     self iconIndicationDisabledOff inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   392
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   393
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   394
    IconDisabledIndicationOff isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   395
	IconDisabledIndicationOff := Icon
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   396
		constantNamed:#'MenuPanel iconIndicationDisabledOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   397
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   398
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   399
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   400
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   401
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   402
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   403
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   404
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   405
				    fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   406
			colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   407
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   408
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   409
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   410
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   411
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   412
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   413
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   414
		]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   415
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   416
    ^ IconDisabledIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   417
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   418
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   419
iconIndicationDisabledOn
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   420
    <resource: #image>
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   421
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   422
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   423
    "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
   424
     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
   425
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   426
     self iconIndicationDisabledOn inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   427
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   428
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   429
    IconDisabledIndicationOn isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   430
	IconDisabledIndicationOn := Icon
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   431
		constantNamed:#'MenuPanel iconIndicationDisabledOn'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   432
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   433
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   434
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   435
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   436
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   437
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   438
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   439
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   440
				    fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   441
			colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   442
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   443
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   444
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   445
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   446
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   447
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   448
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   449
		]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   450
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   451
    ^ IconDisabledIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   452
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   453
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   454
iconIndicationOff
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   455
    <resource: #image>
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   456
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   457
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   458
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   459
     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
   460
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   461
     self iconIndicationOff inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   462
     ImageEditor openOnClass:self andSelector:#iconIndicationOff"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   463
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   464
    IconIndicationOff isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   465
	IconIndicationOff := Icon constantNamed:#'MenuPanel iconIndicationOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   466
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   467
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   468
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   469
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   470
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   471
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   472
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   473
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   474
				    fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   475
			colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   476
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   477
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   478
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   479
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   480
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   481
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   482
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   483
		]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   484
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   485
    ^ IconIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   486
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   487
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   488
iconIndicationOn
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   489
    <resource: #image>
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   490
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   491
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   492
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   493
     the ImageEditor may not be able to read the specification."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   494
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   495
     self iconIndicationOn inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   496
     ImageEditor openOnClass:self andSelector:#iconIndicationOn"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   497
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   498
    IconIndicationOn isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   499
	IconIndicationOn := Icon constantNamed:#'MenuPanel iconIndicationOn'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   500
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   501
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   502
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   503
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   504
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   505
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   506
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   507
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   508
				    fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   509
			colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   510
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   511
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   512
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   513
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   514
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   515
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   516
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   517
		]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   518
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   519
    ^ IconIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   520
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   521
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   522
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   523
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   524
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   525
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   526
    "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
   527
     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
   528
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   529
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   530
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   531
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   532
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   533
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   534
"/    <resource: #image>
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
"/    IconDisabledRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   537
"/        IconDisabledRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   538
"/            constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   539
"/            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
   540
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   541
"/    ^ IconDisabledRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   542
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   543
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   544
    ^ RadioButton disabledPassiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   545
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   546
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   547
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   548
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   549
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   550
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   551
    "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
   552
     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
   553
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   554
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   555
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   556
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   557
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   558
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   559
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   560
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   561
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   562
"/    IconDisabledRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   563
"/        IconDisabledRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   564
"/            constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   565
"/            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
   566
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   567
"/    ^ IconDisabledRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   568
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   569
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   570
    ^ RadioButton disabledActiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   571
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   572
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   573
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   574
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   575
    ^ RadioButton enteredPassiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   576
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   577
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   578
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   579
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   580
    ^ RadioButton enteredActiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   581
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   582
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   583
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   584
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   585
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   586
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   587
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   588
     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
   589
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   590
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   591
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   592
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   593
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   594
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   595
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   596
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   597
"/    IconRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   598
"/        IconRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   599
"/            constantNamed:#'MenuPanel iconRadioGroupOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   600
"/            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
   601
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   602
"/    ^ IconRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   603
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   604
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   605
    ^ RadioButton passiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   606
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   607
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   608
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   609
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   610
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   611
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   612
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   613
     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
   614
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   615
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   616
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   617
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   618
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   619
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   620
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   621
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   622
"/    IconRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   623
"/        IconRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   624
"/            constantNamed:#'MenuPanel iconRadioGroupOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   625
"/            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
   626
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   627
"/    ^ IconRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   628
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   629
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   630
    ^ RadioButton activeForm
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   631
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   632
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   633
menuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   634
    <resource: #image>
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   635
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   636
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   637
    "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
   638
     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
   639
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   640
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   641
     ImageEditor openOnClass:self andSelector:#menuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   642
     Icon flushCachedIcons"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   643
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   644
    ^ Icon constantNamed:#'MenuPanel class menuIndicator'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   645
	ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   646
	    (Depth1Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   647
		width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   648
		height:4;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   649
		photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   650
		bitsPerSample:(#( 1 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   651
		samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   652
		bits:(ByteArray fromPackedString:'@@B@0 @a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   653
		colorMapFromArray:#[ 0 0 0 255 255 255 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   654
		mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   655
			    width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   656
			    height:4;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   657
			    bits:(ByteArray fromPackedString:'?''08D@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   658
			    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   659
		yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   660
	]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   661
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   662
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   663
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   664
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   665
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   666
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   667
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   668
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   669
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   670
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   671
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   672
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   673
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   674
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   675
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   676
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   677
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   678
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   679
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   680
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   681
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   682
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   683
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   684
maxShortCutSearchLevel
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   685
    "1 means: only search in top items.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   686
     2 means: search one level of menus.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   687
     used to be 10"
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   688
3384
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   689
    MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.].
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   690
    ^ MaxShortCutSearchLevel
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   691
!
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   692
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   693
maxShortCutSearchLevel: anInteger
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   694
    "1 means: only search in top items.
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   695
     2 means: search one level of menus."
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   696
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   697
    MaxShortCutSearchLevel := anInteger
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   698
!
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   699
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   700
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   701
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   702
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   703
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   704
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   705
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   706
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   707
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   708
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   709
     ex:
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   710
	&File   mnemonic := Cmdf
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   711
	F&ile   mnemonic := Cmdi
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   712
	....."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   713
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   714
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   715
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   716
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   717
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   718
    "extract values from the styleSheet and cache them in class variables"
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   719
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   720
    <resource: #style (
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   721
	#'selection.disabledForegroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   722
	#'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   723
	#'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   724
	#'menu.itemSpace' #'menu.buttonItemVerticalSpace'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   725
	#'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   726
	#'menu.hilightLevel' #'menu.enteredLevel'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   727
	#'menu.groupDividerSize' #'menu.itemMargin'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   728
	#'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   729
	#'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   730
	#'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   731
	#'menu.selectionFollowsMouse'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   732
	#'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   733
	#'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   734
	#'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   735
	#'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   736
	#'menu.iconIndicationOn' #'menu.iconIndicationOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   737
	#'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   738
	#'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   739
	#'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   740
	#'menu.iconRadioOn' #'menu.iconRadioOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   741
	#'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   742
	#'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   743
	#'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   744
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   745
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   746
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   747
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   748
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   749
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   750
     which returns the default cashed DefaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   751
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   752
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   753
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   754
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   755
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   756
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   757
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   758
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   759
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   760
    DefaultFont     := MenuView defaultFont.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   761
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   762
							    default:[styleSheet
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   763
									colorAt:#'menu.foregroundColor'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   764
									default:Color black].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   765
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   766
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   767
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   768
    var isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   769
	style == #motif ifTrue:[ var := backgroundColor ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   770
		       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   771
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   772
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   773
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   774
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   775
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   776
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   777
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   778
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   779
    var isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   780
	var := styleSheet colorAt:#'selection.disabledForegroundColor'.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   781
	var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   782
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   783
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   784
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   785
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   786
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   787
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   788
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   789
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   790
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   791
    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
   792
    styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   793
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   794
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   795
    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
   796
    styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   797
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   798
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   799
    styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   800
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   801
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   802
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   803
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   804
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   805
    buttonPassiveBackgroundColor isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   806
	buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   807
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   808
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   809
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   810
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   811
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   812
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   813
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   814
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   815
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   816
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   817
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   818
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   819
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   820
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   821
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   822
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   823
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   824
    getBitmapOrFile := [:key :fileKey |
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   825
	|var|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   826
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   827
	var := styleSheet at:key ifAbsent:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   828
	var isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   829
	    var := styleSheet at:fileKey ifAbsent:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   830
	    var notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   831
		var := Smalltalk imageFromFileNamed:var forClass:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   832
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   833
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   834
	var
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   835
    ].
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   836
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   837
    IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   838
    IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   839
    IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   840
    IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   841
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   842
    IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   843
    IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   844
    IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   845
    IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   846
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   847
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   848
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   849
    "
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   850
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   851
    "Modified: / 19-01-2012 / 13:17:59 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   852
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   853
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   854
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   855
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   856
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   857
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   858
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   859
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   860
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   861
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   862
    anImage device == aDevice ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   863
	^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   864
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   865
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   866
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   867
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   868
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   869
	Images at:aDevice put:(deviceImages := Dictionary new)
4605
0d5ab97f8247 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4587
diff changeset
   870
    ].
0d5ab97f8247 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4587
diff changeset
   871
0d5ab97f8247 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4587
diff changeset
   872
    ^ deviceImages at:anImage ifAbsentPut:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   873
	|image|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   874
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   875
	image := anImage copy onDevice:aDevice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   876
	deviceImages at:anImage put:image.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   877
	image
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   878
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   879
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   880
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   881
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   882
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   883
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   884
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   885
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   886
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   887
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   888
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   889
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   890
	LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   891
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   892
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   893
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   894
	^ image
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   895
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   896
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   897
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   898
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   899
    colorMap notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   900
	image := anImage lightened onDevice:aDevice.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   901
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   902
	image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   903
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   904
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   905
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   906
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   907
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   908
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   909
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   910
subMenu:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   911
    "create a submenu; can be redifined in derived classes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   912
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   913
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   914
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   915
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   916
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   917
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   918
!MenuPanel class methodsFor:'utilities'!
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   919
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   920
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   921
    "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
   922
     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
   923
     or fix), or by an ampersand escape.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   924
     Double ampersands are replaced by a single one."
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   925
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   926
    |i label nextChar rest pos size accessCharacter|
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   927
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   928
    pos := accessCharacterPositionOrNil.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   929
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   930
    label := aLabel.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   931
    size := aLabel size.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   932
    i := 1.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   933
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   934
	nextChar := label at:(i+1).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   935
	nextChar isSeparator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   936
	    i := i + 1
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   937
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   938
	    rest := label copyFrom:(i+1).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   939
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   940
	    i == 1 ifTrue:[label := rest]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   941
		  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   942
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   943
	    (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   944
	    size := size - 1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   945
	].
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   946
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   947
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   948
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   949
	^ label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   950
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   951
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   952
    label isText ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   953
	label := Text string:label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   954
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   955
    label emphasisAt:pos add:#underline.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   956
    ^ label
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   957
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   958
    "Created: / 15-02-2012 / 18:50:58 / cg"
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   959
! !
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   960
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   961
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   962
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   963
accept
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   964
    "accept the current selected item"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   965
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   966
    |item|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   967
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   968
    (item := self selection) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   969
	self topMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   970
	    openDelayed:nil;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   971
	    accept:nil.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   972
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   973
	self acceptItem:item inMenu:self
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   974
    ]
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   975
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   976
    "Modified: / 29-06-2011 / 16:14:26 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   977
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   978
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   979
accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   980
    "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
   981
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
   982
    |itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   983
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   984
    self superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   985
	^ self topMenu accept:anItemOrNil
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   986
    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   987
    prevFocusView ~~ self ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   988
	focusView := prevFocusView.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   989
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   990
    prevFocusView := nil.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
   991
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   992
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   993
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   994
    self selection:nil.
420
ca
parents: 417
diff changeset
   995
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   996
    (anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   997
	tgState := anItemOrNil toggleIndication.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   998
	panel := anItemOrNil menuPanel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   999
	itemIdx := panel findFirst:[:el| el == anItemOrNil ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1000
	itemAcceptedOrNil := anItemOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1001
	recv := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1002
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1003
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1004
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1005
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1006
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
  1007
    self isPopUpView ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1008
	self do:[:el| el updateIndicators].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1009
	winGrp notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1010
	    winGrp processExposeEvents.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1011
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1012
    ] ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1013
	self unmap.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1014
	self device sync. "/ round trip - all expose events are now received
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1015
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1016
	winGrp notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1017
	    "/ give expose event a chance to arrive
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1018
	    [shown and:[realized]] whileTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1019
		winGrp processExposeEventsFor:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1020
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1021
	    masterGroup := winGrp previousGroup.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1022
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1023
	"/ cg: disabled-not needed - try PopUpList with destroy...
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1024
	"/ self destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1025
	masterGroup notNil ifTrue:[masterGroup processExposeEvents].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1026
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1027
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1028
    (focusView notNil and:[winGrp notNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1029
	winGrp focusView:focusView.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1030
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1031
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1032
    itemAcceptedOrNil isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1033
	hasPerformed := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1034
	self isPopUpView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1035
	    lastItem := itemAcceptedOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1036
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1037
	^ itemAcceptedOrNil.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1038
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1039
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1040
"/ using master maingroup, sensor in my current windowgroup
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1041
"/ flushes its events if the window goes
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1042
winGrp notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1043
    winGrp mainGroup notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1044
	sensor := winGrp mainGroup sensor.
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1045
    ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1046
].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1047
sensor isNil ifTrue:[sensor := self sensor ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1048
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1049
    sensor pushEvent:(
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1050
	MenuEvent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1051
	    selectMenuItem:itemAcceptedOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1052
	    index:itemIdx
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1053
	    text:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1054
	    value:tgState
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1055
	    inMenu:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1056
	    menuReceiver:recv).
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1057
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1058
    ^ anItemOrNil.  "/ stupid convention
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1059
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1060
"/    acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1061
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1062
"/    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1063
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1064
"/    (itemAcceptedOrNil showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1065
"/    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1066
"/    ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1067
"/        winGrpForBusyCursor withWaitCursorDo:acceptAction
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1068
"/    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1069
"/        acceptAction value
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1070
"/    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1071
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1072
    "Modified: / 07-07-2011 / 18:08:41 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1073
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1074
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1075
accept:anItem index:anIndex toggle:aState receiver:aReceiver
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1076
    "really accept an item"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1077
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1078
    |selectorOrBlock argument numArgs isValueModel rec args arg2
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  1079
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1080
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1081
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1082
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1083
    hasPerformed := isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1084
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1085
    (selectorOrBlock := anItem value) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1086
	^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1087
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1088
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1089
    (argument := anItem argument) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1090
	argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1091
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1092
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1093
    (selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1094
	"/ a valueHolder or block
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1095
	(selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1096
	    'MenuPanel [warning]: menuItem''s value does not respond to #value protocol' infoPrintCR.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1097
	     ^ self "/ ^ selectorOrBlock
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1098
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1099
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1100
	numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1101
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1102
	numArgs == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1103
	    args := nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1104
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1105
	    numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1106
		args := Array with:argument
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1107
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1108
		args := Array with:argument with:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1109
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1110
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1111
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1112
	selectorOrBlock valueWithArguments:args.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1113
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1114
	hasPerformed := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1115
	^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1116
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1117
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1118
    anItem sendToOriginator ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1119
	rec := self originator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1120
	rec isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1121
	    self error:'no originating widget (no target for message)' mayProceed:true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1122
	].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1123
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1124
	rec := aReceiver
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1125
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1126
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1127
    rec isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1128
	'MenuPanel [warning]: menu has no receiver defined' infoPrintCR.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1129
	^ self "/ ^ selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1130
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1131
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1132
    isValueModel ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1133
	rec value:selectorOrBlock
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  1134
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1135
	selectorOrBlock isArray ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1136
	    "/ a hack !!!!!! Must be compatible to old MenuView
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1137
	    args := selectorOrBlock copyFrom:2.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1138
	    selectorOrBlock := selectorOrBlock first.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1139
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1140
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1141
	    arg2 := self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1142
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1143
	    "/ support for ST80 style applications
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1144
	    "/ (expecting the message to go to the application
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1145
	    "/  if not understood by the view)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1146
	    "/ These expect the controller to be passed as argument.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1147
	    "/ sigh.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1148
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1149
	    (rec isView
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1150
	    and:[(rec respondsTo:selectorOrBlock) not
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1151
	    and:[(app := rec application) ~~ rec
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1152
	    and:[app notNil]]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1153
		arg2 := rec controller.       "/ the Views controller
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1154
		rec := app.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1155
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1156
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1157
	    (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1158
		args := nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1159
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1160
		numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1161
		    args := Array with:argument
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1162
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1163
		    args := Array with:argument with:arg2
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1164
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1165
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1166
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1167
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1168
	fallBack :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1169
	    [
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1170
		|val|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1171
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1172
		"/ mhmh - the receiver did not respond to that message;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1173
		"/ if there is a master-application, try that one
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1174
		"/ (recursive)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1175
		master := rec perform:#masterApplication ifNotUnderstood:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1176
		master notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1177
		    rec := master.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1178
		    val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1179
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1180
		    self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1181
			error:('Unimplemented (or error in) menu message: %1 for %2'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1182
				    bindWith:selectorOrBlock
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1183
				    with:aReceiver printString)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1184
			mayProceed:true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1185
		    val := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1186
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1187
		val
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1188
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1189
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1190
	rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
  1191
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1192
    hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1193
    ^ self "/ ^ selectorOrBlock
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1194
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1195
    "Modified: / 06-03-2012 / 14:49:00 / cg"
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1196
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1197
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1198
acceptItem:anItemOrNil inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1199
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1200
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1201
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1202
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1203
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1204
    (anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1205
	topMenu accept:anItemOrNil
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1206
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1207
	anItemOrNil canAccept ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1208
	    tgState := anItemOrNil toggleIndication.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1209
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1210
	    self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1211
		accept:anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1212
		index:(aMenu selectionIndex)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1213
		toggle:tgState
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1214
		receiver:(aMenu receiver).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1215
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1216
	    aMenu do:[:el| el updateIndicators].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1217
	    anItemOrNil hideMenuOnActivated ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1218
		aMenu invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1219
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1220
	]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1221
    ]
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1222
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1223
    "Modified: / 29-06-2011 / 14:34:45 / cg"
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1224
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1225
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1226
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1227
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1228
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1229
  ^ lastItem
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1230
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1231
    "Modified: / 29-06-2011 / 16:24:48 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1232
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1233
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1234
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1235
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1236
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1237
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1238
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1239
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1240
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1241
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1242
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1243
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1244
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1245
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1246
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1247
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1248
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1249
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1250
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1251
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1252
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1254
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1255
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1256
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1257
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1258
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1259
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1260
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1261
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1262
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1263
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1264
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1266
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1267
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1268
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1269
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1270
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1271
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1272
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1273
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1274
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1276
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1279
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1280
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1281
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1282
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1284
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1285
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1286
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1287
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1288
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1289
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1290
doAccessCharacterTranslation
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1291
    "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
  1292
     Can be set to false to leave accessCharacter unchanged"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1293
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1294
    ^ doAccessCharacterTranslation ? true
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1295
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1296
    "Modified: / 02-11-2010 / 10:19:09 / cg"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1297
!
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1298
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1299
doAccessCharacterTranslation:aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1300
    "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
  1301
     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
  1302
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1303
    doAccessCharacterTranslation := aBoolean
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1304
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1305
    "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
  1306
!
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1307
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1308
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1309
    "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
  1310
     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
  1311
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1312
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1313
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1314
    "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
  1315
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1316
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1317
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1318
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1319
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1320
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1321
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1322
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1323
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1324
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1325
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1326
    aGroupSizes = groupSizes ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1327
	groupSizes := aGroupSizes copy.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1328
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1329
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1330
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1331
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1332
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1333
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1334
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1335
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1336
hideOnRelease:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1337
    hideOnRelease := aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1338
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1339
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1340
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1341
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1342
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1343
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1344
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1345
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1346
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1347
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1348
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1349
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1351
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1352
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1353
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1354
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1355
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1356
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1357
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1359
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1360
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1361
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1362
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1363
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1364
	self removeAll.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1365
	size := labels size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1366
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1367
	size > 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1368
	    items := OrderedCollection new:size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1369
	    labels do:[:aLabel| items add:(Item in:self label:aLabel) ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1370
	    preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1371
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1372
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1373
!
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1374
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1375
menuPerformer:anObject
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1376
    "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
  1377
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1378
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1379
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1380
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1381
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1382
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1383
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1384
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1385
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1386
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1387
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1388
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1389
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1390
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1391
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1392
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1393
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1394
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1395
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1396
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1397
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1398
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1399
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1400
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1401
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1402
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1403
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1404
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1405
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1406
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1407
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1408
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1410
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1411
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1412
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1413
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1414
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1415
	^ superMenu originator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1416
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1417
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1418
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1419
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1420
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
    "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
  1422
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1423
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1424
    (receiver isNil and:[superMenu notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1425
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1426
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1427
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1428
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1429
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1430
receiver:anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1431
    "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
  1432
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1433
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1434
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1435
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1437
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1438
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1439
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1440
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
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
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1444
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1445
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1446
    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
  1447
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1448
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1450
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1451
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1452
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1456
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1457
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1459
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1460
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1462
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1463
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1464
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1465
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1466
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1467
valueAt:stringOrNumber put:aBlockOrValueHolderOrSelector
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1468
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1469
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1470
    self itemAt:stringOrNumber do:[:el| el value:aBlockOrValueHolderOrSelector ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1471
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1472
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1473
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1474
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1475
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1477
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1478
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1479
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1482
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1483
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1484
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1488
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1489
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1494
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1495
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1496
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1497
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1500
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1501
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1502
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1506
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1507
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1508
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1509
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1510
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1511
enabled:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1512
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1513
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1514
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1515
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1516
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1518
    enabled ~~ state ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1519
	enabled := state.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1520
	self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1521
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1522
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1523
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1525
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1526
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1527
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1528
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1530
enabledAt:stringOrNumber put:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1531
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1532
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1533
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1536
exclusivePointer:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1537
    "Do nothing here. Compatibility with PopUpListController"
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1538
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1539
    ^ self
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1540
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1541
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1542
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1543
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1544
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1545
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1546
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1547
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1548
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1549
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1550
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1551
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1552
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1553
    enableChannel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1554
	enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1555
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1556
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1557
    (enableChannel := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1558
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1559
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1560
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1561
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1562
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1563
menuChannel
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1564
    ^ self menuHolder
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1565
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1566
    "Created: / 27-03-2007 / 08:38:31 / cg"
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1567
!
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1568
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1569
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1570
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1571
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1572
    menuHolder notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1573
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1574
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1575
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1576
    (menuHolder := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1577
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1578
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1579
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1580
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1581
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1582
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1583
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1584
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1585
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1586
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1587
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1588
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1589
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1590
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1591
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1592
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1593
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1594
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1595
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1596
backgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1597
    "return the background color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1598
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1599
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1600
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1601
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1602
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1603
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1604
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1605
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1606
    self backgroundColor ~~ aColor ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1607
	super viewBackground:aColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1608
	self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1609
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1610
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1611
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1612
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1613
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1614
buttonActiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1615
    "get the background drawing color used to highlight button selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1616
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1617
    ^ buttonActiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1618
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1619
    "Modified: / 19-01-2012 / 11:51:46 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1620
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1621
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1622
buttonActiveForegroundColor
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1623
    "get the foreground drawing color used to highlight button selection"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1624
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1625
    ^ styleSheet colorAt:#'button.activeForegroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1626
		 default:(self foregroundColor)
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1627
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1628
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1629
buttonEdgeStyle
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1630
    "get the button edge style"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1631
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1632
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1633
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1634
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1635
buttonEnteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1636
    "get the background drawing color used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1637
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1638
    ^ buttonEnteredBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1639
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1640
    "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
  1641
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1642
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1643
buttonEnteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1644
    "get the 3D-level used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1645
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1646
    ^ styleSheet at:#'menuPanel.buttonEnteredLevel'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1647
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1648
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1649
buttonHalfLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1650
    "get the background drawing color used to half light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1651
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1652
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1653
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1654
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1655
buttonHalfShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1656
    "get the background drawing color used to half shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1657
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1658
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1659
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1660
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1661
buttonLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1662
    "get the background drawing color used to light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1663
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1664
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1665
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1666
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1667
buttonPassiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1668
    "get the background drawing color used for button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1669
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1670
    ^ buttonPassiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1671
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1672
    "Modified: / 19-01-2012 / 13:13:59 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1673
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1674
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1675
buttonShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1676
    "get the background drawing color used to shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1677
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1678
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1679
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1680
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1681
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1682
    "return the color used for etching disabled items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1683
     If nil, no 3D effect is drawn."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1684
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1685
    |bg|
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1686
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1687
    (bg := self backgroundColor) = DefaultBackgroundColor ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1688
	^ bg mixed:0.5 with:Color white
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1689
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1690
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1691
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1692
    "Modified: / 28-11-2013 / 16:28:25 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1693
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1694
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1695
disabledForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1696
    "return the foreground color used by disabled items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1697
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1698
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1699
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1700
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1701
enteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1702
    "return the background color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1703
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1704
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1705
		 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1706
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1707
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1708
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1709
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1710
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1711
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1712
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1713
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1714
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1715
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1716
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1717
    (aFont isNil or:[aFont = gc font]) ifTrue:[ ^ self ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1718
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1719
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1720
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1721
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1722
    (shown and:[superMenu notNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1723
	self extent:(self preferredExtent)
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1724
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1725
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1726
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1727
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1728
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1729
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1730
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1731
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1732
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1733
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1734
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1735
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1736
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1737
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1738
    aColor ~= fgColor ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1739
	fgColor := aColor onDevice:self graphicsDevice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1740
	self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1741
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1742
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1743
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1744
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1745
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1746
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1747
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1748
    ^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1749
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1750
    "Modified: / 19-01-2011 / 21:21:53 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1751
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1752
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1753
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1754
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1755
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1756
    ^ Color white
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1757
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1758
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1759
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1760
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1761
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1762
    ^ Color black
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1763
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1764
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1765
setFont:aFont
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1766
    "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
  1767
     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
  1768
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1769
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1770
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1771
    currentFont := gc font.
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1772
    (aFont notNil and:[aFont ~= currentFont]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1773
	super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1774
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1775
    ^ currentFont
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1776
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1777
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1778
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1779
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1780
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1781
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1782
3886
68183511e7ef code deobfuscated:
Claus Gittinger <cg@exept.de>
parents: 3881
diff changeset
  1783
    self hasExplicitExtent ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1784
	^ self preferredHeight
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1785
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1786
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1787
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1788
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1789
maxExtent
4113
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1790
    |minH pos|
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1791
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1792
    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
  1793
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1794
    self graphicsDevice notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1795
	"/ notice, the position-dependent query: if there is a higher secondary screen,
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1796
	"/ this makes a difference in where a popUpMenu is allowed...
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1797
	pos := self origin.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1798
	pos = (0@0) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1799
	    "called too early"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1800
	    minH := self graphicsDevice smallestMonitorHeight.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1801
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1802
	    minH := self graphicsDevice usableHeightAt:pos.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1803
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1804
	^ self graphicsDevice usableWidth @ (minH - 2)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1805
	"/ ^ self graphicsDevice usableExtent - 5.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1806
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1807
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1808
	^ superMenu maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1809
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1810
    "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
  1811
    self error:'don''t know maxExtent'.
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1812
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1813
    "Modified: / 15-02-2012 / 19:22:24 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1814
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1815
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1816
origin:origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1817
    "changed due to menu in horizontal panel, if the origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1818
     changed we have to rearrange the menu items if size not fixed"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1819
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1820
    |oldLeft|
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1821
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1822
    (shown and:[mustRearrange not and:[sizeFixed not]]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1823
	^ super origin:origin
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1824
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1825
    "left partner in horizontal panel toggles visibility"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1826
    oldLeft := self left.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1827
    super origin:origin.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1828
    oldLeft = self left ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1829
	"/ no change notification... so cannot call #mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1830
	mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1831
	self invalidate.
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1832
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1833
!
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1834
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1835
preferredExtent
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1836
    "compute and returns my preferred extent"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1837
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1838
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1839
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1840
    "/ If I have an explicit preferredExtent..
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1841
    explicitExtent notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1842
	^ explicitExtent
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1843
    ].
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1844
    "/ If I have a cached preferredExtent value..
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1845
    preferredExtent notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1846
	^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1847
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1848
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1849
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1850
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1851
    superView isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1852
	"/ is standalone
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1853
	preferredWidth notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1854
	    usedExtent x < preferredWidth ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1855
		usedExtent := preferredWidth @ usedExtent y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1856
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1857
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1858
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1859
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1860
    maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1861
    maxExtent notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1862
	usedExtent := usedExtent min:maxExtent.
4627
905fcf6a9bfc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4617
diff changeset
  1863
    ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1864
    "/ changed due to menu in horizontal panel
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1865
    (superView notNil and:[items size == 0] ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1866
	self isViewWrapper ifFalse:[ ^ usedExtent ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1867
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1868
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1869
    preferredExtent := usedExtent.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1870
    ^ usedExtent
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1871
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1872
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1873
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1874
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1875
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1876
    "compute and returns my preferred extent including all items
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1877
	!!!!!! changes have influence on method #rearrangeItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1878
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1879
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1880
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1881
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1882
     size         "{ Class:SmallInteger }"
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1883
     buttonInsetX2 "{ Class:SmallInteger }"
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1884
     buttonInsetY2 "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1885
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1886
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1887
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1888
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1889
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1890
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1891
    (size := items size) == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1892
	self isViewWrapper ifTrue:[ ^ subViews first extent ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1893
	^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1894
    ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1895
    stringOffsetX := nil.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1896
    buttonInsetX2 := 2 * buttonInsetX.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1897
    buttonInsetY2 := 2 * buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1898
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1899
    self isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1900
	labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1901
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1902
	labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1903
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1904
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1905
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1906
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1907
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1908
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1909
    self verticalLayout ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1910
	items keysAndValuesDo:[:key :el| |eX eY|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1911
	    extent := el preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1912
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1913
	    "/ check for visibility (extent x ~~ 0)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1914
	    (eX := extent x) ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1915
		eY := extent y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1916
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1917
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1918
		    eX := eX + buttonInsetX2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1919
		    eY := eY + buttonInsetY2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1920
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1921
		    eX := eX + labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1922
		    eY := eY + labelInsetY.
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
		key ~~ size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1925
		    (self hasGroupDividerAt:key) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1926
			x := x + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1927
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1928
			el needsItemSpaceWhenDrawing ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1929
			    x := x + itemSpace
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1930
			]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1931
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1932
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1933
		x := x + eX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1934
		y := y max:eY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1935
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1936
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1937
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1938
	hasMenu := false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1939
	shCtKey := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1940
	showAcc := MenuView showAcceleratorKeys == true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1941
	y := x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1942
	x := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1943
	itemMargin := 2 * self itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1944
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1945
	items keysAndValuesDo:[:key :el| |eX eY|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1946
	    extent := el preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1947
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1948
	    "/ check for visibility (extent x ~~ 0)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1949
	    (eX := extent x) ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1950
		eY := extent y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1951
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1952
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1953
		    eX := eX + buttonInsetX2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1954
		    eY := eY + buttonInsetY2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1955
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1956
		    eX := eX + labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1957
		    eY := eY + labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1958
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1959
		hasMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1960
		    hasMenu := el hasSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1961
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1962
		(showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1963
		    shCtKey := shCtKey max:(sck widthOn:self)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1964
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1965
		key ~~ size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1966
		    (self hasGroupDividerAt:key) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1967
			y := y + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1968
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1969
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1970
		y := y + eY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1971
		x := x max:eX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1972
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1973
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1974
	x := x + itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1975
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1976
	(hasMenu or:[shCtKey ~~ 0]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1977
	    shortKeyInset := x + Item labelRightOffset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1978
	    x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1979
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1980
	    (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1981
		x := x + self shortcutKeyOffset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1982
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1983
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1984
"/ to have a small inset
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1985
	y := y + 1.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1986
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1987
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1988
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1989
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1990
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1991
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1992
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1993
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1994
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1995
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1996
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1997
     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
  1998
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1999
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2000
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2001
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2002
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2003
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2004
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2005
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2006
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2007
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2008
sizeFixed:aBoolean
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2009
    "set/clear the fix-size attribute.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2010
     If true (the default), the menuPanel will not change its size when items become visible/invisible.
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2011
     If false, it will resize itself to adapt to the number of visible items"
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2012
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2013
    sizeFixed := aBoolean.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2014
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2015
    sizeFixed ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2016
	"/ changed due to menu in horizontal panel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2017
	superView notNil ifTrue:[ superView addDependent:self ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2018
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2019
!
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2020
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2021
stringOffsetXfor:anItem
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2022
    "return the x offset for a MenuItem where to draw the text
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2023
    "
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2024
    |label w|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2025
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2026
    anItem isButton ifTrue:[ ^ 0 ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2027
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2028
    stringOffsetX isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2029
	stringOffsetX := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2030
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2031
	(self isPopUpView and:[self verticalLayout]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2032
	    self do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2033
		el isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2034
		    (    (label := el indicatorForm) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2035
		     or:[(label := el choiceForm) notNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2036
		    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2037
			stringOffsetX := stringOffsetX max:(label width + 2).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2038
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2039
			label := el displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2040
			label class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2041
			    stringOffsetX := stringOffsetX max:(label xOfString).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2042
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2043
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2044
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2045
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2046
	].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2047
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2048
    w := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2049
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2050
    (    (label := anItem indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2051
     or:[(label := anItem choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2052
    ) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2053
	w := label width + 2.
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2054
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2055
    stringOffsetX == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2056
	^ w
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2057
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2058
    w == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2059
	label := anItem displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2060
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2061
	label class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2062
	    ^ stringOffsetX - label xOfString
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2063
	].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2064
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2065
    ^ stringOffsetX.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2066
!
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2067
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2068
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2069
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2070
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2071
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2072
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2073
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2074
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2075
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2076
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2077
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2078
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2079
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2080
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2081
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2082
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2083
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2084
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2085
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2086
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2087
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2088
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2089
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2090
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2091
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2092
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2093
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2094
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2095
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2096
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2097
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2098
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2099
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2100
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2101
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2102
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2103
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2104
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2105
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2106
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2107
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2108
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2109
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2110
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2111
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2112
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2113
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2114
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2115
4240
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2116
hasItems
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2117
    "return true, if I have items"
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2118
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2119
    ^ items notEmptyOrNil
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2120
!
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2121
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2122
itemAt:stringOrNumber do:aOneArgBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2123
    "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
  2124
     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
  2125
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2126
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2127
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2128
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2129
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2130
    "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
  2131
     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
  2132
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2133
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2134
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2135
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2136
    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
  2137
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2138
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2139
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2140
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2141
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2142
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2143
    ^ 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
  2144
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2145
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2146
items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2147
    "returns the list of items or nil.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2148
     Warning: do not change this list - it is mine !!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2149
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2150
    ^ items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2151
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2152
    "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
  2153
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2154
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2155
itemsDo:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2156
    items notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2157
	items do:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2158
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2159
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2160
    "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
  2161
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2162
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2163
itemsDoWithIndex:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2164
    items notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2165
	items doWithIndex:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2166
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2167
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2168
    "Created: / 09-11-2010 / 10:06:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2169
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2170
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2171
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2172
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2173
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2174
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2175
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2176
    ^ styleSheet at:#'menuPanel.buttonActiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2177
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2178
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2179
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2180
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2181
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2182
    ^ (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2183
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  2184
    "Modified: / 19-01-2011 / 21:21:26 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2185
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2186
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2187
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2188
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2189
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2190
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2191
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2192
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2193
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2194
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2195
fitFirstPanel
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2196
    "gets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2197
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2198
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2199
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2200
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2201
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2202
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2203
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2204
fitFirstPanel:aState
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2205
    "sets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2206
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2207
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2208
     NOT SUPPORTED"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2209
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2210
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2211
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2212
    anInt ~~ level ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2213
	super level:anInt.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2214
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2215
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2216
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2217
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2218
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2219
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2220
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2221
    rightArrow isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2222
	self graphicsDevice isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2223
	    ^ SelectionInListView rightArrowFormOn:Screen current
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2224
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2225
	rightArrow := SelectionInListView rightArrowFormOn:self graphicsDevice
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2226
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2227
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2228
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2229
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2230
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2231
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2232
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2233
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2234
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2235
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2236
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2237
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2238
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2239
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2240
showGroupDivider:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2241
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2242
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2243
    showGroupDivider ~~ aState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2244
	showGroupDivider := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2245
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2246
    ]
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
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2250
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2251
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2252
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2253
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2254
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2255
showSeparatingLines:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2256
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2257
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2258
    aState ~~ showSeparatingLines ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2259
	showSeparatingLines := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2260
	self mustRearrange
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2261
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2262
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2263
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2264
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2265
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2266
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2267
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2268
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2269
    superMenu notNil ifTrue:[ verticalLayout := true ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2270
		    ifFalse:[ verticalLayout := self isPopUpView ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2271
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2272
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2273
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2274
verticalLayout:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2275
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2276
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2277
    aState ~~ verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2278
	verticalLayout isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2279
	    verticalLayout := aState
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2280
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2281
	    verticalLayout := aState.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2282
	    self mustRearrange.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2283
	].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2284
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2286
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2287
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2288
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2289
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2290
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2291
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2292
    ^ buttonInsetX
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2293
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2294
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2295
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2296
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2297
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2298
    ^ buttonInsetY
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2299
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2300
3975
ca
parents: 3966
diff changeset
  2301
delayInSecondsBeforeOpeningSubmenu
ca
parents: 3966
diff changeset
  2302
    "answer the seconds a submenu will be delayed before
ca
parents: 3966
diff changeset
  2303
    open; an already open submenu than will be closed"
ca
parents: 3966
diff changeset
  2304
4527
38e526ae120b class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4526
diff changeset
  2305
    ^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu'  default:0.15
3975
ca
parents: 3966
diff changeset
  2306
!
ca
parents: 3966
diff changeset
  2307
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2308
drawMenuIndicatorSeparatorLine
4235
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2309
    ^ true.
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2310
"/    ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine'  default:false
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2311
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2312
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2313
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2314
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2315
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2316
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2317
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2318
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2319
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2320
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2321
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2322
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2323
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2324
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2325
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2326
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2327
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2328
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2329
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2330
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2331
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2332
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2333
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2334
    ^ itemSpace
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2335
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2336
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2337
menuIndicatorVerticalPosition
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2338
    "#center, #top or #bottom"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2339
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2340
    ^ #center
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2341
    "/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2342
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2343
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2344
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2345
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2346
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2347
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2348
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2349
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2350
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2351
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2352
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2353
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2354
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2355
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2356
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2357
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2358
subMenuAt:stringOrNumber
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2359
    "gets the current submenu of an item; if the submenu is nil, the
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2360
     submenu is generated if specified otherwise nil is returned."
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2361
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2362
    |submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2363
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2364
    self itemAt:stringOrNumber do:[:anItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2365
	submenu := anItem currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2366
	submenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2367
	    submenu := anItem setupSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2368
	].
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2369
    ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2370
    ^ submenu
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2371
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2372
    "Modified: / 22-09-2010 / 13:53:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2373
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2374
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2375
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2376
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2377
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2378
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2379
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2380
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2381
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2382
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2383
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2384
    |item submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2385
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2386
    item := self selection.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2387
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2388
    item notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2389
	submenu := item currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2390
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2391
	(submenu notNil and:[submenu shown]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2392
	    ^ submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2393
	].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2394
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2395
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2396
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2397
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  2398
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2400
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2401
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2402
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2403
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2404
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2405
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2406
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2407
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2408
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2409
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2410
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2411
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2412
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2413
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2414
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2415
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2416
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2417
     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
  2418
     (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
  2419
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2420
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2421
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2423
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2424
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2425
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2426
     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
  2427
     (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
  2428
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2429
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  2430
    ^ self showAt:aPoint resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2431
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2432
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2433
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2434
    "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
  2435
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2436
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2437
     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
  2438
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2439
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2440
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  2441
    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
  2442
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2443
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2444
    aBoolean ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2445
	self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2446
    ].
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2447
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2448
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2449
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2450
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2451
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2452
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2453
    self topMenu hasPerformed ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2454
	^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2455
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2456
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2457
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2458
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2459
    "Modified: / 29-06-2011 / 16:24:22 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2460
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2461
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2462
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2463
    "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
  2464
     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
  2465
     (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
  2466
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2467
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2468
    ^ self showAt:(self graphicsDevice pointerPosition) resizing:true
4064
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2469
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2470
    "Modified (format): / 22-07-2011 / 15:24:48 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2471
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2472
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2473
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2474
    "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
  2475
     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
  2476
     (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
  2477
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2478
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2479
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2480
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2481
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2482
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2483
    ^ 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
  2484
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2485
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2486
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2487
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2488
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2489
    "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
  2490
     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
  2491
     (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
  2492
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2493
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2494
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2495
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2496
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2497
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2498
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2499
     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
  2500
     (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
  2501
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2502
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2503
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2504
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2505
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2506
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2507
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2508
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2509
    "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
  2510
     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
  2511
     (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
  2512
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2513
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2514
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2515
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2516
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2517
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2518
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2519
    "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
  2520
     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
  2521
     (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
  2522
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2523
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2524
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2525
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2526
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2527
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2529
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2530
    "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
  2531
     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
  2532
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2533
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2534
    |max item index|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2535
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2536
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2537
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2538
    (index := anIndexOrNil) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2539
	(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2540
	    index := max.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2541
	    "/ ^ nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2542
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2543
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2544
    items isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2545
	items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2546
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2547
	items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2548
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2549
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2550
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2551
    (index isNil or:[index == max]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2552
	items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2553
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2554
	items add:item beforeIndex:index
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2555
    ].
4627
905fcf6a9bfc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4617
diff changeset
  2556
    preferredExtent := nil.     "/ flush cached preferredExtent
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2557
    self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2558
    ^ item
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2559
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2560
    "Modified: / 03-07-2011 / 22:49:47 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2561
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2562
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2563
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2564
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2565
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2566
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2567
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2568
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2569
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2570
	items remove:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2571
	items := items asNilIfEmpty.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2572
	item destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2573
	preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2574
	self mustRearrange.
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2575
    ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2576
    ^ item
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2577
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2578
    "Modified: / 09-11-2010 / 10:04:08 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2579
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2580
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2581
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2582
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2583
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2584
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2585
	self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2586
	groupSizes := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2587
	items notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2588
	    items copy do:[:el| el destroy ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2589
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2590
	items := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2591
	preferredExtent := nil.     "/ flush cached preferredExtent
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2592
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2593
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2594
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2595
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2596
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2597
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2598
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2599
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2600
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2601
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2602
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2603
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2604
    changedObject == superView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2605
	"/ changed due to menu in horizontal panel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2606
	something == #sizeOfView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2607
	    (shown and:[sizeFixed not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2608
		"/ no change notification... so cannot call #mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2609
		mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2610
		self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2611
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2612
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2613
	^ self
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2614
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2615
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2616
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2617
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2618
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2619
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2620
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2621
asMenu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2622
    "convert contents to a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2623
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2624
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2625
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2626
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2627
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2628
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2629
    ^ menu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2630
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2631
    "Modified: / 27-03-2007 / 08:39:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2632
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2633
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2634
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2635
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2636
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2637
    self menu:(Menu decodeFromLiteralArray:aMenuSpec)
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2638
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2639
    "Modified: / 27-03-2007 / 08:42:43 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2640
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2641
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2642
menu:aMenu
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2643
    "setup from a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2644
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2645
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2646
	|menu newItems menuReceiver|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2647
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2648
	self removeAll.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2649
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2650
	(menu := aMenu) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2651
	    (aMenu isCollection) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2652
		menu := Menu decodeFromLiteralArray:aMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2653
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2654
		menuReceiver := menu receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2655
		menuReceiver notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2656
		    self receiver:menuReceiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2657
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2658
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2659
	    (newItems := menu menuItems) notEmptyOrNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2660
		items := newItems collect:[:ni |
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2661
				|i|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2662
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2663
				i:= Item in:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2664
				i menuItem:ni.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2665
				i.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2666
			    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2667
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2668
	    self groupSizes:(menu groupSizes).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2669
	    preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2670
	]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2671
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2672
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2673
    "Modified: / 09-11-2010 / 11:52:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2674
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2675
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2676
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2677
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2678
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2679
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2680
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2681
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2682
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2683
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2684
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2685
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2686
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2687
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2688
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2689
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2690
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2691
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2692
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2693
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2694
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2695
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2696
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2697
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2698
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2699
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2700
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2701
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2702
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2703
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2704
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2705
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2706
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2707
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2708
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2709
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2710
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2711
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2712
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2713
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2714
    aLevel isNil ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2715
    aLevel == 0 ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2716
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2717
    layout := anItem layout.
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2718
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2719
    styleSheet is3D ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2720
	self displayRectangle:layout.
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2721
    ] ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2722
	self drawEdgesForX:(layout left)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2723
			 y:(layout top)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2724
		     width:(layout width)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2725
		    height:(layout height)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2726
		     level:aLevel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2727
		    shadow:(self buttonShadowColor)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2728
		     light:(self buttonLightColor)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2729
		halfShadow:(self buttonHalfShadowColor)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2730
		 halfLight:(self buttonHalfLightColor)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2731
		     style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2732
    ]
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2733
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2734
    "Modified: / 06-02-2014 / 14:55:05 / cg"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2735
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2736
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2737
drawFocusForItem:anItem
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2738
    |lytItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2739
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2740
    lytItem := anItem layout.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2741
    self paint:(Color black).
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2742
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2743
    self displayDottedRectangleX:(lytItem left)
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2744
			       y:(lytItem top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2745
			   width:(lytItem width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2746
			  height:(lytItem height).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2747
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2748
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2749
drawItemsX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2750
    "redraw items and groups in a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2751
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2752
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2753
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2754
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2755
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2756
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2757
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2758
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2759
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2760
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2761
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2762
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2763
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2764
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2765
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2766
    isVertical ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2767
	start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2768
	start == 0 ifTrue:[ ^ self ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2769
	y1 := y + h.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2770
	stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2771
		     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2772
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2773
	start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2774
	start == 0 ifTrue:[ ^ self ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2775
	x1  := x + w.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2776
	stop := items findFirst:[:el| |l| l := el layout .l notNil and:[l left > x1]]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2777
		     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2778
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2779
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2780
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2781
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2782
	groupDivInset := self groupDividerSize // 2.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2783
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2784
	groupDivInset ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2785
	    (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2786
		start := start - 1
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2787
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2788
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2789
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2790
	groupDivInset := 0
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2791
    ].
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2792
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2793
    prevClip := self clippingBoundsOrNil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2794
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2795
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2796
    start to:stop do:[:i|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2797
	item := items at:i.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2798
	item draw.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2799
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2800
	(groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2801
	    layout := item layout.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2802
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2803
	    isVertical ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2804
		x1 := layout left.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2805
		x2 := layout right.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2806
		y1 := layout bottom + groupDivInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2807
		y2 := y1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2808
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2809
		y1 := layout top.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2810
		y2 := layout bottom.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2811
		x1 := layout right + groupDivInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2812
		x2 := x1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2813
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2814
	    self paint:shadowColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2815
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2816
	    self paint:lightColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2817
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2818
	    isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2819
		      ifFalse:[x1 := x1 + 1. x2 := x1 ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2820
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2821
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2822
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2823
	selection == item ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2824
	    self focusComesByTab ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2825
		self drawFocusForItem:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2826
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2827
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2828
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2829
    self clippingRectangle:prevClip.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2830
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2831
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2832
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2833
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2834
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2835
    isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2836
	level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2837
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2838
	anItem == enteredItem ifTrue:[ level := self enteredLevel ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2839
			     ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2840
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2841
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2842
    level ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2843
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2844
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2845
	self drawEdgesForX:(layout left)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2846
			 y:(layout top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2847
		     width:(layout width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2848
		    height:(layout height)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2849
		     level:level
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2850
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2851
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2852
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2853
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2854
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2855
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2856
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2857
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2858
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2859
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2860
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2861
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2862
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2863
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2864
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2865
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2866
	level := -2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2867
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2868
	level := 1
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2869
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2870
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2871
    level ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2872
	self drawEdgesForX:x y:y width:w height:h level:level.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2873
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2874
    icon := scrolling iconAt:aDirection on:self.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2875
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2876
    icon displayOn:self x:(x + (w - icon width  // 2))
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2877
			y:(y + (h - icon height // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2878
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2879
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2880
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2881
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2882
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2883
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2884
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2885
    (mustRearrange not and:[shown]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2886
	layout := anItem layout.
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
	(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2889
	    self invalidate:(layout "insetBy:-1") repairNow:aBool
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2890
	]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2891
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2892
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2893
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2894
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2895
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2896
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2897
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2898
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2899
    |oldPref|
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2900
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2901
    mustRearrange ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2902
	oldPref := preferredExtent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2903
	preferredExtent := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2904
	mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2905
	self invalidate. "/ RepairNow:true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2906
	(oldPref notNil and:[oldPref ~= self preferredExtent]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2907
	    self changed:#preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2908
	].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2909
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2910
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2911
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2912
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2913
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2914
rearrangeGroups
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2915
    "implements the groupIdentifier #right/#conditionalRight in a horizontal menu"
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2916
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2917
    <resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')>
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2918
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2919
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2920
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2921
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2922
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2923
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2924
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2925
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2926
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2927
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2928
    layout := items last layout.
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2929
    layout notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2930
	(dltX := width - margin - layout right) <= 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2931
	    ^ self  "/ no free space
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2932
	].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2933
    ].
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2934
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2935
    "/ The behavior of #conditionalRight is controlled by the styleSheet.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2936
    "/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2937
    "/ otherwise, it is treated like #right.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  2938
    "/ 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
  2939
    "/ non-right under win32 (as is used woth the help-menus).
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2940
    (StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2941
	start := items findFirst:[:anItem| anItem startGroup == #right ].
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  2942
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2943
	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
  2944
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2945
    start == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2946
	^ self  "/ no right-group item detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2947
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2948
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2949
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2950
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2951
    items from:start do:[:anItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2952
	anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2953
	    anItem layout moveBy:point.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2954
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2955
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2956
    self updateEnteredItem.
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  2957
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2958
    "Modified: / 10-10-2007 / 00:29:34 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2959
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2960
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2961
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2962
    "recompute the layout of each item
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2963
	!!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2964
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2965
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2966
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2967
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2968
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2969
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2970
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2971
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2972
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2973
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2974
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2975
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2976
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2977
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2978
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2979
    |
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2980
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2981
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2982
	mustRearrange := false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2983
	^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2984
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2985
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2986
"/  DON'T SET THIS!!
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2987
"/  item layout:  below of first item -> item invalidate
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2988
"/                                    -> menuPanel invalidateItem:repairDamage:
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2989
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2990
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2991
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2992
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2993
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2994
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2995
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2996
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2997
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2998
    isPopUpMenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2999
	labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3000
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3001
	labelInsetX := labelInsetY := 0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3002
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3003
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3004
    (isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3005
	|saveExtent maxExtent extentToSet|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3006
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3007
	extent := self preferredExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3008
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3009
	isPopUpMenu ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3010
	    maxExtent := self maxExtent.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3011
	    maxExtent notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3012
		extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3013
					  ifFalse:[(extent x min:(maxExtent x)) @ extent y].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3014
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3015
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3016
	    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
  3017
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3018
	self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3019
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3020
	extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3021
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  3022
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  3023
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  3024
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3025
    isVertical ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3026
	y0 := margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3027
	y1 := extent y - margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3028
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3029
	items keysAndValuesDo:[:anIndex :el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3030
	    el isVisible ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3031
		el layout:(Rectangle left:x top:y0 right:x bottom:y1)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3032
	    ] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3033
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3034
		    insetX := buttonInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3035
		    insetY := buttonInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3036
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3037
		    insetX := labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3038
		    insetY := labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3039
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3040
		x0 := x  + insetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3041
		x1 := x0 + (el preferredWidth).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3042
		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
  3043
		x := x1 + insetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3044
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3045
		size ~~ anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3046
		    (self hasGroupDividerAt:anIndex) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3047
			x := x + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3048
		    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3049
			el needsItemSpaceWhenDrawing ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3050
			    x := x + itemSpace
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3051
			]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3052
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3053
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3054
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3055
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3056
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3057
	itemMargin := self itemMargin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3058
	x0 := margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3059
	x1 := extent x - margin - itemMargin.  "/ -1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3060
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3061
	items keysAndValuesDo:[:anIndex :el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3062
	    el isVisible ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3063
		el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3064
	    ] ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3065
		el isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3066
		    insetX := buttonInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3067
		    insetY := buttonInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3068
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3069
		    insetX := labelInsetX.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3070
		    insetY := labelInsetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3071
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3072
		y0 := y  + insetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3073
		y1 := y0 + el preferredHeight.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3074
		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
  3075
		y := y1 + insetY.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3076
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3077
		size ~~ anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3078
		    (self hasGroupDividerAt:anIndex) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3079
			y := y + groupDividerSize
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3080
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3081
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3082
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3083
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3084
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3085
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3086
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3087
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3088
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3089
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3090
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3092
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3093
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3094
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3095
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  3096
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3097
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3098
    (items contains:[:item | item canChangeVisibility]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3099
	mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3100
	self rearrangeItems.
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3101
    ]
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3102
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3103
    "Modified: / 03-12-2013 / 17:04:05 / cg"
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3104
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3105
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3106
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3107
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3108
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3109
    |y0 y1 x0 x1 prvBound mustDraw nxtBound|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3110
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3111
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3112
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3113
    mustRearrange ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3114
	self isPopUpView ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3115
	    self explicitExtent:true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3116
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3117
	    "/ changed due to menu in horizontal panel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3118
	    sizeFixed ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3119
		self preferredExtent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3120
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3121
		preferredExtent notNil ifTrue:[ |lw|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3122
		    lw := (superView width - self left) max: 1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3123
		    self width:(preferredExtent x min:lw).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3124
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3125
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3126
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3127
	self rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3128
	self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3129
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3130
    ].
2888
095d9fb3e846 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2884
diff changeset
  3131
    "/ self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3132
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3133
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3134
    items size == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3135
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3136
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3137
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3138
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3139
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3140
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3141
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3142
    "Draw the scroll handles - especially for Popup-Lists"
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3143
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3144
    self hasScrollers ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3145
	(self hasScrollerAt:#PREV) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3146
	    prvBound := self scrollerBoundsAt:#PREV.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3147
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3148
	    self verticalLayout ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3149
		(mustDraw := (prvBound bottom > y)) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3150
		    y0 := prvBound bottom.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3151
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3152
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3153
		(mustDraw := (prvBound right > x)) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3154
		    x0 := prvBound right.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3155
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3156
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3157
	    mustDraw ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3158
		self drawScrollerAt:#PREV bounds:prvBound.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3159
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3160
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3161
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3162
	(self hasScrollerAt:#NEXT) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3163
	    nxtBound := self scrollerBoundsAt:#NEXT.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3164
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3165
	    self verticalLayout ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3166
		(mustDraw := (nxtBound top < y1)) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3167
		    y1 := nxtBound top.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3168
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3169
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3170
		(mustDraw := (nxtBound left < x1)) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3171
		    x1 := nxtBound left.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3172
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3173
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3174
	    mustDraw ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3175
		self drawScrollerAt:#NEXT bounds:nxtBound.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3176
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3177
	].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3178
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3179
    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
  3180
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3181
    (y1 > y0 and:[x1 > x0]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3182
	self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3183
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3184
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3185
    "Modified: / 29-06-2011 / 16:24:34 / cg"
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3186
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3187
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3188
updateEnteredItem
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3189
    |mousePoint|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3190
4552
9ec4e01ead56 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 4529
diff changeset
  3191
    mousePoint  := self graphicsDevice translatePoint:(self graphicsDevice pointerPosition)
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3192
			   fromView:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3193
			     toView:self.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3194
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3195
    (self containsPoint:mousePoint) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3196
	enteredItem := self itemAtPoint:mousePoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3197
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3198
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3199
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  3200
!MenuPanel methodsFor:'enumerating & searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3201
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3202
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3203
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3204
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3205
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3206
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3207
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3208
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3209
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3210
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3211
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3212
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3213
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3214
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3215
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3216
findFirst:aOneArgBlock
3206
48a66f672af3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3203
diff changeset
  3217
    "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
  3218
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3219
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3220
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3221
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3222
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3223
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3224
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3225
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3226
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3227
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3228
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3229
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3230
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3231
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3232
firstItemSelectable
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3233
    "returns the first item which is selectable or nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3234
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3235
    items size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3236
	^ items detect:[:anItem| anItem canSelect ] ifNone:nil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3237
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3238
    ^ nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3239
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3240
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3241
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3242
    "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
  3243
     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
  3244
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3245
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3246
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3247
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3248
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3249
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3250
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3251
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3252
    i ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3253
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3254
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3255
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3256
    something isSymbol ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3257
	i := self findFirst:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3258
				v := el value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3259
				v isSymbol and:[v == something]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3260
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3261
	i ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3262
	    ^ i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3263
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3264
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3265
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3266
    (something respondsTo:#string) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3267
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3268
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3269
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3270
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3271
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3272
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3273
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3274
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3275
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3276
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3277
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3278
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3279
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3280
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3281
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3282
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3283
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3285
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3287
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3288
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3289
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3290
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3291
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3292
    self scrollActivity isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3293
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3294
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3295
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3296
    sensor := self sensor.
4526
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3297
"/ cg: the following seems to lead to leftover submenus to remain unclosed...
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3298
"/    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3299
"/        ^ self
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3300
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3301
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3302
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3303
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3304
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3305
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3306
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3307
    "/ hideOnRelease := true.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3308
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3309
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3310
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3311
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3312
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3313
    hideOnRelease ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3314
	sensor anyButtonPressed ifFalse:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3315
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3316
	sensor anyButtonPressed ifTrue:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3317
    ].
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3318
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3319
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3320
	"/ selection on grabView without a submenu (Button ...); check whether moving out
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3321
	(self containsPoint:motionPoint) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3322
	    ^ self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3323
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3324
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3325
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3326
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3327
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3328
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3329
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3330
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3331
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3332
    |menu point screen screenPoint targetView targetPoint wg|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3333
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3334
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3335
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3336
    "/ simulate momentary loss of focus to force accept into models in other components
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3337
    wg := self windowGroup.
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3338
    wg notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3339
	wg focusMomentaryRelease.
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3340
    ].
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3341
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3342
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3343
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3344
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3345
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3346
    menu isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3347
	self accept:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3348
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3349
	"/ tell underlying view about the click...
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3350
	((button ~~ 2)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3351
	or:[(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease])]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3352
	    screen := self device.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3353
	    screenPoint := screen translatePointToRoot:point fromView:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3354
	    targetView := screen viewFromPoint:screenPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3355
	    (targetView notNil and:[targetView ~~ self]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3356
		targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3357
		targetView buttonPress:button x:targetPoint x y:targetPoint y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3358
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3359
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3360
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3361
	point := menu translateGrabPoint:point.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3362
	menu handleButtonPress:button atPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3363
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3364
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3365
    "Modified: / 02-10-2011 / 09:20:08 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3366
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3367
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3368
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3369
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3370
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3371
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3372
     releaseTime menuMapTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3373
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3374
    hideOnRelease ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3375
	^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3376
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3377
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3378
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3379
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3380
    self scrollActivity stop ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3381
	^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3382
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3383
    dstMenu := topMenu activeMenu.
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3384
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3385
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3386
    hideMenuAndPerformAction ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3387
	"open topMenu, a popup by click and release button in a short time period"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3388
	(topMenu == self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3389
	and:[mapTime notNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3390
	and:[dstMenu == self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3391
	and:[dstMenu isPopUpView]]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3392
	    hideMenuAndPerformAction := false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3393
	].
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3394
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3395
    hideMenuAndPerformAction ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3396
	hideOnRelease ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3397
	    releaseTime := windowGroup lastEvent timeStamp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3398
	    menuMapTime := dstMenu mapTime ? releaseTime.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3399
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3400
	    hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3401
					> (PopUpMenu maxClickTimeToStayOpen).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3402
	].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3403
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3404
    hideMenuAndPerformAction ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3405
	srcPoint := x@y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3406
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3407
	(     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3408
	 and:[(item    := dstMenu selection) notNil]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3409
	) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3410
	    item visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3411
		dstMenu selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3412
		(selection isNil and:[self isPopUpView not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3413
		    self accept:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3414
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3415
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3416
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3417
	    subm := item currentSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3418
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3419
	    subm notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3420
		subm shown ifTrue:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3421
		"/ test whether any action is assigned to the menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3422
		"/ if not ignorre accept
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3423
		item hasDelayedMenu ifFalse:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3424
		"/ handle action defined for the delayed menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3425
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3426
	    dstPoint := dstMenu translateGrabPoint:srcPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3427
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3428
	    (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3429
		item := nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3430
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3431
	    topMenu acceptItem:item inMenu:dstMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3432
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3433
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3434
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3435
	(selection notNil and:[dstMenu == self]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3436
	    selection visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3437
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3438
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3439
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3440
	self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3441
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3442
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3443
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3444
handleSizeChanged:how
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3445
    "used to handle the scrollers and groups in a none popUpView
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3446
    "
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3447
    |layouts damage isVertical scrollBound|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3448
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3449
    (mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3450
	^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3451
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3452
    mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3453
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3454
    shown ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3455
	^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3456
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3457
    layouts := OrderedCollection new.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3458
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3459
    items do:[:el| |layout|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3460
	(layout := el layout) isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3461
	    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3462
	    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3463
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3464
	layouts add:layout.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3465
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3466
    isVertical  := self verticalLayout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3467
    scrollBound := self scrollerBoundsAt:#NEXT.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3468
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3469
    self rearrangeItems.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3470
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3471
    items keysAndValuesDo:[:i :el| |newLyt oldLyt|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3472
	damage isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3473
	    newLyt := el layout.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3474
	    oldLyt := layouts at:i ifAbsent:newLyt.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3475
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3476
	    newLyt ~= oldLyt ifTrue:[ |x y start|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3477
		start := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3478
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3479
		i > 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3480
		    isVertical ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3481
			x := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3482
			y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3483
		    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3484
			y := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3485
			x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3486
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3487
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3488
		start <= 20 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3489
		    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3490
		    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3491
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3492
		damage := Rectangle left:x top:y extent:(self extent).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3493
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3494
	].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3495
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3496
    damage isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3497
	damage := scrollBound.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3498
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3499
    scrollBound := lastDrawnScrollerNextBounds.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3500
    scrollBound notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3501
	damage := damage merge:scrollBound
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3502
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3503
    self invalidate:damage.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3504
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3505
    "Modified: / 29-06-2011 / 16:24:59 / cg"
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3506
!
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3507
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3508
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3509
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3510
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3511
    <resource: #keyboard (#Escape
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3512
			  #Tab #FocusNext #FocusPrevious
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3513
			  #CursorLeft #CursorRight )>
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3514
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3515
    |menu menusSuperMenu sensor|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3516
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3517
    sensor := self sensor.
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3518
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3519
"/    sensor anyButtonPressed ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3520
"/        ^ self  "/ ignored while any button is pressed
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3521
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3522
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3523
    self scrollActivity isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3524
	key ~~ #Escape ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3525
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3526
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3527
	self scrollActivity stop
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3528
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3529
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3530
       (key == #Tab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3531
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3532
    or:[key == #FocusPrevious]]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3533
	self accept:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3534
	^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3535
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3536
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3537
    menu := self detectGrabMenu.
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3538
    menusSuperMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3539
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  3540
    (key == #Escape) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3541
	"/ must hide the active menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3542
	menusSuperMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3543
	    "/ hide active menu but keep the grab
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3544
	    menusSuperMenu selection hideSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3545
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3546
	    "/ hide active menu and ungrab
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3547
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3548
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3549
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3550
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3551
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3552
    menu isViewWrapper ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3553
	sensor compressKeyPressEventsWithKey:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3554
	menu handleKeyPress:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3555
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3556
    ].
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3557
    menusSuperMenu == self ifFalse:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3558
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3559
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3560
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3561
	(self containsPoint:x@y) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3562
	    self handleKeyPress:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3563
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3564
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3565
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3566
3834
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3567
mapped
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3568
    super mapped.
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3569
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3570
    "/ 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
  3571
    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
  3572
!
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3573
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3574
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3575
    "mousewheel action"
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3576
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3577
    |menu|
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3578
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3579
    menu := self detectGrabMenu.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3580
    menu isViewWrapper ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3581
	menu superMenu ~~ self ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3582
	    ^ self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3583
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3584
	menu := self.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3585
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3586
    amount > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3587
	menu handleCursorKey:#CursorUp.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3588
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3589
	menu handleCursorKey:#CursorDown.
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3590
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3591
!
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3592
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3593
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3594
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3595
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3596
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3597
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3598
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3599
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3600
    (selection isNil or:[self isPopUpView]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3601
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3602
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3603
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3604
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3605
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3606
    windowGroup focusView ~~ self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3607
	self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3608
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3609
	selection isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3610
	    sensor := self sensor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3611
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3612
	    sensor isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3613
		self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3614
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3615
		"/ 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
  3616
		sensor anyButtonPressed ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3617
		    self selection:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3618
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3619
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3620
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3621
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3622
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3623
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3624
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3625
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3626
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3627
"/    self isPopUpView ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3628
"/        mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3629
"/        self invalidate
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3630
"/    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3631
"/    ^ super sizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3632
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3633
    self handleSizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3634
    super sizeChanged:how.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3635
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3636
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3637
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3638
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3639
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3640
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3641
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3642
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3643
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3644
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3645
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3646
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3647
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3648
    ev isDamage ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3649
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3650
    ].
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3651
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3652
    (superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3653
	focusView ~~ self ifTrue:[prevFocusView := focusView].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3654
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3655
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3656
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3657
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3658
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3659
    implicitGrabView notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3660
	self sensor leftButtonPressed ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3661
	    self clearImplicitGrab.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3662
	].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3663
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3664
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3665
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3666
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3667
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3668
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3669
    implicitGrabView notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3670
	ev isButtonEvent ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3671
	    p := self graphicsDevice translatePoint:(x@y) fromView:self toView:implicitGrabView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3672
	    ev view:implicitGrabView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3673
	    ev arguments at:2 put:p x.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3674
	    ev arguments at:3 put:p y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3675
	    implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3676
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3677
	    ev isButtonReleaseEvent ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3678
		self clearImplicitGrab.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3679
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3680
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3681
	]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3682
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3683
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3684
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3685
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3686
	self clearImplicitGrab.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3687
	^ super dispatchEvent:ev withFocusOn:focusView delegate:false
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3688
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3689
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3690
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3691
    view := self detectViewAtX:(p x) y:(p y) in:menu.
3630
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3692
    view == self ifTrue:[^self].  "MB:changed - recursion"
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3693
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  3694
    p    := self graphicsDevice translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3695
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3696
    ev isButtonPressEvent ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3697
	(view wantsFocusWithButtonPress) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3698
	    view requestFocus.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3699
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3700
	view ~~ self ifTrue:[ "/ can this ever be self ?
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3701
	    implicitGrabView := view.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3702
	]
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3703
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3704
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3705
    ev isButtonMotionEvent ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3706
	lastPointerView ~~ view ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3707
	    "/ must generate enter/leave ... (sigh)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3708
	    lastPointerView notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3709
		"/ XXX: should be fixed
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3710
		syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3711
		lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3712
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3713
	    view notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3714
		syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3715
		view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3716
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3717
	    lastPointerView := view.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3718
	].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3719
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3720
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3721
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3722
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3723
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3724
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3725
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3726
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3727
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3728
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3729
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3730
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3731
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3732
    |menu item translatedPoint containsPoint direction|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3733
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3734
    containsPoint := self containsPoint:motionPoint.
3975
ca
parents: 3966
diff changeset
  3735
    (containsPoint not and:[items size > 0]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3736
	"/ check if there is still open a menu which is not assigned to the
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3737
	"/ current selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3738
	item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3739
	item notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3740
	    |visibleSubmenu point|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3741
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3742
	    visibleSubmenu := item visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3743
	    visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3744
		point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3745
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3746
		(visibleSubmenu containsPoint:point) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3747
		    selection notNil ifTrue:[ selection invalidate ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3748
		    selection := item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3749
		    selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3750
		    visibleSubmenu becomesActiveMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3751
		    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3752
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3753
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3754
	    item := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3755
	].
3975
ca
parents: 3966
diff changeset
  3756
    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3757
    containsPoint ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3758
	item := self itemAtPoint:motionPoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3759
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3760
4183
280e1f0f4030 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3761
    "no autoscroll, if the mouse pointer is inside the scroll button"
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3762
    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
  3763
    direction notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3764
	self pointerEntersItem:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3765
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3766
	self sensor anyButtonPressed ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3767
	    self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3768
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3769
	^ 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
  3770
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3771
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3772
    "/ self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3773
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3774
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3775
	(self selectionFollowsMouse
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3776
	 and:[self topMenu focusComesByTab not]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3777
	) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3778
	    self isPopUpView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3779
		item isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3780
		    superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3781
			translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3782
			superMenu handleButtonMotion:state atPoint:translatedPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3783
		    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3784
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3785
		    self selectAndOpenDelayed:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3786
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3787
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3788
		"/ processing in the toolbar
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3789
		(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3790
		    self selectAndOpenDelayed:item.
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3791
"/                    self selection:item openMenu:true.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3792
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3793
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3794
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3795
	^ self
3975
ca
parents: 3966
diff changeset
  3796
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3797
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3798
    containsPoint ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3799
	self isPopUpView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3800
	    self selectAndOpenDelayed:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3801
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3802
	    "/ also open delayed if I am the top-menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3803
	    self selectAndOpenDelayed:item.
4191
bd66cf091adb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4185
diff changeset
  3804
"/            self selection:item openMenu:true.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3805
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3806
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3807
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3808
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3809
    menu := self superMenuAtPoint:motionPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3810
    menu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3811
	translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3812
	menu handleButtonMotion:state atPoint:translatedPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3813
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3814
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3815
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3816
	self selection:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3817
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3818
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3819
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3820
handleButtonPress:button atPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3821
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3822
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3823
    |item scrollerDirectionOrNil wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3824
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3825
    item := self itemAtPoint:aPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3826
    item isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3827
	self selection:nil openMenu:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3828
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3829
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3830
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3831
    "/ is a scroller-button present and hit ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3832
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3833
    scrollerDirectionOrNil notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3834
	(self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3835
	    self pointerEntersItem:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3836
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3837
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3838
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3839
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3840
    "/ right button always immediately pulls the delayedMenu
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3841
    button == 2 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3842
	item hasDelayedMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3843
	    self selection:item openMenu:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3844
	    self openDelayed:item afterSeconds:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3845
	    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3846
	].
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3847
    ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3848
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3849
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3850
    wasSelected ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3851
	self selection:item openMenu:true
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3852
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3853
    item hasDelayedMenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3854
	"/ clicked on the arrow icon ?
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3855
	(item menuIndicatorContains:aPoint) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3856
	    self selection:item openMenu:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3857
	    self openDelayed:item afterSeconds:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3858
	    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3859
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3860
	^ self
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3861
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3862
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3863
    (item isToggle or:[item triggerOnDown]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3864
	(wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3865
	    item toggleSubmenuVisibility
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3866
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3867
	^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3868
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3869
    (item canAccept and:[item == self selection]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3870
	^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3871
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3872
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3873
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3874
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  3875
    [ (self graphicsDevice notNil and:[self graphicsDevice anyButtonPressed]) ] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3876
	"/ using device - sensor is not updated sometimes
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3877
	Delay waitForSeconds:0.1.
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3878
    ].
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3879
    self sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3880
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3881
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3882
    "Created: / 13.11.2001 / 14:12:04 / cg"
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  3883
    "Modified: / 13.11.2001 / 19:50:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3884
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3885
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3886
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3887
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3888
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3889
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3890
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3891
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3892
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3893
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3894
    (size  := items size) == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3895
	superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3896
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3897
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3898
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3899
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3900
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  3901
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3902
	(isVrt and:[aKey == #CursorDown]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3903
	    idx := items findFirst:[:el | el notNil and:[ el canSelect ]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3904
	    idx ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3905
		self selection:(items at:idx).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3906
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3907
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3908
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3909
	(isVrt and:[aKey == #CursorUp]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3910
	    idx := items findLast:[:el | el notNil and:[ el canSelect ]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3911
	    idx ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3912
		self selection:(items at:idx).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3913
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3914
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3915
	]
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  3916
    ].
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  3917
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3918
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3919
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3920
    ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3921
	selection isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3922
	    (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3923
		^ superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3924
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3925
	    idx := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3926
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3927
	    isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3928
		"/ used because of vertical scrolling
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3929
		idx := items findFirst:[:el| el layout top > 0 ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3930
		idx ~~ 0 ifTrue:[idx := idx - 1 ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3931
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3932
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3933
	    idx := self indexOf:selection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3934
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3935
	next := aKey == #CursorRight or:[aKey == #CursorDown].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3936
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3937
	idx0 := idx.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3938
	size timesRepeat:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3939
	    |el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3940
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3941
	    next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3942
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3943
	    idx > size ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3944
		idx := 0 "1"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3945
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3946
		idx < 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3947
		    idx := size
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3948
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3949
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3950
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3951
	    idx == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3952
		self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3953
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3954
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3955
		(el := items at:idx ifAbsent:nil) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3956
		    el canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3957
			el hasDelayedMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3958
			    "/ do not open menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3959
			    self selection:el openMenu:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3960
			] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3961
			    "/ open comes from style-sheet
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3962
			    self selection:el.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3963
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3964
			^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3965
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3966
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3967
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3968
	    idx == idx0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3969
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3970
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3971
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3972
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3973
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3974
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3975
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3976
	p1 := self translateGrabPoint:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3977
	p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3978
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3979
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3980
    isVrt ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3981
	(superMenu notNil and:[p1 x > p2 x]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3982
	    backKey := #CursorRight
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3983
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3984
	    backKey := #CursorLeft.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3985
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3986
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3987
	(superMenu notNil and:[p1 y > p2 y]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3988
	    backKey := #CursorDown
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3989
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3990
	    backKey := #CursorUp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3991
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3992
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3993
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3994
    aKey == backKey ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3995
	superMenu isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3996
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3997
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3998
	    superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3999
		superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4000
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4001
		superMenu selection hideSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4002
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4003
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4004
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4005
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4006
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4007
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4008
	superMenu isNil ifTrue:[^ self accept:nil].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4009
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4010
	superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4011
	    superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4012
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4013
	    (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4014
		self selectionIndex:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4015
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4016
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4017
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4018
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4019
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4020
    selection hasSubmenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4021
	(menu := selection visibleSubmenu) isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4022
	    selection toggleSubmenuVisibility
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4023
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4024
	    menu selectionIndex:1
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4025
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4026
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4027
	superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4028
	    superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4029
		superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4030
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4031
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4032
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4033
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4034
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4035
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4036
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4037
handleKeyPress:key
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4038
    <resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)>
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4039
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4040
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4041
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4042
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4043
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4044
    (key == #Return or:[key == Character space]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4045
	self handleReturnPressed.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4046
	^ true.
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4047
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4048
    key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4049
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4050
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4051
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4052
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4053
"/            ].
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4054
	inMenu := self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4055
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4056
	(item := inMenu detectItemForKey:key) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4057
	    inMenu selection:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4058
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4059
	^ true
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4060
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4061
    (key == #CursorDown
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4062
	or:[key == #CursorUp
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4063
	or:[key == #CursorLeft
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4064
	or:[key == #CursorRight]]])
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4065
    ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4066
	self handleCursorKey:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4067
	^ true
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4068
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4069
    ^ false.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4070
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4071
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4072
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4073
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4074
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4075
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4076
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4077
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4078
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4079
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4080
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4081
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4082
    (item := selection) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4083
	superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4084
	    item := superMenu selection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4085
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4086
	    item value notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4087
		"/ is a delayed menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4088
		self accept:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4089
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4090
		item toggleSubmenuVisibility
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4091
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4092
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4093
	    self accept
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4094
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4095
	^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4096
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4097
    selection hasSubmenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4098
	selection hasDelayedMenu ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4099
	    selection toggleSubmenuVisibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4100
	  ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4101
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4102
	subm := selection currentSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4103
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4104
	(subm notNil and:[subm shown]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4105
	    selection toggleSubmenuVisibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4106
	  ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4107
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4108
	self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4109
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4110
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4111
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4112
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4113
    item isToggle ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4114
	self selection:item.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4115
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4116
	(selection notNil and:[selection triggerOnDown]) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4117
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4118
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4119
    ].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4120
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4121
    (sensor := self sensor) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4122
	^ self
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4123
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4124
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4125
    [
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4126
	sensor flushKeyboardFor:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4127
	Delay waitForSeconds:0.1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4128
	sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4129
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4130
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4131
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4132
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4133
    "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
  4134
     redraw the new item highlighted."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4135
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4136
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4137
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4138
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4139
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4140
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4141
     and:[self isPopUpView not]]]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4142
	anItemOrNil isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4143
	    (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4144
	     or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4145
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4146
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4147
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4148
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4149
	    (self enteredLevel ~~ 0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4150
	      or:[self enteredBackgroundColor ~= self backgroundColor]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4151
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4152
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4153
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4154
	]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4155
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4156
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4157
    newItem ~~ enteredItem ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4158
	oldItem     := enteredItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4159
	enteredItem := newItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4160
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4161
	oldItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4162
	    self invalidateItem:oldItem repairNow:(enteredItem isNil).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4163
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4164
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4165
	enteredItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4166
	    self invalidateItem:enteredItem repairNow:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4167
	].
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4168
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4169
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4170
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4171
processHideMenuEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4172
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4173
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4174
    "Modified: / 29-06-2011 / 16:39:36 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4175
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4176
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4177
processMenuEnterItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4178
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4179
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4180
    "Created: / 29-06-2011 / 13:18:05 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4181
    "Modified: / 29-06-2011 / 16:39:29 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4182
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4183
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4184
processMenuSelectItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4185
    |winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4186
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4187
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4188
    winGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4189
	masterGroup := winGrp previousGroup.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4190
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4191
    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4192
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4193
    item := ev item.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4194
    itemIndex := ev itemIndex.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4195
    itemValue := ev itemValue.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4196
    menuReceiver := ev menuReceiver.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4197
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4198
    acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4199
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4200
    (item showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4201
    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4202
    ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4203
	winGrpForBusyCursor withWaitCursorDo:acceptAction
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4204
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4205
	acceptAction value
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4206
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4207
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4208
    "Modified: / 29-06-2011 / 16:32:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4209
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4210
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4211
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4212
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4213
canTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4214
    "depends whether I'am a toolbar and selectable items exists
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4215
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4216
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4217
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4218
    (super canTab and:[self isPopUpView not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4219
	selectableItem := self firstItemSelectable.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4220
	^ selectableItem notNil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4221
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4222
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4223
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4224
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4225
focusComesByTab
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4226
    "returns true if focus comes by tab and should be drawn"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4227
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4228
    focusComesByTab == true ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4229
	(shown and:[self hasFocus]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4230
	    ^ true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4231
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4232
	focusComesByTab := false.
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4233
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4234
    ^ false
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4235
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4236
    "Modified: / 29-06-2011 / 16:23:09 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4237
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4238
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4239
focusComesByTab:aBoolean
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4240
    "only handled for toolBars"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4241
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4242
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4243
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4244
    (self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4245
	focusComesByTab := aBoolean.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4246
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4247
	self hasSelection ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4248
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4249
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4250
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4251
	aBoolean ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4252
	    selectableItem := self firstItemSelectable.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4253
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4254
	self selection:selectableItem openMenu:false.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4255
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4256
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4257
    "Modified: / 29-06-2011 / 16:23:19 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4258
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4259
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4260
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4261
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4262
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4263
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4264
	"/ not visible for popup menus
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4265
	^ super hasKeyboardFocus:aBoolean
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4266
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4267
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4268
"/    (aBoolean not and:[hasImplicitGrap ~~ true]) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4269
"/        (windowGroup focusView ~~ self) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4270
"/            self selection:nil.
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4271
"/        ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4272
"/    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4273
    super hasKeyboardFocus:aBoolean.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4274
!
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4275
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4276
showFocus:focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4277
    self focusComesByTab:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4278
    super showFocus:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4279
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4280
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4281
showNoFocus:focusByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4282
    self focusComesByTab:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4283
    super showNoFocus:focusByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4284
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4285
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4286
supportsFocusOnTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4287
    "returns true if focus is supported
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4288
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4289
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4290
!
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4291
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4292
wantsFocusWithButtonPress
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4293
    "needs only the focus if I'am a toolbar; all events are delegated
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4294
     to my subMenus"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4295
4153
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4296
"/ old:
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4297
"/    ^ self isPopUpView not
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4298
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4299
    "/ I am not sure how this really should be -
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4300
    "/ I guess, it needs a more intelligent and dynamic decision.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4301
    "/ for now, the menuPanelTakesFocusOnClick returns true, otherwise,
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4302
    "/ we cannot control menus with the keyboard.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4303
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4304
	^ false
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4305
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4306
	^ UserPreferences current menuPanelTakesFocusOnClick.
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4307
    ]
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4308
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4309
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4310
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4311
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4312
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4313
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4314
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4315
    superMenu notNil ifTrue:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4316
        superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4317
    ] ifFalse:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4318
        hasImplicitGrap ~~ true ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4319
            self grabMouseAndKeyboard.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4320
            hasImplicitGrap := true
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4321
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4322
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4323
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4324
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4325
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4326
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4327
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4328
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4329
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4330
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4331
	forceDo ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4332
	    superMenu doUngrab:true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4333
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4334
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4335
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4336
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4337
    hasImplicitGrap ~~ true ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4338
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4339
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4340
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4341
    forceDo ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4342
	(selection notNil or:[prevFocusView == self]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4343
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4344
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4345
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4346
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4347
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4348
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  4349
    prevFocusView   := nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4350
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4351
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4352
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4353
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4354
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  4355
    previousKeyboardGrab := self graphicsDevice activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  4356
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4357
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4358
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4359
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4360
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4361
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4362
    |winGroup sensor activeGrab|
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4363
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4364
    winGroup := self windowGroup.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4365
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4366
    (realized and:[winGroup notNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4367
	prevFocusView isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4368
	     prevFocusView := winGroup focusView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4369
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4370
	sensor := self sensor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4371
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4372
	self graphicsDevice activePointerGrab ~~ self ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4373
	    sensor flushMotionEventsFor:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4374
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4375
	    (self grabPointer) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4376
		Delay waitForSeconds:0.1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4377
		(self grabPointer) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4378
		    "give up"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4379
		    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4380
		    self unmap
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4381
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4382
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4383
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4384
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4385
	(activeGrab := self graphicsDevice activeKeyboardGrab) ~~ self ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4386
	    self graphicsDevice sync.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4387
	    "/ 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
  4388
"/            activeGrab notNil ifTrue:[
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4389
"/                sensor flushKeyboardFor:activeGrab.
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4390
"/            ].
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4391
	    sensor flushKeyboardFor:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4392
	    self grabKeyboard.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4393
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4394
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4395
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4396
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4397
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  4398
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4399
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4400
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4401
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4402
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4403
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  4404
    previousPointerGrab := self graphicsDevice activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4405
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4406
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4407
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4408
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4409
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4410
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4411
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4412
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4413
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4414
    (previousKeyboardGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4415
    and:[ previousKeyboardGrab realized ]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4416
	self graphicsDevice grabKeyboardInView:previousKeyboardGrab.
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4417
    ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4418
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4419
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4420
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4421
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4422
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4423
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4424
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4425
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4426
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4427
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4428
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4429
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4430
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4431
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4432
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4433
    and:[ previousPointerGrab realized ]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4434
	self graphicsDevice grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4435
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4436
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4437
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4438
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4439
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4440
flyByHelpSpec
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4441
    "allows subclasses to provide texts"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4442
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4443
    ^ IdentityDictionary new
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4444
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4445
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4446
flyByHelpTextAt:aPoint
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4447
    "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
  4448
     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
  4449
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4450
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4451
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4452
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4453
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4454
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4455
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4456
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4457
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4458
    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
  4459
    ^ nil
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4460
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4461
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4462
flyByHelpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4463
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4464
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  4465
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4466
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4467
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4468
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4469
flyByHelpTextForKey:aKey
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4470
    |app text|
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4471
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4472
    app := self application.
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4473
    app notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4474
	text := self application flyByHelpTextForKey:aKey.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4475
	text notNil ifTrue:[^ text].
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4476
    ].
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4477
    ^ 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
  4478
!
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4479
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4480
helpText
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4481
    "return the helpText for the currently selected item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4482
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4483
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4484
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4485
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4486
helpTextAt:aPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  4487
    "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
  4488
     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
  4489
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4490
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4491
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4492
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4493
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4494
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4495
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4496
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4497
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4498
    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
  4499
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4500
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4501
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4502
helpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4503
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4504
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4505
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4506
    ^ anItem activeHelpText.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4507
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4508
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4509
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
  4510
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4511
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4512
    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
  4513
    dstMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4514
	dstPoint := dstMenu translateGrabPoint:srcPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4515
	item := dstMenu itemAtPoint:dstPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4516
	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
  4517
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4518
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4519
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4520
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4521
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  4522
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4523
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4524
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  4525
    ^ self class image:anImage value onDevice:self graphicsDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4526
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4527
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4528
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4529
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4530
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  4531
    ^ self class lightenedImage:anImage onDevice:self graphicsDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4532
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4533
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  4534
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4535
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4536
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4537
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4538
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4539
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4540
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4541
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4542
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4543
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4544
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4545
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4546
	(PopUpView shadowsOnDevice:self graphicsDevice) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4547
	    shadowView isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4548
		shadowView := (ShadowView onDevice:self graphicsDevice) for:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4549
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4550
		self saveUnder:true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4551
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4552
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4553
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4554
	self hasExplicitExtent ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4555
	    (self width) == (superView width) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4556
		self verticalLayout:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4557
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4558
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4559
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4560
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4561
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4562
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4563
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4564
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4565
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4566
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4567
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4568
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4569
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4570
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4571
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4572
    super destroy.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4573
    prevFocusView := superMenu := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4574
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4575
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4576
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4577
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4578
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4579
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4580
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4581
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4582
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4583
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4584
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4585
	styleSheet := superMenu styleSheet
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4586
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4587
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4588
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4589
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4590
    "/ 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
  4591
    "/ (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
  4592
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4593
    superMenu isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4594
	rightArrow isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4595
	    rightArrow := SelectionInListView rightArrowFormOn:self graphicsDevice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4596
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4597
	fgColor := fgColor onDevice:self graphicsDevice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4598
	style   := styleSheet name.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4599
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4600
	(style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4601
	    rightArrowShadow := SelectionInListView rightArrowShadowFormOn:self graphicsDevice
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4602
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4603
	    rightArrowShadow := nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4604
	].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4605
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4606
	rightArrow       := superMenu rightArrow.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4607
	rightArrowShadow := superMenu rightArrowShadow.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4608
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4609
	self foregroundColor:(superMenu foregroundColor).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4610
	self             font:(superMenu font).
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4611
"/        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4612
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4613
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4614
    items notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4615
	items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4616
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4617
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4618
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4619
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4620
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4621
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4622
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4623
2919
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4624
    <resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4625
		       #'menu.buttonItemVerticalSpace'   #'menu.itemSpace'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4626
		       #'menu.itemHorizontalSpace'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4627
		       #'popup.hideOnRelease'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4628
		       )>
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4629
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4630
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4631
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4632
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4633
    buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4634
    buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4635
    buttonInsetX := buttonInsetX abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4636
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4637
    buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4638
    buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4639
    buttonInsetY := buttonInsetY abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4640
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4641
    itemSpace := styleSheet at:#'menu.itemHorizontalSpace'.
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  4642
    itemSpace isNil ifTrue:[ itemSpace := styleSheet at:#'menu.itemSpace' default:[ gc font widthOf:' '] ].
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4643
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4644
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4645
    fgColor := DefaultForegroundColor.
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4646
    fgColor isNil ifTrue:[ fgColor := Color black ].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4647
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4648
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  4649
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  4650
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4651
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4652
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4653
    buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4654
    buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4655
    buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4656
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4657
    self updateLevelAndBorder.
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4658
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4659
    "Modified (format): / 19-01-2012 / 13:19:19 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4660
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4661
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4662
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4663
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4664
4454
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  4665
    mustRearrange       := false.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  4666
    sizeFixed := true.
4454
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  4667
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4668
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4669
2877
6f7df547445b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  4670
    self enableMotionEvents.  "/ for flyByHelp
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4671
    enabled := true.
3881
0db3473b4eca changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3878
diff changeset
  4672
    self originChangedFlag:false extentChangedFlag:false.
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4673
    "/ explicitExtent      := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4674
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4675
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4676
    showGroupDivider    := true.
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4677
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4678
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4679
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4680
map
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4681
    "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
  4682
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4683
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4684
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4685
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4686
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4687
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4688
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4689
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4690
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4691
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4692
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4693
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4694
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4695
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4696
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4697
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4698
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4699
	self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4700
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4701
	super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4702
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4703
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4704
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4705
    loIndices size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4706
	self redrawX:0 y:0 width:width height:height.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4707
	self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4708
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4709
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  4710
    "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
  4711
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4712
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4713
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4714
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4715
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4716
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4717
    |bgColor|
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4718
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4719
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4720
	bgColor := styleSheet colorAt:'menu.backgroundColor'.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4721
	bgColor notNil ifTrue:[ self viewBackground:bgColor ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4722
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4723
	"Because of #saveUnder of ShadowView the order of realize is significant:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4724
	 shadowView must be realized before self"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4725
	self hiddenOnRealize:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4726
	super realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4727
	self resize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4728
	self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4729
"/        self mustRearrange.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4730
	shadowView notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4731
	    shadowView realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4732
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4733
	self raise.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4734
	self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4735
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4736
	super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4737
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4738
    self allSubViewsDo:[:aView| aView realize ].
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4739
    "/ hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4740
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4741
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4742
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  4743
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4744
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4745
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  4746
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4747
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4748
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4749
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4750
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4751
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4752
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4753
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4754
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4755
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4756
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4757
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4758
    self do:[:anItem |
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4759
	anItem reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4760
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4761
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4762
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4763
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4764
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4765
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4766
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  4767
    "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
  4768
     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
  4769
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4770
    mapTime := nil.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4771
3975
ca
parents: 3966
diff changeset
  4772
    "hide all submenus opened within the menu"
ca
parents: 3966
diff changeset
  4773
    self itemsDo:[:eachItem|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4774
	eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ].
3975
ca
parents: 3966
diff changeset
  4775
    ].
ca
parents: 3966
diff changeset
  4776
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4777
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4778
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4779
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4780
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4781
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4782
"/    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4783
    prevFocusView := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4784
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4785
    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
  4786
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4787
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4788
updateLevelAndBorder
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4789
    "update level & border"
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4790
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4791
    <resource: #style (#'popup.borderWidth'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4792
		       #'popup.borderColor'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4793
		       #'popup.level'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4794
		       #'pullDownMenu.level'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4795
		       )>
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4796
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4797
    |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
  4798
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4799
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4800
	bw  := styleSheet at:#'popup.borderWidth' default:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4801
	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
  4802
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4803
	bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4804
	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
  4805
    ].
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4806
    bw ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4807
	bc  := styleSheet at:#'popup.borderColor' default:Color black.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4808
	self borderColor:bc
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4809
    ].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4810
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4811
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4812
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4813
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4814
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4815
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4816
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4817
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4818
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4819
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4820
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4821
    |menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel|
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4822
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4823
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4824
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4825
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4826
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4827
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4828
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4829
    accessCharacterMatchQuery :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4830
	[:el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4831
	    |k|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4832
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4833
	    k := el accessCharacter.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4834
	    k == uKey or:[k == lKey]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4835
	].
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4836
    maxShortCutSearchLevel := self class maxShortCutSearchLevel.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4837
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4838
    selection notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4839
	"first lookup the current grapMenu before starting in the topMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4840
	"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4841
	menu := self detectGrabMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4842
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4843
	[ menu ~~ self ] whileTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4844
	    index := menu selectionIndex.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4845
	    list  := menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4846
			selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4847
			maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4848
			ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4849
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4850
	    list size ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4851
		"/ has item which responds to the mnemonic
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4852
		menu processCollectedShortcutIndices:list.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4853
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4854
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4855
	    menu := menu superMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4856
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4857
	index := self selectionIndex.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4858
	list  := self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4859
		    selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4860
		    maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4861
		    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
  4862
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4863
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4864
	index := 99999.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4865
	list  := nil.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4866
    ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4867
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4868
    list isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4869
	list := self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4870
		    selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4871
		    maxDepth:maxShortCutSearchLevel from:1 to:index
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4872
		    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4873
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4874
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4875
	list isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4876
	    "/ must clear existing selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4877
	    self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4878
	    ^ nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4879
	]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4880
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4881
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4882
    "/ has item which responds to the mnemonic
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4883
    self processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4884
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4885
    "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
  4886
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4887
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4888
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4889
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4890
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4891
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4892
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4893
    anItemIndiceList size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4894
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4895
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4896
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4897
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4898
    (item notNil and:[item enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4899
	InitialSelectionQuerySignal answer:anItemIndiceList do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4900
	    self selection:item openMenu:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4901
	]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4902
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4903
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4904
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4905
processCollectedShortcutIndices:indices
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4906
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4907
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4908
    indices size == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4909
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4910
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4911
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4912
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4913
    "/ first lookup in current open submenus
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4914
    [menu selectionIndex == indices first] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4915
	(    (item := menu selection) isNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4916
	 or:[(menu := item currentSubmenu) isNil]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4917
	) ifTrue:[ "/ selected but no submenu open - not handled
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4918
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4919
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4920
	indices removeFirst.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4921
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4922
	indices isEmpty ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4923
	   menu selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4924
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4925
	]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4926
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4927
    menu openMenusFromItemIndices:indices.
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4928
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  4929
    "Modified: / 24-03-2011 / 11:19:38 / cg"
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  4930
    "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
  4931
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4932
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4933
processShortcut:aKeyEvent
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4934
    "a shortcutKey event as forwarded from the keyboardProcessor.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  4935
     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
  4936
     Otherwise return false."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4937
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4938
    |menu rawKey logicalKey list item selectableItem|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4939
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4940
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4941
	^ superMenu processShortcut:aKeyEvent
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4942
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4943
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4944
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4945
    logicalKey := aKeyEvent key.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4946
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4947
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4948
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  4949
    ( #( CursorDown CursorUp CursorRight CursorLeft Return Escape
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4950
       ) includes:logicalKey
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4951
    ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4952
	^ false.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4953
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  4954
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  4955
    rawKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  4956
    item := nil.
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  4957
    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
  4958
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4959
    "/ 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
  4960
    aKeyEvent isKeyReleaseEvent ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4961
	selection isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4962
	    prevFocusView := self windowGroup focusView.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4963
	    self requestFocus. "/ self windowGroup focusView:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4964
	    selectableItem := self firstItemSelectable.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4965
	    self selection:selectableItem openMenu:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4966
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4967
	    prevFocusView requestFocus.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4968
	    self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4969
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4970
	^ true
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4971
    ].
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  4972
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4973
    [true] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4974
	list := menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4975
		    selectItemIndicesFor:[:el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4976
			|skey|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4977
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4978
			item := el.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4979
			el ignoreShortcutKeys ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4980
			    false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4981
			] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4982
			    skey := el shortcutKey.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4983
			    skey == rawKey or:[skey == logicalKey]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4984
			]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4985
		    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4986
		    maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4987
		    ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4988
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4989
	list size ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4990
	    "/ has item which responds to the shortcut
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4991
	    item hasSubmenu ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4992
		menu accept:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4993
	    ] ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4994
		menu processCollectedShortcutIndices:list.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4995
		self requestFocus. "/ self windowGroup focusView:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4996
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4997
	    ^ true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4998
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5000
	menu == self ifTrue:[ ^ false ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5001
	menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5002
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5003
    ^ false     "/ never reached
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5004
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5005
    "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
  5006
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5007
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5008
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
  5009
    "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
  5010
     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
  5011
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5012
     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
  5013
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5014
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5015
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5016
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5017
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5018
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5019
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5020
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5021
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5022
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5023
    start to:stop do:[:i|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5024
	|item menu result|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5025
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5026
	item := items at:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5027
	(item enabled and:[item isVisible]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5028
	    (aOneArgBlock value:item) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5029
		^ OrderedCollection with:i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5030
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5031
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5032
	    maxDepth > 1 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5033
		(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5034
		    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5035
			menu := item setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5036
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5037
			(menu notNil and:[menu isEnabled]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5038
			    result := menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5039
					selectItemIndicesFor:aOneArgBlock
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5040
					maxDepth:(maxDepth - 1) from:1 to:99999
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5041
					ignoreSubmenuBlock:ignoreSubmenueBlock.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5042
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5043
			    result notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5044
				result addFirst:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5045
				^ result
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5046
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5047
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5048
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5049
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5050
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5051
	].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5052
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5053
    ^ nil
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5054
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5055
    "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
  5056
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5057
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5058
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5059
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5060
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5061
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5062
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5063
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5064
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5065
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5066
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5067
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5068
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5069
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5070
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5071
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5072
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5073
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5074
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5075
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5076
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5077
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5078
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5079
    [(smenu := menu superMenu) notNil] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5080
	menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5081
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5082
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5083
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5084
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  5085
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5086
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5087
printOn:aStream
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5088
    |label|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5089
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5090
    aStream nextPutAll:'Menu:'.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5091
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5092
    self do:[:eachItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5093
	label  := eachItem label.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5094
	label notEmptyOrNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5095
	    aStream nextPutAll:'  '.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5096
	    label printOn:aStream.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5097
	].
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5098
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5099
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5100
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5101
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5102
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5103
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5104
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5105
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5106
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5107
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5108
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5109
	application := superMenu application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5110
	^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5111
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5112
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5113
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  5114
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5115
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5116
detectItem:aBlock
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5117
    "returns the item for which aBlock returns true."
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5118
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5119
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5120
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5121
	    (aBlock value:anItem) ifTrue:[^ anItem].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5122
	].
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5123
    ].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5124
    ^ nil
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5125
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5126
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5127
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5128
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5129
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5130
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5131
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5132
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5133
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5134
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5135
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5136
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5137
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5138
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5139
    items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5140
	|char label|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5141
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5142
	(     anIndex ~~ cIdx
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5143
	 and:[anItem canSelect
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5144
	 and:[(label := anItem textLabel) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5145
	 and:[label size ~~ 0]]]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5146
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5147
	    (char := anItem accessCharacter) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5148
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5149
		    ^ anItem
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
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5152
		char := label at:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5153
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5154
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5155
		    anIndex > cIdx ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5156
			^ anItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5157
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5158
		    item isNil ifTrue:[item := anItem]
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
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5161
	]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5162
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5163
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5164
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5165
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5166
detectItemForLabel:aLabel
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5167
    ^ self detectItem:[:anItem | anItem label = aLabel].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5168
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5169
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5170
detectItemForNameKey:aKey
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5171
    ^ self detectItem:[:anItem | anItem nameKey == aKey].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5172
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5173
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5174
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5175
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5176
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5177
    aList isCollection ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5178
	items size >= aList size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5179
	    aList keysAndValuesDo:[:anIndex :anArg|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5180
		(items at:anIndex) perform:aSelector with:anArg
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5181
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5182
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5183
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5184
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5185
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5186
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5187
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5188
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5189
    anImage isNil ifTrue:[ ^ nil ].
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  5190
    ^ self class image:anImage onDevice:self graphicsDevice
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5191
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5192
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5193
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5194
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5195
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5196
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5197
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5198
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5199
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5200
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5201
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5202
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5203
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5204
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5205
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5206
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5207
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5208
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5209
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5210
	styleSheet       := superMenu styleSheet.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5211
	rightArrow       := superMenu rightArrow.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5212
	rightArrowShadow := superMenu rightArrowShadow.
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5213
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5214
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5215
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5216
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5217
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5218
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5219
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5220
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5221
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5222
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5223
    "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
  5224
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5225
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5226
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5227
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5228
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5229
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5230
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5231
    "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
  5232
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5233
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5234
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5235
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5236
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5237
    mapTime isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5238
	"/ set the mapTime if not yet done
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5239
	mapTime := Timestamp now.
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5240
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5241
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5242
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5243
    "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
  5244
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5245
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5246
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5247
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5248
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5249
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5250
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5251
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5252
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5253
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5254
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5255
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5256
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5257
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5258
    top activeMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5259
	top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5260
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5261
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5262
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5263
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5264
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5265
mapTime
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5266
    "get the time the menu was activated or nil"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5267
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5268
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5269
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5270
    "Modified: / 27.2.1998 / 17:41:18 / cg"
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5271
!
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5272
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5273
mapTime:aTimestamp
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5274
    "set the time the menu was activated"
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5275
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5276
    mapTime := aTimestamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5277
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5278
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5279
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5280
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5281
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5282
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5283
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5284
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5285
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5286
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5287
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5288
    self hasScrollers ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5289
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5290
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5291
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5292
    aDirection == #PREV ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5293
	layout := items first layout.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5294
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5295
      ^ self verticalLayout ifTrue:[ layout top  < margin]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5296
			   ifFalse:[ layout left < margin]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5297
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5298
    layout := items last layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5299
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5300
  ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5301
		       ifFalse:[ layout right  > (width  - margin)]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5302
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5303
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5304
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5305
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5306
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5307
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5308
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5309
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5310
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5311
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5312
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5313
    superView notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5314
	((first := items first layout) isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5315
	 or:[(last  := items last layout) isNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5316
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5317
	    ^ false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5318
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5319
	isVert ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5320
	    ^ first top < 0 or:[last bottom > height]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5321
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5322
	^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5323
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5324
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5325
    isVert ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5326
	^ (height >= maxExtent y)
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5327
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5328
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5329
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5330
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5331
indexOfItemAtScroller:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5332
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5333
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5334
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5335
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5336
    self hasScrollers ifFalse:[ ^ 0 ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5337
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5338
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5339
    self verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5340
	min := bounds top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5341
	max := bounds bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5342
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5343
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5344
	    anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5345
		layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5346
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5347
		(layout top < max and:[layout bottom > min]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5348
		    ^ anIndex
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5349
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5350
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5351
	].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5352
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5353
	min := bounds left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5354
	max := bounds right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5355
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5356
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5357
	    anItem isVisible ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5358
		layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5359
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5360
		(layout left < max and:[layout right > min]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5361
		    ^ anIndex
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5362
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5363
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5364
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5365
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5366
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5367
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5368
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5369
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5370
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5371
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5372
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5373
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5374
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5375
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5376
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5377
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5378
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5379
    ) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5380
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5381
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5382
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5383
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5384
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5385
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5386
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5387
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5388
    isVertical ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5389
	boundsMin := boundsPREV bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5390
	boundsMax := boundsNEXT top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5391
	layoutMin := layout top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5392
	layoutMax := layout bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5393
	windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5394
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5395
	boundsMin := boundsPREV right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5396
	boundsMax := boundsNEXT left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5397
	layoutMin := layout left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5398
	layoutMax := layout right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5399
	windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5400
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5401
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5402
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5403
    layoutMin < boundsMin ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5404
	layoutMin >= 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5405
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5406
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5407
	"/ test whether is first visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5408
	index := items findLast:[:el| el isVisible] startingAt:(index - 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5409
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5410
	index == 0 ifTrue:[ scr0 := margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5411
		  ifFalse:[ scr0 := boundsMin ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5412
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5413
	delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5414
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5415
	layoutMax > boundsMax ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5416
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5417
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5418
	"/ test whether is last visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5419
	index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5420
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5421
	index == 0 ifTrue:[ scr0 := windowSz - margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5422
		  ifFalse:[ scr0 := boundsMax ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5423
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5424
	delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5425
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5426
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5427
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5428
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5429
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5430
    shown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5431
	delta abs < (windowSz / 2) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5432
	    doScroll := true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5433
	    self repairDamage
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5434
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5435
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5436
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5437
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5438
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5439
    doScroll ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5440
	self invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5441
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5442
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5443
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5444
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5445
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5446
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5447
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5448
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5449
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5450
    delta < 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5451
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5452
	    self copyFrom:self x:margin y:scr1 toX:margin y:scr0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5453
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5454
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5455
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5456
	    inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5457
	    "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5458
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5459
	    self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5460
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5461
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5462
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5463
	    inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5464
	    "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5465
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5466
	inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5467
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5468
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5469
	    self copyFrom:self x:margin y:scr0 toX:margin y:scr1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5470
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5471
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5472
	    inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5473
	    "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5474
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5475
	    self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5476
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5477
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5478
	    inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5479
	    "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5480
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5481
	inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5482
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5483
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5484
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5485
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5486
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5487
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5488
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5489
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5490
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5491
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5492
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5493
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5494
	^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5495
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5496
    scrollActivity isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5497
	scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5498
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5499
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5500
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5501
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5502
scrollerBoundsAt:aDirection
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5503
    "returns the bounds of the scroller at a direction"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5504
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5505
    |y x w h inset|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5506
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5507
    inset := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5508
    x := y := inset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5509
    w := h := 15.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5510
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5511
    self verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5512
	aDirection == #NEXT ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5513
	    y := height - h - inset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5514
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5515
	w := width - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5516
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5517
	aDirection == #NEXT ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5518
	    x := width - w - inset.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5519
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5520
	h := height - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5521
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5522
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5523
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5524
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5525
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5526
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5527
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5528
    self hasScrollers ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5529
	#( PREV NEXT ) do:[:aDirection| |bounds|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5530
	    bounds := self scrollerBoundsAt:aDirection.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5531
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5532
	    (bounds containsPoint:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5533
		^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5534
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5535
	]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5536
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5537
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5538
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5539
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5540
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5541
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5542
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5543
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5544
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5545
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5546
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5547
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5548
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5549
    selection notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5550
	(subMenu := selection visibleSubmenu) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5551
	    ^ subMenu detectGrabMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5552
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5553
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5554
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5555
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5556
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5557
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5558
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5559
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5560
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5561
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5562
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5563
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5564
    ((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
  5565
	firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5566
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5567
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5568
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5569
	^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5570
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5571
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  5572
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5573
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5574
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5575
detectViewAtX:x y:y in:aTopView
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5576
    "detect view at x@y"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5577
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5578
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5579
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5580
"/ 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
  5581
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5582
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5583
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5584
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5585
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5586
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5587
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5588
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5589
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5590
"/                    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
  5591
"/                  ^ 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
  5592
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5593
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5594
"/        ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5595
"/    ].
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5596
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5597
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5598
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5599
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5600
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5601
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5602
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5603
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5604
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5605
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5606
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5607
    stringOrNumberOrPoint isPoint ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5608
	^ self itemAtPoint:stringOrNumberOrPoint
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5609
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5610
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5611
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5612
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5613
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5614
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5615
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5616
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5617
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5618
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5619
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5620
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5621
	x := aPoint x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5622
	y := aPoint y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5623
	^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5624
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5625
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5626
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5627
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5628
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5629
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5630
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5631
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5632
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5633
    (self containsPoint:aPoint) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5634
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5635
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5636
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5637
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5638
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5639
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5640
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5641
	(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5642
	    ^ superMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5643
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5644
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5645
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5646
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5647
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5648
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5649
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5650
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5651
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5652
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5653
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5654
    aView notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5655
	"/ I am no longer a popUpView
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5656
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5657
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5658
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5659
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5660
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5661
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5662
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5663
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5664
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5665
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5666
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5667
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5668
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  5669
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5670
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5671
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5672
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5673
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5674
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5675
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5676
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5677
    groupSizes size ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5678
	i := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5679
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5680
	groupSizes do:[:t|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5681
	    (i := i + t) == anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5682
		^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5683
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5684
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5685
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5686
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5687
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5688
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5689
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5690
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5691
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5692
    ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5693
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5694
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5695
hasPerformed
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5696
    ^ hasPerformed ? false
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5697
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5698
    "Created: / 29-06-2011 / 16:24:14 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5699
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5700
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5701
isFitPanel
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5702
    "returns true if the panel is the first in the menu hierarchy
4384
ba9b2e98323d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4383
diff changeset
  5703
     and must be fit to the extent of its superView;
ba9b2e98323d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4383
diff changeset
  5704
     Obsolete: NO LONGER SUPPORTED"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5705
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5706
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5707
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5708
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5709
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5710
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5711
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5712
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5713
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5714
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5715
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5716
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5717
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5718
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5719
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5720
!
c05874084d4c implement
ca
parents: 407
diff changeset
  5721
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5722
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  5723
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5724
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5725
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5726
type
428
ca
parents: 427
diff changeset
  5727
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5728
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5729
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5730
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5731
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5732
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5733
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5734
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5735
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5736
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5737
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5738
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5739
openDelayed:anItem
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5740
    self openDelayed:anItem afterSeconds:0.5.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5741
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5742
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  5743
openDelayed:anItemOrNil afterSeconds:seconds
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5744
    |b|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5745
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5746
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5747
	superMenu openDelayed:anItemOrNil afterSeconds:seconds.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5748
	^ self
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5749
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5750
    (b := openDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5751
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5752
	Processor removeTimedBlock:b.
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  5753
    ].
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  5754
    (anItemOrNil notNil and:[anItemOrNil hasSubmenu]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5755
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5756
	^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5757
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5758
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5759
    openDelayedMenuBlock :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5760
	[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5761
	    openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5762
	    anItemOrNil openDelayedSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5763
	].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5764
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  5765
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5766
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5767
    "Modified: / 29-08-2013 / 09:40:28 / cg"
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5768
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5769
3975
ca
parents: 3966
diff changeset
  5770
selectAndOpenDelayed:anItemOrNil
ca
parents: 3966
diff changeset
  5771
    "change selection to an item or nil"
ca
parents: 3966
diff changeset
  5772
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5773
    |helpListener oldSelect delayedOpenSeconds b|
3975
ca
parents: 3966
diff changeset
  5774
ca
parents: 3966
diff changeset
  5775
    anItemOrNil == selection ifTrue:[ ^ self ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  5776
    "/ self openDelayed:nil.
3975
ca
parents: 3966
diff changeset
  5777
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5778
    (b := closeDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5779
	closeDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5780
	Processor removeTimedBlock:b.
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5781
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5782
    (b := openDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5783
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5784
	Processor removeTimedBlock:b.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5785
    ].
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5786
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5787
    delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
4617
0922a5f9c84a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4605
diff changeset
  5788
    "/ self verticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5789
3975
ca
parents: 3966
diff changeset
  5790
    oldSelect := selection.
ca
parents: 3966
diff changeset
  5791
    selection := nil.
ca
parents: 3966
diff changeset
  5792
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5793
    "/ redraw current selection cleared
3975
ca
parents: 3966
diff changeset
  5794
    oldSelect notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5795
	|oldSubmenu|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5796
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5797
	oldSubmenu := oldSelect visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5798
	oldSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5799
	    "/ if the new item has a submenu, any current submenu will be closed, when that
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5800
	    "/ one eventuall opens. However, if it is a simple item,
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5801
	    "/ it would remain open. So schedule a delayed close action for it.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5802
	    closeDelayedMenuBlock :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5803
		[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5804
		    "/ but only if we have not reentered the item with the submenu we want to close
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5805
		    selection ~~ oldSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5806
			(oldSelect hasSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5807
			and:[ oldSelect visibleSubmenu notNil ]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5808
			    oldSelect hideSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5809
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5810
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5811
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5812
	    Processor addTimedBlock:closeDelayedMenuBlock afterSeconds:delayedOpenSeconds.
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5813
"/ mhmh - seems to not only not needed, but actually hurting (leftover menus)
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5814
"/            Processor addTimedBlock:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5815
"/                selection ~~ anItemOrNil ifTrue:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5816
"/                    "cancels the current delayed operation"
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5817
"/                    oldSelect hideSubmenu.
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5818
"/
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5819
"/                    ( selection notNil
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5820
"/                    and:[selection hasSubmenu
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5821
"/                    and:[selection visibleSubmenu isNil]]
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5822
"/                    ) ifTrue:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5823
"/                        "setup new delayed operation.."
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5824
"/                        self openDelayed:selection afterSeconds:delayedOpenSeconds "0.1"
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5825
"/                    ].
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5826
"/                ].
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  5827
"/            ] afterSeconds:delayedOpenSeconds.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5828
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5829
	oldSelect invalidate.
3975
ca
parents: 3966
diff changeset
  5830
    ].
ca
parents: 3966
diff changeset
  5831
ca
parents: 3966
diff changeset
  5832
    anItemOrNil notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5833
	self makeItemVisible:anItemOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5834
	anItemOrNil canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5835
	    selection := anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5836
	].
3975
ca
parents: 3966
diff changeset
  5837
    ].
ca
parents: 3966
diff changeset
  5838
    selection isNil ifTrue:[^ self].
ca
parents: 3966
diff changeset
  5839
ca
parents: 3966
diff changeset
  5840
    ActiveHelp isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5841
	helpListener := ActiveHelp currentHelpListener.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5842
	helpListener initiateHelpFor:self at:nil now:true.
3975
ca
parents: 3966
diff changeset
  5843
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  5844
3975
ca
parents: 3966
diff changeset
  5845
    shown ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5846
	"/ self rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5847
	selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5848
	selection hasSubmenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5849
	    "/ cg: disabled: prevents delayed menu when moving over a separator item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5850
	    false "(oldSelect isNil or:[oldSelect visibleSubmenu isNil])" ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5851
		self openDelayed:selection afterSeconds:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5852
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5853
		self openDelayed:selection afterSeconds:delayedOpenSeconds.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5854
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5855
	].
3975
ca
parents: 3966
diff changeset
  5856
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5857
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  5858
    "Modified: / 29-08-2013 / 09:44:06 / cg"
3975
ca
parents: 3966
diff changeset
  5859
!
ca
parents: 3966
diff changeset
  5860
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5861
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5862
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5863
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5864
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5865
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5866
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5867
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5868
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5869
     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
  5870
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5871
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5872
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5873
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5874
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5875
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5876
	self selection:anItemOrNil openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5877
	^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5878
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5879
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5880
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5881
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5882
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5883
    openMenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5884
	openMenu := openOnSelect.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5885
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5886
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5887
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5888
    openOnSelect ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5889
	"/ select first item in submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5890
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5891
	submenu := anItemOrNil currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5892
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5893
	submenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5894
	    item := submenu itemAt:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5895
	    (item notNil and:[item hasSubmenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5896
		submenu selection:item openMenu:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5897
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5898
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5899
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5900
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5901
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5902
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5903
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5904
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5905
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5906
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5907
    anItemOrNil == selection ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5908
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5909
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5910
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5911
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5912
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5913
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5914
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5915
    anItemOrNil notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5916
	self makeItemVisible:anItemOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5917
	anItemOrNil canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5918
	    selection := anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5919
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5920
	    oldSelect isNil ifTrue:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5921
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5922
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5923
    oldSelect notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5924
	"/ clear current selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5925
	oldSelect isSelected:false.
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  5926
    ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  5927
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5928
	^ self
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  5929
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5930
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5931
"/    selection == enteredItem ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5932
"/        enteredItem := nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5933
"/    ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5934
"/        self pointerEntersItem:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  5935
"/    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5936
    ActiveHelp isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5937
	helpListener := ActiveHelp currentHelpListener.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5938
	helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5939
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5940
    shown ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5941
	"/ self rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5942
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5943
	openMenu ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5944
	    selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5945
	]
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5946
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5947
    openMenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5948
	selection isSelected:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5949
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5950
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5951
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5952
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5953
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5954
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5955
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5956
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5957
    (item := self selection) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5958
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5959
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5960
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5961
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5962
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5963
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5964
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5965
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5966
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5967
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5968
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5969
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5970
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5971
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5972
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5973
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5974
    superMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5975
	"I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5976
	aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5977
	^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5978
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5979
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5980
    relativeGrabOrigin isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5981
	relativeGrabOrigin := self topMenu translatePoint:0 to:self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5982
	relativeGrabOrigin isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5983
	    "I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5984
	    aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5985
	    ^ aGrabPoint
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5986
	].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5987
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5988
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5989
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5990
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5991
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5992
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5993
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5994
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5995
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5996
    aMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5997
	^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5998
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5999
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6000
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6001
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6002
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6003
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6004
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6005
    "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
  6006
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  6007
    ^ self graphicsDevice
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6008
	translatePoint:aPoint asPoint
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6009
	fromView:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6010
	toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6011
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6012
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6013
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6014
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6015
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6016
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6017
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6018
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6019
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6020
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6021
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6022
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6023
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6024
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6025
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6026
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6027
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6028
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6029
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6030
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6031
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6032
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6033
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6034
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6035
halfSeparatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6036
    "returns the size of a space-separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6037
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6038
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6039
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6040
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6041
separatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6042
    "returns the size of a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6043
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6044
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6045
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6046
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6047
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6048
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6049
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6050
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6051
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6052
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6053
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6054
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6055
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6056
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6057
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6058
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  6059
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6060
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6061
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6062
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6063
    "
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  6064
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6065
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6066
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6067
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6068
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6069
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6070
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6071
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6072
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6073
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6074
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6075
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6076
    item label:aLabel.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6077
    ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6078
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6079
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6080
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6081
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6082
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6083
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6084
    item menuItem:aMenuItem.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6085
    ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6086
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6087
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6088
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6089
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6090
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6091
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  6092
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6093
420
ca
parents: 417
diff changeset
  6094
canAccept
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6095
    "returns true if item is acceptable"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6096
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6097
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6098
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6099
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6100
    self hasDelayedMenu ifFalse:[^ false ].
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  6101
    ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6102
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6103
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6104
toggleIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6105
    "toggle indication or choice"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6106
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6107
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6108
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6109
    indication notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6110
	arg := self indicationValue not.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6111
	self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6112
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6113
	(choice notNil and:[choice isValueModel])ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6114
	    choice value:(menuItem choiceValue).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6115
	    ^ true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6116
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6117
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6118
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6119
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6120
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6121
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6122
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6123
accessCharacter
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6124
    "returns my accessCharacter or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6125
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6126
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6127
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6128
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6129
accessCharacterPosition
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6130
    "get the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6131
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6132
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6133
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6134
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6135
accessCharacterPosition:anIndex
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6136
    "set the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6137
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6138
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6139
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6140
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6141
argument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6142
    "gets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6143
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6144
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6145
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6146
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6147
argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6148
    "sets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6149
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6150
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6151
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6152
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6153
displayLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6154
    "returns my printable Label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6155
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6156
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6157
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6158
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6159
displayLabelExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6160
    "returns the labels extent"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6161
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6162
    |myFont prevFont w h|
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6163
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6164
    displayLabelExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6165
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6166
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6167
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6168
    displayLabel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6169
	displayLabelExtent := 0@0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6170
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6171
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6172
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6173
    myFont := self font.
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6174
    myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6175
    myFont := myFont onDevice:menuPanel device.
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6176
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6177
    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
  6178
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6179
    displayLabel isString ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6180
	w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6181
	h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6182
"/        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
  6183
"/        h := myFont heightOf:displayLabel.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6184
    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6185
	displayLabel isArray ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6186
	    w := h := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6187
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6188
	    displayLabel do:[:aSubLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6189
		aSubLabel notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6190
		    w := w max:(aSubLabel widthOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6191
		    h := h + 1 + (aSubLabel heightOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6192
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6193
		    h := h + (self spaceBetweenEmptyLines)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6194
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6195
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6196
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6197
	    w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6198
	    h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6199
	].
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6200
    ].
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6201
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6202
    menuPanel setFont:prevFont.     "/ restore previous font
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6203
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6204
    "/ care for italic fonts - give a few more pixels at the end
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6205
    myFont italic ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6206
	w := w + 2.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6207
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6208
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6209
    ^ displayLabelExtent
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6210
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6211
    "Modified: / 17-08-2010 / 10:46:06 / cg"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6212
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6213
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6214
font
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6215
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6216
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6217
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6218
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6219
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6220
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6221
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6222
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6223
    font notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6224
	font := font onDevice:(menuPanel device).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6225
	menuItem font:font.
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6226
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6227
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6228
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6229
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6230
font:aFont
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6231
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6232
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6233
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6234
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6235
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6236
ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6237
    "if true, mnemonic (access character) in the submenus under the item are ignored.
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6238
     Set this to speedup accelerator key processing for slow dynamci menus"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6239
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6240
    ^ menuItem ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6241
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6242
    "Modified (comment): / 08-09-2011 / 04:29:47 / cg"
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6243
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6244
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6245
ignoreMnemonicKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6246
    "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
  6247
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6248
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6249
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6250
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6251
ignoreShortcutKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6252
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6253
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6254
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6255
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6256
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6257
ignoreShortcutKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6258
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6259
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6260
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6261
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6262
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6263
itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6264
    "gets the item's value"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6265
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6266
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6267
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6268
    "Modified (comment): / 06-03-2012 / 14:41:27 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6269
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6270
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6271
itemValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6272
    "argument could be a value holder, an action or selector"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6273
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6274
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6275
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6276
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6277
label
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6278
    "returns the label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6279
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6280
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6281
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6282
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6283
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6284
    "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
  6285
     handle characters $& (ST-80 compatibility)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6286
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6287
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6288
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6289
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6290
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6291
    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
  6292
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  6293
    "Stefan: Why do we use #value two times??"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6294
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6295
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6296
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6297
    displayLabel isString ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6298
	"CHECK FOR SEPARATOR"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6299
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6300
	(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6301
	    size := displayLabel size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6302
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6303
	    size == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6304
		displayLabel := nil.            "blank separator"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6305
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6306
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6307
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6308
	    size == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6309
		char := displayLabel first.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6310
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6311
		(char == $- or:[char == $=]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6312
		    label := displayLabel.      "line separator"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6313
		    displayLabel := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6314
		    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6315
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6316
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6317
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6318
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6319
	displayLabel isCollection ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6320
	    displayLabel := displayLabel asArray.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6321
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6322
    ].
4218
ade9025919d7 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4209
diff changeset
  6323
    menuPanel notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6324
	menuPanel doAccessCharacterTranslation ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6325
	    displayLabel notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6326
		displayLabel isArray ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6327
		    displayLabel keysAndValuesDo:[:i :el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6328
			el notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6329
			    displayLabel at:i put:(self updateAccessCharacterFor:el).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6330
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6331
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6332
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6333
		    displayLabel isImageOrForm ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6334
			displayLabel := self updateAccessCharacterFor:displayLabel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6335
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6336
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6337
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6338
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6339
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6340
	menuPanel shown ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6341
	    self fetchImages.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6342
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6343
	    oldExtent = self displayLabelExtent ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6344
		self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6345
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6346
		menuPanel mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6347
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6348
	].
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6349
    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6350
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6351
    "Modified: / 06-10-2011 / 16:36:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6352
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6354
menuPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6355
    "returns my menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6356
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6357
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6358
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6359
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6360
nameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6361
    "gets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6362
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6363
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6364
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6365
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6366
nameKey:aNameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6367
    "sets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6368
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6369
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6370
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6371
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6372
rawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6373
    "returns my raw, unprocessed label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6374
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6375
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6376
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6377
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6378
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6379
    "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
  6380
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6381
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6382
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6383
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6384
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6385
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6386
    "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
  6387
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6388
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6389
    menuItem shortcutKey ~= aKey ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6390
	menuItem shortcutKey:aKey.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6391
	self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6392
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6393
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6394
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6395
startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6396
    "start group #left #right #conditionalRight ... or nil
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6397
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6398
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6399
    ^ menuItem startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6400
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6401
    "Modified: / 16-10-2006 / 13:06:25 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6402
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6403
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6404
startGroup:aSymbol
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6405
    "start group #left #right #conditionalRight ...
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6406
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6407
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6408
    menuItem startGroup:aSymbol.
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6409
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6410
    "Modified: / 16-10-2006 / 13:06:37 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6411
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6412
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6413
submenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6414
    "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
  6415
     May return nil, if there is really no menu"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6416
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6417
    subMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6418
	self setupSubmenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6419
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6420
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6421
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6422
    "Modified: / 07-11-2006 / 11:09:49 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6423
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6424
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6425
submenu:aSubMenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6426
    "set a new submenu; an existing submenu will be destroyed.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6427
     This might lead to a redraw if 'hasSubmenu' changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6428
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6429
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6430
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6431
    subMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6432
	subMenu ~~ aSubMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6433
	    subMenu destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6434
	    subMenu := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6435
	].
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6436
    ].
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6437
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6438
    aSubMenu isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6439
	subMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6440
	    subMenu destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6441
	    subMenu := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6442
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6443
	^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6444
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6445
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6446
    (aSubMenu isKindOf:Menu) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6447
	subMenu := MenuPanel new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6448
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6449
	menuPanel notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6450
	    subMenu receiver:menuPanel receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6451
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6452
	subMenu superMenu:menuPanel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6453
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6454
	menuItem horizontalLayout == true ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6455
	    subMenu verticalLayout:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6456
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6457
	subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6458
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6459
	aSubMenu isView ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6460
	    (aSubMenu isKindOf:ApplicationModel) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6461
		"/ ... mhhhh ....
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6462
		^ menuItem submenuChannel:aSubMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6463
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6464
	    widget := SimpleView new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6465
	    widget client:aSubMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6466
	] ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6467
	    widget := aSubMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6468
	    subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6469
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6470
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6471
	(widget isKindOf:MenuPanel) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6472
	    subMenu := widget.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6473
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6474
	    menuItem horizontalLayout == true ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6475
		subMenu verticalLayout:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6476
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6477
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6478
	    subMenu := MenuPanel new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6479
	    subMenu receiver:menuPanel receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6480
	    subMenu addSubView:widget.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6481
	    subMenu extent:(widget preferredExtent).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6482
	    widget origin:0.0@0.0 corner:1.0@1.0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6483
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6484
	subMenu superMenu:menuPanel.
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6485
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6486
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6487
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6488
submenuOrNil
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6489
    "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
  6490
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6491
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6492
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6493
    "Created: / 07-11-2006 / 11:04:47 / cg"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6494
!
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6495
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6496
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6497
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6498
     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
  6499
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6500
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6501
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6502
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6503
	displayLabel isArray ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6504
	    ^ displayLabel perform:#string ifNotUnderstood:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6505
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6506
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6507
	displayLabel do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6508
	    (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6509
		^ txt
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6510
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6511
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6512
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6513
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6514
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6515
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6516
triggerOnDown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6517
    "return true if triggering the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6518
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6519
    menuItem triggerOnDown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6520
	self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6521
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6522
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6523
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6524
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6525
triggerOnDown:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6526
    "setup to trigger the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6527
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6528
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6529
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6530
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6531
value
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6532
    "gets the item's value
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6533
     Left here for ST80 compatibility - value is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6534
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6535
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6536
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6537
    "Modified (comment): / 06-03-2012 / 14:41:23 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6538
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6539
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6540
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6541
    "could be a value holder, an action or selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6542
     Left here for ST80 compatibility - value: is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6543
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6544
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6545
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6546
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6547
value:aValue argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6548
    "set the value and an argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6549
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6550
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6551
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6552
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6553
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6554
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6555
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6556
choice
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6557
    "implements a radio group; the field"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6558
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6559
    ^ choice
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6560
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6561
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6562
choice:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6563
    "set choice indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6564
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6565
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6566
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6567
    choice isValueModel ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6568
	choice removeDependent:self
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6569
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6570
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6571
    choice := something.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6572
    choice notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6573
	choice isSymbol ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6574
	    choice := (self aspectAt:choice) ? choice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6575
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6576
	choice isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6577
	    choice addDependent:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6578
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6579
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6580
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6581
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6582
choiceValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6583
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6584
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6585
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6586
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6587
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6588
choiceValue:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6589
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6590
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6591
    menuItem choiceValue ~= something ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6592
	menuItem choiceValue:something.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6593
	choice notNil ifTrue:[ self invalidate ].
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6594
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6595
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6596
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6597
enabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6598
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6599
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6600
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6601
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6602
    menuPanel isNil ifTrue:[ ^ false].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6603
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6604
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6605
    enableChannel isSymbol ifTrue:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6606
        state := self aspectAt:enableChannel.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6607
        state isValueModel ifTrue:[
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6608
            enableChannel := state.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6609
            enableChannel addDependent:self.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6610
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6611
    ] ifFalse:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6612
        state := enableChannel.
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6613
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6614
    ^ state value ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6615
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6616
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6617
enabled:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6618
    "change the enabled state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6619
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6620
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6621
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6622
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6623
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6624
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6625
	oldState := enableChannel value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6626
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6627
	    enableChannel removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6628
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6629
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6630
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6631
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6632
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6633
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6634
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6635
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6636
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6637
	    enableChannel addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6638
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6639
	    enableChannel isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6640
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6641
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6642
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6643
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6644
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6645
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6646
	self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6647
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6648
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6649
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6650
hideMenuOnActivated
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6651
    "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6652
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6653
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6654
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6655
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6656
hideMenuOnActivated:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6657
   "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6658
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6659
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6660
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6661
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6662
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6663
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6664
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6665
    |app|
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6666
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6667
    app := menuPanel application.
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6668
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6669
    (menuPanel receiver isNil
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6670
    and:[ app notNil
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6671
    and:[ app askFor:#isUIPainter]])
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6672
    ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6673
	^ self "/ suppressed
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6674
    ].
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6675
    aMessage infoPrint.
3833
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6676
"/    app notNil ifTrue:[
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6677
"/        ' Application: ' infoPrint. app infoPrint
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6678
"/    ].
3444
b7d2f3fe5055 avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents: 3441
diff changeset
  6679
    '' infoPrintCR.
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6680
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6681
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6682
indication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6683
    "get on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6684
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6685
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6686
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6687
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6688
indication:aValueHolder
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6689
    "set on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6690
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6691
    indication == aValueHolder ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6692
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6693
    indication isValueModel ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6694
	indication removeDependent:self
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6695
    ].
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6696
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6697
    (indication := aValueHolder) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6698
	indication isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6699
	    indication addDependent:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6700
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6701
	    "/ to force an update of the value
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6702
	    self indicationValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6703
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6704
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6705
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6706
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6707
keepLinkedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6708
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6709
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6710
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6711
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6712
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6713
keepLinkedMenu:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6714
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6715
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6716
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6717
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6718
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6719
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6720
    "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
  6721
     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
  6722
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6723
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6724
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6725
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6726
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6727
    "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
  6728
     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
  6729
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6730
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6731
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6732
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6733
submenuChannel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6734
    "get the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6735
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6736
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6737
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6738
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6739
submenuChannel:aSelectorOrNil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6740
    "returns the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6741
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6742
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6743
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6744
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6745
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6746
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6747
moveBy:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6748
    "move the layouts origin"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6749
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6750
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6751
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6752
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6753
preferredExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6754
    "compute my preferred extent excluding the shortCutKey and the menu identifier"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6755
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6756
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6757
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6758
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6759
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6760
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6761
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6762
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6763
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6764
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6765
    isButton ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6766
	s := menuPanel maxAbsoluteButtonLevel ? 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6767
	x := s + HorizontalButtonInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6768
	y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6769
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6770
	x  := HorizontalInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6771
	y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6772
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6773
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6774
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6775
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6776
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6777
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6778
    self isSeparator ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6779
	s := self class separatorSize.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6780
	label = '' ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6781
	    s := self class halfSeparatorSize.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6782
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6783
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6784
	"width of doubleSeparator is 5 !!!!"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6785
	isVertical ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6786
	    x := x max:s.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6787
	    y := y + 5.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6788
	] ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6789
	    y := y max:s.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6790
	    x := x + 5.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6791
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6792
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6793
	labelExtent := self displayLabelExtent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6794
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6795
	x := x + labelExtent x.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6796
	y := y + labelExtent y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6797
	x := x + (menuPanel stringOffsetXfor:self).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6798
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6799
	isButton ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6800
	    menuPanel showSeparatingLines ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6801
		"width of separator is 2 plus right offset 1 := 3"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6802
		isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6803
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6804
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6805
	wIcon := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6806
	self hasMenuIndicator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6807
	    icon := MenuPanel menuIndicator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6808
	    wIcon := MenuPanel menuIndicatorOffset + icon width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6809
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6810
	    self hasDelayedMenuIndicator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6811
		icon := MenuPanel delayedMenuIndicator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6812
		wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6813
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6814
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6815
	x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6816
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6817
    ^ x@y
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6818
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  6819
    "Modified: / 19-01-2011 / 21:20:35 / cg"
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6820
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6821
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6822
preferredHeight
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6823
    ^ self preferredExtent y
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6824
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6825
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6826
preferredWidth
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  6827
    ^ self preferredExtent x
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6828
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6829
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6830
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6831
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6832
activeHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6833
    "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
  6834
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6835
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6836
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6837
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6838
activeHelpKey:aHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6839
    "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
  6840
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6841
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6842
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6843
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6844
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6845
activeHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6846
    "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
  6847
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6848
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6849
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6850
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6851
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6852
    ((key := self activeHelpKey) notNil
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6853
    and:[(app := menuPanel application) notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6854
	^ app helpTextForKey:key.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6855
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6856
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6857
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6858
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6859
activeHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6860
    "set the active helpText"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6861
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6862
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6863
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6864
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6865
flyByHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6866
    "get the flyBy helpText or nil."
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6867
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  6868
    |text key app keyUsed itemsActionSelector|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6869
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6870
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6871
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6872
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  6873
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6874
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6875
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6876
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  6877
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6878
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6879
    "/ if an activeHelpKey was explicitely given, use that one
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6880
    key := keyUsed := self activeHelpKey.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6881
    keyUsed isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6882
        "/ try action as key
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  6883
        (itemsActionSelector := menuItem itemValue) isSymbol ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  6884
            keyUsed := itemsActionSelector.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  6885
        ].
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6886
    ].
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6887
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  6888
    "/ special hook for menuItems added by other applications (i.e. via addMenuItem to the launcher)
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6889
    (keyUsed isAssociation) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6890
        app := keyUsed key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6891
        keyUsed := keyUsed value.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6892
    ] ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6893
        app := menuPanel application.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6894
    ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6895
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6896
    keyUsed notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6897
        app notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6898
            text := app flyByHelpTextForKey:keyUsed.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6899
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6900
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6901
            text := menuPanel flyByHelpTextForKey:keyUsed.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6902
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6903
        "/ if the key used is NOT the activeHelpKey, but the action name,
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6904
        "/ then do not accept the default
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6905
        ((text = keyUsed) and:[key isNil]) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6906
            text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6907
        ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6908
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6909
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  6910
    "/ 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
  6911
    text isNil ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6912
        self hasSubmenu ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6913
            ^ key
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6914
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6915
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6916
        "/ then use the original activeHelpKey (but not the action)
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6917
        text := key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6918
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6919
            displayLabel isString ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6920
                text := displayLabel string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6921
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6922
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6923
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6924
            text := self rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6925
            text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6926
                text := menuItem rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6927
                text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6928
                    text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6929
                ]
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6930
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6931
            text notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6932
                (text includes:$&) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6933
                    text := (self updateAccessCharacterFor:text) string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6934
                ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6935
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6936
        ].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6937
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6938
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  6939
    (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
  6940
    text = displayLabel ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6941
        "for text menus: it does not make sense to show the label's string again
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6942
         (i.e. in a pull down menu)"
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  6943
        ^ nil
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6944
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6945
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6946
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6947
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6948
flyByHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6949
    "exlicitly set the flyBy helpText. For example, to dynamically change it."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6950
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6951
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6952
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  6953
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6954
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6955
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6956
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6957
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6958
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6959
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6960
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6961
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6962
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6963
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6964
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6965
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6966
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6967
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6968
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6969
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6970
isButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6971
    "returns whether the item looks like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6972
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6973
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6974
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6975
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6976
isButton:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6977
    "set/clear the item to look like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6978
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6979
    menuItem isButton ~~ aBool ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6980
	menuItem isButton:aBool.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6981
	self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6982
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6983
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6984
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6985
layout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6986
    "returns my layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6987
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6988
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6989
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6990
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6991
layout:aLayout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6992
    "set a new layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6993
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6994
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6995
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6996
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6997
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6998
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6999
    "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
  7000
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7001
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7002
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7003
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7004
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7005
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7006
    "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
  7007
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7008
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7009
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7010
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7011
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  7012
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7013
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7014
currentSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7015
    "returns the current submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7016
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7017
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7018
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7019
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7020
hideSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7021
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7022
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7023
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7024
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7025
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7026
hideSubmenu:aSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7027
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7028
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7029
    |id wg|
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7030
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7031
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7032
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7033
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7034
    aSubmenu realized ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7035
	id := aSubmenu id.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7036
	id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7037
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7038
	aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7039
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7040
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7041
    aSubmenu windowGroup:nil.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7042
    (wg := menuPanel windowGroup) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7043
	wg removeView:aSubmenu.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7044
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7045
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7046
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7047
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7048
	menuItem keepLinkedMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7049
	    subMenu := nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7050
	]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7051
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7052
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7053
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7054
openDelayedSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7055
    "called to open now my delayed submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7056
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7057
    |subMenuBeforeOpening|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7058
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7059
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7060
    subMenu notNil ifTrue:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7061
        subMenu realized ifTrue:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7062
            "/ already open
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7063
            ^ self
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7064
        ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7065
    ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7066
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7067
    "/ bugfix : check if delayed menu canbe open (only for toolbars and items having a delayed menu)
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7068
    (menuPanel isPopUpView                      
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7069
    or:[self hasDelayedMenu not
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7070
    or:[menuPanel sensor anyButtonPressed]]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7071
    ) ifFalse:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7072
        "/ check if any menu already is open than accept otherwise ignore
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7073
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7074
        menuPanel items
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7075
            detect:[:el|(el currentSubmenu isView and:[el currentSubmenu realized])]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7076
            ifNone:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7077
    ].
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  7078
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7079
    self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7080
    subMenu isNil ifTrue:[^ self].
4241
9b3b8041c18f class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4240
diff changeset
  7081
    subMenu hasItems ifFalse:[^ self].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7082
    subMenuBeforeOpening := subMenu.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7083
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7084
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7085
    (subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7086
        "/ closed during building or opening the submenu
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7087
        self hideSubmenu:subMenuBeforeOpening.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7088
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7089
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7090
    "Modified: / 07-11-2006 / 11:07:57 / cg"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7091
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7092
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7093
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7094
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7095
     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
  7096
     nescessary."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7097
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7098
    |p o device isVertical topMenu windGrp prefExtent lastEvent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7099
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7100
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7101
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7102
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7103
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7104
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7105
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7106
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7107
    (subMenu isNil or:[subMenu shown or:[self isSelected not or:[menuPanel realized not]]]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7108
	^ self
3975
ca
parents: 3966
diff changeset
  7109
    ].
ca
parents: 3966
diff changeset
  7110
    "close all other open submenus assigned to the menuPanel I'am located in"
ca
parents: 3966
diff changeset
  7111
ca
parents: 3966
diff changeset
  7112
    menuPanel itemsDo:[:eachItem|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7113
	(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7114
	    eachItem hideSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7115
	].
3975
ca
parents: 3966
diff changeset
  7116
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7117
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7118
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7119
	subMenu releaseDeviceResources.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7120
	subMenu setDevice:topMenu device id:nil gcId:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7121
	subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7122
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7123
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7124
    windGrp := topMenu windowGroup.
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7125
    windGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7126
	lastEvent := windGrp lastEvent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7127
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7128
	(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7129
	    subMenu mapTime:(lastEvent timeStamp).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7130
	].
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7131
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7132
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7133
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7134
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7135
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7136
    windGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7137
	subMenu windowGroup:windGrp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7138
	windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7139
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7140
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7141
    "Q&D kludge - test whether the layout is nil;
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7142
		  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7143
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7144
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7145
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7146
    isVertical := menuPanel verticalLayout.
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7147
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7148
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7149
    menuPanel isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7150
	o := menuPanel origin + p
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7151
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7152
	o := menuPanel translatePoint:p to:nil.   "/ translate to root window
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7153
    ].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7154
    subMenu origin:o.   "set temporary origin to compute preferredExtent"
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7155
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7156
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7157
      TODO: only invoke mustRearrange if any are blocks
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7158
	    (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7159
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7160
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7161
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7162
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7163
    "compute origin of subMenu"
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7164
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7165
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7166
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7167
    width      := prefExtent x.
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7168
    devBot     := device  usableHeightAt:o.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7169
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7170
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7171
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7172
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7173
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7174
    top + height > devBot ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7175
	top := isVertical ifTrue:[devBot - height]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7176
			 ifFalse:[top - layout height - height + 2]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7177
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7178
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7179
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7180
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7181
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7182
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7183
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7184
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7185
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7186
"/    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7187
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7188
    left + width > devRight ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7189
	left := isVertical ifTrue:[left - layout width - width + 2]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7190
			  ifFalse:[devRight - width]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7191
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7192
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7193
"/ ***** MULTI SCREEN
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7194
"/    top := top max:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7195
"/    left := left max:0.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7196
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7197
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7198
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7199
    subMenu realized ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7200
	subMenu realize.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7201
    ] ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7202
	topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7203
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7204
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7205
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7206
toggleSubmenuVisibility
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7207
    "toggle the visibility of the submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7208
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7209
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7210
	subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7211
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7212
	self setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7213
	subMenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7214
	    "/ cannot open a submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7215
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7216
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7217
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7218
    self openSubmenu.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7219
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7220
    "Modified: / 07-11-2006 / 11:06:42 / cg"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7221
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7222
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7223
visibleSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7224
    "returns the current visible submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7225
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7226
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7227
	subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7228
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7229
    ^ nil
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7230
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7231
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7232
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7233
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7234
aspectAt:aKey
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  7235
    "returns the value assigned to key or nil"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7236
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7237
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7238
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7239
    appl := menuPanel receiver.
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  7240
    (appl isValueModel) ifTrue:[
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7241
        ^ appl value:aKey
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7242
    ].
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7243
    appl isNil ifTrue:[
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7244
        appl := menuPanel application.
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7245
        appl isNil ifTrue:[ ^ nil].
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7246
    ].
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7247
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7248
    MessageNotUnderstood handle:[:ex|
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7249
        ex selector ~~ aKey ifTrue:[
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7250
            ex reject
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7251
        ].
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7252
        self ifNotInUIBuilderInfoPrintCR:
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  7253
            ('MenuPanel::Item [error]: application (%1) does not provide aspect: %2 (in %3)'
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7254
             bindWith:appl classNameWithArticle
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7255
             with:aKey
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7256
             with:(label isString ifTrue:[label] ifFalse:[self nameKey ? self itemValue ? '???'])).
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7257
    ] do:[
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7258
        aKey argumentCount == 1 ifTrue:[
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7259
            value := appl perform:aKey with:(menuItem argument ? self).
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7260
        ] ifFalse:[
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7261
            (appl respondsTo:#aspectFor:) ifTrue:[
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7262
                value := appl aspectFor:aKey
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7263
            ] ifFalse:[
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7264
                value := appl perform:aKey
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7265
            ]
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7266
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7267
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7268
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  7269
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  7270
    "Modified: / 02-08-2013 / 16:44:28 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7271
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7272
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7273
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7274
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7275
fontChanged
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7276
    "called whenever the font changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7277
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7278
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7279
	displayLabelExtent := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7280
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7281
	subMenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7282
	    subMenu font:(menuPanel font).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7283
	].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7284
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7285
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7286
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7287
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7288
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7289
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7290
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7291
    (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
  7292
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7293
    self isSeparator ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7294
	"/ NOT A SEPARATOR
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7295
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7296
	menuPanel shown ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7297
	    changedObject == enableChannel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7298
		(enableChannel value == false and:[self isSelected]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7299
		    ^ menuPanel selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7300
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7301
		^ self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7302
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7303
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7304
	    (changedObject == indication or:[changedObject == choice]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7305
		menuItem isButton ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7306
		    self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7307
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7308
		    "/ invalidate the interactor only
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7309
		    "/ take any interactor; interactors has the same extent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7310
		    form := menuPanel iconIndicationOff.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7311
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7312
		    rect := Rectangle left:(layout left + HorizontalInset)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7313
				       top:(layout top)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7314
				     width:(form width)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7315
				    height:(layout height).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7316
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7317
		    menuPanel invalidate:rect repairNow:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7318
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7319
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7320
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7321
	    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7322
	].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7323
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7324
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7325
    changedObject == isVisible ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7326
	menuPanel mustRearrange.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7327
	"/ actually: the following is wrong, because we have to delay the rearrangement
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7328
	"/ until the next redraw event comes. Otherwise, we might compute new layouts
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7329
	"/ too early if more items change their visibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7330
	"/ redraw will call rearrangeItems, if the mustRearrange is set.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7331
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7332
	"/ menuPanel rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7333
	^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7334
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7335
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7336
    super update:something with:aParameter from:changedObject
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7337
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7338
    "Modified (comment): / 24-11-2011 / 19:01:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7339
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7340
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7341
updateIndicators
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7342
    "update indicators "
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7343
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  7344
    indication notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7345
	(indication isSymbol
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7346
	or:[menuItem hideMenuOnActivated not])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7347
	ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7348
	    "indication is a selector;
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7349
	     otherwise no need to redraw, because
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7350
	     a change notification is raised from the model !!!!"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7351
	    self update:nil with:nil from:indication
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7352
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7353
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7354
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7355
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7356
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7357
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7358
asMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7359
    "convert to a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7360
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7361
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7362
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7363
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7364
menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7365
    ^ menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7366
!
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7367
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7368
menuItem:aMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7369
    "setup attributes from a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7370
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7371
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  7372
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7373
    menuPanel disabledRedrawDo:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7374
	menuItem := aMenuItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7375
	menuItem isNil ifTrue:[ menuItem := MenuItem new].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7376
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7377
	label := displayLabel := activeHelpText := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7378
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7379
	self    enabled:(menuItem enabled).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7380
	self indication:(menuItem indication).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7381
	self     choice:(menuItem choice).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7382
	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
  7383
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7384
"/ 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
  7385
"/ but ... ??
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7386
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7387
	(lbl := menuItem labelImage value) isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7388
	    lbl := menuItem rawLabel. "/ avoid translating &'s twice
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7389
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7390
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7391
	self submenu:(menuItem submenu).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7392
	self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7393
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  7394
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  7395
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7396
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7397
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7398
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7399
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7400
addDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7401
    "add all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7402
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7403
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7404
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7405
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7406
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7407
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7408
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7409
removeDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7410
    "remove all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7411
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7412
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7413
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7414
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7415
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7416
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7417
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7418
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7419
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7420
choiceForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7421
    "returns choice form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7422
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7423
    |isOn|
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7424
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7425
    choice isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7426
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7427
    isOn := (choice value = menuItem choiceValue).
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7428
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7429
	^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7430
	       ifFalse:[menuPanel iconRadioGroupDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7431
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7432
    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7433
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7434
	    ifTrue:[menuPanel iconRadioGroupEnteredOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7435
	    ifFalse:[menuPanel iconRadioGroupEnteredOff]
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7436
    ].
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7437
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7438
	   ifFalse:[menuPanel iconRadioGroupOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7439
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7440
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7441
draw
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7442
    "redraw this item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7443
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7444
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7445
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7446
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7447
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7448
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7449
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7450
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7451
    self isVisible ifFalse:[^ self].
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7452
    layout isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7453
	"/ cg: why does this happen - it does!!
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7454
	^ self
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7455
    ].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7456
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7457
    self isSeparator ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7458
	self drawSeparator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7459
	^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7460
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7461
    menuItem isButton ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7462
	self drawButton.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7463
	^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7464
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7465
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7466
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7467
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7468
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7469
    bgColor    := menuPanel backgroundColor.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7470
    paint      := isSelected
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7471
		    ifTrue:[self activeBackgroundColor]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7472
		    ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7473
			(self isEnabled and:[ self isEntered ]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7474
			    menuPanel enteredBackgroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7475
			] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7476
			    bgColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7477
			]].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7478
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7479
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7480
	paint := ownBgCol
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7481
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7482
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7483
    paint ~= bgColor ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7484
	menuPanel paint:paint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7485
	menuPanel fillRectangle:layout.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7486
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7487
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7488
    menuPanel showSeparatingLines ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7489
	self drawSeparatingLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7490
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7491
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7492
    self drawLabel.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7493
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7494
    (ownBgCol notNil and:[isSelected]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7495
	ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7496
				 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7497
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7498
	x := layout left.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7499
	y := layout top.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7500
	w := layout width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7501
	h := layout height.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7502
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7503
	menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7504
	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
  7505
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7506
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7507
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7508
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7509
drawButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7510
    "draw as button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7511
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7512
    |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
  7513
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7514
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7515
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7516
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7517
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7518
    isSelected := self isSelected.
4632
de5377ba14e4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4631
diff changeset
  7519
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7520
    isSelected ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7521
	"/ test whether button has pressed toggle behaviour
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7522
	showSelected := (self isToggle and:[self indicationValue]).
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7523
    ] ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7524
	showSelected := isSelected
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7525
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7526
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7527
    showSelected ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7528
	bg := self activeBackgroundColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7529
	fg := self activeForegroundColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7530
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7531
	self isEntered ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7532
	    bg := self buttonEnteredBackgroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7533
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7534
	    bg := self backgroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7535
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7536
	isEnabled ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7537
	    fg := menuPanel foregroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7538
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7539
	    fg := menuPanel disabledForegroundColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7540
	    etchFg := menuPanel disabledEtchedForegroundColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7541
	    drawObject := self disabledRawLabel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7542
	]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7543
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7544
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7545
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7546
	bg := ownBgCol
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7547
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7548
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7549
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7550
    bg ~= menuPanel backgroundColor ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7551
	menuPanel paint:bg.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7552
	menuPanel fillRectangle:layout.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7553
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7554
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7555
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7556
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7557
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7558
	x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7559
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7560
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7561
    isSelected ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7562
	"check whether button should be drawn selected; indicator or radio button"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7563
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7564
	indication notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7565
	    "button is indicator and set"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7566
	    isSelected := self indicationValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7567
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7568
	    isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7569
	]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7570
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7571
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7572
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7573
    isSelected ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7574
	level := menuPanel buttonActiveLevel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7575
	x     := x + 1 "level abs".
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7576
	y     := y + 1 "level abs".
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7577
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7578
	level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7579
			       ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7580
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7581
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7582
    drawObject notEmptyOrNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7583
	etchFg notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7584
	    "/ donot draw images twice.. images are shown lightened
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7585
	    drawObject isImageOrForm ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7586
		self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7587
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7588
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7589
	self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7590
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7591
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7592
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7593
    level ~~ 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7594
	menuPanel drawButtonEdgesFor:self level:level
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7595
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7596
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7597
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7598
drawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7599
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7600
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7601
    |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
  7602
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7603
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7604
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7605
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7606
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7607
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7608
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7609
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7610
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7611
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7612
    isSelected ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7613
	fg := self activeForegroundColor
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7614
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7615
	isEnabled ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7616
	    self isEntered ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7617
		fg := menuPanel enteredForegroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7618
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7619
		fg := menuPanel foregroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7620
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7621
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7622
	    fg          := menuPanel disabledForegroundColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7623
	    etchFg      := menuPanel disabledEtchedForegroundColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7624
	    drawObject  := self disabledRawLabel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7625
	]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7626
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7627
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7628
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7629
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7630
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7631
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7632
    (    (form := self indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7633
     or:[(form := self choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7634
    ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7635
	y := t + ((h - form height) // 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7636
	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
  7637
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7638
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7639
    drawObject notEmptyOrNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7640
	x := x + (menuPanel stringOffsetXfor:self).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7641
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7642
	etchFg notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7643
	    "/ donot draw images twice.. images are shown lightened
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7644
	    drawObject isImageOrForm ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7645
		self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7646
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7647
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7648
	self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7649
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7650
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7651
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7652
    "/ DRAW SHORTCUT KEY
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7653
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7654
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7655
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7656
    ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7657
	x := layout left + x.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7658
	y := t + ((h - (scKey heightOn:menuPanel)) // 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7659
	y := y + menuPanel font ascent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7660
	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
  7661
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7662
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7663
    "/ DRAW SUBMENU INDICATION (if a vertical menu with submenu)
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7664
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7665
	arrow := menuPanel rightArrow.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7666
	x := layout right - arrow width - HorizontalInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7667
	y := t + ((h - arrow height) // 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7668
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7669
	(menuPanel styleSheet is3D not
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7670
	or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7671
	    menuPanel displayForm:arrow x:x y:y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7672
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7673
	    cLa := menuPanel shadowColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7674
	    cLb := menuPanel lightColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7675
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7676
	    isSelected ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7677
		fg  := cLa.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7678
		cLa := cLb.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7679
		cLb := fg
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7680
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7681
	    menuPanel paint:cLa.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7682
	    menuPanel displayForm:arrow x:x y:y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7683
	    menuPanel paint:cLb.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7684
	    menuPanel displayForm:drawObject x:x y:y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7685
	].
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7686
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7687
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7688
    "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
  7689
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7690
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7691
drawMenuIndicator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7692
    "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
  7693
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7694
    |x y icon bAbsLevel verticalPosition|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7695
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7696
    icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7697
    icon isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7698
	^ self
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7699
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7700
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7701
    x := layout right  - icon width.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7702
    verticalPosition := menuPanel menuIndicatorVerticalPosition.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7703
    verticalPosition == #center ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7704
	y := (layout height - icon height) // 2 + layout top.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7705
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7706
	verticalPosition == #top ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7707
	    y := layout top + 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7708
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7709
	    y := layout bottom - icon height - 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7710
	]
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7711
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7712
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7713
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7714
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7715
	self isSelected ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7716
	    x := x + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7717
	    y := y + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7718
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7719
	bAbsLevel := menuPanel maxAbsoluteButtonLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7720
	x := x - bAbsLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7721
	y := y - bAbsLevel.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7722
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7723
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7724
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7725
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7726
	icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7727
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7728
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7729
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7730
    (menuPanel drawMenuIndicatorSeparatorLine
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7731
	and:[ self isEntered
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7732
	and:[ menuPanel buttonEnteredLevel ~~ 0] ])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7733
    ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7734
	menuPanel paint:menuPanel buttonShadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7735
	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
  7736
	menuPanel paint:menuPanel buttonLightColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7737
	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
  7738
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7739
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7740
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7741
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7742
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7743
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7744
    |oldFont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7745
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7746
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7747
     x0 "{ Class:SmallInteger }"
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7748
     isSelected|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7749
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7750
    isSelected := self isSelected.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7751
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7752
    oldFont := menuPanel setFont:(self font).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7753
    "/ fontAscent := menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7754
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7755
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7756
4232
8193baee0399 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  7757
    y := layout top + ((layout height - labelExtent y) // 2) + yOffset.
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7758
"/  menuPanel centerItems ifTrue:[self halt].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7759
    aLabel isArray ifFalse:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7760
        |printLabel|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7761
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7762
        (aLabel isText or:[aLabel isLabelAndIcon]) ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7763
            "/ background of label has already been drawn
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7764
            "/ cg: 1.12.2014: remove any emphasis (in case we draw grey on light blue)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7765
            isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7766
                printLabel := aLabel withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7767
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7768
                printLabel := aLabel withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7769
            ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7770
        ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7771
            printLabel := aLabel.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7772
        ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7773
        y := y + (printLabel ascentOn:menuPanel).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7774
        printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7775
    ] ifTrue:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7776
        aLabel do:[:eachLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7777
            |shownLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7778
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7779
            eachLine notNil ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7780
                "/ cg: 1.12.2014: remove any emphasis (in case we draw grey on light blue)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7781
                isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7782
                    shownLine := eachLine withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7783
                ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7784
                    shownLine := eachLine withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7785
                ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7786
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7787
                y0 := y + (shownLine ascentOn:menuPanel).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7788
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7789
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7790
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7791
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7792
"/                ].
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7793
                x0 := x + ((labelExtent x - (shownLine widthOn:menuPanel)) // 2).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7794
                shownLine displayOn:menuPanel x:x0 y:y0.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7795
                y := y + 1 + (shownLine heightOn:menuPanel)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7796
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7797
                y := y + (self spaceBetweenEmptyLines)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7798
            ]
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  7799
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  7800
    ].
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  7801
    menuPanel setFont:oldFont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7802
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7803
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7804
drawSeparatingLines
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7805
    "draw separating lines"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7806
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7807
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7808
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7809
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7810
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7811
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7812
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  7813
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7814
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7815
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7816
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7817
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7818
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7819
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7820
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7821
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7822
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7823
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7824
    (lfSep or:[rtSep]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7825
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7826
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7827
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7828
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7829
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7830
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7831
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7832
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7833
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7834
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7835
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7836
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7837
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7838
    menuPanel verticalLayout ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7839
	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
  7840
	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
  7841
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7842
	menuPanel paint:shadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7843
	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
  7844
	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
  7845
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7846
	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
  7847
	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
  7848
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7849
	menuPanel paint:shadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7850
	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
  7851
	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
  7852
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7853
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7854
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7855
drawSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7856
    "draw as separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7857
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7858
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7859
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7860
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7861
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7862
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7863
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7864
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7865
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7866
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7867
    (type isNil or:[type == #blankLine]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7868
	^ self
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7869
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7870
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7871
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7872
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7873
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7874
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7875
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7876
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7877
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7878
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7879
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7880
    menuPanel verticalLayout ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7881
	x0 := left  + HorizontalInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7882
	x1 := layout right - HorizontalInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7883
	y0 := top   - 1 + (layout height // 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7884
	isDouble ifTrue:[y0 := y0 - 2].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7885
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7886
	menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7887
	isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7888
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7889
	menuPanel paint:lightColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7890
	menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7891
	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
  7892
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7893
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7894
	y1 := layout bottom.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7895
	x0 := left - 1 + (layout width // 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7896
	y0 := top.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7897
	isDouble ifTrue:[x0 := x0 - 2].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7898
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7899
	menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7900
	isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7901
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7902
	menuPanel paint:lightColor.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7903
	menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7904
	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
  7905
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7906
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7907
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7908
indicatorForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7909
    "returns indication form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7910
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7911
    |isOn|
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7912
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7913
    indication isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7914
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7915
    isOn := self indicationValue.
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7916
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7917
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7918
	    ifTrue:[menuPanel iconIndicationDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7919
	    ifFalse:[menuPanel iconIndicationDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7920
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7921
"/    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7922
"/        ^ isOn == true
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7923
"/            ifTrue:[menuPanel iconIndicationEnteredOn]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7924
"/            ifFalse:[menuPanel iconIndicationEnteredOff]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7925
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7926
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7927
    ^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7928
	ifTrue:[menuPanel iconIndicationOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7929
	ifFalse:[menuPanel iconIndicationOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7930
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7931
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7932
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7933
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7934
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7935
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7936
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7937
	menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7938
    ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7939
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7940
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7941
menuIndicatorIcon
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7942
    "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
  7943
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7944
    self hasDelayedMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7945
	^ MenuPanel delayedMenuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7946
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7947
    self hasMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7948
	^ MenuPanel menuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7949
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7950
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7951
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7952
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7953
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7954
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7955
destroy
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7956
    "destroy submenus, remove dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7957
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7958
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7959
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7960
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7961
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7962
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  7963
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7964
in:aPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7965
    "create item in a menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7966
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7967
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7968
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7969
    menuItem isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7970
	self breakPoint:#ca.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7971
	menuItem := MenuItem new
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7972
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7973
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7974
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7975
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7976
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7977
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7978
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7979
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7980
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7981
    subMenu notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  7982
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7983
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7984
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7985
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  7986
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7987
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7988
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7989
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7990
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  7991
disabledRawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7992
    "returns the label used if the item is disabled"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7993
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7994
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7995
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7996
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7997
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7998
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7999
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8000
    disabledDisplayLabel isString ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8001
	^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8002
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8003
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8004
    block := [:el| |rslt|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8005
	(rslt := el) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8006
	    el isImageOrForm ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8007
		el colorMap notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8008
		    rslt := menuPanel lightenedImageOnDevice:el
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8009
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8010
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8011
		(displayLabel isKindOf:LabelAndIcon) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8012
		    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8013
			form := menuPanel lightenedImageOnDevice:form
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8014
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8015
		    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8016
			image := menuPanel lightenedImageOnDevice:image
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8017
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8018
		    rslt := LabelAndIcon form:form image:image string:(el string).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8019
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8020
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8021
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8022
	rslt
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8023
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8024
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8025
    displayLabel isArray ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8026
	disabledDisplayLabel := Array new:(displayLabel size).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8027
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8028
	displayLabel keysAndValuesDo:[:anIndex :aLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8029
	    disabledDisplayLabel at:anIndex put:(block value:aLabel)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8030
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8031
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8032
	disabledDisplayLabel := block value:displayLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8033
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8034
    ^ disabledDisplayLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8035
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8036
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8037
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  8038
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8039
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8040
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8041
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8042
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8043
fetchImages
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8044
    "fetch my icon images"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8045
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  8046
    |icon|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  8047
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8048
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8049
	^ self
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8050
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8051
    displayLabel isImageOrForm ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8052
	displayLabel := menuPanel imageOnMyDevice:displayLabel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8053
	^ self.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8054
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8055
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8056
    (displayLabel isKindOf:LabelAndIcon) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8057
	(icon := displayLabel image) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8058
	    displayLabel image:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8059
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8060
	(icon := displayLabel icon) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8061
	    displayLabel icon:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8062
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8063
	^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8064
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8065
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8066
    displayLabel isArray ifFalse:[^ self].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8067
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8068
    displayLabel keysAndValuesDo:[:i :el|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8069
	(el notNil and:[el isString not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8070
	    el isImageOrForm ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8071
		displayLabel at:i put:(menuPanel imageOnMyDevice:el).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8072
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8073
		el class == LabelAndIcon ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8074
		    (icon := el image) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8075
			el image:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8076
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8077
		    (icon := el icon) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8078
			el icon:(menuPanel imageOnMyDevice:icon)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8079
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8080
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8081
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8082
	]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8083
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8084
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8085
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8086
updateAccessCharacterFor:aLabel
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  8087
    "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
  8088
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  8089
    accessCharacter notNil ifTrue:[^ aLabel].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8090
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8091
    aLabel isString ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8092
	aLabel class == LabelAndIcon ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8093
	    aLabel string:(self updateAccessCharacterFor:(aLabel string))
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8094
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8095
	^ aLabel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8096
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8097
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8098
    ^ MenuPanel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8099
		processAmpersandCharactersFor:aLabel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8100
		withAccessCharacterPosition:(menuItem accessCharacterPosition).
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  8101
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
  8102
    "Modified: / 15-02-2012 / 18:53:11 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8103
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8104
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8105
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8106
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  8107
printOn:aGCOrStream
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8108
    aGCOrStream
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8109
	nextPutAll:self class name;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8110
	nextPut:$(.
4139
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8111
    label displayOn:aGCOrStream.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8112
    aGCOrStream nextPut:$).
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8113
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8114
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8115
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8116
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8117
activeBackgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8118
    "returns the active background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8119
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8120
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8121
	^ menuPanel buttonActiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8122
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8123
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8124
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8125
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8126
activeForegroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8127
    "returns the active foreground color derived from menuPanel"
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8128
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8129
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8130
	^ menuPanel buttonActiveForegroundColor
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8131
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8132
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8133
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8134
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8135
backgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8136
    "returns the background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8137
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8138
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8139
	^ menuPanel buttonPassiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8140
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8141
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8142
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8143
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8144
backgroundColorFromLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8145
    "returns the background color derived from label or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8146
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8147
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8148
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8149
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8150
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8151
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8152
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8153
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8154
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8155
    run size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8156
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8157
	    ^ run value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8158
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8159
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8160
	run do:[:r|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8161
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8162
		^ r value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8163
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8164
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8165
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8166
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8167
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8168
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8169
buttonEnteredBackgroundColor
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8170
    "returns the background color to use when thhe mouse has entered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8171
     derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8172
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8173
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8174
	^ menuPanel buttonEnteredBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8175
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8176
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8177
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8178
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8179
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8180
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8181
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8182
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8183
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8184
3866
fbdbf71489d8 show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  8185
    |subm sel numArgs gotMenu|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8186
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8187
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8188
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8189
    sel := menuItem submenuChannel.
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8190
    (sel isString or:[sel isSymbol]) ifFalse:[^ nil].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8191
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8192
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8193
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8194
    numArgs == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8195
	gotMenu := false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8196
	MessageNotUnderstood handle:[:ex |
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8197
	    |selector|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8198
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8199
	    ((selector := ex selector) == sel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8200
	    or:[selector == #aspectFor:]) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8201
		ex reject
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8202
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8203
	] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8204
	    subm := aRecv aspectFor:sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8205
	    gotMenu := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8206
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8207
	"/ used to be subm notNil; however, this is a bad test,
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8208
	"/ as it does not allow for the app to return nil for no-menu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8209
	gotMenu ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8210
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8211
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8212
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8213
    do:[:aPossibleReceiver |
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8214
	MessageNotUnderstood handle:[:ex|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8215
	    ex message selector == sel ifFalse:[ ex reject ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8216
	] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8217
	    numArgs == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8218
		subm := aPossibleReceiver perform:sel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8219
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8220
		numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8221
		    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8222
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8223
		    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8224
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8225
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8226
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8227
	subm notNil ifTrue:[^ subm].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8228
	Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8229
	    "/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8230
	]
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8231
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8232
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8233
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8234
4027
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  8235
    "Modified: / 24-03-2011 / 11:20:24 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8236
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8237
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8238
indicationValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8239
    "returns indication value or nil in case of no indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8240
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8241
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8242
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8243
    indication isNil ifTrue:[^ nil].       "no indication specified"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8244
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8245
    indication isSymbol ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8246
	^ indication value == true          "block or model"
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8247
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8248
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8249
    numArgs := indication numArgs.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8250
    numArgs == 2 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8251
	recv := menuPanel receiver ? menuPanel application.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8252
	(recv notNil and:[recv isValueModel not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8253
	    sel := indication copyFrom:1 to:(indication indexOf:$:).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8254
	    sel := sel asSymbol.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8255
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8256
	    MessageNotUnderstood handle:[:ex|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8257
		ex selector ~~ sel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8258
		    ex reject.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8259
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8260
	    ] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8261
		sel := recv perform:sel with:(menuItem argument).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8262
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8263
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8264
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8265
	numArgs == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8266
	    sel := indication
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8267
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8268
	    sel := (indication copyButLast:1) asSymbol.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8269
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8270
	sel := self aspectAt:sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8271
	sel isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8272
	    indication := sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8273
	    indication addDependent:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8274
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8275
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8276
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8277
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8278
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8279
indicationValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8280
    "set the indication value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8281
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8282
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8283
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8284
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8285
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8286
    indication isSymbol ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8287
	indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8288
	^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8289
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8290
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8291
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8292
	^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8293
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8294
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  8295
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8296
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8297
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8298
    recv isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8299
	recv := menuPanel application.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8300
	recv isNil ifTrue:[^ self].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8301
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8302
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8303
    MessageNotUnderstood handle:[:ex|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8304
	(ex selector ~~ indication) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8305
	    ex reject
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8306
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8307
	self ifNotInUIBuilderInfoPrintCR:
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8308
	    ('MenuPanel::Item [info]: application (%1) does not respond to: %2'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8309
	     bindWith:recv classNameWithArticle
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8310
	     with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8311
    ] do:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8312
	numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8313
	    recv perform:indication with:aValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8314
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8315
	    recv perform:indication with:(menuItem argument ? self) with:aValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8316
	]
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8317
    ].
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8318
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8319
    "Modified (format): / 02-08-2013 / 16:42:20 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8320
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8321
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8322
isEntered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8323
    "returns true if the mouse pointer is over the item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8324
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8325
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8326
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8327
    "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
  8328
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8329
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  8330
separatorType
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8331
    "returns type of separator line or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8332
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8333
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8334
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8335
    self isSeparator ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8336
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8337
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8338
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8339
    (lbl := label value) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8340
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8341
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8342
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8343
    lbl size == 1 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8344
	c := lbl first.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8345
	c == $- ifTrue:[^ #singleLine].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8346
	c == $= ifTrue:[^ #doubleLine].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8347
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8348
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8349
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8350
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8351
setupSubmenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8352
    |appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8353
     channel whoProvidedMenu t|
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8354
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8355
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8356
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8357
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8358
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8359
	menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8360
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8361
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8362
    channel isSymbol ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8363
	submenuHolder := channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8364
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8365
	"/ submenu is specified by a selector in submenuChannel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8366
	"/ who gets me the menu:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8367
	"/ 1) submenuProvider (if not nil)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8368
	"/ 2) menuPanel application
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8369
	"/ 3) menuPanel receiver
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8370
	"/ 4) menuPanel application master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8371
	"/ 5) menuPanel receiver master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8372
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8373
	(submenuProvider := menuItem submenuProvider) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8374
	    submenuHolder := self findSubMenuIn:submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8375
	    whoProvidedMenu := submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8376
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8377
	submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8378
	    appl := menuPanel application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8379
	    (appl notNil and:[appl ~~ submenuProvider]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8380
		submenuHolder := self findSubMenuIn:appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8381
		whoProvidedMenu := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8382
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8383
	    submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8384
		recv := menuPanel receiver.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8385
		(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8386
		    submenuHolder := self findSubMenuIn:recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8387
		    whoProvidedMenu := recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8388
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8389
		(submenuHolder isNil and:[appl notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8390
		    t := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8391
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8392
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8393
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8394
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8395
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8396
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8397
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8398
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8399
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8400
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8401
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8402
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8403
		(submenuHolder isNil and:[recv notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8404
		    t := recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8405
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8406
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8407
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8408
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8409
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8410
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8411
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8412
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8413
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8414
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8415
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8416
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8417
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8418
	].
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8419
"/        submenuHolder isNil ifTrue:[
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8420
"/            self halt:'did not find any menu'
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8421
"/        ].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8422
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8423
"/        appl := menuPanel application.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8424
"/        appl isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8425
"/            appl := menuPanel receiver.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8426
"/            appl notNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8427
"/                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8428
"/                    [submenuHolder isNil
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8429
"/                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8430
"/                          and:[master ~~ appl]]] whileTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8431
"/                        appl := master.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8432
"/                        submenuHolder := self findSubMenuIn:appl.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8433
"/                    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8434
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8435
"/            ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8436
"/        ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8437
"/        submenuHolder isNil ifTrue:[
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8438
"/            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8439
"/                (recv := menuPanel receiver) ~~ appl ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8440
"/                    appl := recv.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8441
"/                    submenuHolder := self findSubMenuIn:appl
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8442
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8443
"/            ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8444
"/        ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8445
    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8446
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8447
    (newSubmenu := submenuHolder value) isArray ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8448
	submenuEncoding := newSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8449
	newSubmenu := Menu decodeFromLiteralArray:submenuEncoding.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8450
	"/ cg: linked menus also may contain translations ...
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8451
	newSubmenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8452
	    whoProvidedMenu "appl" notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8453
		newSubmenu findGuiResourcesIn:whoProvidedMenu "appl".
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8454
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8455
	].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8456
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8457
    "/ appl notNil ifTrue:[submenu application:appl].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8458
    self submenu:newSubmenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8459
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8460
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8461
    "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
  8462
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8463
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8464
spaceBetweenEmptyLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8465
	^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8466
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8467
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8468
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8469
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8470
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8471
    "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
  8472
     otherwise there is a change notification raised if the model changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8473
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8474
    ^ isVisible isSymbol or:[isVisible isValueModel]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8475
"/  ^ isVisible notNil and:[isVisible ~~ true]
3112
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8476
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8477
    "Modified: / 11-10-2006 / 21:43:31 / cg"
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8478
    "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
  8479
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8480
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8481
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8482
    "returns true if item is selectable; no separator, visible and enabled.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8483
     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
  8484
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8485
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8486
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8487
    (self isVisible and:[self enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8488
	(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8489
	    ^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8490
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8491
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8492
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8493
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8494
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8495
containsPoint:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8496
    "returns true if aPoint is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8497
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8498
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8499
	^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8500
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8501
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8502
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8503
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8504
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8505
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8506
containsPointX:x y:y
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8507
    "returns true if point is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8508
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8509
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8510
	^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8511
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8512
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8513
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8514
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8515
hasDelayedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8516
    "returns true if a delayed menu exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8517
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8518
    self hasSubmenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8519
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8520
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8521
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8522
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8523
    (indication isNil and:[choice isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8524
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8525
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8526
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8527
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8528
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8529
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8530
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8531
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8532
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8533
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8534
	^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8535
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8536
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8537
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8538
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8539
hasIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8540
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8541
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8542
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8543
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8544
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8545
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8546
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8547
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8548
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8549
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8550
	^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8551
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8552
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8553
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8554
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8555
hasSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8556
    "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
  8557
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8558
    ^ subMenu notNil or:[ menuItem submenuChannel notNil ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8559
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8560
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8561
isEnabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8562
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8563
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8564
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8565
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8566
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8567
isSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8568
    "returns true if item is a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8569
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8570
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8571
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8572
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8573
isToggle
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8574
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8575
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8576
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8577
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8578
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8579
isVisible
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8580
    "returns the visibility state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8581
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8582
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8583
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8584
    menuPanel isNil ifTrue:[^ false].
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8585
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8586
    isVisible isSymbol ifTrue:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8587
        state := self aspectAt:isVisible.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8588
        state isValueModel ifTrue:[
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8589
            isVisible := state.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8590
            isVisible addDependent:self.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8591
        ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8592
    ] ifFalse:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8593
        state := isVisible
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8594
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8595
    ^ state value ~~ false
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8596
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8597
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8598
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8599
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8600
isVisible:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8601
    "change the visibility state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8602
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8603
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8604
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8605
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8606
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8607
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8608
	oldState := isVisible value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8609
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8610
	    isVisible removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8611
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8612
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8613
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8614
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8615
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8616
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8617
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8618
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8619
	    isVisible addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8620
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8621
	    isVisible isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8622
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8623
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8624
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8625
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8626
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8627
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8628
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8629
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8630
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8631
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8632
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8633
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8634
menuIndicatorContains:aPoint
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8635
    "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
  8636
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8637
    |icon xSep|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8638
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8639
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8640
	(layout containsPoint:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8641
	    icon := self menuIndicatorIcon.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8642
	    icon notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8643
		xSep := layout right - icon width.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8644
		^ aPoint x >= xSep
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8645
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8646
	]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8647
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8648
    ^ false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8649
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8650
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8651
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8652
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8653
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8654
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8655
shortcutKeyAsString
3601
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8656
    "converts shortcutKey to a text object for the menu-label-hint.
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8657
     returns nil, if the key has no assignment."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8658
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8659
    |shortcutKey|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8660
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8661
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8662
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8663
    shortcutKey isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8664
	^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8665
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8666
    shortcutKey isCharacter ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8667
	shortcutKey == Character space ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8668
	    ^ 'Space'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8669
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8670
	^ shortcutKey asString
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8671
    ].
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8672
    ^ menuPanel device shortKeyStringFor:shortcutKey.
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8673
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8674
    "Modified: / 08-08-2006 / 15:46:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8675
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8676
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8677
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8678
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8679
isSelected
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8680
    "returns true if item is selected"
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8681
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8682
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8683
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8684
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8685
isSelected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  8686
    "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
  8687
     submenu and perform a redraw"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8688
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8689
    (isSelected and:[menuPanel notNil]) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8690
	self invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8691
	self hideSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8692
	^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8693
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8694
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8695
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8696
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8697
    (indication isNil or:[menuItem isButton not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8698
	self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8699
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8700
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8701
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8702
    self hasDelayedMenu ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8703
	menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8704
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8705
	self setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8706
	subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  8707
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8708
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8709
    "Modified: / 07-11-2006 / 11:08:03 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8710
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8711
4755
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8712
!MenuPanel::Item methodsFor:'testing'!
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8713
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8714
isMenuItem
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8715
    "return true, if the receiver is a menu item inside a MenuPanel, Menu or PopUpmenu.
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8716
     true is returned here - I am a menuitem"
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8717
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8718
    ^ true
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8719
! !
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8720
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8721
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8722
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8723
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8724
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8725
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8726
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8727
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8728
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8729
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8730
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8731
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  8732
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8733
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8734
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8735
icon
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  8736
    <resource: #image>
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8737
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8738
     by the ImageEditor of ST/X."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8739
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8740
     the ImageEditor may not be able to read the specification."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8741
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8742
     self icon inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  8743
     ImageEditor openOnClass:self andSelector:#icon"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8744
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  8745
    ^ Icon constantNamed:#'MenuPanel::ScrollActivity class icon'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8746
	ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8747
	    (Depth1Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8748
		width:11;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8749
		height:11;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8750
		photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8751
		bitsPerSample:(#( 1 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8752
		samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8753
		bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8754
		colorMapFromArray:#[ 0 0 0 255 255 255 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8755
		mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8756
			    width:11;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8757
			    height:11;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8758
			    bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8759
			    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8760
		yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8761
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8762
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8763
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8764
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8765
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8766
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8767
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8768
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8769
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8770
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8771
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8772
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8773
    "returns the active menu the scrolling is activated on; nil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8774
     is returned if scrolling is deactivated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8775
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8776
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8777
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8778
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8779
direction
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8780
    "returns the scroll-direction"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8781
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8782
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8783
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8784
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8785
iconAt:aDirection on:aMenu
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8786
    |icon device index|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8787
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8788
    device := aMenu device.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8789
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8790
    aDirection == #PREV ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8791
	aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8792
			    ifFalse:[index := 2]    "/ 2 - 1 * 90  90
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8793
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8794
	aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8795
			    ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8796
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8797
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8798
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8799
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8800
    (icon isNil or:[icon device ~~ device]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8801
	icon := self class icon.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8802
	index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8803
		 ifFalse:[ icon := icon copy ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8804
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8805
	icon := icon onDevice:device.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8806
	icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8807
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8808
    ^ icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8809
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8810
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8811
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8812
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8813
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8814
4173
84cae9f6efce class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4172
diff changeset
  8815
    semaLock := RecursionLock new name:'MenuPanel ScrollActivity'.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  8816
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8817
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8818
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8819
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8820
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8821
isActive
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8822
    "returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8823
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8824
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8825
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8826
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  8827
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8828
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8829
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8830
    "start scrolling; returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8831
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8832
    |bounds index isScrolledMenu boundsOnRoot|
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8833
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  8834
    isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8835
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8836
    semaLock critical:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8837
	self stop.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8838
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8839
	isScrolledMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8840
	    bounds := aMenu scrollerBoundsAt:aDirection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8841
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8842
	    comesViaButtonPress ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8843
		boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8844
					  extent:(bounds extent).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8845
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8846
	    "clear selection"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8847
	    aMenu selection:nil openMenu:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8848
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8849
	    activeMenu := aMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8850
	    direction  := aDirection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8851
	    index      := aMenu indexOfItemAtScroller:aDirection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8852
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8853
	    index ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8854
		scrollTask :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8855
		    [
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8856
			|item step continue|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8857
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8858
			[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8859
			    step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8860
			    ( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8861
				aMenu makeItemVisible:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8862
				index := index + step.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8863
			    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8864
			    Delay waitForSeconds:(ButtonController defaultInitialDelay).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8865
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8866
			    [
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8867
				continue := aMenu shown.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8868
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8869
				boundsOnRoot notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8870
				    continue ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8871
					continue := boundsOnRoot containsPoint:aMenu sensor mousePoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8872
				    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8873
					boundsOnRoot := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8874
				    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8875
				].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8876
				continue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8877
			    ]  whileTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8878
				item := aMenu itemAt:index.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8879
				item notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8880
				    aMenu makeItemVisible:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8881
				    index := index + step.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8882
				].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8883
				Delay waitForSeconds:(ButtonController defaultRepeatDelay).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8884
			    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8885
			    item := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8886
			] ensure:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8887
			    activeMenu := direction := scrollTask := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8888
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8889
			    item notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8890
				"/ process was killed
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8891
				aMenu invalidate:bounds
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8892
			    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8893
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8894
			boundsOnRoot notNil ifTrue:[ aMenu invalidate:bounds ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8895
		    ] forkAt:8.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8896
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8897
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8898
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8899
    ^ bounds notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  8900
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8901
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8902
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  8903
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8904
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8905
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8906
stop
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8907
    "stop scrolling; returns true if the scrolling was activated otherwise false"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8908
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8909
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8910
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8911
    activeMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8912
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8913
    ].
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  8914
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8915
    semaLock critical:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8916
	resp := activeMenu notNil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8917
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8918
	(task := scrollTask) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8919
	    scrollTask := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8920
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8921
	    Error handle:[:ex|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8922
	    ] do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8923
		task terminateWithAllSubprocessesInGroup.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8924
		task waitUntilTerminated.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8925
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8926
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8927
	activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8928
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8929
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8930
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  8931
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8932
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8933
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8934
version
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  8935
    ^ '$Header$'
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8936
!
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  8937
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  8938
version_CVS
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  8939
    ^ '$Header$'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8940
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8941
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  8942
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8943
MenuPanel initialize!