MenuPanel.st
author Stefan Vogel <sv@exept.de>
Wed, 15 Mar 2017 17:48:27 +0100
changeset 5515 f87f470e99c9
parent 5473 6015183249c7
child 5516 565035d19b67
permissions -rw-r--r--
#REFACTORING by stefan class: MenuPanel MenuPanel::Item >> #aspectAt:
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
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
    29
		buttonPassiveBackgroundColor maxExtent sizeFixed extraMargin
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
    30
		buttonActiveLevel buttonPassiveLevel buttonEnteredLevel
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
    31
		pluggableHelpSpecProvider'
5193
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    32
	classVariableNames:'DefaultBackgroundColor DefaultForegroundColor
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    33
		IconDisabledIndicationOff IconDisabledIndicationOn
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    34
		IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    35
		IconIndicationOn IconRadioOff IconRadioOn Images
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    36
		InitialSelectionQuerySignal LigthenedImages
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
    37
		MaxShortCutSearchLevel'
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    38
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    39
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    40
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    41
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    42
Object subclass:#Item
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    43
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    44
		disabledDisplayLabel enableChannel label activeHelpText
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    45
		flyByHelpText isVisible indication choice accessCharacter'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    46
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    47
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    48
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    49
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    50
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    51
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    52
Object subclass:#Adornment
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    53
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    54
		choice choiceValue'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    55
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    56
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    57
	privateIn:MenuPanel::Item
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    58
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    59
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    60
Object subclass:#ScrollActivity
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    61
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    62
	classVariableNames:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    63
	poolDictionaries:''
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    64
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    65
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    66
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    67
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    68
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    69
copyright
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
 COPYRIGHT (c) 1997 by eXept Software AG
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
    72
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    73
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    74
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    75
 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
    76
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    77
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    78
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    79
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    80
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    81
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    83
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    85
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    86
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    87
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    88
    Due to some historic leftover, there are two mechanisms for menus:
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
    89
	1) the (very) old MenuView (which inherits from SelectionInListView)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
    90
	2) this new MenuPanel.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    91
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    92
    this will eventually replace most of the MenuView and PopUpMenu stuff.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    93
    (and hopefully be ST-80 compatible...)
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    94
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    95
    To create a menu, there exists a MenuEditor which can generate
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    96
    menu specifications, from which a MenuPanel can be dynamically created.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    97
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    98
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    99
    Notice:
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   100
	This is going to replace the obsolete MenuView.
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
   101
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
    [author:]
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   103
	Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
    [see also:]
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   106
	Menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   107
	MenuItem
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   108
	MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   109
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   110
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   111
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   115
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
"
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   118
  a PullDownMenu
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   119
                                                                                [exBegin]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   120
    |top subView mview labels|
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   121
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   122
    top := StandardSystemView new.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   123
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   124
    labels := #( 'foo' 'bar' 'baz' 'test') copy.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   125
    labels at:4 put:(LabelAndIcon label:'test' icon:(ToolbarIconLibrary cutIcon)).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   126
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   127
    mview := MenuPanel in:top.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   128
    mview labels:labels.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   129
    (mview itemAt:1) enabled:false.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   130
    (mview itemAt:4) enabled:false.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   131
    top extent:(mview preferredExtent + 20).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   132
    top open.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   133
                                                                                [exEnd]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   134
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   135
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   136
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   137
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   140
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   142
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   143
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   145
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   146
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   148
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   149
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   151
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   152
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   153
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   154
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   155
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   156
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   157
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   158
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   159
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   160
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   161
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   162
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   163
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   164
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   165
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   166
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   167
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   168
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   169
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   170
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   171
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   173
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   174
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   175
    top open.
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   176
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   177
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   178
  a PullDownMenu with applications
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   179
                                                                                [exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   180
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   181
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   182
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   183
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   184
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   185
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   186
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   187
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   188
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   189
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   190
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   191
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   192
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   193
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   194
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   195
    view := ImageView new.
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   196
    view image:(Image fromScreen:(0@0 corner:200@200)).
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   197
    view preferredExtent:(200@200).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   198
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   199
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   200
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   201
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   202
    top open.
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   203
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   204
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   205
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   206
  a PopUpMenu
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   207
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   208
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   209
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   210
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   211
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   212
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   213
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   214
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   215
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   216
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   217
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   218
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   219
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   220
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   221
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   222
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   223
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   224
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   225
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   226
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   227
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   228
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   229
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   230
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   231
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   232
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   233
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   234
    mview startUp
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   235
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   236
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   237
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   238
  a menu spec
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   239
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   240
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   241
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   242
    menu := MenuPanel menu:
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   243
        #(#Menu #( #(#MenuItem
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   244
                    #label: 'File'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   245
                    #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   246
                      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   247
                                 (#MenuItem
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   248
                                    #label: 'edit'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   249
                                    #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   250
                                      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   251
                                                 #(#MenuItem #label: 'close' #value:#close)
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   252
                                               )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   253
                                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   254
                                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   255
                                       )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   256
                                  )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   257
                                 #(#MenuItem #label: 'help' #value:#help )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   258
                               )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   259
                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   260
                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   261
                       )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   262
                 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   263
                #(#MenuItem #label: 'Inspect' #value:#inspectMenu )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   264
                #(#MenuItem #label: 'Bar'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   265
                            #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   266
                               #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   267
                                          #(#MenuItem #label: 'bar 2' #value:#bar2 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   268
                                        )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   269
                                        nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   270
                                        nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   271
                                )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   272
                 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   273
              )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   274
              #( 2 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   275
              nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   276
         ) decodeAsLiteralArray.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
    Transcript showCR:(menu startUp).
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   280
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
    ^ self fromSpec:aSpec 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
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   292
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
    aSpec notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   295
	menu := Menu new.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   296
	menu receiver:aReceiver.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   297
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   304
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   309
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   314
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   315
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   318
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   320
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   321
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   322
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   323
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   324
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   326
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   328
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   329
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   330
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   331
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   332
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   333
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   334
	"/ no receiver specified in the menu; thus set the receiver immediately
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   335
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   336
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   337
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   338
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   339
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   340
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   341
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   342
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   343
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   344
    aReceiver notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   345
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   346
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   347
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   348
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   349
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   350
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   351
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   352
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   353
    InitialSelectionQuerySignal isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   354
	InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   355
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   356
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   357
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   358
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   359
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   360
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   361
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   362
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   363
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   364
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   365
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   366
delayedMenuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   367
    <resource: #image>
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   368
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   369
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   370
    "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
   371
     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
   372
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   373
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   374
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   375
     Icon flushCachedIcons"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   376
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   377
    ^ Icon constantNamed:#'MenuPanel class delayedMenuIndicator'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   378
	ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   379
	    (Depth1Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   380
		width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   381
		height:6;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   382
		photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   383
		bitsPerSample:(#( 1 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   384
		samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   385
		bits:(ByteArray fromPackedString:'@@@@@HCB');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   386
		colorMapFromArray:#[ 0 0 0 255 255 255 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   387
		mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   388
			    width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   389
			    height:6;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   390
			    bits:(ByteArray fromPackedString:'@J+V[C P');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   391
			    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   392
		yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   393
	]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   394
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   395
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   396
iconIndicationDisabledOff
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   397
    <resource: #image>
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   398
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   399
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   400
    "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
   401
     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
   402
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   403
     self iconIndicationDisabledOff inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   404
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   405
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   406
    IconDisabledIndicationOff isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   407
	IconDisabledIndicationOff := Icon
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   408
		constantNamed:#'MenuPanel iconIndicationDisabledOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   409
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   410
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   411
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   412
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   413
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   414
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   415
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   416
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   417
				    fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   418
			colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   419
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   420
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   421
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   422
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   423
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   424
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   425
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   426
		]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   427
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   428
    ^ IconDisabledIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   429
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   430
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   431
iconIndicationDisabledOn
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   432
    <resource: #image>
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   433
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   434
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   435
    "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
   436
     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
   437
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   438
     self iconIndicationDisabledOn inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   439
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   440
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   441
    IconDisabledIndicationOn isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   442
	IconDisabledIndicationOn := Icon
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   443
		constantNamed:#'MenuPanel iconIndicationDisabledOn'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   444
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   445
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   446
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   447
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   448
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   449
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   450
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   451
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   452
				    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
   453
			colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   454
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   455
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   456
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   457
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   458
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   459
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   460
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   461
		]
2755
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   462
    ].
f8035120da51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2754
diff changeset
   463
    ^ IconDisabledIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   464
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   465
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   466
iconIndicationOff
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   467
    <resource: #image>
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   468
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   469
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   470
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   471
     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
   472
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   473
     self iconIndicationOff inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   474
     ImageEditor openOnClass:self andSelector:#iconIndicationOff"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   475
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   476
    IconIndicationOff isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   477
	IconIndicationOff := Icon constantNamed:#'MenuPanel iconIndicationOff'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   478
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   479
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   480
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   481
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   482
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   483
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   484
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   485
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   486
				    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
   487
			colorMapFromArray:#[ 255 255 255 127 127 127 170 170 170 0 0 0 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   488
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   489
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   490
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   491
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   492
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   493
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   494
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   495
		]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   496
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   497
    ^ IconIndicationOff
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   498
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   499
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   500
iconIndicationOn
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   501
    <resource: #image>
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   502
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   503
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   504
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   505
     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
   506
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   507
     self iconIndicationOn inspect
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   508
     ImageEditor openOnClass:self andSelector:#iconIndicationOn"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   509
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   510
    IconIndicationOn isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   511
	IconIndicationOn := Icon constantNamed:#'MenuPanel iconIndicationOn'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   512
		ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   513
		    (Depth2Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   514
			width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   515
			height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   516
			photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   517
			bitsPerSample:(#( 2 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   518
			samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   519
			bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   520
				    fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   521
			colorMapFromArray:#[ 0 0 0 255 255 255 127 127 127 170 170 170 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   522
			mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   523
				    width:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   524
				    height:14;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   525
				    bits:(ByteArray
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   526
						fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   527
				    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   528
			yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   529
		]
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   530
    ].
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   531
    ^ IconIndicationOn
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   532
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   533
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   534
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   535
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   536
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   537
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   538
    "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
   539
     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
   540
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   541
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   542
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   543
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   544
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   545
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   546
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   547
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   548
"/    IconDisabledRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   549
"/        IconDisabledRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   550
"/            constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   551
"/            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
   552
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   553
"/    ^ IconDisabledRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   554
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   555
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   556
    ^ RadioButton disabledPassiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   557
!
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
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   560
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   561
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   562
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   563
    "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
   564
     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
   565
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   566
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   567
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   568
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   569
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   570
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   571
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   572
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   573
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   574
"/    IconDisabledRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   575
"/        IconDisabledRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   576
"/            constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   577
"/            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
   578
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   579
"/    ^ IconDisabledRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   580
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   581
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   582
    ^ RadioButton disabledActiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   583
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   584
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   585
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   586
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   587
    ^ RadioButton enteredPassiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   588
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   589
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   590
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   591
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   592
    ^ RadioButton enteredActiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   593
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   594
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   595
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   596
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   597
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   598
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   599
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   600
     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
   601
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   602
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   603
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   604
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   605
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   606
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   607
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   608
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   609
"/    IconRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   610
"/        IconRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   611
"/            constantNamed:#'MenuPanel iconRadioGroupOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   612
"/            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
   613
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   614
"/    ^ IconRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   615
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   616
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   617
    ^ RadioButton passiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   618
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   619
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   620
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   621
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   622
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   623
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   624
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   625
     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
   626
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   627
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   628
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   629
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   630
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   631
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   632
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   633
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   634
"/    IconRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   635
"/        IconRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   636
"/            constantNamed:#'MenuPanel iconRadioGroupOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   637
"/            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
   638
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   639
"/    ^ IconRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   640
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   641
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   642
    ^ RadioButton activeForm
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   643
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   644
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   645
menuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   646
    <resource: #image>
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   647
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   648
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   649
    "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
   650
     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
   651
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   652
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   653
     ImageEditor openOnClass:self andSelector:#menuIndicator
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   654
     Icon flushCachedIcons"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   655
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
   656
    ^ Icon constantNamed:#'MenuPanel class menuIndicator'
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   657
	ifAbsentPut:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   658
	    (Depth1Image new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   659
		width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   660
		height:4;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   661
		photometric:(#palette);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   662
		bitsPerSample:(#( 1 ));
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   663
		samplesPerPixel:(1);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   664
		bits:(ByteArray fromPackedString:'@@B@0 @a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   665
		colorMapFromArray:#[ 0 0 0 255 255 255 ];
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   666
		mask:((ImageMask new)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   667
			    width:7;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   668
			    height:4;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   669
			    bits:(ByteArray fromPackedString:'?''08D@@a');
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   670
			    yourself);
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   671
		yourself
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   672
	]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   673
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   674
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   675
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   676
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   677
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   678
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   679
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   680
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   681
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   682
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   683
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   684
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   685
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   686
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   687
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   688
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   689
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   690
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   691
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   692
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   693
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   694
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   695
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   696
maxShortCutSearchLevel
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   697
    "1 means: only search in top items.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   698
     2 means: search one level of menus.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   699
     used to be 10"
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   700
3384
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   701
    MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.].
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   702
    ^ MaxShortCutSearchLevel
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   703
!
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   704
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   705
maxShortCutSearchLevel: anInteger
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   706
    "1 means: only search in top items.
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   707
     2 means: search one level of menus."
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   708
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   709
    MaxShortCutSearchLevel := anInteger
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   710
!
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   711
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   712
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   713
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   714
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   715
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   716
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   717
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   718
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   719
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   720
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   721
     ex:
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   722
	&File   mnemonic := Cmdf
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   723
	F&ile   mnemonic := Cmdi
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   724
	....."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   725
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   726
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   727
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   728
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   729
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   730
    "extract values from the styleSheet and cache them in class variables"
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   731
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   732
    <resource: #style (
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   733
        #'selection.disabledForegroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   734
        #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   735
        #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   736
        #'menu.itemSpace' #'menu.buttonItemVerticalSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   737
        #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   738
        #'menu.hilightLevel' #'menu.enteredLevel'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   739
        #'menu.groupDividerSize' #'menu.itemMargin'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   740
        #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   741
        #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   742
        #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   743
        #'menu.selectionFollowsMouse'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   744
        #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   745
        #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   746
        #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   747
        #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   748
        #'menu.iconIndicationOn' #'menu.iconIndicationOff'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   749
        #'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   750
        #'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   751
        #'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   752
        #'menu.iconRadioOn' #'menu.iconRadioOff'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   753
        #'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   754
        #'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   755
        #'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   756
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   757
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   758
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   759
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   760
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   761
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
5464
ba69f1d9e99c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
   762
     which returns the default cached DefaultBackgroundColor
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   763
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   764
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   765
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   766
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   767
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   768
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   769
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   770
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   771
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   772
    DefaultFont     := MenuView defaultFont.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   773
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   774
                                                            default:[styleSheet
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   775
                                                                        colorAt:#'menu.foregroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   776
                                                                        default:Color black].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   777
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   778
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   779
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   780
    var isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   781
        style == #motif ifTrue:[ var := backgroundColor ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   782
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   783
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   784
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   785
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   786
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   787
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   788
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   789
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   790
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   791
    var isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   792
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   793
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   794
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   795
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   796
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   797
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   798
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   799
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   800
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   801
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   802
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   803
    buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ].
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   804
    "/ styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   805
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   806
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   807
    buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel :=  styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])].
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   808
    "/ styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   809
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   810
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   811
    "/ styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   812
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   813
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   814
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   815
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   816
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   817
    buttonPassiveBackgroundColor isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   818
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   819
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   820
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   821
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   822
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   823
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   824
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   825
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   826
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   827
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   828
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   829
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   830
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   831
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   832
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   833
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   834
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   835
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   836
    getBitmapOrFile := [:key :fileKey |
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   837
        |var|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   838
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   839
        var := styleSheet at:key ifAbsent:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   840
        var isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   841
            var := styleSheet at:fileKey ifAbsent:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   842
            var notNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   843
                var := Smalltalk imageFromFileNamed:var forClass:self.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   844
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   845
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   846
        var
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   847
    ].
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   848
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   849
    IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   850
    IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   851
    IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   852
    IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   853
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   854
    IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   855
    IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   856
    IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   857
    IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   858
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   859
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   860
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   861
    "
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   862
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   863
    "Modified: / 19-01-2012 / 13:17:59 / cg"
5464
ba69f1d9e99c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
   864
    "Modified (format): / 12-02-2017 / 12:04:25 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   865
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   866
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   867
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   868
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   869
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   870
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   871
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   872
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   873
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   874
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   875
    anImage device == aDevice ifTrue:[
5009
023fac61ed67 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5001
diff changeset
   876
        ^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   877
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   878
5246
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   879
    Images isNil ifTrue:[ 
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   880
        Images := IdentityDictionary new.
5246
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   881
    ].
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   882
    deviceImages := Images at:aDevice ifAbsentPut:[Dictionary new].
5009
023fac61ed67 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5001
diff changeset
   883
    ^ deviceImages at:anImage ifAbsentPut:[anImage copy onDevice:aDevice].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   884
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   885
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   886
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   887
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   888
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   889
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   890
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   891
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   892
    LigthenedImages isNil ifTrue:[LigthenedImages := IdentityDictionary new].
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   893
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   894
    deviceImages := LigthenedImages at:aDevice ifAbsentPut:[WeakIdentityDictionary new].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   895
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   896
        ^ image
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   897
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   898
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   899
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   900
    colorMap notNil ifTrue:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   901
        image := anImage lightened onDevice:aDevice.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   902
    ] ifFalse:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   903
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   904
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   905
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   906
    ^ image
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   907
!
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   908
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   909
releaseCachedImagesFromDevice:aGraphicsDevice
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   910
    "flush cached resources before saving a snapshot
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   911
     (do not save them in the image)"
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   912
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   913
    aGraphicsDevice isNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   914
        Images := LigthenedImages := nil.
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   915
        ^ self.
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   916
    ].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   917
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   918
    Images notNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   919
        Images removeKey:aGraphicsDevice ifAbsent:[].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   920
    ].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   921
    LigthenedImages notNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   922
        LigthenedImages removeKey:aGraphicsDevice ifAbsent:[].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   923
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   924
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   925
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   926
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   927
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   928
subMenu:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   929
    "create a submenu; can be redifined in derived classes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   930
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   931
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   932
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   933
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   934
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   935
5094
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   936
!MenuPanel class methodsFor:'startup & release'!
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   937
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   938
preSnapshot
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   939
    "flush cached resources before saving a snapshot
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   940
     (do not save them in the image)"
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   941
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   942
    self releaseCachedImagesFromDevice:nil
5094
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   943
! !
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   944
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   945
!MenuPanel class methodsFor:'utilities'!
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
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   948
    "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
   949
     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
   950
     or fix), or by an ampersand escape.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   951
     Double ampersands are replaced by a single one."
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   952
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   953
    |i label nextChar rest pos size accessCharacter|
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
    pos := accessCharacterPositionOrNil.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   956
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   957
    label := aLabel.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   958
    size := aLabel size.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   959
    i := 1.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   960
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   961
	nextChar := label at:(i+1).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   962
	nextChar isSeparator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   963
	    i := i + 1
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   964
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   965
	    rest := label copyFrom:(i+1).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   966
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   967
	    i == 1 ifTrue:[label := rest]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   968
		  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   969
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   970
	    (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   971
	    size := size - 1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   972
	].
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   973
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   974
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   975
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   976
	^ label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   977
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   978
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   979
    label isText ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   980
	label := Text string:label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   981
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   982
    label emphasisAt:pos add:#underline.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   983
    ^ label
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   984
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   985
    "Created: / 15-02-2012 / 18:50:58 / cg"
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   986
! !
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   987
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   988
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   989
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   990
accept
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   991
    "accept the current selected item"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   992
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   993
    |item|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   994
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   995
    (item := self selection) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   996
	self topMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   997
	    openDelayed:nil;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
   998
	    accept:nil.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   999
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1000
	self acceptItem:item inMenu:self
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1001
    ]
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1002
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1003
    "Modified: / 29-06-2011 / 16:14:26 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1004
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1005
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1006
accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1007
    "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
  1008
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1009
    |itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  1010
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1011
    self superMenu notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1012
        ^ self topMenu accept:anItemOrNil
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1013
    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  1014
    prevFocusView ~~ self ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1015
        focusView := prevFocusView.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  1016
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  1017
    prevFocusView := nil.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  1018
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1019
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  1020
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1021
    self selection:nil.
420
ca
parents: 417
diff changeset
  1022
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1023
    (anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1024
        tgState := anItemOrNil toggleIndication.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1025
        panel := anItemOrNil menuPanel.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1026
        itemIdx := panel findFirst:[:el| el == anItemOrNil ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1027
        itemAcceptedOrNil := anItemOrNil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1028
        recv := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1029
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1030
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1031
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1032
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1033
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
  1034
    self isPopUpView ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1035
        self do:[:el| el updateIndicators].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1036
        winGrp notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1037
            winGrp processExposeEvents.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1038
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1039
    ] ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1040
        self unmap.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1041
        device sync. "/ round trip - all expose events are now received
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1042
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1043
        winGrp notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1044
            "/ give expose event a chance to arrive
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1045
            [shown and:[realized]] whileTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1046
                winGrp processExposeEventsFor:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1047
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1048
            masterGroup := winGrp previousGroup.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1049
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1050
        "/ cg: disabled-not needed - try PopUpList with destroy...
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1051
        "/ self destroy.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1052
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1053
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1054
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1055
    (focusView notNil and:[winGrp notNil]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1056
        winGrp focusView:focusView.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1057
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1058
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1059
    itemAcceptedOrNil isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1060
        hasPerformed := true.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1061
        self isPopUpView ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1062
            lastItem := itemAcceptedOrNil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1063
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1064
        ^ itemAcceptedOrNil.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1065
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1066
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1067
"/ using master maingroup, sensor in my current windowgroup
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1068
"/ flushes its events if the window goes
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1069
winGrp notNil ifTrue:[
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1070
    winGrp mainGroup notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1071
        sensor := winGrp mainGroup sensor.
4089
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1072
    ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1073
].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1074
sensor isNil ifTrue:[sensor := self sensor ].
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1075
0de7cd2f7734 changed: #accept:
ca
parents: 4086
diff changeset
  1076
    sensor pushEvent:(
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1077
        MenuEvent
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1078
            selectMenuItem:itemAcceptedOrNil
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1079
            index:itemIdx
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1080
            text:nil
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1081
            value:tgState
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1082
            inMenu:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1083
            menuReceiver:recv).
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1084
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1085
    ^ anItemOrNil.  "/ stupid convention
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1086
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1087
"/    acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1088
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1089
"/    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1090
"/
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1091
"/    (itemAcceptedOrNil showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1092
"/    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1093
"/    ifTrue:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1094
"/        winGrpForBusyCursor withWaitCursorDo:acceptAction
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1095
"/    ] ifFalse:[
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1096
"/        acceptAction value
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1097
"/    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1098
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
  1099
    "Modified: / 07-07-2011 / 18:08:41 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1100
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1101
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1102
accept:anItem index:anIndex toggle:aState receiver:aReceiver
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1103
    "really accept an item"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1104
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1105
    |selectorOrBlock argument numArgs isValueModel rec args arg2
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  1106
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1107
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1108
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1109
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1110
    hasPerformed := isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1111
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  1112
    (selectorOrBlock := anItem value) isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1113
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1114
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1115
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1116
    (argument := anItem argument) isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1117
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1118
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1119
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1120
    (selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1121
        "/ a valueHolder or block
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1122
        (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1123
            'MenuPanel [warning]: menuItem''s value does not respond to #value protocol' infoPrintCR.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1124
             ^ self "/ ^ selectorOrBlock
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1125
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1126
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1127
        numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1128
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1129
        numArgs == 0 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1130
            args := nil
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1131
        ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1132
            numArgs == 1 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1133
                args := Array with:argument
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1134
            ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1135
                args := Array with:argument with:self
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1136
            ]
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1137
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1138
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1139
        selectorOrBlock valueWithArguments:args.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1140
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1141
        hasPerformed := true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1142
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1143
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1144
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1145
    anItem sendToOriginator ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1146
        rec := self originator.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1147
        rec isNil ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1148
            self error:'no originating widget (no target for message)' mayProceed:true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1149
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1150
    ] ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1151
        rec := aReceiver
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1152
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1153
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1154
    rec isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1155
        'MenuPanel [warning]: menu has no receiver defined' infoPrintCR.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1156
        ^ self "/ ^ selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1157
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1158
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1159
    isValueModel ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1160
        rec value:selectorOrBlock
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  1161
    ] ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1162
        selectorOrBlock isArray ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1163
            "/ a hack !!!!!! Must be compatible to old MenuView
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1164
            args := selectorOrBlock copyFrom:2.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1165
            selectorOrBlock := selectorOrBlock first.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1166
        ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1167
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1168
            arg2 := self.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1169
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1170
            "/ support for ST80 style applications
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1171
            "/ (expecting the message to go to the application
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1172
            "/  if not understood by the view)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1173
            "/ These expect the controller to be passed as argument.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1174
            "/ sigh.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1175
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1176
            (rec isView
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1177
            and:[(rec respondsTo:selectorOrBlock) not
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1178
            and:[(app := rec application) ~~ rec
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1179
            and:[app notNil]]]) ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1180
                arg2 := rec controller.       "/ the view's controller
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1181
                rec := app.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1182
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1183
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1184
            (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1185
                args := nil
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1186
            ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1187
                numArgs == 1 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1188
                    args := Array with:argument
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1189
                ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1190
                    args := Array with:argument with:arg2
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1191
                ]
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1192
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1193
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1194
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1195
        fallBack :=
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1196
            [
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1197
                |val|
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1198
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1199
                "/ mhmh - the receiver did not respond to that message;
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1200
                "/ if there is a master-application, try that one
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1201
                "/ (recursive)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1202
                master := rec perform:#masterApplication ifNotUnderstood:nil.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1203
                master notNil ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1204
                    rec := master.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1205
                    val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1206
                ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1207
                    self
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1208
                        error:('Unimplemented (or error in) menu message: %1 for %2'
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1209
                                    bindWith:selectorOrBlock
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1210
                                    with:aReceiver printString)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1211
                        mayProceed:true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1212
                    val := nil.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1213
                ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1214
                val
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1215
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1216
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1217
        rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
  1218
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1219
    hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1220
    ^ self "/ ^ selectorOrBlock
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1221
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1222
    "Modified: / 06-03-2012 / 14:49:00 / cg"
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1223
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1224
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1225
acceptItem:anItemOrNil inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1226
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1227
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1228
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1229
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1230
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1231
    (anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1232
	topMenu accept:anItemOrNil
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1233
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1234
	anItemOrNil canAccept ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1235
	    tgState := anItemOrNil toggleIndication.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1236
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1237
	    self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1238
		accept:anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1239
		index:(aMenu selectionIndex)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1240
		toggle:tgState
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1241
		receiver:(aMenu receiver).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1242
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1243
	    aMenu do:[:el| el updateIndicators].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1244
	    anItemOrNil hideMenuOnActivated ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1245
		aMenu invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1246
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1247
	]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1248
    ]
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1249
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1250
    "Modified: / 29-06-2011 / 14:34:45 / cg"
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1251
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1252
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1253
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1254
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1255
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1256
  ^ lastItem
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1257
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1258
    "Modified: / 29-06-2011 / 16:24:48 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1259
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1260
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1261
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1262
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1263
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1264
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1265
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1266
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1267
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1268
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1269
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1270
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1271
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1272
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1273
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1274
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1276
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1277
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1279
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1280
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1281
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1282
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1283
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1284
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1285
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1287
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1288
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1289
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1290
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1291
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1292
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1293
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1294
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1295
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1296
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1297
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1299
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1300
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1301
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1303
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1306
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1307
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1308
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1309
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1312
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1313
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1317
doAccessCharacterTranslation
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1318
    "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
  1319
     Can be set to false to leave accessCharacter unchanged"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1320
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1321
    ^ doAccessCharacterTranslation ? true
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1322
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1323
    "Modified: / 02-11-2010 / 10:19:09 / cg"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1324
!
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1325
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1326
doAccessCharacterTranslation:aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1327
    "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
  1328
     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
  1329
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1330
    doAccessCharacterTranslation := aBoolean
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1331
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1332
    "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
  1333
!
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1334
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1335
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1336
    "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
  1337
     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
  1338
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1339
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1340
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1341
    "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
  1342
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1343
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1344
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1345
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1346
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1347
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1349
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1351
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1352
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1353
    aGroupSizes = groupSizes ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1354
	groupSizes := aGroupSizes copy.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1355
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1356
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1357
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1359
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1360
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1361
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1362
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1363
hideOnRelease:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1364
    hideOnRelease := aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1365
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1366
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1367
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1368
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1369
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1370
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1372
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1373
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1374
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1375
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1376
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1377
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1378
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1379
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1380
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1381
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1382
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1383
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1384
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1385
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1386
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1387
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1388
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1389
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1390
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1391
	self removeAll.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1392
	size := labels size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1393
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1394
	size > 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1395
	    items := OrderedCollection new:size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1396
	    labels do:[:aLabel| items add:(Item in:self label:aLabel) ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1397
	    preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1398
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1399
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1400
!
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1401
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1402
menuPerformer:anObject
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1403
    "set the menu-receiver. That's the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1404
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1405
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1406
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1407
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1408
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1410
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1411
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1412
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1413
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1414
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1415
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1416
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1417
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1418
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1419
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1420
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1422
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1423
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1425
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1426
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1427
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1428
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1429
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1430
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1431
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1432
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1433
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1434
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1435
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1437
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1438
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1439
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1440
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1441
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1442
	^ superMenu originator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1443
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1444
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1445
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1446
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1447
receiver
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1448
    "get the menu-receiver. That's the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1449
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1450
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1451
    (receiver isNil and:[superMenu notNil]) ifTrue:[
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1452
        ^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1454
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1457
receiver:anObject
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1458
    "set the menu-receiver. That's the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1459
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1460
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1461
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1464
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1465
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1466
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1467
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1470
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1471
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1472
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1473
    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
  1474
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1477
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1478
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1479
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1482
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1483
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1484
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1488
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1489
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1490
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1491
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1494
valueAt:stringOrNumber put:aBlockOrValueHolderOrSelector
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1495
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1496
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1497
    self itemAt:stringOrNumber do:[:el| el value:aBlockOrValueHolderOrSelector ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1500
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1501
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1502
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1506
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1507
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1508
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1509
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1510
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1511
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1512
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1513
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1514
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1515
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1516
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1521
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1522
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1523
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1525
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1526
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1527
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1528
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1530
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1531
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1532
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1533
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1534
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1535
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1537
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1538
enabled:aBooleanOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1539
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1540
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1541
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1542
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1543
    state := aBooleanOrNil ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1544
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1545
    enabled ~~ state ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1546
        enabled := state.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1547
        self invalidate.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1548
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1549
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1550
    "Modified (format): / 04-02-2017 / 21:32:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1551
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1552
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1553
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1554
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1555
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1556
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1557
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1558
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1559
enabledAt:stringOrNumber put:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1560
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1561
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1562
    self itemAt:stringOrNumber do:[:el| el enabled:aBoolean ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1563
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1564
    "Modified (format): / 04-02-2017 / 21:33:01 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1565
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1566
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1567
exclusivePointer:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1568
    "Do nothing here. Compatibility with PopUpListController"
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1569
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1570
    ^ self
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1571
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1572
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1573
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1574
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1575
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1576
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1577
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1578
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1579
!MenuPanel methodsFor:'accessing-channels'!
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
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1582
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1583
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1584
    enableChannel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1585
	enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1586
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1587
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1588
    (enableChannel := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1589
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1590
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1591
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1592
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1593
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1594
menuChannel
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1595
    ^ self menuHolder
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1596
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1597
    "Created: / 27-03-2007 / 08:38:31 / cg"
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1598
!
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1599
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1600
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1601
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1602
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1603
    menuHolder notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1604
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1605
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1606
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1607
    (menuHolder := aValueHolder) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1608
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1609
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1610
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1611
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1612
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1613
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1614
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1615
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1616
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1617
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1618
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1619
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1620
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1621
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1622
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1623
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1624
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1625
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1626
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1627
backgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1628
    "return the background color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1629
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1630
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1631
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1632
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1633
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1634
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1635
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1636
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1637
    self backgroundColor ~~ aColor ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1638
	super viewBackground:aColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1639
	self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1640
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1641
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1642
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1643
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1644
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1645
buttonActiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1646
    "get the background drawing color used to highlight button selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1647
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1648
    ^ buttonActiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1649
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1650
    "Modified: / 19-01-2012 / 11:51:46 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1651
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1652
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1653
buttonActiveForegroundColor
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1654
    "get the foreground drawing color used to highlight button selection"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1655
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1656
    ^ styleSheet colorAt:#'button.activeForegroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1657
		 default:(self foregroundColor)
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1658
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  1659
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1660
buttonEdgeStyle
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1661
    "get the button edge style"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1662
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1663
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1664
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1665
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1666
buttonEnteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1667
    "get the background drawing color used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1668
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1669
    ^ buttonEnteredBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1670
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1671
    "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
  1672
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1673
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1674
buttonEnteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1675
    "get the 3D-level used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1676
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1677
    ^ buttonEnteredLevel "/ ? (styleSheet at:#'menuPanel.buttonEnteredLevel') ? 0
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1678
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1679
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1680
buttonHalfLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1681
    "get the background drawing color used to half light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1682
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1683
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1684
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1685
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1686
buttonHalfShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1687
    "get the background drawing color used to half shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1688
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1689
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1690
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1691
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1692
buttonLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1693
    "get the background drawing color used to light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1694
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1695
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1696
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1697
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1698
buttonPassiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1699
    "get the background drawing color used for button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1700
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1701
    ^ buttonPassiveBackgroundColor ? viewBackground
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1702
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  1703
    "Modified: / 19-01-2012 / 13:13:59 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1704
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1705
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1706
buttonShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1707
    "get the background drawing color used to shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1708
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1709
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1710
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1711
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1712
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1713
    "return the color used for etching disabled items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1714
     If nil, no 3D effect is drawn."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1715
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1716
    |bg|
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1717
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1718
    (bg := self backgroundColor) = DefaultBackgroundColor ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1719
	^ bg mixed:0.5 with:Color white
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1720
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1721
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
4453
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1722
20778fc5b77e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4424
diff changeset
  1723
    "Modified: / 28-11-2013 / 16:28:25 / cg"
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1724
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1725
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1726
disabledForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1727
    "return the foreground color used by disabled items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1728
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1729
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1730
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1731
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1732
enteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1733
    "return the background color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1734
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1735
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1736
		 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1737
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1738
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1739
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1740
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1741
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1742
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1743
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1744
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1745
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1746
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1747
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1748
    (aFont isNil or:[aFont = gc font]) ifTrue:[ ^ self ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1749
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1750
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1751
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1752
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1753
    (shown and:[superMenu notNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1754
	self extent:(self preferredExtent)
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1755
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1756
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1757
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1758
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1759
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1760
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1761
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1762
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1763
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1764
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1765
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1766
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1767
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1768
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1769
    aColor ~= fgColor ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1770
        fgColor := aColor onDevice:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1771
        self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1772
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1773
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1774
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1775
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1776
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1777
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1778
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1779
    ^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1780
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1781
    "Modified: / 19-01-2011 / 21:21:53 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1782
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1783
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1784
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1785
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1786
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  1787
    ^ self whiteColor
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1788
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1789
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1790
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1791
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1792
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  1793
    ^ self blackColor
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1794
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1795
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1796
setFont:aFont
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1797
    "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
  1798
     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
  1799
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1800
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1801
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1802
    currentFont := gc font.
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1803
    (aFont notNil and:[aFont ~= currentFont]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1804
	super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1805
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1806
    ^ currentFont
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1807
!
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1808
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1809
suppressSeparatingLines
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1810
    ^ self verticalLayout not
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1811
    and:[ (styleSheet at:#'menu.suppressSeparatingLinesInToolbar' default:false) ] 
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1812
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1813
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1814
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1815
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1816
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1817
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1818
3886
68183511e7ef code deobfuscated:
Claus Gittinger <cg@exept.de>
parents: 3881
diff changeset
  1819
    self hasExplicitExtent ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1820
	^ self preferredHeight
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1821
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1822
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1823
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1824
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1825
maxExtent
4113
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1826
    |minH pos|
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1827
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1828
    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
  1829
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1830
    device notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1831
        "/ notice, the position-dependent query: if there is a higher secondary screen,
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1832
        "/ this makes a difference in where a popUpMenu is allowed...
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1833
        pos := self origin.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1834
        pos = (0@0) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1835
            "called too early"
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1836
            minH := device smallestMonitorHeight.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1837
        ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1838
            minH := device usableHeightAt:pos.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1839
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1840
        ^ device usableWidth @ (minH - 2)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1841
        "/ ^ 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
  1842
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1843
    superMenu notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1844
        ^ superMenu maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1845
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1846
    "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
  1847
    self error:'don''t know maxExtent'.
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1848
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1849
    "Modified: / 15-02-2012 / 19:22:24 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1850
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1851
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1852
origin:origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1853
    "changed due to menu in horizontal panel, if the origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1854
     changed we have to rearrange the menu items if size not fixed"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1855
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1856
    |oldLeft|
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1857
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1858
    (shown and:[mustRearrange not and:[sizeFixed not]]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1859
	^ super origin:origin
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1860
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1861
    "left partner in horizontal panel toggles visibility"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1862
    oldLeft := self left.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1863
    super origin:origin.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1864
    oldLeft = self left ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1865
	"/ no change notification... so cannot call #mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1866
	mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  1867
	self invalidate.
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1868
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1869
!
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1870
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1871
preferredExtent
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1872
    "compute and returns my preferred extent"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1873
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1874
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1875
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1876
    "/ If I have an explicit preferredExtent..
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1877
    explicitExtent notNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1878
        ^ explicitExtent
3580
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1879
    ].
e9fe446dc779 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3565
diff changeset
  1880
    "/ If I have a cached preferredExtent value..
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1881
    preferredExtent notNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1882
        ^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1883
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1884
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1885
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1886
    superView isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1887
        "/ is standalone
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1888
        preferredWidth notNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1889
            usedExtent x < preferredWidth ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1890
                usedExtent := preferredWidth @ usedExtent y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1891
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1892
        ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1893
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1894
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1895
    maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1896
    maxExtent notNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1897
        usedExtent := usedExtent min:maxExtent.
4627
905fcf6a9bfc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4617
diff changeset
  1898
    ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1899
    "/ changed due to menu in horizontal panel
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1900
    (superView notNil and:[items size == 0] ) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1901
        self isViewWrapper ifFalse:[ ^ usedExtent ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1902
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1903
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  1904
    preferredExtent := usedExtent.
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1905
    ^ usedExtent
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1906
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1907
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1908
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1909
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1910
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1911
    "compute and returns my preferred extent including all items
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1912
        !!!!!! changes have influence on method #rearrangeItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1913
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1914
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1915
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1916
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1917
     size         "{ Class:SmallInteger }"
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1918
     buttonInsetX2 "{ Class:SmallInteger }"
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1919
     buttonInsetY2 "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1920
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1921
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1922
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1923
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1924
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1925
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1926
    (size := items size) == 0 ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1927
        self isViewWrapper ifTrue:[ ^ subViews first extent ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1928
        ^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1929
    ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1930
    stringOffsetX := nil.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1931
    buttonInsetX2 := 2 * buttonInsetX.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1932
    buttonInsetY2 := 2 * buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1933
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1934
    self isPopUpView ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1935
        labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1936
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1937
        labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1938
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1939
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1940
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1941
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1942
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1943
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1944
    self verticalLayout ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1945
        items keysAndValuesDo:[:key :el| |eX eY|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1946
            extent := el preferredExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1947
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1948
            "/ check for visibility (extent x ~~ 0)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1949
            (eX := extent x) ~~ 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1950
                eY := extent y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1951
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1952
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1953
                    eX := eX + buttonInsetX2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1954
                    eY := eY + buttonInsetY2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1955
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1956
                    eX := eX + labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1957
                    eY := eY + labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1958
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1959
                key ~~ size ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1960
                    (self hasGroupDividerAt:key) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1961
                        x := x + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1962
                    ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1963
                        el needsItemSpaceWhenDrawing ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1964
                            x := x + itemSpace
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1965
                        ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1966
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1967
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1968
                x := x + eX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1969
                y := y max:eY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1970
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1971
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1972
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1973
        hasMenu := false.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1974
        shCtKey := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1975
        showAcc := MenuView showAcceleratorKeys == true.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1976
        y := x.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1977
        x := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1978
        itemMargin := 2 * self itemMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1979
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1980
        items keysAndValuesDo:[:key :el| |eX eY|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1981
            extent := el preferredExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1982
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1983
            "/ check for visibility (extent x ~~ 0)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1984
            (eX := extent x) ~~ 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1985
                eY := extent y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1986
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1987
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1988
                    eX := eX + buttonInsetX2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1989
                    eY := eY + buttonInsetY2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1990
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1991
                    eX := eX + labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1992
                    eY := eY + labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1993
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1994
                hasMenu ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1995
                    hasMenu := el hasSubmenu
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1996
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1997
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1998
                    shCtKey := shCtKey max:(sck widthOn:self)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1999
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2000
                key ~~ size ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2001
                    (self hasGroupDividerAt:key) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2002
                        y := y + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2003
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2004
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2005
                y := y + eY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2006
                x := x max:eX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2007
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2008
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2009
        x := x + itemMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2010
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2011
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2012
            shortKeyInset := x + Item labelRightOffset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2013
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2014
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2015
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2016
                x := x + self shortcutKeyOffset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2017
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2018
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2019
"/ to have a small inset
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2020
        y := y + 1.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2021
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2022
    ].
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2023
    x := x + ((margin + extraMargin)*2).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2024
    y := y + ((margin + extraMargin)*2).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2025
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2026
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2027
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2028
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2029
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2030
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2031
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2032
     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
  2033
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2034
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2035
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2036
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2037
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2038
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2039
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2040
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2041
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2042
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2043
sizeFixed:aBoolean
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2044
    "set/clear the fix-size attribute.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2045
     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
  2046
     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
  2047
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2048
    sizeFixed := aBoolean.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2049
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2050
    sizeFixed ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2051
	"/ changed due to menu in horizontal panel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2052
	superView notNil ifTrue:[ superView addDependent:self ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2053
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2054
!
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2055
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2056
stringOffsetXfor:anItem
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2057
    "return the x offset for a MenuItem where to draw the text
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2058
    "
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2059
    |label w|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2060
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2061
    anItem isButton ifTrue:[ ^ 0 ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2062
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2063
    stringOffsetX isNil ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2064
        stringOffsetX := 0.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2065
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2066
        (self isPopUpView and:[self verticalLayout]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2067
            self do:[:el|
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2068
                el isVisible ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2069
                    (    (label := el indicatorForm) notNil
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2070
                     or:[(label := el choiceForm) notNil]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2071
                    ) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2072
                        stringOffsetX := stringOffsetX max:(label width + 2).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2073
                    ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2074
                        label := el displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2075
                        label isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2076
                            stringOffsetX := stringOffsetX max:(label xOfString).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2077
                        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2078
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2079
                ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2080
            ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2081
        ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2082
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2083
    w := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2084
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2085
    (    (label := anItem indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2086
     or:[(label := anItem choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2087
    ) ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2088
        w := label width + 2.
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2089
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2090
    stringOffsetX == 0 ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2091
        ^ w
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2092
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2093
    w == 0 ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2094
        label := anItem displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2095
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2096
        label isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2097
            ^ stringOffsetX - label xOfString
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2098
        ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2099
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2100
    ^ stringOffsetX.
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2101
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2102
    "Modified: / 04-02-2017 / 22:11:38 / cg"
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2103
!
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2104
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2105
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2106
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2107
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2108
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2109
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2110
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2111
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2112
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2113
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2114
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2115
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2116
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2117
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2118
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2119
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2120
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2121
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2122
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2123
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2124
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2125
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2126
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2127
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2128
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2129
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2130
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2131
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2132
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2133
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2134
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2135
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2136
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2137
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2138
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2139
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2140
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2141
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2142
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2143
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2144
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2145
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2146
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2147
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2148
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2149
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2150
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2151
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
4240
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2153
hasItems
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2154
    "return true, if I have items"
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2155
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2156
    ^ items notEmptyOrNil
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2157
!
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2158
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2159
itemAt:stringOrNumber do:aOneArgBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2160
    "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
  2161
     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
  2162
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2163
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2164
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2165
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2166
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2167
    "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
  2168
     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
  2169
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2170
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2171
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2172
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2173
    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
  2174
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2175
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2176
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2177
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2178
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2179
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2180
    ^ 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
  2181
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2182
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2183
items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2184
    "returns the list of items or nil.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2185
     Warning: do not change this list - it is mine !!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2186
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2187
    ^ items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2188
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2189
    "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
  2190
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2191
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2192
itemsDo:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2193
    items notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2194
	items do:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2195
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2196
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2197
    "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
  2198
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2199
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2200
itemsDoWithIndex:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2201
    items notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2202
	items doWithIndex:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2203
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2204
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2205
    "Created: / 09-11-2010 / 10:06:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2206
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2207
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2208
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2209
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2210
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2211
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2212
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2213
    ^ buttonActiveLevel "/ ? (styleSheet at:#'menuPanel.buttonActiveLevel') ? 0
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2214
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2215
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2216
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2217
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2218
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2219
    ^ buttonPassiveLevel "/ ? (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2220
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2221
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2222
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2223
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2224
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2225
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2226
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2227
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2228
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2229
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2230
fitFirstPanel
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2231
    "gets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2232
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2233
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2234
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2235
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2236
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2237
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2238
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2239
fitFirstPanel:aBoolean
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2240
    "NOT SUPPORTED.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2241
     should return true if the first panel in the menu hierarchy must fit
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2242
     to the extent of its superView"
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2243
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2244
    "Modified (comment): / 04-02-2017 / 21:33:36 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2245
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2246
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2247
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2248
    anInt ~~ level ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2249
	super level:anInt.
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  2250
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2251
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2252
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2253
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2254
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2255
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2256
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2257
    rightArrow isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2258
        device isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2259
            ^ SelectionInListView rightArrowFormOn:Screen current
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2260
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2261
        rightArrow := SelectionInListView rightArrowFormOn:device
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2262
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2263
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2264
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2265
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2266
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2267
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2268
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2269
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2270
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2271
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2272
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2273
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2274
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2275
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2276
showGroupDivider:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2277
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2278
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2279
    showGroupDivider ~~ aBoolean ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2280
        showGroupDivider := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2281
        self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2282
    ]
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2283
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2284
    "Modified (format): / 04-02-2017 / 21:33:47 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2287
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2288
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2289
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2290
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2291
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2292
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2293
showSeparatingLines:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2294
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2295
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2296
    aBoolean ~~ showSeparatingLines ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2297
        showSeparatingLines := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2298
        self mustRearrange
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2299
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2300
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2301
    "Modified (format): / 04-02-2017 / 21:33:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2302
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2304
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2305
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2306
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2307
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2308
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2309
    superMenu notNil ifTrue:[ verticalLayout := true ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2310
		    ifFalse:[ verticalLayout := self isPopUpView ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2311
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2312
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2313
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2314
verticalLayout:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2315
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2316
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2317
    aBoolean ~~ verticalLayout ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2318
        verticalLayout isNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2319
            verticalLayout := aBoolean
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2320
        ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2321
            verticalLayout := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2322
            self mustRearrange.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2323
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2324
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2325
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2326
    "Modified (format): / 04-02-2017 / 21:33:58 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2327
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2328
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2329
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2330
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2331
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2332
    "returns the verical button space"
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
    ^ buttonInsetX
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2335
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2336
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2337
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2338
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2339
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2340
    ^ buttonInsetY
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2341
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2342
3975
ca
parents: 3966
diff changeset
  2343
delayInSecondsBeforeOpeningSubmenu
ca
parents: 3966
diff changeset
  2344
    "answer the seconds a submenu will be delayed before
ca
parents: 3966
diff changeset
  2345
    open; an already open submenu than will be closed"
ca
parents: 3966
diff changeset
  2346
4527
38e526ae120b class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4526
diff changeset
  2347
    ^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu'  default:0.15
3975
ca
parents: 3966
diff changeset
  2348
!
ca
parents: 3966
diff changeset
  2349
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2350
drawMenuIndicatorSeparatorLine
4235
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2351
    ^ true.
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2352
"/    ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine'  default:false
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2353
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2354
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2355
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2356
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2357
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2358
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2359
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2360
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2361
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2362
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2363
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2364
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2365
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2366
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2367
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2368
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2369
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2370
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2371
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2372
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2373
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2374
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2375
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2376
    ^ itemSpace
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2377
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2378
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2379
menuIndicatorVerticalPosition
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2380
    "#center, #top or #bottom"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2381
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2382
    ^ #center
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2383
    "/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2384
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2385
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2386
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2387
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2388
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2389
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2390
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2391
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2392
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2393
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2394
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2395
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2396
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2397
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2398
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
subMenuAt:stringOrNumber
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2401
    "gets the current submenu of an item; if the submenu is nil, the
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2402
     submenu is generated if specified otherwise nil is returned."
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2403
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2404
    |submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2405
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2406
    self itemAt:stringOrNumber do:[:anItem|
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2407
	submenu := anItem currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2408
	submenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2409
	    submenu := anItem setupSubmenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2410
	].
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2411
    ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2412
    ^ submenu
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2413
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2414
    "Modified: / 22-09-2010 / 13:53:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2415
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2416
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2417
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2418
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2419
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2420
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2421
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2423
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2424
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2425
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2426
    |item submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2427
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2428
    item := self selection.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2429
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2430
    item notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2431
	submenu := item currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2432
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2433
	(submenu notNil and:[submenu shown]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2434
	    ^ submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2435
	].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2436
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2437
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2438
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2439
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  2440
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2441
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2442
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2443
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2444
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2445
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2446
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2447
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2448
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2449
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2450
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2451
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2452
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2453
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2454
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2455
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2456
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2457
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2458
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2459
     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
  2460
     (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
  2461
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2462
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2463
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2464
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2465
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2466
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2467
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2468
     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
  2469
     (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
  2470
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2471
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  2472
    ^ self showAt:aPoint resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2473
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2474
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2475
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2476
    "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
  2477
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2478
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2479
     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
  2480
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2481
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2482
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  2483
    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
  2484
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2485
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2486
    aBoolean ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2487
	self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2488
    ].
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2489
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2490
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2491
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2492
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2493
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2494
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2495
    self topMenu hasPerformed ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2496
	^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2497
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2498
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2499
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2500
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2501
    "Modified: / 29-06-2011 / 16:24:22 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2502
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2503
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2504
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2505
    "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
  2506
     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
  2507
     (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
  2508
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2509
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2510
    ^ self showAt:(device pointerPosition) resizing:true
4064
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2511
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2512
    "Modified (format): / 22-07-2011 / 15:24:48 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2513
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2514
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2515
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2516
    "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
  2517
     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
  2518
     (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
  2519
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2520
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2521
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2522
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2523
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2524
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2525
    ^ 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
  2526
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2527
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2529
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2530
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2531
    "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
  2532
     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
  2533
     (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
  2534
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2535
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2536
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2537
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2538
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2539
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2540
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2541
     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
  2542
     (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
  2543
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2544
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2545
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2546
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2547
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2548
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2549
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2550
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2551
    "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
  2552
     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
  2553
     (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
  2554
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2555
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2556
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2557
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2558
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2559
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2560
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2561
    "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
  2562
     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
  2563
     (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
  2564
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2565
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2566
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2567
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2568
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2569
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2570
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2571
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2572
    "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
  2573
     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
  2574
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2575
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2576
    |max item index|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2577
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2578
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2579
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2580
    (index := anIndexOrNil) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2581
	(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2582
	    index := max.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2583
	    "/ ^ nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2584
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2585
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2586
    items isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2587
	items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2588
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2589
	items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2590
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2591
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2592
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2593
    (index isNil or:[index == max]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2594
	items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2595
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2596
	items add:item beforeIndex:index
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2597
    ].
4627
905fcf6a9bfc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4617
diff changeset
  2598
    preferredExtent := nil.     "/ flush cached preferredExtent
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2599
    self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2600
    ^ item
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2601
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2602
    "Modified: / 03-07-2011 / 22:49:47 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2603
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2604
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2605
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2606
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2607
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2608
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2609
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2610
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2611
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2612
	items remove:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2613
	items := items asNilIfEmpty.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2614
	item destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2615
	preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2616
	self mustRearrange.
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2617
    ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2618
    ^ item
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2619
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2620
    "Modified: / 09-11-2010 / 10:04:08 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2621
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2622
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2623
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2624
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2625
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2626
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2627
	self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2628
	groupSizes := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2629
	items notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2630
	    items copy do:[:el| el destroy ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2631
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2632
	items := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2633
	preferredExtent := nil.     "/ flush cached preferredExtent
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2634
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2635
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2636
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2637
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2638
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2639
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2640
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2641
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2642
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2643
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2644
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2645
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2646
    changedObject == superView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2647
	"/ changed due to menu in horizontal panel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2648
	something == #sizeOfView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2649
	    (shown and:[sizeFixed not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2650
		"/ no change notification... so cannot call #mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2651
		mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2652
		self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2653
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2654
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2655
	^ self
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2656
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2657
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2658
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2659
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2660
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2661
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2662
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2663
asMenu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2664
    "convert contents to a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2665
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2666
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2667
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2668
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2669
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2670
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2671
    ^ menu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2672
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2673
    "Modified: / 27-03-2007 / 08:39:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2674
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2675
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2676
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2677
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2678
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2679
    self menu:(Menu decodeFromLiteralArray:aMenuSpec)
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2680
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2681
    "Modified: / 27-03-2007 / 08:42:43 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2682
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2683
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2684
menu:aMenu
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2685
    "setup from a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2686
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2687
    self disabledRedrawDo:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2688
	|menu newItems menuReceiver|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2689
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2690
	self removeAll.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2691
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2692
	(menu := aMenu) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2693
	    (aMenu isCollection) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2694
		menu := Menu decodeFromLiteralArray:aMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2695
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2696
		menuReceiver := menu receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2697
		menuReceiver notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2698
		    self receiver:menuReceiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2699
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2700
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2701
	    (newItems := menu menuItems) notEmptyOrNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2702
		items := newItems collect:[:ni |
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2703
				|i|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2704
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2705
				i:= Item in:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2706
				i menuItem:ni.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2707
				i.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2708
			    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2709
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2710
	    self groupSizes:(menu groupSizes).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2711
	    preferredExtent := nil.     "/ flush cached preferredExtent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2712
	]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2713
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2714
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2715
    "Modified: / 09-11-2010 / 11:52:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2716
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2717
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2718
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2719
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2720
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2721
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2722
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2723
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2724
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2725
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2726
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2727
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2728
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2729
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2730
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2731
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2732
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2733
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2734
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2735
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2736
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2737
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2738
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2739
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2740
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2741
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2742
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2743
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2744
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2745
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2746
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2747
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2748
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2749
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2750
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2751
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2752
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2753
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2754
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2755
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2756
    aLevel isNil ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2757
    aLevel == 0 ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2758
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2759
    layout := anItem layout.
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2760
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2761
    (styleSheet at:'menuPanel.button3D' default:styleSheet is3D) ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2762
        self displayRectangle:layout.
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2763
    ] ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2764
        self drawEdgesForX:(layout left)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2765
                         y:(layout top)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2766
                     width:(layout width)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2767
                    height:(layout height)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2768
                     level:aLevel
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2769
                    shadow:(self buttonShadowColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2770
                     light:(self buttonLightColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2771
                halfShadow:(self buttonHalfShadowColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2772
                 halfLight:(self buttonHalfLightColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2773
                     style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2774
    ]
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2775
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2776
    "Modified: / 06-02-2014 / 14:55:05 / cg"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2777
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2778
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2779
drawFocusForItem:anItem
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2780
    |lytItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2781
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2782
    lytItem := anItem layout.
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2783
    self paint:(self blackColor).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2784
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2785
    self displayDottedRectangleX:(lytItem left)
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2786
                               y:(lytItem top)
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2787
                           width:(lytItem width)
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2788
                          height:(lytItem height).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2789
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2790
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2791
drawItemsX:x y:y width:w height:h
5416
9da5642194a6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  2792
    "redraw items and groups"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2793
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2794
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2795
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2796
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2797
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2798
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2799
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2800
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2801
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2802
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2803
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2804
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2805
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2806
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2807
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2808
    isVertical ifTrue:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2809
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2810
        start == 0 ifTrue:[ ^ self ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2811
        y1 := y + h.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2812
        stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ]
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2813
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2814
    ] ifFalse:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2815
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2816
        start == 0 ifTrue:[ ^ self ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2817
        x1  := x + w.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2818
        stop := items findFirst:[:el| |l| l := el layout .l notNil and:[l left > x1]]
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2819
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2820
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2821
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2822
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2823
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2824
        groupDivInset := self groupDividerSize // 2.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2825
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2826
        groupDivInset ~~ 0 ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2827
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2828
                start := start - 1
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2829
            ]
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2830
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2831
    ] ifFalse:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2832
        groupDivInset := 0
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2833
    ].
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2834
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2835
    prevClip := self clippingBoundsOrNil.
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2836
    self clippingBounds:(Rectangle left:x top:y width:w height:h).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2837
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2838
    start to:stop do:[:i|
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2839
        item := items at:i.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2840
        item draw.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2841
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2842
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2843
            layout := item layout.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2844
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2845
            isVertical ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2846
                x1 := layout left.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2847
                x2 := layout right.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2848
                y1 := layout bottom + groupDivInset.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2849
                y2 := y1.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2850
            ] ifFalse:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2851
                y1 := layout top.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2852
                y2 := layout bottom.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2853
                x1 := layout right + groupDivInset.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2854
                x2 := x1.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2855
            ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2856
            self paint:shadowColor.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2857
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2858
            self paint:lightColor.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2859
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2860
            isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2861
                      ifFalse:[x1 := x1 + 1. x2 := x1 ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2862
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2863
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2864
        ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2865
        selection == item ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2866
            self focusComesByTab ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2867
                self drawFocusForItem:item.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2868
            ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2869
        ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2870
    ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2871
    self clippingBounds:prevClip.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2872
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2873
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2874
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2875
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2876
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2877
    isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2878
	level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2879
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2880
	anItem == enteredItem ifTrue:[ level := self enteredLevel ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2881
			     ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2882
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2883
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2884
    level ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2885
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2886
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2887
	self drawEdgesForX:(layout left)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2888
			 y:(layout top)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2889
		     width:(layout width)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2890
		    height:(layout height)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2891
		     level:level
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2892
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2893
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2894
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2895
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2896
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2897
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2898
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2899
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2900
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2901
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2902
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2903
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2904
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2905
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2906
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2907
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2908
        level := styleSheet at:'menuPanel.scrollButtonActiveLevel' default:-2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2909
    ] ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2910
        level := styleSheet at:'menuPanel.scrollButtonPassiveLevel' default:1
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2911
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2912
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2913
    self isPopUpView ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2914
        self verticalLayout ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2915
            aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2916
                icon := scrolling class iconScrollRightM    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2917
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2918
                aDirection == #PREV ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2919
                    icon := scrolling class iconScrollLeftM    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2920
                ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2921
            ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2922
        ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2923
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2924
    icon isNil ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2925
        icon := scrolling iconAt:aDirection on:self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2926
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2927
    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2928
    icon displayOn:self x:(x + ((w - icon width) // 2))
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2929
                        y:(y + 2 + ((h - 2 - icon height) // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2930
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2931
    level ~~ 0 ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2932
        self drawEdgesForX:x y:y width:w height:h level:level.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2933
    ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2934
"/        self paint:lightColor.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2935
"/        self displayLineFromX:x y:2 toX:x+w-1 y:2.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2936
"/        aDirection == #NEXT ifTrue:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2937
"/            self displayLineFromX:x y:2 toX:x y:h-1.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2938
"/        ] ifFalse:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2939
"/            aDirection == #PREV ifTrue:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2940
"/                self paint:shadowColor.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2941
"/                self displayLineFromX:x+w-1 y:2 toX:x+w-1 y:h-1.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2942
"/            ].    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2943
"/        ].    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2944
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2945
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2946
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2947
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2948
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2949
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2950
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2951
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2952
    (mustRearrange not and:[shown]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2953
	layout := anItem layout.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2954
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2955
	(layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2956
	    self invalidate:(layout "insetBy:-1") repairNow:aBool
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2957
	]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2958
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2959
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2960
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2961
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2962
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2963
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2964
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2965
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2966
    |oldPref|
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2967
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2968
    mustRearrange ifFalse:[
5147
2bb6ca095860 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  2969
        oldPref := preferredExtent.
2bb6ca095860 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  2970
        preferredExtent := nil.
2bb6ca095860 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  2971
        mustRearrange := true.
5276
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2972
        "/ if I am not yet created/was never created, do nothing
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2973
        device notNil ifTrue:[
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2974
            self invalidate. "/ RepairNow:true
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2975
            (oldPref notNil and:[oldPref ~= self preferredExtent]) ifTrue:[
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2976
                dependents notNil ifTrue:[ self changed:#preferredExtent ]
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2977
            ].
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  2978
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2979
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2980
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2981
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2982
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2983
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2984
rearrangeGroups
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2985
    "implements the groupIdentifier #right/#conditionalRight in a horizontal menu"
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2986
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  2987
    <resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')>
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2988
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2989
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2990
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2991
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2992
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2993
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2994
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2995
        ^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2996
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2997
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2998
    layout := items last layout.
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  2999
    layout notNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3000
        (dltX := width - margin - extraMargin - layout right) <= 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3001
            ^ self  "/ no free space
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3002
        ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3003
    ].
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  3004
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3005
    "/ The behavior of #conditionalRight is controlled by the styleSheet.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3006
    "/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3007
    "/ otherwise, it is treated like #right.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3008
    "/ 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
  3009
    "/ non-right under win32 (as is used woth the help-menus).
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  3010
    (StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3011
        start := items findFirst:[:anItem| anItem startGroup == #right ].
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  3012
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3013
        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
  3014
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3015
    start == 0 ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3016
        ^ self  "/ no right-group item detected
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3017
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3018
    
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3019
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3020
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3021
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3022
    items from:start do:[:anItem|
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3023
        anItem isVisible ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3024
            anItem layout moveBy:point.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3025
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3026
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3027
    self updateEnteredItem.
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  3028
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  3029
    "Modified: / 10-10-2007 / 00:29:34 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3030
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3031
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3032
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3033
    "recompute the layout of each item
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3034
        !!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3035
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3036
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3037
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3038
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3039
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3040
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3041
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3042
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3043
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3044
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3045
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3046
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3047
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3048
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3049
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3050
    |
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3051
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3052
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3053
        mustRearrange := false.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3054
        ^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3055
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3056
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3057
"/  DON'T SET THIS!!
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3058
"/  item layout:  below of first item -> item invalidate
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3059
"/                                    -> menuPanel invalidateItem:repairDamage:
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3060
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3061
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3062
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3063
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3064
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3065
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3066
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3067
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3068
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3069
    isPopUpMenu ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3070
        labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3071
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3072
        labelInsetX := labelInsetY := 0
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3073
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3074
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3075
    (isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3076
        |saveExtent maxExtent extentToSet|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3077
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3078
        extent := self preferredExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3079
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3080
        isPopUpMenu ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3081
            maxExtent := self maxExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3082
            maxExtent notNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3083
                extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3084
                                          ifFalse:[(extent x min:(maxExtent x)) @ extent y].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3085
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3086
        ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3087
            extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3088
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3089
        self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3090
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3091
        extent := self computeExtent
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3092
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3093
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3094
    x := y := margin + extraMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3095
    
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3096
    isVertical ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3097
        y0 := y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3098
        y1 := extent y - margin - extraMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3099
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3100
        items keysAndValuesDo:[:anIndex :el|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3101
            el isVisible ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3102
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3103
            ] ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3104
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3105
                    insetX := buttonInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3106
                    insetY := buttonInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3107
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3108
                    insetX := labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3109
                    insetY := labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3110
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3111
                x0 := x  + insetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3112
                x1 := x0 + (el preferredWidth).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3113
                el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3114
                x := x1 + insetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3115
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3116
                size ~~ anIndex ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3117
                    (self hasGroupDividerAt:anIndex) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3118
                        x := x + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3119
                    ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3120
                        el needsItemSpaceWhenDrawing ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3121
                            x := x + itemSpace
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3122
                        ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3123
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3124
                ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3125
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3126
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3127
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3128
        itemMargin := self itemMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3129
        x0 := margin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3130
        x1 := extent x - margin - itemMargin.  "/ -1
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3131
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3132
        items keysAndValuesDo:[:anIndex :el|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3133
            el isVisible ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3134
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3135
            ] ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3136
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3137
                    insetX := buttonInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3138
                    insetY := buttonInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3139
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3140
                    insetX := labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3141
                    insetY := labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3142
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3143
                y0 := y  + insetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3144
                y1 := y0 + el preferredHeight.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3145
                el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3146
                y := y1 + insetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3147
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3148
                size ~~ anIndex ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3149
                    (self hasGroupDividerAt:anIndex) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3150
                        y := y + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3151
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3152
                ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3153
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3154
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3155
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3156
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3157
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3158
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3159
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3160
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3161
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3162
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3163
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3164
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3165
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3166
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  3167
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3168
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3169
    (items contains:[:item | item canChangeVisibility]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3170
	mustRearrange := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3171
	self rearrangeItems.
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3172
    ]
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3173
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3174
    "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
  3175
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3176
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3177
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3178
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3179
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3180
    |y0 y1 x0 x1 prvBound mustDrawLeft mustDrawRight nxtBound isScroller|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3181
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3182
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3183
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3184
    mustRearrange ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3185
        self isPopUpView ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3186
            self explicitExtent:true.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3187
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3188
            "/ changed due to menu in horizontal panel
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3189
            sizeFixed ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3190
                self preferredExtent.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3191
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3192
                preferredExtent notNil ifTrue:[ |lw|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3193
                    lw := (superView width - self left) max: 1.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3194
                    self width:(preferredExtent x min:lw).
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3195
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3196
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3197
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3198
        self rearrangeItems.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3199
        self invalidate.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3200
        ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3201
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3202
2888
095d9fb3e846 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2884
diff changeset
  3203
    "/ self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3204
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3205
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3206
    items size == 0 ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3207
        ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3208
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3209
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3210
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3211
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3212
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3213
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3214
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3215
    "Draw the scroll handles - especially for Popup-Lists"
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3216
    mustDrawLeft := mustDrawRight := false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3217
    
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3218
    self hasScrollers ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3219
        (self hasScrollerAt:#PREV) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3220
            prvBound := self scrollerBoundsAt:#PREV.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3221
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3222
            self verticalLayout ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3223
                (mustDrawLeft := (prvBound bottom > y)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3224
                    y0 := prvBound bottom.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3225
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3226
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3227
                (mustDrawLeft := (prvBound right > x)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3228
                    x0 := prvBound right.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3229
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3230
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3231
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3232
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3233
        (self hasScrollerAt:#NEXT) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3234
            nxtBound := self scrollerBoundsAt:#NEXT.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3235
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3236
            self verticalLayout ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3237
                (mustDrawRight := (nxtBound top < y1)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3238
                    y1 := nxtBound top.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3239
                ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3240
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3241
                (mustDrawRight := (nxtBound left < x1)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3242
                    x1 := nxtBound left.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3243
                ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3244
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3245
        ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3246
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3247
    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
  3248
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3249
    (y1 > y0 and:[x1 > x0]) ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3250
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3251
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3252
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3253
    mustDrawLeft ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3254
        self drawScrollerAt:#PREV bounds:prvBound.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3255
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3256
    mustDrawRight ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3257
        self drawScrollerAt:#NEXT bounds:nxtBound.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3258
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3259
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3260
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3261
updateEnteredItem
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3262
    |mousePoint|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3263
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3264
    mousePoint  := device translatePoint:(device pointerPosition)
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3265
                           fromView:nil toView:self.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3266
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3267
    (self containsPoint:mousePoint) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3268
        enteredItem := self itemAtPoint:mousePoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3269
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3270
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3271
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  3272
!MenuPanel methodsFor:'enumerating & searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3273
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3274
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3275
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3276
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3277
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3278
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3279
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3280
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3282
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3283
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3284
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3285
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3286
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3287
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3288
findFirst:aOneArgBlock
3206
48a66f672af3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3203
diff changeset
  3289
    "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
  3290
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3291
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3292
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3293
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3294
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3295
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3296
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3297
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3298
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3299
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3300
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3301
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3302
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3303
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3304
firstItemSelectable
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3305
    "returns the first item which is selectable or nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3306
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3307
    items size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3308
	^ items detect:[:anItem| anItem canSelect ] ifNone:nil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3309
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3310
    ^ nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3311
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3312
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3313
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3314
    "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
  3315
     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
  3316
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3317
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3318
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3319
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3320
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3321
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3322
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3323
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3324
    i ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3325
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3326
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3327
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3328
    something isSymbol ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3329
	i := self findFirst:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3330
				v := el value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3331
				v isSymbol and:[v == something]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3332
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3333
	i ~~ 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3334
	    ^ i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3335
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3336
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3337
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3338
    (something respondsTo:#string) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3339
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3340
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3341
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3342
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3343
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3344
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3345
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3346
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3347
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3348
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3349
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3350
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3351
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3352
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3353
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3354
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3355
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3356
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3357
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3358
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3359
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3360
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3361
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3362
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3363
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3364
    self scrollActivity isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3365
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3366
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3367
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3368
    sensor := self sensor.
4526
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3369
"/ cg: the following seems to lead to leftover submenus to remain unclosed...
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3370
"/    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3371
"/        ^ self
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3372
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3373
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3374
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3375
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3376
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3377
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3378
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3379
    "/ hideOnRelease := true.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3380
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3381
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3382
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3383
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3384
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3385
    hideOnRelease ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3386
	sensor anyButtonPressed ifFalse:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3387
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3388
	sensor anyButtonPressed ifTrue:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3389
    ].
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3390
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3391
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3392
	"/ selection on grabView without a submenu (Button ...); check whether moving out
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3393
	(self containsPoint:motionPoint) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3394
	    ^ self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3395
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3396
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3397
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3398
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3399
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3400
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3401
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3402
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3403
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3404
    |menu point screen screenPoint targetView targetPoint wg|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3405
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3406
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3407
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3408
    "/ 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
  3409
    wg := self windowGroup.
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3410
    wg notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3411
        wg focusMomentaryRelease.
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3412
    ].
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3413
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3414
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3415
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3416
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3417
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3418
    menu isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3419
        self accept:nil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3420
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3421
        "/ tell underlying view about the click...
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3422
        ((button ~~ 2)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3423
        or:[(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease])]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3424
            screen := device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3425
            screenPoint := screen translatePointToRoot:point fromView:self.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3426
            targetView := screen viewFromPoint:screenPoint.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3427
            (targetView notNil and:[targetView ~~ self]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3428
                targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3429
                targetView buttonPress:button x:targetPoint x y:targetPoint y.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3430
            ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3431
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3432
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3433
        point := menu translateGrabPoint:point.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3434
        menu handleButtonPress:button atPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3435
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3436
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3437
    "Modified: / 02-10-2011 / 09:20:08 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3438
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3439
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3440
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3441
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3442
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3443
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3444
     releaseTime menuMapTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3445
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3446
    hideOnRelease ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3447
	^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3448
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3449
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3450
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3451
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3452
    self scrollActivity stop ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3453
	^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3454
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3455
    dstMenu := topMenu activeMenu.
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3456
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3457
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3458
    hideMenuAndPerformAction ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3459
	"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
  3460
	(topMenu == self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3461
	and:[mapTime notNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3462
	and:[dstMenu == self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3463
	and:[dstMenu isPopUpView]]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3464
	    hideMenuAndPerformAction := false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3465
	].
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3466
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3467
    hideMenuAndPerformAction ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3468
	hideOnRelease ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3469
	    releaseTime := windowGroup lastEvent timeStamp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3470
	    menuMapTime := dstMenu mapTime ? releaseTime.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3471
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3472
	    hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3473
					> (PopUpMenu maxClickTimeToStayOpen).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3474
	].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3475
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3476
    hideMenuAndPerformAction ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3477
	srcPoint := x@y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3478
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3479
	(     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3480
	 and:[(item    := dstMenu selection) notNil]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3481
	) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3482
	    item visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3483
		dstMenu selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3484
		(selection isNil and:[self isPopUpView not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3485
		    self accept:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3486
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3487
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3488
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3489
	    subm := item currentSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3490
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3491
	    subm notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3492
		subm shown ifTrue:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3493
		"/ test whether any action is assigned to the menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3494
		"/ if not ignorre accept
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3495
		item hasDelayedMenu ifFalse:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3496
		"/ handle action defined for the delayed menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3497
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3498
	    dstPoint := dstMenu translateGrabPoint:srcPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3499
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3500
	    (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3501
		item := nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3502
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3503
	    topMenu acceptItem:item inMenu:dstMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3504
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3505
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3506
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3507
	(selection notNil and:[dstMenu == self]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3508
	    selection visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3509
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3510
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3511
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3512
	self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3513
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3514
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3515
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3516
handleSizeChanged:how
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3517
    "used to handle the scrollers and groups in a none popUpView
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3518
    "
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3519
    |layouts damage isVertical scrollBound|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3520
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3521
    (mustRearrange or:[items size == 0 or:[self isPopUpView]]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3522
	^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3523
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3524
    mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3525
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3526
    shown ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3527
	^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3528
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3529
    layouts := OrderedCollection new.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3530
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3531
    items do:[:el| |layout|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3532
	(layout := el layout) isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3533
	    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3534
	    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3535
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3536
	layouts add:layout.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3537
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3538
    isVertical  := self verticalLayout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3539
    scrollBound := self scrollerBoundsAt:#NEXT.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3540
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3541
    self rearrangeItems.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3542
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3543
    items keysAndValuesDo:[:i :el| |newLyt oldLyt|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3544
	damage isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3545
	    newLyt := el layout.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3546
	    oldLyt := layouts at:i ifAbsent:newLyt.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3547
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3548
	    newLyt ~= oldLyt ifTrue:[ |x y start|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3549
		start := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3550
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3551
		i > 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3552
		    isVertical ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3553
			x := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3554
			y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3555
		    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3556
			y := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3557
			x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3558
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3559
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3560
		start <= 20 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3561
		    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3562
		    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3563
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3564
		damage := Rectangle left:x top:y extent:(self extent).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3565
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3566
	].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3567
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3568
    damage isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3569
	damage := scrollBound.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3570
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3571
    scrollBound := lastDrawnScrollerNextBounds.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3572
    scrollBound notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3573
	damage := damage merge:scrollBound
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3574
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3575
    self invalidate:damage.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3576
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3577
    "Modified: / 29-06-2011 / 16:24:59 / cg"
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3578
!
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3579
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3580
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3581
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3582
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3583
    <resource: #keyboard (#Escape
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3584
			  #Tab #FocusNext #FocusPrevious
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3585
			  #CursorLeft #CursorRight )>
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3586
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3587
    |menu menusSuperMenu sensor|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3588
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3589
    sensor := self sensor.
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3590
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3591
"/    sensor anyButtonPressed ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3592
"/        ^ self  "/ ignored while any button is pressed
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3593
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3594
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3595
    self scrollActivity isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3596
	key ~~ #Escape ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3597
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3598
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3599
	self scrollActivity stop
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3600
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3601
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3602
       (key == #Tab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3603
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3604
    or:[key == #FocusPrevious]]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3605
	self accept:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3606
	^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3607
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3608
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3609
    menu := self detectGrabMenu.
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3610
    menusSuperMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3611
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  3612
    (key == #Escape) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3613
	"/ must hide the active menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3614
	menusSuperMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3615
	    "/ hide active menu but keep the grab
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3616
	    menusSuperMenu selection hideSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3617
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3618
	    "/ hide active menu and ungrab
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3619
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3620
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3621
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3622
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3623
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3624
    menu isViewWrapper ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3625
	sensor compressKeyPressEventsWithKey:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3626
	menu handleKeyPress:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3627
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3628
    ].
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3629
    menusSuperMenu == self ifFalse:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3630
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3631
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3632
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3633
	(self containsPoint:x@y) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3634
	    self handleKeyPress:key.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3635
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3636
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3637
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3638
3834
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3639
mapped
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3640
    super mapped.
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3641
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3642
    "/ if I come up with a pressed button, react on release instead.
5191
61ec3a24b042 #BUGFIX by sr
sr
parents: 5190
diff changeset
  3643
    gc device anyButtonPressed ifTrue:[ hideOnRelease := true ].
3834
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3644
!
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3645
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3646
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3647
    "mousewheel action"
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3648
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3649
    |menu|
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3650
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3651
    menu := self detectGrabMenu.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3652
    menu isViewWrapper ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3653
        menu superMenu ~~ self ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3654
        menu := self.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3655
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3656
    "/ support line and page scrolling
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3657
    menu shown ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3658
        self window sensor shiftDown ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3659
            amount > 0 ifTrue:[menu pageUp]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3660
                      ifFalse:[menu pageDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3661
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3662
            amount > 0 ifTrue:[menu scrollUp]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3663
                      ifFalse:[menu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3664
        ].
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3665
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3666
!
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3667
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3668
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3669
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3670
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3671
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3672
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3673
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3674
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3675
    (selection isNil or:[self isPopUpView]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3676
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3677
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3678
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3679
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3680
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3681
    windowGroup focusView ~~ self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3682
	self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3683
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3684
	selection isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3685
	    sensor := self sensor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3686
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3687
	    sensor isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3688
		self accept:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3689
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3690
		"/ 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
  3691
		sensor anyButtonPressed ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3692
		    self selection:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3693
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3694
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3695
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3696
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3697
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3698
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3699
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3700
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3701
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3702
"/    self isPopUpView ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3703
"/        mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3704
"/        self invalidate
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3705
"/    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3706
"/    ^ super sizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3707
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3708
    self handleSizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3709
    super sizeChanged:how.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3710
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3711
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3712
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3713
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3714
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3715
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3716
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3717
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3718
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3719
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3720
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3721
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3722
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3723
    ev isDamage ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3724
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3725
    ].
5376
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3726
    device isNil ifTrue:[
5386
4a69442cbcd1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5376
diff changeset
  3727
        "/ 'MenuPanel - leftover event ignored' infoPrintCR.
5376
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3728
        ^ self
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3729
    ].
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3730
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3731
    (superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3732
        focusView ~~ self ifTrue:[prevFocusView := focusView].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3733
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3734
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3735
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3736
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3737
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3738
    implicitGrabView notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3739
        self sensor leftButtonPressed ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3740
            self clearImplicitGrab.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3741
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3742
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3743
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3744
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3745
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3746
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3747
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3748
    implicitGrabView notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3749
        ev isButtonEvent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3750
            p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3751
            ev view:implicitGrabView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3752
            ev arguments at:2 put:p x.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3753
            ev arguments at:3 put:p y.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3754
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3755
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3756
            ev isButtonReleaseEvent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3757
                self clearImplicitGrab.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3758
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3759
            ^ self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3760
        ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3761
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3762
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3763
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3764
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3765
        self clearImplicitGrab.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3766
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3767
    ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3768
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3769
    p := menu translateGrabPoint:(x@y).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3770
    view := self detectViewAtX:(p x) y:(p y) in:menu.
3630
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3771
    view == self ifTrue:[^self].  "MB:changed - recursion"
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3772
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3773
    p := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3774
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3775
    ev isButtonPressEvent ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3776
        (view wantsFocusWithButtonPress) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3777
            view requestFocus.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3778
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3779
        view ~~ self ifTrue:[ "/ can this ever be self ?
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3780
            implicitGrabView := view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3781
        ]
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3782
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3783
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3784
    ev isButtonMotionEvent ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3785
        lastPointerView ~~ view ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3786
            "/ must generate enter/leave ... (sigh)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3787
            lastPointerView notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3788
                "/ XXX: should be fixed
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3789
                syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3790
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3791
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3792
            view notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3793
                syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3794
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3795
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3796
            lastPointerView := view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3797
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3798
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3799
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3800
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3801
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3802
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3803
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3804
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3805
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3806
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3807
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3808
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3809
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3810
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3811
    |menu item translatedPoint containsPoint direction|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3812
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3813
    containsPoint := self containsPoint:motionPoint.
3975
ca
parents: 3966
diff changeset
  3814
    (containsPoint not and:[items size > 0]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3815
	"/ 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
  3816
	"/ current selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3817
	item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3818
	item notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3819
	    |visibleSubmenu point|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3820
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3821
	    visibleSubmenu := item visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3822
	    visibleSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3823
		point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3824
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3825
		(visibleSubmenu containsPoint:point) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3826
		    selection notNil ifTrue:[ selection invalidate ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3827
		    selection := item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3828
		    selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3829
		    visibleSubmenu becomesActiveMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3830
		    ^ self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3831
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3832
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3833
	    item := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3834
	].
3975
ca
parents: 3966
diff changeset
  3835
    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3836
    containsPoint ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3837
	item := self itemAtPoint:motionPoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3838
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3839
4183
280e1f0f4030 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3840
    "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
  3841
    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
  3842
    direction notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3843
	self pointerEntersItem:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3844
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3845
	self sensor anyButtonPressed ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3846
	    self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3847
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3848
	^ 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
  3849
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3850
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3851
    "/ self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3852
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3853
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3854
	(self selectionFollowsMouse
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3855
	 and:[self topMenu focusComesByTab not]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3856
	) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3857
	    self isPopUpView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3858
		item isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3859
		    superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3860
			translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3861
			superMenu handleButtonMotion:state atPoint:translatedPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3862
		    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3863
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3864
		    self selectAndOpenDelayed:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3865
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3866
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3867
		"/ processing in the toolbar
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3868
		(item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3869
		    self selectAndOpenDelayed:item.
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3870
"/                    self selection:item openMenu:true.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3871
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3872
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3873
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3874
	^ self
3975
ca
parents: 3966
diff changeset
  3875
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3876
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3877
    containsPoint ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3878
	self isPopUpView ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3879
	    self selectAndOpenDelayed:item.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3880
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3881
	    "/ also open delayed if I am the top-menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3882
	    self selectAndOpenDelayed:item.
4191
bd66cf091adb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4185
diff changeset
  3883
"/            self selection:item openMenu:true.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3884
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3885
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3886
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3887
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3888
    menu := self superMenuAtPoint:motionPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3889
    menu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3890
	translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3891
	menu handleButtonMotion:state atPoint:translatedPoint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3892
	^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3893
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3894
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3895
	self selection:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3896
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3897
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3898
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3899
handleButtonPress:button atPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3900
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3901
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3902
    |item scrollerDirectionOrNil wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3903
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3904
    "/ is a scroller-button present and hit ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3905
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3906
    scrollerDirectionOrNil notNil ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3907
        (self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3908
            self pointerEntersItem:nil.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3909
            ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3910
        ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3911
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3912
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3913
    item := self itemAtPoint:aPoint.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3914
    item isNil ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3915
        self selection:nil openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3916
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3917
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3918
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3919
    "/ right button always immediately pulls the delayedMenu
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3920
    button == 2 ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3921
        item hasDelayedMenu ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3922
            self selection:item openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3923
            self openDelayed:item afterSeconds:0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3924
            ^ self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3925
        ].
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3926
    ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  3927
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3928
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3929
    wasSelected ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3930
        self selection:item openMenu:true.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3931
        "/ make sure that a momentary press is visible
5345
1411504c964d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5344
diff changeset
  3932
        (item hasIndication or:[item hasSubmenu and:[item hasDelayedMenu not]]) ifFalse:[
5344
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  3933
            self repairDamage.
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  3934
            Delay waitForSeconds:0.1.
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  3935
        ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3936
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3937
    item hasDelayedMenu ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3938
        "/ clicked on the arrow icon ?
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3939
        (item menuIndicatorContains:aPoint) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3940
            self selection:item openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3941
            self openDelayed:item afterSeconds:0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3942
            ^ self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3943
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3944
        ^ self
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3945
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3946
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3947
    (item isToggle or:[item triggerOnDown]) ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3948
        (wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3949
            item toggleSubmenuVisibility
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3950
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3951
        ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3952
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3953
    (item canAccept and:[item == self selection]) ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3954
        ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3955
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3956
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3957
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3958
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3959
    [ (device notNil and:[device anyButtonPressed]) ] whileTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3960
        "/ using device - sensor is not updated sometimes
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3961
        Delay waitForSeconds:0.1.
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3962
    ].
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  3963
    self sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3964
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3965
5344
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  3966
    "Created: / 13-11-2001 / 14:12:04 / cg"
5345
1411504c964d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5344
diff changeset
  3967
    "Modified: / 20-11-2016 / 13:20:04 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3968
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3969
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3970
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3971
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3972
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3973
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3974
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3975
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3976
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3977
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3978
    (size  := items size) == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3979
	superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3980
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3981
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3982
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3983
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3984
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  3985
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3986
	(isVrt and:[aKey == #CursorDown]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3987
	    idx := items findFirst:[:el | el notNil and:[ el canSelect ]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3988
	    idx ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3989
		self selection:(items at:idx).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3990
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3991
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3992
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3993
	(isVrt and:[aKey == #CursorUp]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3994
	    idx := items findLast:[:el | el notNil and:[ el canSelect ]].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3995
	    idx ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3996
		self selection:(items at:idx).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3997
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3998
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  3999
	]
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  4000
    ].
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  4001
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4002
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4003
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4004
    ) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4005
	selection isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4006
	    (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4007
		^ superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4008
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4009
	    idx := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4010
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4011
	    isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4012
		"/ used because of vertical scrolling
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4013
		idx := items findFirst:[:el| el layout top > 0 ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4014
		idx ~~ 0 ifTrue:[idx := idx - 1 ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4015
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4016
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4017
	    idx := self indexOf:selection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4018
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4019
	next := aKey == #CursorRight or:[aKey == #CursorDown].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4020
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4021
	idx0 := idx.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4022
	size timesRepeat:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4023
	    |el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4024
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4025
	    next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4026
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4027
	    idx > size ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4028
		idx := 0 "1"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4029
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4030
		idx < 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4031
		    idx := size
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4032
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4033
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4034
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4035
	    idx == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4036
		self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4037
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4038
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4039
		(el := items at:idx ifAbsent:nil) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4040
		    el canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4041
			el hasDelayedMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4042
			    "/ do not open menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4043
			    self selection:el openMenu:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4044
			] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4045
			    "/ open comes from style-sheet
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4046
			    self selection:el.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4047
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4048
			^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4049
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4050
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4051
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4052
	    idx == idx0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4053
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4054
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4055
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4056
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4057
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4058
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4059
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4060
	p1 := self translateGrabPoint:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4061
	p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4062
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4063
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4064
    isVrt ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4065
	(superMenu notNil and:[p1 x > p2 x]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4066
	    backKey := #CursorRight
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4067
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4068
	    backKey := #CursorLeft.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4069
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4070
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4071
	(superMenu notNil and:[p1 y > p2 y]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4072
	    backKey := #CursorDown
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4073
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4074
	    backKey := #CursorUp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4075
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4076
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4077
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4078
    aKey == backKey ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4079
	superMenu isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4080
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4081
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4082
	    superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4083
		superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4084
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4085
		superMenu selection hideSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4086
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4087
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4088
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4089
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4090
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4091
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4092
	superMenu isNil ifTrue:[^ self accept:nil].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4093
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4094
	superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4095
	    superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4096
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4097
	    (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4098
		self selectionIndex:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4099
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4100
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4101
	^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4102
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4103
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4104
    selection hasSubmenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4105
	(menu := selection visibleSubmenu) isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4106
	    selection toggleSubmenuVisibility
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4107
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4108
	    menu selectionIndex:1
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4109
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4110
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4111
	superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4112
	    superMenu verticalLayout ~~ isVrt ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4113
		superMenu handleCursorKey:aKey
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4114
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4115
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4116
	    self accept:nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4117
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4118
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4119
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4120
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4121
handleKeyPress:key
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4122
    <resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)>
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4123
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4124
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4125
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4126
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4127
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4128
    (key == #Return or:[key == Character space]) ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4129
        self handleReturnPressed.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4130
        ^ true.
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4131
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4132
    key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4133
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4134
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4135
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4136
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4137
"/            ].
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4138
        inMenu := self.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4139
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4140
        (item := inMenu detectItemForKey:key) notNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4141
            inMenu selection:item
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4142
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4143
        ^ true
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4144
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4145
    (key == #CursorDown
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4146
        or:[key == #CursorUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4147
        or:[key == #CursorLeft
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4148
        or:[key == #CursorRight]]])
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4149
    ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4150
        self handleCursorKey:key.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4151
        ^ true
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4152
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4153
    "/ handle scrolling keys"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4154
    key == #EndOfLine    ifTrue:[self scrollToBottom. ^ true ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4155
    key == #BeginOfLine  ifTrue:[self scrollToTop. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4156
    key == #NextPage     ifTrue:[self pageDown. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4157
    key == #PreviousPage ifTrue:[self pageUp. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4158
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4159
    ^ false.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4160
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4161
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4162
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4163
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4164
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4165
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4166
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4167
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4168
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4169
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4170
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4171
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4172
    (item := selection) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4173
	superMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4174
	    item := superMenu selection.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4175
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4176
	    item value notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4177
		"/ is a delayed menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4178
		self accept:item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4179
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4180
		item toggleSubmenuVisibility
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4181
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4182
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4183
	    self accept
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4184
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4185
	^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4186
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4187
    selection hasSubmenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4188
	selection hasDelayedMenu ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4189
	    selection toggleSubmenuVisibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4190
	  ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4191
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4192
	subm := selection currentSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4193
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4194
	(subm notNil and:[subm shown]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4195
	    selection toggleSubmenuVisibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4196
	  ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4197
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4198
	self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4199
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4200
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4201
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4202
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4203
    item isToggle ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4204
	self selection:item.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4205
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4206
	(selection notNil and:[selection triggerOnDown]) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4207
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4208
	]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4209
    ].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4210
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4211
    (sensor := self sensor) isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4212
	^ self
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4213
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4214
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4215
    [
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4216
	sensor flushKeyboardFor:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4217
	Delay waitForSeconds:0.1.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4218
	sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4219
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4220
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4221
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4222
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4223
    "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
  4224
     redraw the new item highlighted."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4225
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4226
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4227
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4228
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4229
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4230
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4231
     and:[self isPopUpView not]]]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4232
	anItemOrNil isButton ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4233
	    (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4234
	     or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4235
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4236
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4237
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4238
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4239
	    (self enteredLevel ~~ 0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4240
	      or:[self enteredBackgroundColor ~= self backgroundColor]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4241
	    ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4242
		newItem := anItemOrNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4243
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4244
	]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4245
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4246
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4247
    newItem ~~ enteredItem ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4248
	oldItem     := enteredItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4249
	enteredItem := newItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4250
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4251
	oldItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4252
	    self invalidateItem:oldItem repairNow:(enteredItem isNil).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4253
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4254
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4255
	enteredItem notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4256
	    self invalidateItem:enteredItem repairNow:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4257
	].
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4258
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4259
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4260
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4261
processHideMenuEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4262
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4263
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4264
    "Modified: / 29-06-2011 / 16:39:36 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4265
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4266
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4267
processMenuEnterItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4268
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4269
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4270
    "Created: / 29-06-2011 / 13:18:05 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4271
    "Modified: / 29-06-2011 / 16:39:29 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4272
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4273
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4274
processMenuSelectItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4275
    |winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver acceptAction|
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4276
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4277
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4278
    winGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4279
	masterGroup := winGrp previousGroup.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4280
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4281
    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4282
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4283
    item := ev item.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4284
    itemIndex := ev itemIndex.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4285
    itemValue := ev itemValue.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4286
    menuReceiver := ev menuReceiver.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4287
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4288
    acceptAction := [ self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4289
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4290
    (item showBusyCursorWhilePerforming
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4291
    and:[winGrpForBusyCursor notNil])
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4292
    ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4293
	winGrpForBusyCursor withWaitCursorDo:acceptAction
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4294
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4295
	acceptAction value
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4296
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4297
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4298
    "Modified: / 29-06-2011 / 16:32:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4299
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4300
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4301
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4302
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4303
canTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4304
    "depends whether I'am a toolbar and selectable items exists
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4305
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4306
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4307
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4308
    (super canTab and:[self isPopUpView not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4309
	selectableItem := self firstItemSelectable.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4310
	^ selectableItem notNil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4311
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4312
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4313
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4314
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4315
focusComesByTab
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4316
    "returns true if focus comes by tab and should be drawn"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4317
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4318
    focusComesByTab == true ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4319
	(shown and:[self hasFocus]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4320
	    ^ true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4321
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4322
	focusComesByTab := false.
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4323
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4324
    ^ false
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4325
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4326
    "Modified: / 29-06-2011 / 16:23:09 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4327
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4328
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4329
focusComesByTab:aBoolean
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4330
    "only handled for toolBars"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4331
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4332
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4333
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4334
    (self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4335
	focusComesByTab := aBoolean.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4336
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4337
	self hasSelection ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4338
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4339
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4340
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4341
	aBoolean ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4342
	    selectableItem := self firstItemSelectable.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4343
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4344
	self selection:selectableItem openMenu:false.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4345
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4346
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4347
    "Modified: / 29-06-2011 / 16:23:19 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4348
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4349
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4350
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4351
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4352
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4353
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4354
	"/ not visible for popup menus
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4355
	^ super hasKeyboardFocus:aBoolean
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4356
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4357
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4358
"/    (aBoolean not and:[hasImplicitGrap ~~ true]) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4359
"/        (windowGroup focusView ~~ self) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4360
"/            self selection:nil.
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4361
"/        ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4362
"/    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4363
    super hasKeyboardFocus:aBoolean.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4364
!
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4365
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4366
showFocus:focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4367
    self focusComesByTab:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4368
    super showFocus:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4369
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4370
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4371
showNoFocus:focusByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4372
    self focusComesByTab:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4373
    super showNoFocus:focusByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4374
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4375
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4376
supportsFocusOnTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4377
    "returns true if focus is supported
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4378
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4379
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4380
!
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4381
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4382
wantsFocusWithButtonPress
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4383
    "needs only the focus if I'am a toolbar; all events are delegated
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4384
     to my subMenus"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4385
4153
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4386
"/ old:
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4387
"/    ^ self isPopUpView not
2de187bba3f8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4152
diff changeset
  4388
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4389
    "/ I am not sure how this really should be -
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4390
    "/ I guess, it needs a more intelligent and dynamic decision.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4391
    "/ for now, the menuPanelTakesFocusOnClick returns true, otherwise,
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4392
    "/ we cannot control menus with the keyboard.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4393
    self isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4394
	^ false
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4395
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4396
	^ UserPreferences current menuPanelTakesFocusOnClick.
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4397
    ]
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4398
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4399
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4400
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4401
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4402
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4403
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4404
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4405
    superMenu notNil ifTrue:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4406
        superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4407
    ] ifFalse:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4408
        hasImplicitGrap ~~ true ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4409
            self grabMouseAndKeyboard.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4410
            hasImplicitGrap := true
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4411
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4412
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4413
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4414
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4415
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4416
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4417
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4418
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4419
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4420
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4421
	forceDo ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4422
	    superMenu doUngrab:true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4423
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4424
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4425
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4426
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4427
    hasImplicitGrap ~~ true ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4428
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4429
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4430
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4431
    forceDo ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4432
	(selection notNil or:[prevFocusView == self]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4433
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4434
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4435
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4436
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4437
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4438
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  4439
    prevFocusView   := nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4440
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4441
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4442
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4443
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4444
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4445
    previousKeyboardGrab := device activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  4446
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4447
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4448
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4449
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4450
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4451
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4452
    |winGroup sensor activeGrab|
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4453
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4454
    winGroup := self windowGroup.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4455
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4456
    (realized and:[winGroup notNil]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4457
        prevFocusView isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4458
             prevFocusView := winGroup focusView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4459
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4460
        sensor := self sensor.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4461
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4462
        device activePointerGrab ~~ self ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4463
            sensor flushMotionEventsFor:nil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4464
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4465
            (self grabPointer) ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4466
                Delay waitForSeconds:0.1.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4467
                (self grabPointer) ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4468
                    "give up"
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4469
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4470
                    self unmap
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4471
                ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4472
            ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4473
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4474
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4475
        (activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4476
            device sync.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4477
            "/ 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
  4478
"/            activeGrab notNil ifTrue:[
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4479
"/                sensor flushKeyboardFor:activeGrab.
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4480
"/            ].
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4481
            sensor flushKeyboardFor:nil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4482
            self grabKeyboard.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4483
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4484
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4485
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4486
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4487
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  4488
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4489
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4490
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4491
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4492
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4493
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4494
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4495
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4496
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4497
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4498
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4499
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4500
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4501
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4502
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4503
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4504
    (previousKeyboardGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4505
    and:[ previousKeyboardGrab realized ]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4506
        device grabKeyboardInView:previousKeyboardGrab.
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4507
    ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4508
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4509
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4510
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4511
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4512
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4513
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4514
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4515
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4516
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4517
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4518
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4519
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4520
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4521
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4522
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4523
    and:[ previousPointerGrab realized ]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4524
        device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4525
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4526
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4527
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4528
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4529
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4530
flyByHelpSpec
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4531
    "allows subclasses to provide texts"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4532
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4533
    pluggableHelpSpecProvider notNil ifTrue:[
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4534
        ^ pluggableHelpSpecProvider flyByHelpSpec.
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4535
    ].    
5190
516ad18734b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5168
diff changeset
  4536
    ^ Dictionary new.
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4537
!
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4538
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4539
flyByHelpSpecProvider:aSpecProvider
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4540
    "pluggable helpspec provider"
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4541
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4542
    pluggableHelpSpecProvider := aSpecProvider
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4543
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4544
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4545
flyByHelpTextAt:aPoint
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4546
    "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
  4547
     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
  4548
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4549
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4550
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4551
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4552
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4553
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4554
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4555
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4556
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4557
    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
  4558
    ^ nil
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4559
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4560
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4561
flyByHelpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4562
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4563
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  4564
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4565
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4566
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  4567
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4568
flyByHelpTextForKey:aKey
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4569
    |app text spec|
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4570
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4571
    app := self application.
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4572
    app notNil ifTrue:[
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4573
        text := app flyByHelpTextForKey:aKey.
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4574
        text notNil ifTrue:[^ text].
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4575
    ].
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4576
    spec := self flyByHelpSpec.
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4577
    spec isNil ifTrue:[^ nil].
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4578
    ^ spec at:aKey ifAbsent:nil
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4579
!
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  4580
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4581
helpText
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4582
    "return the helpText for the currently selected item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4583
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4584
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4585
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4586
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4587
helpTextAt:aPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  4588
    "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
  4589
     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
  4590
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4591
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4592
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4593
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4594
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4595
    scrollerDirectionOrNil notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4596
	^ 'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4597
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4598
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4599
    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
  4600
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4601
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4602
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4603
helpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4604
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4605
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4606
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4607
    ^ anItem activeHelpText.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4608
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4609
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4610
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
  4611
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4612
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4613
    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
  4614
    dstMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4615
	dstPoint := dstMenu translateGrabPoint:srcPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4616
	item := dstMenu itemAtPoint:dstPoint.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4617
	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
  4618
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4619
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4620
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4621
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4622
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  4623
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4624
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4625
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4626
    ^ self class image:anImage value onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4627
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4628
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4629
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4630
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4631
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4632
    ^ self class lightenedImage:anImage onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4633
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4634
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  4635
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4636
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4637
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4638
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4639
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4640
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4641
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4642
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4643
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4644
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4645
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4646
    self isPopUpView ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4647
        (PopUpView shadowsOnDevice:device) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4648
            shadowView isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4649
                shadowView := (ShadowView onDevice:device) for:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4650
            ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4651
                self saveUnder:true.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4652
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4653
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4654
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4655
        self hasExplicitExtent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4656
            (self width) == (superView width) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4657
                self verticalLayout:false
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4658
            ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4659
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4660
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4661
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4662
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4663
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4664
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4665
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4666
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4667
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4668
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4669
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4670
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4671
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4672
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4673
    super destroy.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4674
    prevFocusView := superMenu := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4675
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4676
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4677
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4678
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4679
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4680
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4681
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4682
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4683
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4684
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4685
    superMenu notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4686
        styleSheet := superMenu styleSheet
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4687
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4688
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4689
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4690
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  4691
    "/ that's a kludge - will be replaced by values from the styleSheet ...
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4692
    "/ (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
  4693
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4694
    superMenu isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4695
        rightArrow isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4696
            rightArrow := SelectionInListView rightArrowFormOn:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4697
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4698
        fgColor := fgColor onDevice:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4699
        style   := styleSheet name.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4700
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4701
        (style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4702
            rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4703
        ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4704
            rightArrowShadow := nil
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4705
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4706
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4707
        rightArrow       := superMenu rightArrow.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4708
        rightArrowShadow := superMenu rightArrowShadow.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4709
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4710
        self foregroundColor:(superMenu foregroundColor).
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4711
        self             font:(superMenu font).
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4712
"/        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4713
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4714
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4715
    items notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4716
        items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4717
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4718
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4719
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4720
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4721
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4722
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4723
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4724
2919
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4725
    <resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4726
                       #'menu.buttonItemVerticalSpace'   #'menu.itemSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4727
                       #'menu.itemHorizontalSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4728
                       #'menu.extraMargin'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4729
                       #'button.activeBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4730
                       #'button.buttonEnteredBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4731
                       #'button.buttonPassiveBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4732
                       #'popup.hideOnRelease'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4733
                       )>
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4734
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4735
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4736
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4737
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4738
    buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4739
    buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4740
    buttonInsetX := buttonInsetX abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4741
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4742
    buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4743
    buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4744
    buttonInsetY := buttonInsetY abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4745
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4746
    itemSpace := styleSheet at:#'menu.itemHorizontalSpace'.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4747
    itemSpace isNil ifTrue:[ 
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4748
        itemSpace := styleSheet at:#'menu.itemSpace' default:[ gc font widthOf:' '] 
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4749
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4750
    extraMargin := styleSheet at:#'menu.extraMargin' default:0.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4751
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4752
    fgColor := DefaultForegroundColor.
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4753
    fgColor isNil ifTrue:[ fgColor := Color black ].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4754
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4755
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  4756
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  4757
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4758
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4759
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4760
    buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4761
    buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4762
    buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4763
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4764
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4765
    buttonActiveLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4766
        buttonActiveLevel := styleSheet at:#'button.activeLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4767
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4768
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4769
    buttonPassiveLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4770
        buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4771
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4772
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4773
    buttonEnteredLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4774
        buttonEnteredLevel := styleSheet at:#'button.enteredLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4775
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4776
    
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4777
    self updateLevelAndBorder.
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4778
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4779
    "Modified (format): / 19-01-2012 / 13:19:19 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4780
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4781
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4782
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4783
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4784
4454
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  4785
    mustRearrange       := false.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  4786
    sizeFixed := true.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4787
    extraMargin := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4788
    
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4789
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4790
2877
6f7df547445b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  4791
    self enableMotionEvents.  "/ for flyByHelp
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4792
    enabled := true.
3881
0db3473b4eca changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3878
diff changeset
  4793
    self originChangedFlag:false extentChangedFlag:false.
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4794
    "/ explicitExtent      := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4795
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4796
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4797
    showGroupDivider    := true.
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4798
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4799
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4800
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4801
map
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4802
    "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
  4803
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4804
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4805
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4806
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4807
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4808
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4809
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4810
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4811
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4812
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4813
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4814
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4815
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4816
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4817
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4818
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4819
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4820
	self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4821
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4822
	super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4823
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4824
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4825
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4826
    loIndices size > 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4827
	self redrawX:0 y:0 width:width height:height.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4828
	self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4829
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4830
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  4831
    "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
  4832
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4833
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4834
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4835
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4836
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4837
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4838
    |bgColor|
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4839
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4840
    self isPopUpView ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4841
	bgColor := styleSheet colorAt:'menu.backgroundColor'.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4842
	bgColor notNil ifTrue:[ self viewBackground:bgColor ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4843
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4844
	"Because of #saveUnder of ShadowView the order of realize is significant:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4845
	 shadowView must be realized before self"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4846
	self hiddenOnRealize:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4847
	super realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4848
	self resize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4849
	self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4850
"/        self mustRearrange.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4851
	shadowView notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4852
	    shadowView realize.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4853
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4854
	self raise.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4855
	self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4856
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4857
	super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4858
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4859
    self allSubViewsDo:[:aView| aView realize ].
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4860
    "/ hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4861
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4862
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4863
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  4864
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4865
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4866
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  4867
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4868
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4869
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4870
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4871
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4872
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4873
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4874
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4875
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4876
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4877
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4878
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4879
    self do:[:anItem |
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4880
	anItem reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4881
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4882
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4883
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  4884
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4885
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4886
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4887
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  4888
    "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
  4889
     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
  4890
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4891
    mapTime := nil.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  4892
3975
ca
parents: 3966
diff changeset
  4893
    "hide all submenus opened within the menu"
ca
parents: 3966
diff changeset
  4894
    self itemsDo:[:eachItem|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4895
	eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ].
3975
ca
parents: 3966
diff changeset
  4896
    ].
ca
parents: 3966
diff changeset
  4897
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4898
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4899
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4900
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4901
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4902
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4903
"/    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4904
    prevFocusView := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4905
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4906
    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
  4907
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4908
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4909
updateLevelAndBorder
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4910
    "update level & border"
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4911
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4912
    <resource: #style (#'popup.borderWidth'
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4913
                       #'popup.borderColor'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4914
                       #'popup.level'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4915
                       #'pullDownMenu.level'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4916
                       )>
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4917
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  4918
    |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
  4919
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4920
    self isPopUpView ifTrue:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4921
        bw  := styleSheet at:#'popup.borderWidth' default:1.
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4922
        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
  4923
    ] ifFalse:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4924
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4925
        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
  4926
    ].
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4927
    bw ~~ 0 ifTrue:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4928
        bc  := styleSheet at:#'popup.borderColor' default:self blackColor.
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  4929
        self borderColor:bc
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  4930
    ].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4931
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4932
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4933
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4934
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4935
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4936
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4937
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4938
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4939
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4940
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4941
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4942
    |menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel|
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4943
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4944
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4945
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4946
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4947
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  4948
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4949
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4950
    accessCharacterMatchQuery :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4951
	[:el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4952
	    |k|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4953
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4954
	    k := el accessCharacter.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4955
	    k == uKey or:[k == lKey]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4956
	].
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4957
    maxShortCutSearchLevel := self class maxShortCutSearchLevel.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  4958
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4959
    selection notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4960
	"first lookup the current grapMenu before starting in the topMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4961
	"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4962
	menu := self detectGrabMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4963
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4964
	[ menu ~~ self ] whileTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4965
	    index := menu selectionIndex.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4966
	    list  := menu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4967
			selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4968
			maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4969
			ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4970
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4971
	    list size ~~ 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4972
		"/ has item which responds to the mnemonic
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4973
		menu processCollectedShortcutIndices:list.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4974
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4975
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4976
	    menu := menu superMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4977
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4978
	index := self selectionIndex.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4979
	list  := self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4980
		    selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4981
		    maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4982
		    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
  4983
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4984
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4985
	index := 99999.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4986
	list  := nil.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4987
    ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  4988
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4989
    list isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4990
	list := self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4991
		    selectItemIndicesFor:accessCharacterMatchQuery
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4992
		    maxDepth:maxShortCutSearchLevel from:1 to:index
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4993
		    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4994
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4995
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4996
	list isNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4997
	    "/ must clear existing selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4998
	    self selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  4999
	    ^ nil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5000
	]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5001
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5002
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5003
    "/ has item which responds to the mnemonic
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5004
    self processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5005
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5006
    "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
  5007
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5008
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5009
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5010
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5011
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5012
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5013
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5014
    anItemIndiceList size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5015
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5016
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5017
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5018
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5019
    (item notNil and:[item enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5020
	InitialSelectionQuerySignal answer:anItemIndiceList do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5021
	    self selection:item openMenu:true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5022
	]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5023
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5024
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5025
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5026
processCollectedShortcutIndices:indices
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5027
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5028
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5029
    indices size == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5030
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5031
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5032
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5033
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  5034
    "/ first lookup in current open submenus
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5035
    [menu selectionIndex == indices first] whileTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5036
	(    (item := menu selection) isNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5037
	 or:[(menu := item currentSubmenu) isNil]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5038
	) ifTrue:[ "/ selected but no submenu open - not handled
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5039
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5040
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5041
	indices removeFirst.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5042
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5043
	indices isEmpty ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5044
	   menu selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5045
	    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5046
	]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5047
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5048
    menu openMenusFromItemIndices:indices.
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  5049
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  5050
    "Modified: / 24-03-2011 / 11:19:38 / cg"
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5051
    "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
  5052
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5053
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5054
processShortcut:aKeyEvent
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  5055
    "a shortcutKey event as forwarded from the keyboardProcessor.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  5056
     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
  5057
     Otherwise return false."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5058
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5059
    |menu rawKey logicalKey list item selectableItem|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5060
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5061
    superMenu notNil ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5062
        ^ superMenu processShortcut:aKeyEvent
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5063
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5064
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5065
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5066
    logicalKey := aKeyEvent key.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5067
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5068
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5069
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  5070
    ( #( CursorDown CursorUp CursorRight CursorLeft Return Escape
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5071
       ) includes:logicalKey
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5072
    ) ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5073
        ^ false.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5074
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  5075
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5076
    rawKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5077
    item := nil.
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5078
    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
  5079
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  5080
    "/ 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
  5081
    aKeyEvent isKeyReleaseEvent ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5082
        selection isNil ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5083
            prevFocusView := self windowGroup focusView.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5084
            self requestFocus. "/ self windowGroup focusView:self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5085
            selectableItem := self firstItemSelectable.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5086
            self selection:selectableItem openMenu:false.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5087
        ] ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5088
            prevFocusView requestFocus.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5089
            self selection:nil.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5090
        ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5091
        ^ true
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5092
    ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5093
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5094
    Menu::NeedResourcesQuery answer:false do:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5095
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5096
        [true] whileTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5097
            list := menu
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5098
                        selectItemIndicesFor:[:el|
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5099
                            |skey|
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5100
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5101
                            item := el.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5102
                            el ignoreShortcutKeys ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5103
                                false
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5104
                            ] ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5105
                                skey := el shortcutKey.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5106
                                skey == rawKey or:[skey == logicalKey]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5107
                            ]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5108
                        ]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5109
                        maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5110
                        ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5111
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5112
            list size ~~ 0 ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5113
                "/ has item which responds to the shortcut
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5114
                item hasSubmenu ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5115
                    menu accept:item
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5116
                ] ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5117
                    menu processCollectedShortcutIndices:list.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5118
                    self requestFocus. "/ self windowGroup focusView:self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5119
                ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5120
                ^ true
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5121
            ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5122
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5123
            menu == self ifTrue:[ ^ false ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5124
            menu := self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5125
        ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5126
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5127
    ^ false     "/ never reached
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5128
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5129
    "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
  5130
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5131
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5132
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
  5133
    "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
  5134
     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
  5135
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5136
     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
  5137
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5138
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5139
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5140
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5141
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5142
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5143
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5144
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5145
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5146
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5147
    start to:stop do:[:i|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5148
	|item menu result|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5149
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5150
	item := items at:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5151
	(item enabled and:[item isVisible]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5152
	    (aOneArgBlock value:item) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5153
		^ OrderedCollection with:i
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5154
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5155
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5156
	    maxDepth > 1 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5157
		(item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5158
		    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5159
			menu := item setupSubmenu.
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
			(menu notNil and:[menu isEnabled]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5162
			    result := menu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5163
					selectItemIndicesFor:aOneArgBlock
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5164
					maxDepth:(maxDepth - 1) from:1 to:99999
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5165
					ignoreSubmenuBlock:ignoreSubmenueBlock.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5166
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5167
			    result notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5168
				result addFirst:i.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5169
				^ result
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5170
			    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5171
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5172
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5173
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5174
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5175
	].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5176
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5177
    ^ nil
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5178
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5179
    "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
  5180
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5181
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5182
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5183
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5184
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5185
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5186
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5187
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5188
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5189
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5190
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5191
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5192
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5193
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5194
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5196
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5197
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5198
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5199
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5200
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5201
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5202
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5203
    [(smenu := menu superMenu) notNil] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5204
	menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5205
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5206
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5207
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5208
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  5209
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5210
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5211
printOn:aStream
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5212
    |label|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5213
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5214
    aStream nextPutAll:'Menu:'.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5215
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5216
    self do:[:eachItem|
5193
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5217
        label := eachItem label.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5218
        label notEmptyOrNil ifTrue:[
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5219
            aStream nextPutAll:'  '.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5220
            label printOn:aStream.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5221
        ].
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5222
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5223
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5224
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5225
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5226
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5227
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5228
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5229
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5230
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5231
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5232
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5233
	application := superMenu application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5234
	^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5235
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5236
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5237
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  5238
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5239
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5240
detectItem:aBlock
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5241
    "returns the item for which aBlock returns true."
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5242
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5243
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5244
	items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5245
	    (aBlock value:anItem) ifTrue:[^ anItem].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5246
	].
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5247
    ].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5248
    ^ nil
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5249
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5250
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5251
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5252
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5253
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5254
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5255
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5256
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5257
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5258
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5259
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5260
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5261
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5262
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5263
    items keysAndValuesDo:[:anIndex :anItem|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5264
	|char label|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5265
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5266
	(     anIndex ~~ cIdx
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5267
	 and:[anItem canSelect
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5268
	 and:[(label := anItem textLabel) notNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5269
	 and:[label size ~~ 0]]]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5270
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5271
	    (char := anItem accessCharacter) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5272
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5273
		    ^ anItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5274
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5275
	    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5276
		char := label at:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5277
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5278
		(char == uKey or:[char == lKey]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5279
		    anIndex > cIdx ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5280
			^ anItem
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5281
		    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5282
		    item isNil ifTrue:[item := anItem]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5283
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5284
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5285
	]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5286
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5287
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5288
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5289
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5290
detectItemForLabel:aLabel
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5291
    ^ self detectItem:[:anItem | anItem label = aLabel].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5292
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5293
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5294
detectItemForNameKey:aKey
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5295
    ^ self detectItem:[:anItem | anItem nameKey == aKey].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5296
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5297
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5298
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5299
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5300
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5301
    aList isCollection ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5302
	items size >= aList size ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5303
	    aList keysAndValuesDo:[:anIndex :anArg|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5304
		(items at:anIndex) perform:aSelector with:anArg
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5305
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5306
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5307
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5308
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5309
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5310
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5311
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5312
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5313
    anImage isNil ifTrue:[ ^ nil ].
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  5314
    ^ self class image:anImage onDevice:device
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5315
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5316
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5317
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5318
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5319
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5320
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5321
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5322
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5323
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5324
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5325
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5326
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5327
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5328
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5329
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5330
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5331
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5332
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5333
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5334
	styleSheet       := superMenu styleSheet.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5335
	rightArrow       := superMenu rightArrow.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5336
	rightArrowShadow := superMenu rightArrowShadow.
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5337
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5338
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5339
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5340
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5341
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5342
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5343
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5344
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5345
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5346
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5347
    "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
  5348
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5349
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5350
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5351
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5352
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5353
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5354
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5355
    "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
  5356
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5357
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5358
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5359
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5360
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5361
    mapTime isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5362
	"/ set the mapTime if not yet done
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5363
	mapTime := Timestamp now.
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5364
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5365
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5366
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5367
    "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
  5368
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5369
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5370
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5371
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5372
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5373
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5374
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5375
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5376
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5377
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5378
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5379
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5380
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5381
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5382
    top activeMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5383
	top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5384
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5385
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5386
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5387
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5388
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5389
mapTime
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5390
    "get the time the menu was activated or nil"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5391
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5392
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5393
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5394
    "Modified: / 27.2.1998 / 17:41:18 / cg"
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5395
!
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5396
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5397
mapTime:aTimestamp
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5398
    "set the time the menu was activated"
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5399
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5400
    mapTime := aTimestamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5401
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5402
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5403
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5404
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5405
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5406
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5407
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5408
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5409
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5410
    self hasScrollers ifTrue:[ |layout item|
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5411
        aDirection == #PREV ifTrue:[
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5412
            item   := items detect:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5413
            layout := item layout.
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5414
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5415
          ^ self verticalLayout ifTrue:[ layout top  < margin]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5416
                               ifFalse:[ layout left < margin]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5417
        ].
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5418
        aDirection == #NEXT ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5419
            "/ must check for visibility
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5420
            item   := items detectLast:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5421
            layout := item layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5422
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5423
          ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5424
                               ifFalse:[ layout right  > (width  - margin)]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5425
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5426
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5427
    ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5428
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5429
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5430
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5431
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5432
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5433
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5434
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5435
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5436
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5437
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5438
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5439
    superView notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5440
	((first := items first layout) isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5441
	 or:[(last  := items last layout) isNil]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5442
	) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5443
	    ^ false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5444
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5445
	isVert ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5446
	    ^ first top < 0 or:[last bottom > height]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5447
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5448
	^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5449
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5450
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5451
    isVert ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5452
	^ (height >= maxExtent y)
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5453
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5454
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5455
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5456
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5457
indexOfFirstItemShown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5458
    "answer the index of the first item shown (scrolling) or 0"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5459
    items size == 0 ifTrue:[^ 0].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5460
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5461
    self verticalLayout ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5462
        ^ items findFirst:[:each|(each layout notNil and:[each layout top >= 0 and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5463
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5464
    ^ items findFirst:[:each|(each layout notNil and:[each layout left >= 0 and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5465
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5466
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5467
indexOfItemAtScroller:aDirection
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5468
     <resource: #obsolete>
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5469
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5470
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5471
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5472
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5473
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5474
    self hasScrollers ifFalse:[ ^ 0 ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5475
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5476
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5477
    self verticalLayout ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5478
        min := bounds top.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5479
        max := bounds bottom.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5480
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5481
        items keysAndValuesDo:[:anIndex :anItem|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5482
            anItem isVisible ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5483
                layout := anItem layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5484
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5485
                (layout top < max and:[layout bottom > min]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5486
                    ^ anIndex
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5487
                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5488
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5489
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5490
    ] ifFalse:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5491
        min := bounds left.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5492
        max := bounds right.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5493
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5494
        items keysAndValuesDo:[:anIndex :anItem|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5495
            anItem isVisible ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5496
                layout := anItem layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5497
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5498
                (layout left < max and:[layout right > min]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5499
                    ^ anIndex
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5500
                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5501
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5502
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5503
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5504
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5505
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5506
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5507
indexOfLastItemShown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5508
    "answer the index of the last item shown (scrolling) or 0"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5509
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5510
    items size == 0 ifTrue:[^ 0].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5511
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5512
    self verticalLayout ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5513
        ^ items findLast:[:each|(each layout notNil and:[each layout bottom <= height and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5514
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5515
    ^ items findLast:[:each|(each layout notNil and:[each layout right <= width and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5516
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5517
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5518
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5519
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5520
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5521
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5522
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5523
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5524
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5525
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5526
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5527
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5528
    ) ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5529
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5530
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5531
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5532
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5533
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5534
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5535
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5536
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5537
    isVertical ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5538
	boundsMin := boundsPREV bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5539
	boundsMax := boundsNEXT top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5540
	layoutMin := layout top.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5541
	layoutMax := layout bottom.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5542
	windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5543
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5544
	boundsMin := boundsPREV right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5545
	boundsMax := boundsNEXT left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5546
	layoutMin := layout left.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5547
	layoutMax := layout right.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5548
	windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5549
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5550
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5551
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5552
    layoutMin < boundsMin ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5553
	layoutMin >= 0 ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5554
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5555
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5556
	"/ test whether is first visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5557
	index := items findLast:[:el| el isVisible] startingAt:(index - 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5558
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5559
	index == 0 ifTrue:[ scr0 := margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5560
		  ifFalse:[ scr0 := boundsMin ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5561
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5562
	delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5563
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5564
	layoutMax > boundsMax ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5565
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5566
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5567
	"/ test whether is last visible item
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5568
	index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5569
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5570
	index == 0 ifTrue:[ scr0 := windowSz - margin ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5571
		  ifFalse:[ scr0 := boundsMax ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5572
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5573
	delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5574
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5575
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5576
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5577
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5578
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5579
    shown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5580
	delta abs < (windowSz / 2) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5581
	    doScroll := true.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5582
	    self repairDamage
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5583
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5584
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5585
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5586
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5587
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5588
    doScroll ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5589
	self invalidate.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5590
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5591
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5592
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5593
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5594
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5595
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5596
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5597
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5598
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5599
    delta < 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5600
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5601
	    self copyFrom:self x:margin y:scr1 toX:margin y:scr0
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5602
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5603
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5604
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5605
	    inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5606
	    "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5607
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5608
	    self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5609
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5610
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5611
	    scr1 := scr0 + scrSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5612
	    inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5613
	    "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5614
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5615
	inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5616
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5617
	isVertical ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5618
	    self copyFrom:self x:margin y:scr0 toX:margin y:scr1
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5619
			   width:windowSz height:scrSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5620
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5621
	    inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5622
	    "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5623
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5624
	    self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5625
			   width:scrSz height:windowSz async:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5626
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5627
	    inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5628
	    "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5629
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5630
	inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5631
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5632
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5633
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5634
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5635
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5636
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5637
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5638
pageDown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5639
    "scroll one page down"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5640
    |index delta foundItem isVertical|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5641
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5642
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5643
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5644
    index := self indexOfLastItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5645
    index == 0 ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5646
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5647
    isVertical := self verticalLayout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5648
    delta := isVertical ifTrue:[self height] ifFalse:[self width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5649
    delta := delta - 15. "/ bounds
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5650
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5651
    [delta > 0] whileTrue:[ |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5652
        item := items at:index ifAbsent:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5653
        item isNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5654
            delta := 0
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5655
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5656
            (item layout notNil and:[item isVisible]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5657
                isVertical ifTrue:[delta := delta - item layout height]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5658
                          ifFalse:[delta := delta - item layout width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5659
                foundItem := item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5660
            ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5661
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5662
        index := index + 1.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5663
     ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5664
     self makeItemVisible:foundItem.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5665
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5666
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5667
pageUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5668
    "scroll one page up"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5669
    |index delta foundItem isVertical|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5670
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5671
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5672
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5673
    index := self indexOfFirstItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5674
    index == 0 ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5675
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5676
    isVertical := self verticalLayout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5677
    delta := isVertical ifTrue:[self height] ifFalse:[self width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5678
    delta := delta - 15. "/ bounds
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5679
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5680
    [delta > 0] whileTrue:[ |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5681
        item := items at:index ifAbsent:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5682
        item isNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5683
            delta := 0
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5684
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5685
            (item layout notNil and:[item isVisible]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5686
                isVertical ifTrue:[delta := delta - item layout height]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5687
                          ifFalse:[delta := delta - item layout width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5688
                foundItem := item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5689
            ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5690
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5691
        index := index - 1.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5692
     ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5693
     self makeItemVisible:foundItem.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5694
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5695
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5696
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5697
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5698
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5699
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5700
    superMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5701
	^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5702
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5703
    scrollActivity isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5704
	scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5705
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5706
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5707
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5708
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5709
scrollDown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5710
    "scroll one line down"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5711
    |item index|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5712
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5713
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5714
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5715
    index := self indexOfLastItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5716
    index > 0 ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5717
        item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5718
            detect:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5719
            startingAt:(index + 1)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5720
            ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5721
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5722
    item notNil ifTrue:[self makeItemVisible:item]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5723
               ifFalse:[self scrollToBottom].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5724
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5725
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5726
scrollToBottom
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5727
    "scroll to last visible item"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5728
    |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5729
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5730
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5731
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5732
    item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5733
        detectLast:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5734
        ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5735
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5736
    self makeItemVisible:item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5737
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5738
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5739
scrollToTop
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5740
    "scroll to first visible item"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5741
    |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5742
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5743
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5744
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5745
    item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5746
        detect:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5747
        ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5748
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5749
    self makeItemVisible:item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5750
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5751
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5752
scrollUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5753
    "scroll one line up"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5754
    |item index|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5755
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5756
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5757
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5758
    index := self indexOfFirstItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5759
    index > 1 ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5760
        item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5761
            detectLast:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5762
            startingAt:(index - 1)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5763
            ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5764
    ].    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5765
    item notNil ifTrue:[self makeItemVisible:item]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5766
               ifFalse:[self scrollToTop].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5767
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5768
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5769
scrollerBoundsAt:aDirection
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5770
    "returns the bounds of the scroller at a direction"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5771
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5772
    |y x w h|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5773
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5774
    x := 0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5775
    y := 0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5776
    w := 15.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5777
    h := 15.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5778
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5779
    self verticalLayout ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5780
        aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5781
            y := height - h.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5782
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5783
        w := width.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5784
    ] ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5785
        aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5786
            x := width - w.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5787
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5788
        h := height.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5789
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5790
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5791
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5792
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5793
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5794
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5795
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5796
    self hasScrollers ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5797
        #( PREV NEXT ) do:[:aDirection| 
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5798
            |bounds|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5799
            
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5800
            (self hasScrollerAt:aDirection) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5801
                bounds := self scrollerBoundsAt:aDirection.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5802
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5803
                (bounds containsPoint:aPoint) ifTrue:[^ aDirection]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5804
            ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5805
        ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5806
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5807
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5808
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5809
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5810
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5811
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5812
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5813
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5814
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5815
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5816
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5817
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5818
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5819
    selection notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5820
	(subMenu := selection visibleSubmenu) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5821
	    ^ subMenu detectGrabMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5822
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5823
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5824
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5825
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5826
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5827
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5828
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5829
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5830
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5831
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5832
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5833
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5834
    ((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
  5835
	firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5836
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5837
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5838
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5839
	^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5840
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5841
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  5842
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5843
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5844
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5845
detectViewAtX:x y:y in:aTopView
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5846
    "detect view at x@y"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5847
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5848
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5849
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5850
"/ 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
  5851
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5852
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5853
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5854
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5855
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5856
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5857
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5858
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5859
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5860
"/                    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
  5861
"/                  ^ 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
  5862
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5863
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5864
"/        ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5865
"/    ].
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5866
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5867
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  5868
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5869
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5870
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5871
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5872
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5873
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5874
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5875
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5876
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5877
    stringOrNumberOrPoint isPoint ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5878
	^ self itemAtPoint:stringOrNumberOrPoint
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5879
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5880
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5881
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5882
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5883
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5884
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5885
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5886
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5887
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5888
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5889
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5890
    items notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5891
	x := aPoint x.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5892
	y := aPoint y.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5893
	^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5894
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5895
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5896
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5897
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5898
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5899
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5900
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5901
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5902
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5903
    (self containsPoint:aPoint) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5904
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5905
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5906
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5907
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5908
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5909
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5910
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5911
	(superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5912
	    ^ superMenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5913
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5914
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5915
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5916
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5917
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5918
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5919
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5920
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5921
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5922
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5923
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5924
    aView notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5925
	"/ I am no longer a popUpView
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  5926
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5927
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5928
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5929
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5930
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5931
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5932
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5933
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5934
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5935
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5936
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5937
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5938
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  5939
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5940
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5941
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5942
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5943
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5944
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5945
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5946
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5947
    groupSizes size ~~ 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5948
	i := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5949
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5950
	groupSizes do:[:t|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5951
	    (i := i + t) == anIndex ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5952
		^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5953
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5954
	]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5955
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5956
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5957
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5958
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5959
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5960
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5961
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5962
    ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5963
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5964
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5965
hasPerformed
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5966
    ^ hasPerformed ? false
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5967
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5968
    "Created: / 29-06-2011 / 16:24:14 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5969
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  5970
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5971
isFitPanel
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5972
    "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
  5973
     and must be fit to the extent of its superView;
ba9b2e98323d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4383
diff changeset
  5974
     Obsolete: NO LONGER SUPPORTED"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5975
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5976
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5977
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5978
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5979
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5980
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5981
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5982
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5983
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5984
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5985
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5986
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5987
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5988
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5989
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5990
!
c05874084d4c implement
ca
parents: 407
diff changeset
  5991
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5992
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  5993
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5994
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  5995
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5996
type
428
ca
parents: 427
diff changeset
  5997
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  5998
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5999
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6000
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6001
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6002
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6003
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6004
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6005
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6006
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6007
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6008
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6009
openDelayed:anItem
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6010
    self openDelayed:anItem afterSeconds:0.5.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6011
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6012
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6013
openDelayed:anItemOrNil afterSeconds:seconds
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6014
    |b|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6015
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6016
    superMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6017
	superMenu openDelayed:anItemOrNil afterSeconds:seconds.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6018
	^ self
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6019
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6020
    (b := openDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6021
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6022
	Processor removeTimedBlock:b.
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6023
    ].
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6024
    (anItemOrNil notNil and:[anItemOrNil hasSubmenu]) ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6025
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6026
	^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6027
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6028
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6029
    openDelayedMenuBlock :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6030
	[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6031
	    openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6032
	    anItemOrNil openDelayedSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6033
	].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  6034
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6035
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6036
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6037
    "Modified: / 29-08-2013 / 09:40:28 / cg"
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6038
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6039
3975
ca
parents: 3966
diff changeset
  6040
selectAndOpenDelayed:anItemOrNil
ca
parents: 3966
diff changeset
  6041
    "change selection to an item or nil"
ca
parents: 3966
diff changeset
  6042
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6043
    |helpListener oldSelect delayedOpenSeconds b|
3975
ca
parents: 3966
diff changeset
  6044
ca
parents: 3966
diff changeset
  6045
    anItemOrNil == selection ifTrue:[ ^ self ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  6046
    "/ self openDelayed:nil.
3975
ca
parents: 3966
diff changeset
  6047
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6048
    (b := closeDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6049
	closeDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6050
	Processor removeTimedBlock:b.
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6051
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6052
    (b := openDelayedMenuBlock notNil) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6053
	openDelayedMenuBlock := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6054
	Processor removeTimedBlock:b.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6055
    ].
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6056
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6057
    delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
4617
0922a5f9c84a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4605
diff changeset
  6058
    "/ self verticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6059
3975
ca
parents: 3966
diff changeset
  6060
    oldSelect := selection.
ca
parents: 3966
diff changeset
  6061
    selection := nil.
ca
parents: 3966
diff changeset
  6062
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6063
    "/ redraw current selection cleared
3975
ca
parents: 3966
diff changeset
  6064
    oldSelect notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6065
	|oldSubmenu|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6066
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6067
	oldSubmenu := oldSelect visibleSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6068
	oldSubmenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6069
	    "/ 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
  6070
	    "/ one eventuall opens. However, if it is a simple item,
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6071
	    "/ it would remain open. So schedule a delayed close action for it.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6072
	    closeDelayedMenuBlock :=
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6073
		[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6074
		    "/ 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
  6075
		    selection ~~ oldSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6076
			(oldSelect hasSubmenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6077
			and:[ oldSelect visibleSubmenu notNil ]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6078
			    oldSelect hideSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6079
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6080
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6081
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6082
	    Processor addTimedBlock:closeDelayedMenuBlock afterSeconds:delayedOpenSeconds.
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6083
"/ mhmh - seems to not only not needed, but actually hurting (leftover menus)
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6084
"/            Processor addTimedBlock:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6085
"/                selection ~~ anItemOrNil ifTrue:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6086
"/                    "cancels the current delayed operation"
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6087
"/                    oldSelect hideSubmenu.
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6088
"/
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6089
"/                    ( selection notNil
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6090
"/                    and:[selection hasSubmenu
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6091
"/                    and:[selection visibleSubmenu isNil]]
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6092
"/                    ) ifTrue:[
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6093
"/                        "setup new delayed operation.."
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6094
"/                        self openDelayed:selection afterSeconds:delayedOpenSeconds "0.1"
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6095
"/                    ].
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6096
"/                ].
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6097
"/            ] afterSeconds:delayedOpenSeconds.
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6098
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6099
	oldSelect invalidate.
3975
ca
parents: 3966
diff changeset
  6100
    ].
ca
parents: 3966
diff changeset
  6101
ca
parents: 3966
diff changeset
  6102
    anItemOrNil notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6103
	self makeItemVisible:anItemOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6104
	anItemOrNil canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6105
	    selection := anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6106
	].
3975
ca
parents: 3966
diff changeset
  6107
    ].
ca
parents: 3966
diff changeset
  6108
    selection isNil ifTrue:[^ self].
ca
parents: 3966
diff changeset
  6109
ca
parents: 3966
diff changeset
  6110
    ActiveHelp isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6111
	helpListener := ActiveHelp currentHelpListener.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6112
	helpListener initiateHelpFor:self at:nil now:true.
3975
ca
parents: 3966
diff changeset
  6113
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  6114
3975
ca
parents: 3966
diff changeset
  6115
    shown ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6116
	"/ self rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6117
	selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6118
	selection hasSubmenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6119
	    "/ cg: disabled: prevents delayed menu when moving over a separator item
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6120
	    false "(oldSelect isNil or:[oldSelect visibleSubmenu isNil])" ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6121
		self openDelayed:selection afterSeconds:0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6122
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6123
		self openDelayed:selection afterSeconds:delayedOpenSeconds.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6124
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6125
	].
3975
ca
parents: 3966
diff changeset
  6126
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6127
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6128
    "Modified: / 29-08-2013 / 09:44:06 / cg"
3975
ca
parents: 3966
diff changeset
  6129
!
ca
parents: 3966
diff changeset
  6130
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6131
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6132
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6133
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6134
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6135
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6136
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6137
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6138
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6139
     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
  6140
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6141
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6142
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6143
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6144
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6145
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6146
	self selection:anItemOrNil openMenu:false.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6147
	^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6148
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6149
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6150
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6151
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6152
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6153
    openMenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6154
	openMenu := openOnSelect.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6155
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6156
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6157
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6158
    openOnSelect ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6159
	"/ select first item in submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6160
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6161
	submenu := anItemOrNil currentSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6162
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6163
	submenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6164
	    item := submenu itemAt:1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6165
	    (item notNil and:[item hasSubmenu not]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6166
		submenu selection:item openMenu:false
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6167
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6168
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6169
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6170
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6171
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6172
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6173
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6174
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6175
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6176
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6177
    anItemOrNil == selection ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6178
	^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6179
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6180
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6181
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6182
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6183
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6184
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6185
    anItemOrNil notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6186
	self makeItemVisible:anItemOrNil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6187
	anItemOrNil canSelect ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6188
	    selection := anItemOrNil
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6189
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6190
	    oldSelect isNil ifTrue:[^ self].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6191
	].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6192
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6193
    oldSelect notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6194
	"/ clear current selection
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6195
	oldSelect isSelected:false.
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6196
    ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6197
    selection isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6198
	^ self
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6199
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6200
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6201
"/    selection == enteredItem ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6202
"/        enteredItem := nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6203
"/    ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6204
"/        self pointerEntersItem:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6205
"/    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6206
    ActiveHelp isActive ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6207
	helpListener := ActiveHelp currentHelpListener.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6208
	helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6209
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6210
    shown ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6211
	"/ self rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6212
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6213
	openMenu ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6214
	    selection invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6215
	]
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6216
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6217
    openMenu ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6218
	selection isSelected:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6219
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6220
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6221
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6222
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6223
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6224
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6225
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6226
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6227
    (item := self selection) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6228
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6229
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6230
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6231
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6232
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6233
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6234
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6235
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6236
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6237
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6238
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6239
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6240
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6241
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6242
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6243
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6244
    superMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6245
	"I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6246
	aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6247
	^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6248
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6249
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6250
    relativeGrabOrigin isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6251
	relativeGrabOrigin := self topMenu translatePoint:0 to:self.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6252
	relativeGrabOrigin isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6253
	    "I am the grabView"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6254
	    aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6255
	    ^ aGrabPoint
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6256
	].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6257
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6258
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6259
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6260
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6261
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6262
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6263
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6264
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6265
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6266
    aMenu == self ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6267
	^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6268
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6269
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6270
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6271
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6272
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6273
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6274
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6275
    "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
  6276
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6277
    ^ device
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6278
        translatePoint:aPoint asPoint
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6279
        fromView:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6280
        toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6281
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6282
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6283
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6284
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6285
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6286
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6287
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6288
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6289
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6290
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6291
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6292
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6293
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6294
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6295
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6296
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6297
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6298
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6299
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6300
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6301
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6302
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6303
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6304
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6305
halfSeparatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6306
    "returns the size of a space-separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6307
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6308
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6309
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6310
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6311
separatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6312
    "returns the size of a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6313
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6314
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6315
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6316
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6317
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6318
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6319
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6320
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6321
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6322
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6323
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6324
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6325
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6326
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6327
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6328
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  6329
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6330
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6331
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6332
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6333
    "
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  6334
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6335
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6336
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6337
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6338
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6339
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6340
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6341
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6342
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6343
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6344
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6345
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6346
    item label:aLabel.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6347
    ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6348
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6349
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6350
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6351
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6352
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6353
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6354
    item menuItem:aMenuItem.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6355
    ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6356
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6357
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6358
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6359
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6360
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6361
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  6362
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6363
420
ca
parents: 417
diff changeset
  6364
canAccept
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6365
    "returns true if item is acceptable"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6366
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6367
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6368
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6369
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6370
    self hasDelayedMenu ifFalse:[^ false ].
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  6371
    ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6372
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6373
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6374
toggleIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6375
    "toggle indication or choice"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6376
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6377
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6378
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6379
    indication notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6380
	arg := self indicationValue not.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6381
	self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6382
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6383
	(choice notNil and:[choice isValueModel])ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6384
	    choice value:(menuItem choiceValue).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6385
	    ^ true
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6386
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6387
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6388
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6389
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6390
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6391
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6392
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6393
accessCharacter
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6394
    "returns my accessCharacter or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6395
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6396
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6397
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6398
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6399
accessCharacterPosition
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6400
    "get the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6401
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6402
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6403
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6404
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6405
accessCharacterPosition:anIndex
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6406
    "set the access character position or nil"
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 accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6409
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6410
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6411
argument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6412
    "gets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6413
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6414
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6415
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6416
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6417
argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6418
    "sets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6419
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6420
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6421
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6422
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6423
displayLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6424
    "returns my printable Label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6425
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6426
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6427
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6428
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6429
displayLabelExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6430
    "returns the labels extent"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6431
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6432
    |myFont prevFont w h|
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6433
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6434
    displayLabelExtent notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6435
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6436
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6437
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6438
    displayLabel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6439
	displayLabelExtent := 0@0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6440
	^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6441
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6442
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6443
    myFont := self font.
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6444
    myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6445
    myFont := myFont onDevice:menuPanel device.
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6446
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6447
    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
  6448
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6449
    displayLabel isString ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6450
	w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6451
	h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6452
"/        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
  6453
"/        h := myFont heightOf:displayLabel.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6454
    ] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6455
	displayLabel isArray ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6456
	    w := h := 0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6457
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6458
	    displayLabel do:[:aSubLabel|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6459
		aSubLabel notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6460
		    w := w max:(aSubLabel widthOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6461
		    h := h + 1 + (aSubLabel heightOn:menuPanel).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6462
		] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6463
		    h := h + (self spaceBetweenEmptyLines)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6464
		]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6465
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6466
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6467
	    w := displayLabel widthOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6468
	    h := displayLabel heightOn:menuPanel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6469
	].
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6470
    ].
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6471
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6472
    menuPanel setFont:prevFont.     "/ restore previous font
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6473
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6474
    "/ care for italic fonts - give a few more pixels at the end
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6475
    myFont italic ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6476
	w := w + 2.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6477
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6478
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6479
    ^ displayLabelExtent
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6480
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6481
    "Modified: / 17-08-2010 / 10:46:06 / cg"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6482
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6483
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6484
font
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6485
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6486
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6487
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6488
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6489
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6490
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6491
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6492
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6493
    font notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6494
	font := font onDevice:(menuPanel device).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6495
	menuItem font:font.
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6496
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6497
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6498
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6499
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6500
font:aFont
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6501
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6502
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6503
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6504
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6505
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6506
ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6507
    "if true, mnemonic (access character) in the submenus under the item are ignored.
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6508
     Set this to speedup accelerator key processing for slow dynamci menus"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6509
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6510
    ^ menuItem ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6511
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6512
    "Modified (comment): / 08-09-2011 / 04:29:47 / cg"
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6513
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6514
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6515
ignoreMnemonicKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6516
    "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
  6517
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6518
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6519
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6520
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6521
ignoreShortcutKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6522
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6523
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6524
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6525
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6526
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6527
ignoreShortcutKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6528
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6529
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6530
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6531
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6532
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6533
itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6534
    "gets the item's value"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6535
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6536
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6537
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6538
    "Modified (comment): / 06-03-2012 / 14:41:27 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6539
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6540
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6541
itemValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6542
    "argument could be a value holder, an action or selector"
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.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6545
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6546
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6547
label
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6548
    "returns the label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6549
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6550
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6551
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6552
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6553
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6554
    "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
  6555
     handle characters $& (ST-80 compatibility)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6556
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6557
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6558
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6559
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6560
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6561
    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
  6562
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  6563
    "Stefan: Why do we use #value two times??"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6564
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6565
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6566
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6567
    displayLabel isString ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6568
	"CHECK FOR SEPARATOR"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6569
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6570
	(menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6571
	    size := displayLabel size.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6572
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6573
	    size == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6574
		displayLabel := nil.            "blank separator"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6575
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6576
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6577
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6578
	    size == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6579
		char := displayLabel first.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6580
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6581
		(char == $- or:[char == $=]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6582
		    label := displayLabel.      "line separator"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6583
		    displayLabel := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6584
		    ^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6585
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6586
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6587
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6588
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6589
	displayLabel isCollection ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6590
	    displayLabel := displayLabel asArray.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6591
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6592
    ].
4218
ade9025919d7 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4209
diff changeset
  6593
    menuPanel notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6594
	menuPanel doAccessCharacterTranslation ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6595
	    displayLabel notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6596
		displayLabel isArray ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6597
		    displayLabel keysAndValuesDo:[:i :el|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6598
			el notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6599
			    displayLabel at:i put:(self updateAccessCharacterFor:el).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6600
			].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6601
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6602
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6603
		    displayLabel isImageOrForm ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6604
			displayLabel := self updateAccessCharacterFor:displayLabel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6605
		    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6606
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6607
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6608
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6609
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6610
	menuPanel shown ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6611
	    self fetchImages.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6612
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6613
	    oldExtent = self displayLabelExtent ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6614
		self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6615
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6616
		menuPanel mustRearrange
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6617
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6618
	].
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6619
    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6620
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6621
    "Modified: / 06-10-2011 / 16:36:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6622
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6623
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6624
menuPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6625
    "returns my menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6626
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6627
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6628
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6629
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6630
nameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6631
    "gets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6632
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6633
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6634
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6635
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6636
nameKey:aNameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6637
    "sets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6638
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6639
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6640
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6641
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6642
rawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6643
    "returns my raw, unprocessed label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6644
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6645
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6646
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6647
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6648
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6649
    "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
  6650
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6651
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6652
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6653
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6654
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6655
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6656
    "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
  6657
     no submenu exists evaluate the action assigned to the item (accept)."
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 shortcutKey ~= aKey ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6660
	menuItem shortcutKey:aKey.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6661
	self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6662
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6663
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6664
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6665
startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6666
    "start group #left #right #conditionalRight ... or nil
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6667
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6668
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6669
    ^ menuItem startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6670
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6671
    "Modified: / 16-10-2006 / 13:06:25 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6672
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6673
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6674
startGroup:aSymbol
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6675
    "start group #left #right #conditionalRight ...
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6676
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6677
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6678
    menuItem startGroup:aSymbol.
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6679
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6680
    "Modified: / 16-10-2006 / 13:06:37 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6681
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6682
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6683
submenu
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6684
    "returns my submenu or creates it if it's defined via a selector or channel.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6685
     May return nil, if there is really no menu"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6686
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6687
    subMenu isNil ifTrue:[
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6688
        self setupSubmenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6689
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6690
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6691
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6692
    "Modified: / 07-11-2006 / 11:09:49 / cg"
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6693
    "Modified (comment): / 13-02-2017 / 20:26:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6694
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6695
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6696
submenu:aSubMenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6697
    "set a new submenu; an existing submenu will be destroyed.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6698
     This might lead to a redraw if 'hasSubmenu' changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6699
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6700
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6701
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6702
    subMenu notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6703
	subMenu ~~ aSubMenu ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6704
	    subMenu destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6705
	    subMenu := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6706
	].
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6707
    ].
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6708
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6709
    aSubMenu isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6710
	subMenu notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6711
	    subMenu destroy.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6712
	    subMenu := nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6713
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6714
	^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6715
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6716
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6717
    (aSubMenu isKindOf:Menu) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6718
	subMenu := MenuPanel new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6719
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6720
	menuPanel notNil ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6721
	    subMenu receiver:menuPanel receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6722
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6723
	subMenu superMenu:menuPanel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6724
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6725
	menuItem horizontalLayout == true ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6726
	    subMenu verticalLayout:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6727
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6728
	subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6729
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6730
	aSubMenu isView ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6731
	    (aSubMenu isKindOf:ApplicationModel) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6732
		"/ ... mhhhh ....
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6733
		^ menuItem submenuChannel:aSubMenu
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6734
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6735
	    widget := SimpleView new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6736
	    widget client:aSubMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6737
	] ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6738
	    widget := aSubMenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6739
	    subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6740
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6741
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6742
	(widget isKindOf:MenuPanel) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6743
	    subMenu := widget.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6744
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6745
	    menuItem horizontalLayout == true ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6746
		subMenu verticalLayout:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6747
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6748
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6749
	    subMenu := MenuPanel new.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6750
	    subMenu receiver:menuPanel receiver.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6751
	    subMenu addSubView:widget.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6752
	    subMenu extent:(widget preferredExtent).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6753
	    widget origin:0.0@0.0 corner:1.0@1.0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6754
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6755
	subMenu superMenu:menuPanel.
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6756
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6757
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6758
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6759
submenuOrNil
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6760
    "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
  6761
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6762
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6763
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6764
    "Created: / 07-11-2006 / 11:04:47 / cg"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6765
!
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6766
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6767
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6768
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6769
     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
  6770
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6771
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6772
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6773
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6774
	displayLabel isArray ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6775
	    ^ displayLabel perform:#string ifNotUnderstood:nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6776
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6777
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6778
	displayLabel do:[:el|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6779
	    (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6780
		^ txt
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6781
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6782
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6783
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6784
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6785
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6786
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6787
triggerOnDown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6788
    "return true if triggering the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6789
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6790
    menuItem triggerOnDown ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6791
	self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6792
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6793
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6794
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6795
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6796
triggerOnDown:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6797
    "setup to trigger the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6798
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6799
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6800
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6801
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6802
value
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6803
    "gets the item's value
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6804
     Left here for ST80 compatibility - value is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6805
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6806
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6807
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6808
    "Modified (comment): / 06-03-2012 / 14:41:23 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6809
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6810
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6811
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6812
    "could be a value holder, an action or selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6813
     Left here for ST80 compatibility - value: is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6814
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6815
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6816
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6817
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6818
value:aValue argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6819
    "set the value and an argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6820
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6821
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6822
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6823
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6824
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6825
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6826
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6827
choice
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6828
    "implements a radio group; the field"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6829
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6830
    ^ choice
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6831
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6832
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6833
choice:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6834
    "set choice indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6835
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6836
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6837
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6838
    choice isValueModel ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6839
	choice removeDependent:self
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6840
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6841
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6842
    choice := something.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6843
    choice notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6844
	choice isSymbol ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6845
	    choice := (self aspectAt:choice) ? choice.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6846
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6847
	choice isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6848
	    choice addDependent:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6849
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6850
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6851
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6852
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6853
choiceValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6854
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6855
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6856
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6857
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6858
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6859
choiceValue:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6860
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6861
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6862
    menuItem choiceValue ~= something ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6863
	menuItem choiceValue:something.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6864
	choice notNil ifTrue:[ self invalidate ].
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6865
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6866
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6867
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6868
enabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6869
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6870
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6871
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6872
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6873
    menuPanel isNil ifTrue:[ ^ false].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6874
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6875
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6876
    enableChannel isSymbol ifTrue:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6877
        state := self aspectAt:enableChannel.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6878
        state isValueModel ifTrue:[
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6879
            enableChannel := state.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6880
            enableChannel addDependent:self.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6881
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6882
    ] ifFalse:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  6883
        state := enableChannel.
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6884
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6885
    ^ state value ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6886
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6887
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6888
enabled:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6889
    "change the enabled state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6890
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6891
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6892
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6893
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6894
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6895
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6896
	oldState := enableChannel value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6897
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6898
	    enableChannel removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6899
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6900
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6901
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6902
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6903
    enableChannel isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6904
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6905
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6906
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6907
	enableChannel isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6908
	    enableChannel addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6909
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6910
	    enableChannel isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6911
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6912
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6913
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6914
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6915
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6916
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6917
	self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6918
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6919
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6920
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6921
hideMenuOnActivated
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6922
    "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6923
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6924
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6925
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6926
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6927
hideMenuOnActivated:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6928
   "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6929
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6930
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6931
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  6932
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6933
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6934
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6935
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6936
    |app|
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6937
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6938
    app := menuPanel application.
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6939
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6940
    (menuPanel receiver isNil
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6941
    and:[ app notNil
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  6942
    and:[ app askFor:#isUIPainter]])
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6943
    ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6944
	^ self "/ suppressed
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6945
    ].
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  6946
    aMessage infoPrint.
3833
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6947
"/    app notNil ifTrue:[
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6948
"/        ' Application: ' infoPrint. app infoPrint
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  6949
"/    ].
3444
b7d2f3fe5055 avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents: 3441
diff changeset
  6950
    '' infoPrintCR.
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6951
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  6952
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6953
indication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6954
    "get on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6955
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6956
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6957
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6958
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6959
indication:aValueHolder
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6960
    "set on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6961
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6962
    indication == aValueHolder ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6963
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6964
    indication isValueModel ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6965
	indication removeDependent:self
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6966
    ].
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6967
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  6968
    (indication := aValueHolder) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6969
	indication isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6970
	    indication addDependent:self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6971
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6972
	    "/ to force an update of the value
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6973
	    self indicationValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6974
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6975
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6976
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6977
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6978
keepLinkedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6979
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6980
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6981
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6982
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6983
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6984
keepLinkedMenu:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6985
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6986
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6987
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6988
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6989
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6990
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6991
    "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
  6992
     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
  6993
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6994
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6995
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6996
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6997
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  6998
    "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
  6999
     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
  7000
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7001
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7002
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7003
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7004
submenuChannel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7005
    "get the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7006
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7007
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7008
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7009
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7010
submenuChannel:aSelectorOrNil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7011
    "returns the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7012
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7013
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7014
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7015
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  7016
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7017
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7018
moveBy:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7019
    "move the layouts origin"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7020
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7021
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7022
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7023
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7024
preferredExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7025
    "compute my preferred extent excluding the shortCutKey and the menu identifier"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7026
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7027
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7028
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7029
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7030
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7031
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7032
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7033
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7034
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7035
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7036
    isButton ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7037
	s := menuPanel maxAbsoluteButtonLevel ? 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7038
	x := s + HorizontalButtonInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7039
	y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7040
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7041
	x  := HorizontalInset.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7042
	y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7043
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7044
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7045
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7046
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7047
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7048
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7049
    self isSeparator ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7050
	s := self class separatorSize.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7051
	label = '' ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7052
	    s := self class halfSeparatorSize.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7053
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7054
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7055
	"width of doubleSeparator is 5 !!!!"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7056
	isVertical ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7057
	    x := x max:s.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7058
	    y := y + 5.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7059
	] ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7060
	    y := y max:s.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7061
	    x := x + 5.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7062
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7063
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7064
	labelExtent := self displayLabelExtent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7065
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7066
	x := x + labelExtent x.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7067
	y := y + labelExtent y.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7068
	x := x + (menuPanel stringOffsetXfor:self).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7069
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7070
	isButton ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7071
	    menuPanel showSeparatingLines ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7072
		"width of separator is 2 plus right offset 1 := 3"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7073
		isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7074
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7075
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7076
	wIcon := 0.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7077
	self hasMenuIndicator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7078
	    icon := MenuPanel menuIndicator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7079
	    wIcon := MenuPanel menuIndicatorOffset + icon width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7080
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7081
	    self hasDelayedMenuIndicator ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7082
		icon := MenuPanel delayedMenuIndicator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7083
		wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7084
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7085
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7086
	x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7087
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7088
    ^ x@y
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  7089
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  7090
    "Modified: / 19-01-2011 / 21:20:35 / cg"
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7091
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7092
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7093
preferredHeight
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7094
    ^ self preferredExtent y
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7095
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7096
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7097
preferredWidth
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7098
    ^ self preferredExtent x
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7099
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7100
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  7101
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7102
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7103
activeHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7104
    "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
  7105
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7106
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7107
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7108
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7109
activeHelpKey:aHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7110
    "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
  7111
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7112
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7113
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7114
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7115
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7116
activeHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7117
    "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
  7118
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7119
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7120
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7121
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7122
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7123
    ((key := self activeHelpKey) notNil
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7124
    and:[(app := menuPanel application) notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7125
	^ app helpTextForKey:key.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7126
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7127
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7128
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7129
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7130
activeHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7131
    "set the active helpText"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7132
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7133
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7134
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7135
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7136
flyByHelpText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7137
    "get the flyBy helpText or nil."
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7138
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7139
    |text key app keyUsed itemsActionSelector|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7140
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7141
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7142
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  7143
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  7144
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7145
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7146
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7147
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7148
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7149
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  7150
    "/ if an activeHelpKey was explicitely given, use that one
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7151
    key := keyUsed := self activeHelpKey.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7152
    keyUsed isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7153
        "/ try action as key
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7154
        (itemsActionSelector := menuItem itemValue) isSymbol ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7155
            keyUsed := itemsActionSelector.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7156
        ].
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7157
    ].
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  7158
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  7159
    "/ 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
  7160
    (keyUsed isAssociation) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7161
        app := keyUsed key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7162
        keyUsed := keyUsed value.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7163
    ] ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7164
        app := menuPanel application.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7165
    ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7166
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7167
    keyUsed notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7168
        app notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7169
            text := app flyByHelpTextForKey:keyUsed.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7170
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7171
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7172
            text := menuPanel flyByHelpTextForKey:keyUsed.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7173
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7174
        "/ if the key used is NOT the activeHelpKey, but the action name,
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7175
        "/ then do not accept the default
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7176
        ((text = keyUsed) and:[key isNil]) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7177
            text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7178
        ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7179
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7180
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  7181
    "/ 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
  7182
    text isNil ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7183
        self hasSubmenu ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7184
            ^ key
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7185
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7186
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7187
        "/ then use the original activeHelpKey (but not the action)
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7188
        text := key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7189
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7190
            displayLabel isString ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7191
                text := displayLabel string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7192
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7193
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7194
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7195
            text := self rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7196
            text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7197
                text := menuItem rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7198
                text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7199
                    text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7200
                ]
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7201
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7202
            text notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7203
                (text includes:$&) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7204
                    text := (self updateAccessCharacterFor:text) string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7205
                ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7206
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7207
        ].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7208
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7209
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  7210
    (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
  7211
    text = displayLabel ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7212
        "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
  7213
         (i.e. in a pull down menu)"
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7214
        ^ nil
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7215
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7216
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7217
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7218
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7219
flyByHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7220
    "exlicitly set the flyBy helpText. For example, to dynamically change it."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7221
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7222
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7223
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7224
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7225
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7226
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7227
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7228
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7229
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7230
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7231
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7232
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7233
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7234
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7235
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7236
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7237
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7238
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7239
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7240
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7241
isButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7242
    "returns whether the item looks like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7243
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7244
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7245
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7246
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7247
isButton:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7248
    "set/clear the item to look like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7249
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7250
    menuItem isButton ~~ aBool ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7251
	menuItem isButton:aBool.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7252
	self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7253
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7254
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7255
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7256
layout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7257
    "returns my layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7258
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7259
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7260
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7261
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7262
layout:aLayout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7263
    "set a new layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7264
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7265
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7266
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7267
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7268
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7269
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7270
    "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
  7271
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7272
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7273
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7274
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7275
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7276
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7277
    "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
  7278
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7279
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7280
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7281
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7282
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  7283
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7284
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7285
currentSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7286
    "returns the current submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7287
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7288
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7289
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7290
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7291
hideSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7292
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7293
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7294
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7295
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7296
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7297
hideSubmenu:aSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7298
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7299
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7300
    |id wg|
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7301
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7302
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7303
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7304
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7305
    aSubmenu realized ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7306
	id := aSubmenu id.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7307
	id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7308
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7309
	aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7310
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7311
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7312
    aSubmenu windowGroup:nil.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7313
    (wg := menuPanel windowGroup) notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7314
	wg removeView:aSubmenu.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7315
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7316
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7317
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7318
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7319
	menuItem keepLinkedMenu ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7320
	    subMenu := nil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7321
	]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7322
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7323
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7324
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7325
openDelayedSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7326
    "called to open now my delayed submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7327
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7328
    |subMenuBeforeOpening|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7329
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7330
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7331
    subMenu notNil ifTrue:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7332
        subMenu realized ifTrue:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7333
            "/ already open
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7334
            ^ self
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7335
        ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7336
    ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7337
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7338
    "/ bugfix : check if delayed menu canbe open (only for toolbars and items having a delayed menu)
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7339
    (menuPanel isPopUpView                      
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7340
    or:[self hasDelayedMenu not
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7341
    or:[menuPanel sensor anyButtonPressed]]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7342
    ) ifFalse:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7343
        "/ check if any menu already is open than accept otherwise ignore
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7344
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7345
        menuPanel items
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7346
            detect:[:el|(el currentSubmenu isView and:[el currentSubmenu realized])]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7347
            ifNone:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7348
    ].
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  7349
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7350
    self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7351
    subMenu isNil ifTrue:[^ self].
4241
9b3b8041c18f class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4240
diff changeset
  7352
    subMenu hasItems ifFalse:[^ self].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7353
    subMenuBeforeOpening := subMenu.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7354
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7355
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7356
    (subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7357
        "/ closed during building or opening the submenu
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7358
        self hideSubmenu:subMenuBeforeOpening.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7359
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7360
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7361
    "Modified: / 07-11-2006 / 11:07:57 / cg"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7362
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7363
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7364
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7365
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7366
     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
  7367
     nescessary."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7368
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7369
    |p o device isVertical topMenu windGrp prefExtent lastEvent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7370
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7371
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7372
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7373
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7374
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7375
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7376
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7377
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7378
    (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
  7379
	^ self
3975
ca
parents: 3966
diff changeset
  7380
    ].
ca
parents: 3966
diff changeset
  7381
    "close all other open submenus assigned to the menuPanel I'am located in"
ca
parents: 3966
diff changeset
  7382
ca
parents: 3966
diff changeset
  7383
    menuPanel itemsDo:[:eachItem|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7384
	(eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7385
	    eachItem hideSubmenu.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7386
	].
3975
ca
parents: 3966
diff changeset
  7387
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7388
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7389
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7390
	subMenu releaseDeviceResources.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7391
	subMenu setDevice:topMenu device id:nil gcId:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7392
	subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7393
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7394
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7395
    windGrp := topMenu windowGroup.
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7396
    windGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7397
	lastEvent := windGrp lastEvent.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7398
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7399
	(lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7400
	    subMenu mapTime:(lastEvent timeStamp).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7401
	].
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7402
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7403
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7404
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7405
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7406
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7407
    windGrp notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7408
	subMenu windowGroup:windGrp.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7409
	windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7410
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7411
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7412
    "Q&D kludge - test whether the layout is nil;
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7413
		  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7414
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7415
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7416
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7417
    isVertical := menuPanel verticalLayout.
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7418
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7419
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7420
    menuPanel isPopUpView ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7421
	o := menuPanel origin + p
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7422
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7423
	o := menuPanel translatePoint:p to:nil.   "/ translate to root window
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7424
    ].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7425
    subMenu origin:o.   "set temporary origin to compute preferredExtent"
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7426
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7427
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7428
      TODO: only invoke mustRearrange if any are blocks
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7429
	    (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7430
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7431
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7432
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7433
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7434
    "compute origin of subMenu"
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7435
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7436
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7437
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7438
    width      := prefExtent x.
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7439
    devBot     := device  usableHeightAt:o.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7440
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7441
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7442
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7443
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7444
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7445
    top + height > devBot ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7446
	top := isVertical ifTrue:[devBot - height]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7447
			 ifFalse:[top - layout height - height + 2]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7448
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7449
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7450
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7451
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7452
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7453
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7454
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7455
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7456
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7457
"/    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7458
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7459
    left + width > devRight ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7460
	left := isVertical ifTrue:[left - layout width - width + 2]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7461
			  ifFalse:[devRight - width]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7462
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7463
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7464
"/ ***** MULTI SCREEN
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7465
"/    top := top max:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7466
"/    left := left max:0.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7467
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7468
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7469
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7470
    subMenu realized ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7471
	subMenu realize.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7472
    ] ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7473
	topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7474
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7475
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7476
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7477
toggleSubmenuVisibility
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7478
    "toggle the visibility of the submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7479
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7480
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7481
	subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7482
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7483
	self setupSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7484
	subMenu isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7485
	    "/ cannot open a submenu
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7486
	    ^ self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7487
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7488
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7489
    self openSubmenu.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7490
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7491
    "Modified: / 07-11-2006 / 11:06:42 / cg"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7492
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7493
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7494
visibleSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7495
    "returns the current visible submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7496
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7497
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7498
	subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7499
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7500
    ^ nil
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7501
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7502
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7503
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7504
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7505
aspectAt:aKey
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  7506
    "returns the value assigned to key or nil"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7507
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7508
    |appl|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7509
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7510
    appl := menuPanel receiver.
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7511
    appl isNil ifTrue:[
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7512
        appl := menuPanel application.
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7513
        appl isNil ifTrue:[ 
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7514
            ^ nil
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7515
        ].
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7516
    ] ifFalse:[appl isValueModel ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7517
        ^ appl value:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7518
    ]].
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7519
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7520
    ^ [
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7521
        aKey argumentCount == 1 ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7522
            appl perform:aKey with:(menuItem argument ? self).
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7523
        ] ifFalse:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7524
            (appl respondsTo:#aspectFor:) ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7525
                appl aspectFor:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7526
            ] ifFalse:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7527
                appl perform:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7528
            ]
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7529
        ]
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7530
    ] on:MessageNotUnderstood do:[:ex|
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7531
        ex selector ~~ aKey ifTrue:[
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7532
            ex reject.
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7533
        ].
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7534
        self ifNotInUIBuilderInfoPrintCR:
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  7535
            ('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
  7536
             bindWith:appl classNameWithArticle
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7537
             with:aKey
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7538
             with:(label isString ifTrue:[label] ifFalse:[self nameKey ? self itemValue ? '???'])).
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7539
        nil
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7540
    ].
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  7541
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  7542
    "Modified: / 02-08-2013 / 16:44:28 / cg"
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7543
    "Modified (format): / 15-03-2017 / 17:00:31 / stefan"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7544
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7545
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7546
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7547
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7548
fontChanged
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7549
    "called whenever the font changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7550
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7551
    displayLabel notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7552
	displayLabelExtent := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7553
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7554
	subMenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7555
	    subMenu font:(menuPanel font).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7556
	].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7557
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7558
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7559
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7560
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7561
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7562
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7563
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7564
    (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
  7565
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7566
    self isSeparator ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7567
	"/ NOT A SEPARATOR
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7568
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7569
	menuPanel shown ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7570
	    changedObject == enableChannel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7571
		(enableChannel value == false and:[self isSelected]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7572
		    ^ menuPanel selection:nil.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7573
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7574
		^ self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7575
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7576
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7577
	    (changedObject == indication or:[changedObject == choice]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7578
		menuItem isButton ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7579
		    self invalidate
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7580
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7581
		    "/ invalidate the interactor only
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7582
		    "/ take any interactor; interactors has the same extent
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7583
		    form := menuPanel iconIndicationOff.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7584
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7585
		    rect := Rectangle left:(layout left + HorizontalInset)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7586
				       top:(layout top)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7587
				     width:(form width)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7588
				    height:(layout height).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7589
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7590
		    menuPanel invalidate:rect repairNow:false
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7591
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7592
		^ self
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7593
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7594
	    self invalidate.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7595
	].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7596
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7597
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7598
    changedObject == isVisible ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7599
	menuPanel mustRearrange.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7600
	"/ actually: the following is wrong, because we have to delay the rearrangement
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7601
	"/ until the next redraw event comes. Otherwise, we might compute new layouts
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7602
	"/ too early if more items change their visibility.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7603
	"/ redraw will call rearrangeItems, if the mustRearrange is set.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7604
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7605
	"/ menuPanel rearrangeItems.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7606
	^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7607
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7608
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7609
    super update:something with:aParameter from:changedObject
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7610
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7611
    "Modified (comment): / 24-11-2011 / 19:01:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7612
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7613
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7614
updateIndicators
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7615
    "update indicators "
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7616
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  7617
    indication notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7618
	(indication isSymbol
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7619
	or:[menuItem hideMenuOnActivated not])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7620
	ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7621
	    "indication is a selector;
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7622
	     otherwise no need to redraw, because
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7623
	     a change notification is raised from the model !!!!"
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7624
	    self update:nil with:nil from:indication
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7625
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7626
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7627
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7628
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7629
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7630
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7631
asMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7632
    "convert to a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7633
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7634
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7635
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7636
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7637
menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7638
    ^ menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7639
!
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7640
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7641
menuItem:aMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7642
    "setup attributes from a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7643
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7644
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  7645
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7646
    menuPanel disabledRedrawDo:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7647
	menuItem := aMenuItem.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7648
	menuItem isNil ifTrue:[ menuItem := MenuItem new].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7649
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7650
	label := displayLabel := activeHelpText := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7651
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7652
	self    enabled:(menuItem enabled).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7653
	self indication:(menuItem indication).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7654
	self     choice:(menuItem choice).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7655
	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
  7656
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7657
"/ 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
  7658
"/ but ... ??
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7659
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7660
	(lbl := menuItem labelImage value) isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7661
	    lbl := menuItem rawLabel. "/ avoid translating &'s twice
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7662
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7663
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7664
	self submenu:(menuItem submenu).
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7665
	self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7666
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  7667
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  7668
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7669
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7670
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7671
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7672
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7673
addDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7674
    "add all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7675
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7676
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7677
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7678
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7679
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7680
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7682
removeDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7683
    "remove all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7684
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7685
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7686
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7687
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7688
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7689
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7690
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7691
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7692
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7693
choiceForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7694
    "returns choice form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7695
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7696
    |isOn|
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7697
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7698
    choice isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7699
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7700
    isOn := (choice value = menuItem choiceValue).
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7701
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7702
	^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7703
	       ifFalse:[menuPanel iconRadioGroupDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7704
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7705
    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7706
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7707
	    ifTrue:[menuPanel iconRadioGroupEnteredOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7708
	    ifFalse:[menuPanel iconRadioGroupEnteredOff]
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7709
    ].
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7710
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7711
	   ifFalse:[menuPanel iconRadioGroupOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7712
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7713
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7714
draw
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7715
    "redraw this item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7716
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7717
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7718
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7719
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7720
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7721
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7722
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7723
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7724
    self isVisible ifFalse:[^ self].
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7725
    layout isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7726
	"/ cg: why does this happen - it does!!
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7727
	^ self
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7728
    ].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7729
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7730
    self isSeparator ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7731
	self drawSeparator.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7732
	^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7733
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7734
    menuItem isButton ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7735
	self drawButton.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7736
	^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7737
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7738
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7739
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7740
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7741
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7742
    bgColor    := menuPanel backgroundColor.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7743
    paint      := isSelected
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7744
		    ifTrue:[self activeBackgroundColor]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7745
		    ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7746
			(self isEnabled and:[ self isEntered ]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7747
			    menuPanel enteredBackgroundColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7748
			] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7749
			    bgColor
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7750
			]].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7751
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7752
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7753
	paint := ownBgCol
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7754
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7755
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7756
    paint ~= bgColor ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7757
	menuPanel paint:paint.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7758
	menuPanel fillRectangle:layout.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7759
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7760
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7761
    menuPanel showSeparatingLines ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7762
	self drawSeparatingLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7763
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7764
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7765
    self drawLabel.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7766
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7767
    (ownBgCol notNil and:[isSelected]) ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7768
	ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7769
				 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7770
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7771
	x := layout left.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7772
	y := layout top.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7773
	w := layout width.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7774
	h := layout height.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7775
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7776
	menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  7777
	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
  7778
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7779
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7780
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7781
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7782
drawButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7783
    "draw as button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7784
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7785
    |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
  7786
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7787
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7788
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7789
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7790
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7791
    isSelected := self isSelected.
4632
de5377ba14e4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4631
diff changeset
  7792
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7793
    isSelected ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7794
        "/ test whether button has pressed toggle behaviour
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7795
        showSelected := (self isToggle and:[self indicationValue]).
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7796
    ] ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7797
        showSelected := isSelected
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7798
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7799
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7800
    showSelected ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7801
        bg := self activeBackgroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7802
        fg := self activeForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7803
        isEnabled ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7804
            fg := menuPanel disabledForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7805
        ].    
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7806
    ] ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7807
        self isEntered ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7808
            bg := self buttonEnteredBackgroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7809
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7810
            bg := self backgroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7811
        ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7812
        isEnabled ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7813
            fg := menuPanel foregroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7814
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7815
            fg := menuPanel disabledForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7816
            etchFg := menuPanel disabledEtchedForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7817
            drawObject := self disabledRawLabel
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7818
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7819
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7820
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7821
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7822
        bg := ownBgCol
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7823
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  7824
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7825
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7826
    bg ~= menuPanel backgroundColor ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7827
        menuPanel paint:bg.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7828
        menuPanel fillRectangle:layout.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7829
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7830
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7831
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7832
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7833
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7834
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  7835
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7836
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7837
    isSelected ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7838
        "check whether button should be drawn selected; indicator or radio button"
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7839
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7840
        indication notNil ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7841
            "button is indicator and set"
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7842
            isSelected := self indicationValue
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7843
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7844
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7845
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7846
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  7847
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7848
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7849
    isSelected ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7850
        level := menuPanel buttonActiveLevel.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7851
        x     := x + 1 "level abs".
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7852
        y     := y + 1 "level abs".
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7853
    ] ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7854
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7855
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7856
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  7857
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7858
    drawObject notEmptyOrNil ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7859
        etchFg notNil ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7860
            "/ donot draw images twice.. images are shown lightened
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7861
            drawObject isImageOrForm ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7862
                self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7863
            ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7864
        ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7865
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7866
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7867
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7868
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7869
    level ~~ 0 ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7870
        menuPanel drawButtonEdgesFor:self level:level
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7871
    ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7872
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  7873
    "Modified: / 13-02-2017 / 18:11:11 / cg"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7874
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7875
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7876
drawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7877
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7878
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7879
    |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
  7880
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7881
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7882
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7883
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7884
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7885
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7886
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7887
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7888
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7889
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7890
    isSelected ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7891
        fg := self activeForegroundColor
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7892
    ] ifFalse:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7893
        isEnabled ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7894
            self isEntered ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7895
                fg := menuPanel enteredForegroundColor
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7896
            ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7897
                fg := menuPanel foregroundColor
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7898
            ]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7899
        ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7900
            fg          := menuPanel disabledForegroundColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7901
            etchFg      := menuPanel disabledEtchedForegroundColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7902
            drawObject  := self disabledRawLabel
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7903
        ]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7904
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7905
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7906
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7907
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7908
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7909
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7910
    (    (form := self indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7911
     or:[(form := self choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  7912
    ) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7913
        y := t + ((h - form height) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7914
        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
  7915
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7916
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  7917
    drawObject notEmptyOrNil ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7918
        x := x + (menuPanel stringOffsetXfor:self).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7919
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7920
        etchFg notNil ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7921
            "/ do not draw images twice.. images are shown lightened
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7922
            drawObject isImageOrForm ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7923
                self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7924
            ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7925
        ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7926
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7927
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7928
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7929
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7930
    "/ DRAW SHORTCUT KEY
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7931
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7932
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7933
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7934
    ) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7935
        x := layout left + x.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7936
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7937
        y := y + menuPanel font ascent.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7938
        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
  7939
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7940
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7941
    "/ DRAW SUBMENU INDICATION (if a vertical menu with submenu)
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7942
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7943
        arrow := menuPanel rightArrow.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7944
        x := layout right - arrow width - HorizontalInset.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7945
        y := t + ((h - arrow height) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7946
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7947
        (menuPanel styleSheet is3D not
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7948
        or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7949
            menuPanel displayForm:arrow x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7950
        ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7951
            cLa := menuPanel shadowColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7952
            cLb := menuPanel lightColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7953
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7954
            isSelected ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7955
                fg  := cLa.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7956
                cLa := cLb.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7957
                cLb := fg
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7958
            ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7959
            menuPanel paint:cLa.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7960
            menuPanel displayForm:arrow x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7961
            menuPanel paint:cLb.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7962
            menuPanel displayForm:drawObject x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  7963
        ].
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  7964
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7965
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7966
    "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
  7967
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7968
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7969
drawMenuIndicator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7970
    "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
  7971
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7972
    |x y icon bAbsLevel verticalPosition|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7973
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7974
    icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7975
    icon isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7976
	^ self
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7977
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7978
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7979
    x := layout right  - icon width.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7980
    verticalPosition := menuPanel menuIndicatorVerticalPosition.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  7981
    verticalPosition == #center ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7982
	y := (layout height - icon height) // 2 + layout top.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7983
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7984
	verticalPosition == #top ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7985
	    y := layout top + 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7986
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7987
	    y := layout bottom - icon height - 2.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7988
	]
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7989
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7990
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  7991
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7992
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7993
	self isSelected ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7994
	    x := x + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7995
	    y := y + 1.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7996
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7997
	bAbsLevel := menuPanel maxAbsoluteButtonLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7998
	x := x - bAbsLevel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7999
	y := y - bAbsLevel.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8000
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8001
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8002
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8003
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8004
	icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8005
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8006
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8007
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8008
    (menuPanel drawMenuIndicatorSeparatorLine
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8009
	and:[ self isEntered
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8010
	and:[ menuPanel buttonEnteredLevel ~~ 0] ])
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8011
    ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8012
	menuPanel paint:menuPanel buttonShadowColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8013
	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
  8014
	menuPanel paint:menuPanel buttonLightColor.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8015
	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
  8016
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8017
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8018
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8019
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8020
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8021
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8022
    |oldFont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8023
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8024
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8025
     x0 "{ Class:SmallInteger }"
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8026
     isSelected|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8027
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8028
    isSelected := self isSelected.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8029
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8030
    oldFont := menuPanel setFont:(self font).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8031
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  8032
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  8033
4232
8193baee0399 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  8034
    y := layout top + ((layout height - labelExtent y) // 2) + yOffset.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8035
    aLabel isArray ifFalse:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8036
        |printLabel|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8037
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8038
        (aLabel isText or:[aLabel isLabelAndIcon]) ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8039
            "/ background of label has already been drawn
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8040
            "/ 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
  8041
            isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8042
                printLabel := aLabel withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8043
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8044
                printLabel := aLabel withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8045
            ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8046
        ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8047
            printLabel := aLabel.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8048
        ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8049
        y := y + (printLabel ascentOn:menuPanel).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8050
        printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8051
    ] ifTrue:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8052
        aLabel do:[:eachLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8053
            |shownLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8054
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8055
            eachLine notNil ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8056
                "/ 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
  8057
                isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8058
                    shownLine := eachLine withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8059
                ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8060
                    shownLine := eachLine withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8061
                ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8062
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8063
                y0 := y + (shownLine ascentOn:menuPanel).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8064
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8065
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8066
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8067
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8068
"/                ].
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8069
                x0 := x + ((labelExtent x - (shownLine widthOn:menuPanel)) // 2).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8070
                shownLine displayOn:menuPanel x:x0 y:y0.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8071
                y := y + 1 + (shownLine heightOn:menuPanel)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8072
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8073
                y := y + (self spaceBetweenEmptyLines)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8074
            ]
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8075
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8076
    ].
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8077
    menuPanel setFont:oldFont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8078
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8079
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8080
drawSeparatingLines
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8081
    "draw separating lines"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8082
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8083
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8084
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8085
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8086
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8087
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8088
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  8089
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8090
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8091
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8092
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8093
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8094
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8095
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8096
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8097
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8098
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8099
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8100
    (lfSep or:[rtSep]) ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8101
        ^ self
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8102
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8103
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8104
    menuPanel suppressSeparatingLines ifTrue:[^ self].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8105
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8106
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8107
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8108
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8109
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8110
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8111
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8112
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8113
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8114
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8115
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8116
    menuPanel verticalLayout ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8117
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8118
        rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8119
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8120
        menuPanel paint:shadowColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8121
        lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8122
        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
  8123
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8124
        lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8125
        rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8126
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8127
        menuPanel paint:shadowColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8128
        lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8129
        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
  8130
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8131
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8132
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8133
drawSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8134
    "draw as separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8135
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8136
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8137
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8138
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8139
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8140
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8141
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8142
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8143
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8144
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8145
    (type isNil or:[type == #blankLine]) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8146
        ^ self
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8147
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8148
    menuPanel suppressSeparatingLines ifTrue:[^ self].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8149
    
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8150
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8151
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8152
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8153
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8154
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8155
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8156
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8157
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8158
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8159
    menuPanel verticalLayout ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8160
        x0 := left  + HorizontalInset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8161
        x1 := layout right - HorizontalInset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8162
        y0 := top   - 1 + (layout height // 2).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8163
        isDouble ifTrue:[y0 := y0 - 2].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8164
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8165
        menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8166
        isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8167
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8168
        menuPanel paint:lightColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8169
        menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8170
        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
  8171
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8172
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8173
        y1 := layout bottom.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8174
        x0 := left - 1 + (layout width // 2).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8175
        y0 := top.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8176
        isDouble ifTrue:[x0 := x0 - 2].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8177
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8178
        menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8179
        isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8180
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8181
        menuPanel paint:lightColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8182
        menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8183
        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
  8184
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8185
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8186
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8187
indicatorForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8188
    "returns indication form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8189
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8190
    |isOn|
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8191
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8192
    indication isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8193
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8194
    isOn := self indicationValue.
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8195
    self enabled ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8196
	^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8197
	    ifTrue:[menuPanel iconIndicationDisabledOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8198
	    ifFalse:[menuPanel iconIndicationDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8199
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8200
"/    self isSelected ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8201
"/        ^ isOn == true
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8202
"/            ifTrue:[menuPanel iconIndicationEnteredOn]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8203
"/            ifFalse:[menuPanel iconIndicationEnteredOff]
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8204
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8205
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8206
    ^ isOn == true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8207
	ifTrue:[menuPanel iconIndicationOn]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8208
	ifFalse:[menuPanel iconIndicationOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8209
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8210
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8211
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8212
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8213
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8214
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8215
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8216
	menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8217
    ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8218
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8219
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8220
menuIndicatorIcon
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8221
    "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
  8222
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8223
    self hasDelayedMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8224
	^ MenuPanel delayedMenuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8225
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8226
    self hasMenuIndicator ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8227
	^ MenuPanel menuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8228
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8229
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8230
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8231
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8232
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8233
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8234
destroy
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8235
    "destroy submenus, remove dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8236
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8237
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  8238
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8239
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8240
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8241
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8242
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8243
in:aPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8244
    "create item in a menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8245
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8246
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8247
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8248
    menuItem isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8249
	self breakPoint:#ca.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8250
	menuItem := MenuItem new
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8251
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8252
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8253
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8254
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8255
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8256
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8257
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8258
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8259
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8260
    subMenu notNil ifTrue:[
3147
b7c2db746f84 conditionalRight fix
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
  8261
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8262
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8263
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8264
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8265
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8266
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8267
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8268
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8269
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8270
disabledRawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8271
    "returns the label used if the item is disabled"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8272
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8273
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8274
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8275
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8276
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8277
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8278
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8279
    disabledDisplayLabel isString ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8280
        ^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8281
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8282
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8283
    block := [:el| |rslt|
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8284
        (rslt := el) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8285
            el isImageOrForm ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8286
                el colorMap notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8287
                    rslt := menuPanel lightenedImageOnDevice:el
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8288
                ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8289
            ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8290
                (displayLabel isLabelAndIcon) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8291
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8292
                        form := menuPanel lightenedImageOnDevice:form
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8293
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8294
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8295
                        image := menuPanel lightenedImageOnDevice:image
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8296
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8297
                    rslt := LabelAndIcon form:form image:image string:(el string).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8298
                ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8299
            ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8300
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8301
        rslt
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8302
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8303
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8304
    displayLabel isArray ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8305
        disabledDisplayLabel := Array new:(displayLabel size).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8306
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8307
        displayLabel keysAndValuesDo:[:anIndex :aLabel|
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8308
            disabledDisplayLabel at:anIndex put:(block value:aLabel)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8309
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8310
    ] ifFalse:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8311
        disabledDisplayLabel := block value:displayLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8312
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8313
    ^ disabledDisplayLabel
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8314
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8315
    "Modified: / 04-02-2017 / 22:11:45 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8316
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8317
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8318
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  8319
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8320
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8321
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8322
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8323
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8324
fetchImages
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8325
    "fetch my icon images"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8326
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8327
    |icon device makeDeviceImage|
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  8328
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8329
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8330
        ^ self
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8331
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8332
    (device := menuPanel device) isNil ifTrue:[^ self].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8333
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8334
    makeDeviceImage :=
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8335
        [:thingy |
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8336
            thingy isImageOrForm ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8337
                thingy onDevice:device.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8338
                "/ menuPanel imageOnMyDevice:thingy.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8339
            ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8340
                (thingy isLabelAndIcon) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8341
                    (icon := thingy image) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8342
                        thingy image:(icon onDevice:device)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8343
                        "/ thingy image:(menuPanel imageOnMyDevice:icon)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8344
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8345
                    (icon := thingy icon) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8346
                        thingy icon:(icon onDevice:device)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8347
                        "/ thingy icon:(menuPanel imageOnMyDevice:icon)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8348
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8349
                ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8350
                thingy
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8351
            ].    
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8352
       ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8353
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8354
    displayLabel isArray ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8355
        displayLabel := makeDeviceImage value:displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8356
    ] ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8357
        displayLabel doWithIndex:[:el :i |
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8358
            (el notNil and:[el isString not]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8359
                displayLabel at:i put:(makeDeviceImage value:el)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8360
            ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8361
        ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8362
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8363
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8364
    "Modified: / 04-02-2017 / 22:08:43 / cg"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8365
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8366
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8367
updateAccessCharacterFor:aLabel
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  8368
    "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
  8369
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  8370
    accessCharacter notNil ifTrue:[^ aLabel].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8371
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8372
    aLabel isString ifFalse:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8373
        aLabel isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8374
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8375
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8376
        ^ aLabel
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8377
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8378
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8379
    ^ MenuPanel
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8380
                processAmpersandCharactersFor:aLabel
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8381
                withAccessCharacterPosition:(menuItem accessCharacterPosition).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8382
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8383
    "Modified: / 04-02-2017 / 22:09:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8384
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8385
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8386
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8387
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  8388
printOn:aGCOrStream
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8389
    aGCOrStream
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8390
	nextPutAll:self class name;
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8391
	nextPut:$(.
4139
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8392
    label displayOn:aGCOrStream.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8393
    aGCOrStream nextPut:$).
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8394
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8395
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8396
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8397
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8398
activeBackgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8399
    "returns the active background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8400
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8401
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8402
	^ menuPanel buttonActiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8403
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8404
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8405
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8406
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8407
activeForegroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8408
    "returns the active foreground color derived from menuPanel"
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8409
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8410
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8411
	^ menuPanel buttonActiveForegroundColor
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8412
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8413
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8414
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8415
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8416
backgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8417
    "returns the background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8418
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8419
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8420
	^ menuPanel buttonPassiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8421
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8422
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8423
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8424
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8425
backgroundColorFromLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8426
    "returns the background color derived from label or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8427
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8428
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8429
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8430
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8431
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8432
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8433
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8434
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8435
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8436
    run size == 0 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8437
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8438
	    ^ run value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8439
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8440
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8441
	run do:[:r|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8442
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8443
		^ r value
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8444
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8445
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8446
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8447
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8448
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8449
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8450
buttonEnteredBackgroundColor
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8451
    "returns the background color to use when thhe mouse has entered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8452
     derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8453
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8454
    menuItem isButton ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8455
	^ menuPanel buttonEnteredBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8456
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8457
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8458
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8459
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8460
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8461
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8462
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8463
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8464
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8465
3866
fbdbf71489d8 show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  8466
    |subm sel numArgs gotMenu|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8467
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8468
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8469
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8470
    sel := menuItem submenuChannel.
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8471
    (sel isString or:[sel isSymbol]) ifFalse:[^ nil].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8472
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8473
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8474
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8475
    numArgs == 0 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8476
	gotMenu := false.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8477
	MessageNotUnderstood handle:[:ex |
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8478
	    |selector|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8479
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8480
	    ((selector := ex selector) == sel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8481
	    or:[selector == #aspectFor:]) ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8482
		ex reject
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8483
	    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8484
	] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8485
	    subm := aRecv aspectFor:sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8486
	    gotMenu := true.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8487
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8488
	"/ used to be subm notNil; however, this is a bad test,
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8489
	"/ 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
  8490
	gotMenu ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8491
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8492
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8493
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8494
    do:[:aPossibleReceiver |
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8495
	MessageNotUnderstood handle:[:ex|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8496
	    ex message selector == sel ifFalse:[ ex reject ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8497
	] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8498
	    numArgs == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8499
		subm := aPossibleReceiver perform:sel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8500
	    ] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8501
		numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8502
		    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8503
		] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8504
		    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8505
		]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8506
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8507
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8508
	subm notNil ifTrue:[^ subm].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8509
	Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8510
	    "/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8511
	]
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8512
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8513
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8514
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8515
4027
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  8516
    "Modified: / 24-03-2011 / 11:20:24 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8517
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8518
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8519
indicationValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8520
    "returns indication value or nil in case of no indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8521
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8522
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8523
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8524
    indication isNil ifTrue:[^ nil].       "no indication specified"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8525
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8526
    indication isSymbol ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8527
	^ 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
  8528
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8529
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8530
    numArgs := indication numArgs.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8531
    numArgs == 2 ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8532
	recv := menuPanel receiver ? menuPanel application.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8533
	(recv notNil and:[recv isValueModel not]) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8534
	    sel := indication copyFrom:1 to:(indication indexOf:$:).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8535
	    sel := sel asSymbol.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8536
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8537
	    MessageNotUnderstood handle:[:ex|
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8538
		ex selector ~~ sel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8539
		    ex reject.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8540
		].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8541
	    ] do:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8542
		sel := recv perform:sel with:(menuItem argument).
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8543
	    ]
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8544
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8545
    ] ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8546
	numArgs == 0 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8547
	    sel := indication
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8548
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8549
	    sel := (indication copyButLast:1) asSymbol.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8550
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8551
	sel := self aspectAt:sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8552
	sel isValueModel ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8553
	    indication := sel.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8554
	    indication addDependent:self.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8555
	].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8556
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8557
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8558
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8559
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8560
indicationValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8561
    "set the indication value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8562
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8563
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8564
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8565
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8566
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8567
    indication isSymbol ifFalse:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8568
	indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8569
	^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8570
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8571
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8572
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8573
	^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8574
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8575
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  8576
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8577
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8578
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8579
    recv isNil ifTrue:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8580
	recv := menuPanel application.
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8581
	recv isNil ifTrue:[^ self].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8582
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8583
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8584
    MessageNotUnderstood handle:[:ex|
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8585
	(ex selector ~~ indication) ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8586
	    ex reject
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8587
	].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8588
	self ifNotInUIBuilderInfoPrintCR:
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8589
	    ('MenuPanel::Item [info]: application (%1) does not respond to: %2'
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8590
	     bindWith:recv classNameWithArticle
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8591
	     with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8592
    ] do:[
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8593
	numArgs == 1 ifTrue:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8594
	    recv perform:indication with:aValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8595
	] ifFalse:[
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8596
	    recv perform:indication with:(menuItem argument ? self) with:aValue
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8597
	]
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8598
    ].
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8599
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8600
    "Modified (format): / 02-08-2013 / 16:42:20 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8601
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8602
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8603
isEntered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8604
    "returns true if the mouse pointer is over the item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8605
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8606
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8607
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8608
    "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
  8609
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8610
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  8611
separatorType
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8612
    "returns type of separator line or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8613
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8614
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8615
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8616
    self isSeparator ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8617
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8618
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8619
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8620
    (lbl := label value) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8621
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8622
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8623
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8624
    lbl size == 1 ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8625
	c := lbl first.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8626
	c == $- ifTrue:[^ #singleLine].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8627
	c == $= ifTrue:[^ #doubleLine].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8628
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8629
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8630
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8631
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8632
setupSubmenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8633
    |appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8634
     channel whoProvidedMenu t|
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8635
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8636
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8637
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8638
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8639
    subMenu notNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8640
	menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8641
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8642
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8643
    channel isSymbol ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8644
	submenuHolder := channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8645
    ] ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8646
	"/ submenu is specified by a selector in submenuChannel.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8647
	"/ who gets me the menu:
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8648
	"/ 1) submenuProvider (if not nil)
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8649
	"/ 2) menuPanel application
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8650
	"/ 3) menuPanel receiver
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8651
	"/ 4) menuPanel application master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8652
	"/ 5) menuPanel receiver master-chain
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8653
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8654
	(submenuProvider := menuItem submenuProvider) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8655
	    submenuHolder := self findSubMenuIn:submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8656
	    whoProvidedMenu := submenuProvider.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8657
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8658
	submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8659
	    appl := menuPanel application.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8660
	    (appl notNil and:[appl ~~ submenuProvider]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8661
		submenuHolder := self findSubMenuIn:appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8662
		whoProvidedMenu := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8663
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8664
	    submenuHolder isNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8665
		recv := menuPanel receiver.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8666
		(recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8667
		    submenuHolder := self findSubMenuIn:recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8668
		    whoProvidedMenu := recv.
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
		(submenuHolder isNil and:[appl notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8671
		    t := appl.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8672
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8673
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8674
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8675
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8676
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8677
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8678
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8679
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8680
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8681
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8682
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8683
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8684
		(submenuHolder isNil and:[recv notNil]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8685
		    t := recv.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8686
		    [ submenuHolder isNil
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8687
		       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8688
		    ] whileTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8689
		       ( master ~~ appl
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8690
			and:[ master ~~ recv
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8691
			and:[ master ~~ submenuProvider ]] ) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8692
			    submenuHolder := self findSubMenuIn:master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8693
			].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8694
			t := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8695
			whoProvidedMenu := master.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8696
		    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8697
		].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8698
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8699
	].
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8700
"/        submenuHolder isNil ifTrue:[
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8701
"/            self halt:'did not find any menu'
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8702
"/        ].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8703
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8704
"/        appl := menuPanel application.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8705
"/        appl isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8706
"/            appl := menuPanel receiver.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8707
"/            appl notNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8708
"/                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8709
"/                    [submenuHolder isNil
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8710
"/                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8711
"/                          and:[master ~~ appl]]] whileTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8712
"/                        appl := master.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8713
"/                        submenuHolder := self findSubMenuIn:appl.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8714
"/                    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8715
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8716
"/            ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8717
"/        ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8718
"/        submenuHolder isNil ifTrue:[
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8719
"/            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8720
"/                (recv := menuPanel receiver) ~~ appl ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8721
"/                    appl := recv.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8722
"/                    submenuHolder := self findSubMenuIn:appl
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8723
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8724
"/            ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8725
"/        ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8726
    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8727
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8728
    (newSubmenu := submenuHolder value) isArray ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8729
	submenuEncoding := newSubmenu.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8730
	newSubmenu := Menu decodeFromLiteralArray:submenuEncoding.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8731
	"/ cg: linked menus also may contain translations ...
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8732
	newSubmenu notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8733
	    whoProvidedMenu "appl" notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8734
		newSubmenu findGuiResourcesIn:whoProvidedMenu "appl".
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8735
	    ]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8736
	].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8737
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8738
    "/ appl notNil ifTrue:[submenu application:appl].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8739
    self submenu:newSubmenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8740
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8741
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  8742
    "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
  8743
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8744
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8745
spaceBetweenEmptyLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8746
	^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8747
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8748
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8749
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8750
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8751
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8752
    "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
  8753
     otherwise there is a change notification raised if the model changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8754
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8755
    ^ isVisible isSymbol or:[isVisible isValueModel]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8756
"/  ^ isVisible notNil and:[isVisible ~~ true]
3112
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8757
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  8758
    "Modified: / 11-10-2006 / 21:43:31 / cg"
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  8759
    "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
  8760
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  8761
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8762
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  8763
    "returns true if item is selectable; no separator, visible and enabled.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8764
     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
  8765
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8766
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8767
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8768
    (self isVisible and:[self enabled]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8769
	(choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8770
	    ^ true
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8771
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8772
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  8773
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8774
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8775
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8776
containsPoint:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8777
    "returns true if aPoint is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8778
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8779
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8780
	^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8781
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8782
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8783
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8784
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8785
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  8786
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8787
containsPointX:x y:y
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8788
    "returns true if point is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8789
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8790
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8791
	^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8792
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  8793
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8794
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8795
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8796
hasDelayedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8797
    "returns true if a delayed menu exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8798
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8799
    self hasSubmenu ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8800
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8801
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8802
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8803
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  8804
    (indication isNil and:[choice isNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8805
	^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8806
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8807
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8808
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8809
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8810
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8811
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8812
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8813
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8814
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8815
	^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8816
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8817
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8818
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8819
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8820
hasIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8821
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8822
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8823
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8824
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8825
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8826
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8827
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8828
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8829
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8830
    menuPanel isPopUpView ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8831
	^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8832
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8833
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8834
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8835
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8836
hasSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8837
    "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
  8838
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8839
    ^ subMenu notNil or:[ menuItem submenuChannel notNil ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8840
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8841
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8842
isEnabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8843
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8844
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8845
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8846
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8847
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8848
isSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8849
    "returns true if item is a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8850
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8851
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8852
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8853
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8854
isToggle
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8855
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8856
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8857
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8858
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8859
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8860
isVisible
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8861
    "returns the visibility state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8862
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8863
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8864
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8865
    menuPanel isNil ifTrue:[^ false].
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8866
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8867
    isVisible isSymbol ifTrue:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8868
        state := self aspectAt:isVisible.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8869
        state isValueModel ifTrue:[
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8870
            isVisible := state.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8871
            isVisible addDependent:self.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8872
        ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8873
    ] ifFalse:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  8874
        state := isVisible
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8875
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8876
    ^ state value ~~ false
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8877
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8878
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8879
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8880
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8881
isVisible:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8882
    "change the visibility state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8883
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8884
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8885
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8886
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8887
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8888
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8889
	oldState := isVisible value.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8890
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8891
	    isVisible removeDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8892
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8893
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8894
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8895
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8896
    isVisible isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8897
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8898
    ] ifFalse:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8899
	isVisible isValueModel ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8900
	    isVisible addDependent:self
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8901
	] ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8902
	    isVisible isSymbol ifTrue:[^ self]
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8903
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8904
	menuPanel shown ifFalse:[^ self].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8905
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8906
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8907
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8908
    newState ~~ oldState ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8909
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8910
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8911
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  8912
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8913
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  8914
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8915
menuIndicatorContains:aPoint
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8916
    "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
  8917
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8918
    |icon xSep|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8919
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8920
    (self isVisible and:[layout notNil]) ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8921
	(layout containsPoint:aPoint) ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8922
	    icon := self menuIndicatorIcon.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8923
	    icon notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8924
		xSep := layout right - icon width.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8925
		^ aPoint x >= xSep
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
	]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8928
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8929
    ^ false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8930
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8931
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8932
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8933
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8934
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8935
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8936
shortcutKeyAsString
3601
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8937
    "converts shortcutKey to a text object for the menu-label-hint.
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  8938
     returns nil, if the key has no assignment."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8939
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8940
    |shortcutKey|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8941
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8942
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8943
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8944
    shortcutKey isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8945
	^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8946
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  8947
    shortcutKey isCharacter ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8948
	shortcutKey == Character space ifFalse:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8949
	    ^ 'Space'
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8950
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8951
	^ shortcutKey asString
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8952
    ].
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8953
    ^ menuPanel device shortKeyStringFor:shortcutKey.
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8954
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  8955
    "Modified: / 08-08-2006 / 15:46:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8956
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8957
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8958
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8959
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8960
isSelected
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8961
    "returns true if item is selected"
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8962
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  8963
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8964
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8965
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8966
isSelected:isSelected
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8967
    "change selection to a state. Depending on the state open or hide an existing
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8968
     submenu and perform a redraw"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8969
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8970
    (isSelected and:[menuPanel notNil]) ifFalse:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8971
        self invalidate.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8972
        self hideSubmenu.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8973
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8974
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  8975
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8976
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8977
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8978
    (indication isNil or:[menuItem isButton not]) ifTrue:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8979
        self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8980
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8981
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8982
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8983
    self hasDelayedMenu ifTrue:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8984
        menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  8985
    ] ifFalse:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8986
        self setupSubmenu.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  8987
        subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  8988
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8989
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  8990
    "Modified: / 07-11-2006 / 11:08:03 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8991
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8992
4755
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8993
!MenuPanel::Item methodsFor:'testing'!
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8994
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8995
isMenuItem
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8996
    "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
  8997
     true is returned here - I am a menuitem"
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8998
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  8999
    ^ true
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9000
! !
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9001
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9002
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9003
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9004
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9005
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9006
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9007
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9008
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9009
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9010
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9011
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9012
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9013
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9014
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9015
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9016
icon
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9017
    ^ self iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9018
! !
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9019
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9020
!MenuPanel::ScrollActivity class methodsFor:'image specs'!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9021
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9022
iconBlack
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9023
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9024
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9025
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9026
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9027
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9028
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9029
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9030
     self iconBlack inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9031
     ImageEditor openOnClass:self andSelector:#iconBlack
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9032
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9033
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9034
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  9035
    <resource: #image>
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9036
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9037
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9038
        constantNamed:'MenuPanel::ScrollActivity iconBlack'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9039
        ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[0 0 0 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9040
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9041
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9042
iconGrey
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9043
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9044
     by the ImageEditor of ST/X."
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9045
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9046
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9047
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9048
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9049
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9050
     self iconGrey inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9051
     ImageEditor openOnClass:self andSelector:#iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9052
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9053
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9054
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9055
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9056
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9057
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9058
        constantNamed:'MenuPanel::ScrollActivity iconGrey'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9059
        ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[91 91 91 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9060
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9061
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9062
iconGrey3D
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9063
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9064
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9065
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9066
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9067
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9068
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9069
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9070
     self iconGrey inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9071
     ImageEditor openOnClass:self andSelector:#iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9072
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9073
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9074
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9075
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9076
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9077
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9078
        constantNamed:'MenuPanel::ScrollActivity iconGrey'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9079
        ifAbsentPut:[(Depth1Image width:11 height:11) bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') colorMapFromArray:#[91 91 91 255 255 255] mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9080
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9081
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9082
iconScrollLeft
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9083
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9084
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9085
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9086
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9087
     the ImageEditor may not be able to read the specification."
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9088
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9089
    "
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9090
     self iconScrollLeft inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9091
     ImageEditor openOnClass:self andSelector:#iconScrollLeft
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9092
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9093
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9094
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9095
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9096
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9097
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9098
        constantNamed:'MenuPanel::ScrollActivity iconScrollLeft'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9099
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9100
@@@@@@@@@@@@@@@@@@@@@@@1H14@@@@@@@@@@A4R@A@@@@@@@@@@J@8I@" @@@@@@@@ B28)@Q8@@@@@@A$$F!! FG @@@@@@C@P,E (^@@@@@@@@CAPWA2,@
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9101
@@@@@@@@@@L%D2X"@@@@@@@@@@@HCPT[EP@@@@@@@@@@BB<*G0X@@@@@@@@@@@0''KP<@@@@@@@@@@C@\K"@@@@@@@@@@@@@^DQ8@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@G@@<@G0@?@G8@?@C8@G0@O @_@@<@C0@G@@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9102
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9103
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9104
iconScrollLeftM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9105
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9106
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9107
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9108
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9109
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9110
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9111
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9112
     self iconScrollLeftM inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9113
     ImageEditor openOnClass:self andSelector:#iconScrollLeftM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9114
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9115
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9116
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9117
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9118
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9119
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9120
        constantNamed:'MenuPanel::ScrollActivity iconScrollLeftM'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9121
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9122
@@@@@@@@@@@@@@@@@@@@@@@1H14@@A4@@@@@@A4R@A@@@@@]@@@@J@8I@ @]@A4@@@@ B28)@Q8@GP@@@A$$F!! FG @]@A4@C@P,E (^GQ4@GP@]CAPWA2,]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9123
GP@]@A4@@@L%D2X"GQ4@GP@@@@@HCPT[EP@]@A4@@@@@BB<*G0X@GP@]@@@@@@0''KP<]@A4@@@@@@@@\K"@@GP@@@@@@@@@@DQ8]@A4@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@GH@<PG*@?PG: ?5C>(G=@O*@_T@> A4@C(@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9124
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9125
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9126
iconScrollRight
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9127
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9128
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9129
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9130
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9131
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9132
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9133
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9134
     self iconScrollRight inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9135
     ImageEditor openOnClass:self andSelector:#iconScrollRight
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9136
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9137
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9138
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9139
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9140
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9141
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9142
        constantNamed:'MenuPanel::ScrollActivity iconScrollRight'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9143
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9144
@@@@@@@@@@@@@@@@@@@@@A4#LP@@@@@@@@@@@A@@D!!4@@@@@@@@@@B BBP8(@@@@@@@@@A8AJR8KH@@@@@@@@@@^A!! ZIA$@@@@@@@@@G (VK@PL@@@@@@@@
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9145
@B,GE1PL@@@@@@@@H"XSIPL@@@@@@@@UF0TMB@@@@@@@@@X_J"<H@@@@@@@@@@<-I00@@@@@@@@@@B@.GC@@@@@@@@@@@A8QG @@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@@N@@<@C8@O0@_ @?@A<@O A<@O @<@C0@N@@@a'); yourself); yourself]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9146
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9147
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9148
iconScrollRightM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9149
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9150
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9151
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9152
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9153
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9154
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9155
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9156
     self iconScrollRightM inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9157
     ImageEditor openOnClass:self andSelector:#iconScrollRightM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9158
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9159
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9160
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9161
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9162
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9163
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9164
        constantNamed:'MenuPanel::ScrollActivity iconScrollRightM'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9165
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9166
@@@@@@@@@@@@@@@@@A4@@A4#LP@@@@@@GP@@@A@@D!!4@@@@@@A4@GP@BBP8(@@@@@@@]@A8AJR8KH@@@@A4@GP@^A!! ZIA$@GP@]@A4]G (VK@PL@A4@GP@]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9167
GR,GE1PL@@@]@A4]H"XSIPL@@A4@GP@UF0TMB@@@GP@]@@X_J"<H@@@@@A4@GP<-I00@@@@@@@@]@B@.G@@@@@@@@A4@GQ8Q@@@@@@@@') colorMapFromArray:#[139 138 139 227 227 227 133 133 133 240 240 240 106 106 106 173 173 173 226 226 226 160 160 160 239 239 239 145 145 145 225 225 225 104 104 104 238 238 238 157 157 157 103 103 103 116 116 116 89 89 89 250 250 250 102 102 102 169 169 169 142 142 142 222 222 222 155 155 155 168 168 168 141 141 141 236 236 236 154 154 154 127 127 127 234 234 234 229 229 230 247 247 247 128 128 128 233 233 233 246 246 246 219 219 219 85 85 85 107 107 108 152 152 152 125 125 125 165 165 165 231 231 231 137 137 137 177 177 177 217 217 217 163 163 163 176 176 176 149 149 149 162 162 162 247 246 247 228 228 228] mask:((Depth1Image width:12 height:14) bits:(ByteArray fromPackedString:'@@AN@H<@U8@/0E_ +?AW<B? U<B/ E<@K A\@@@a'); yourself); yourself]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9168
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9169
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9170
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9171
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9172
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9173
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9174
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9175
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9176
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9177
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9178
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9179
    "returns the active menu the scrolling is activated on; nil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9180
     is returned if scrolling is deactivated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9181
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9182
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9183
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9184
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9185
direction
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9186
    "returns the scroll-direction"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9187
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9188
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9189
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9190
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9191
iconAt:aDirection on:aMenu
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9192
    |icon menusDevice index|
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9193
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9194
    menusDevice := aMenu device.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9195
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9196
    aDirection == #PREV ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9197
        aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9198
                            ifFalse:[index := 2]    "/ 2 - 1 * 90  90
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9199
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9200
        aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9201
                            ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9202
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9203
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9204
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9205
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9206
    (icon isNil or:[icon device ~~ menusDevice]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9207
        icon := self class icon.
5333
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9208
        index > 1 ifTrue:[ icon := icon rotated:((index - 1) * 90) ]
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9209
                 ifFalse:[ icon := icon copy ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9210
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9211
        icon := icon onDevice:menusDevice.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9212
        icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9213
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9214
    ^ icon
5333
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9215
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9216
    "Modified (format): / 16-11-2016 / 23:12:59 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9217
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9218
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9219
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9220
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9221
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9222
4173
84cae9f6efce class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4172
diff changeset
  9223
    semaLock := RecursionLock new name:'MenuPanel ScrollActivity'.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9224
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9225
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9226
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9227
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9228
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9229
isActive
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9230
    "returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9231
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9232
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9233
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9234
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9235
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9236
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  9237
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9238
    "start scrolling; returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9239
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9240
    |isScrolledMenu|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9241
"/true ifTrue:[^ self __startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  9242
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  9243
    isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9244
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9245
    semaLock critical:[ |bounds boundsOnRoot|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9246
        self stop.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9247
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9248
        (aMenu notNil and:[aMenu shown and:[aMenu hasScrollerAt:aDirection]]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9249
            bounds := aMenu scrollerBoundsAt:aDirection.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9250
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9251
            comesViaButtonPress ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9252
                boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9253
                                          extent:(bounds extent).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9254
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9255
            "clear selection"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9256
            aMenu selection:nil openMenu:false.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9257
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9258
            activeMenu := aMenu.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9259
            direction  := aDirection.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9260
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9261
            (aMenu hasScrollerAt:aDirection) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9262
                scrollTask :=
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9263
                    [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9264
                        |continue|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9265
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9266
                        [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9267
                            aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9268
                            Delay waitForSeconds:(ButtonController defaultInitialDelay).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9269
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9270
                            [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9271
                                continue := aMenu shown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9272
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9273
                                boundsOnRoot notNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9274
                                    continue ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9275
                                        continue := boundsOnRoot containsPoint:aMenu sensor mousePoint.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9276
                                    ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9277
                                        boundsOnRoot := nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9278
                                    ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9279
                                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9280
                                continue
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9281
                            ]  whileTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9282
                                aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9283
                                Delay waitForSeconds:(ButtonController defaultRepeatDelay).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9284
                            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9285
                        ] ensure:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9286
                            activeMenu := direction := scrollTask := nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9287
                            aMenu invalidate:bounds.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9288
                        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9289
                    ] forkAt:8.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9290
            ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9291
                aMenu invalidate:bounds.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9292
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9293
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9294
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9295
    ^ scrollTask notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  9296
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9297
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9298
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9299
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9300
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9301
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9302
stop
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9303
    "stop scrolling; returns true if the scrolling was activated otherwise false"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9304
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9305
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9306
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9307
    activeMenu isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9308
	^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9309
    ].
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  9310
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9311
    semaLock critical:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9312
	resp := activeMenu notNil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9313
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9314
	(task := scrollTask) notNil ifTrue:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9315
	    scrollTask := nil.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9316
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9317
	    Error handle:[:ex|
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9318
	    ] do:[
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9319
		task terminateWithAllSubprocessesInGroup.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9320
		task waitUntilTerminated.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9321
	    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9322
	].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9323
	activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9324
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9325
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9326
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9327
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9328
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9329
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9330
version
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  9331
    ^ '$Header$'
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9332
!
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9333
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  9334
version_CVS
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  9335
    ^ '$Header$'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9336
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9337
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  9338
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9339
MenuPanel initialize!