MenuPanel.st
author Stefan Vogel <sv@exept.de>
Wed, 22 May 2019 16:10:09 +0200
changeset 6053 88091f958e67
parent 6050 63d0cca05196
child 6055 ecbbd4e84b0f
permissions -rw-r--r--
#BUGFIX by stefan class: DSVColumnView changed: #update:with:from: invaldiate when enableChannel changes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
     1
"{ Encoding: utf8 }"
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
     2
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     3
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     4
 COPYRIGHT (c) 1997 by eXept Software AG
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
     5
              All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     6
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     7
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     8
 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
     9
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    11
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    12
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    13
"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
    15
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
    16
"{ NameSpace: Smalltalk }"
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
    17
2182
59a770bbb95a changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
    18
View subclass:#MenuPanel
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    19
	instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    20
		selection items groupSizes receiver enabled lastActiveMenu
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    21
		enteredItem prevFocusView previousPointerGrab
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    22
		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    23
		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    24
		showSeparatingLines showGroupDivider implicitGrabView
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    25
		lastPointerView openDelayedMenuBlock closeDelayedMenuBlock
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    26
		preferredWidth application originator centerItems hideOnRelease
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    27
		defaultHideOnRelease buttonInsetX buttonInsetY itemSpace
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    28
		stringOffsetX doAccessCharacterTranslation lastItem hasPerformed
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    29
		focusComesByTab lastDrawnScrollerNextBounds
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    30
		buttonActiveBackgroundColor buttonEnteredBackgroundColor
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    31
		buttonPassiveBackgroundColor sizeFixed extraMargin
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    32
		buttonActiveLevel buttonPassiveLevel buttonEnteredLevel
5824
04608830f559 #REFACTORING by sr
sr
parents: 5823
diff changeset
    33
		pluggableHelpSpecProvider'
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    34
	classVariableNames:'DefaultBackgroundColor DefaultForegroundColor
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    35
		IconDisabledIndicationOff IconDisabledIndicationOn
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    36
		IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    37
		IconIndicationOn IconRadioOff IconRadioOn Images
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    38
		InitialSelectionQuerySignal LigthenedImages
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    39
		MaxShortCutSearchLevel'
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    40
	poolDictionaries:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    41
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    42
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    43
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    44
Object subclass:#Item
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    45
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    46
		disabledDisplayLabel enableChannel label activeHelpText
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    47
		flyByHelpText isVisible indication choice accessCharacter'
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    48
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    49
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    50
	poolDictionaries:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    51
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    52
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    53
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    54
Object subclass:#Adornment
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    55
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    56
		choice choiceValue'
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    57
	classVariableNames:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    58
	poolDictionaries:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    59
	privateIn:MenuPanel::Item
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    60
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    61
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    62
Object subclass:#ScrollActivity
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    63
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    64
	classVariableNames:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    65
	poolDictionaries:''
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
    66
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    67
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    68
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    69
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    70
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    71
copyright
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    72
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    73
 COPYRIGHT (c) 1997 by eXept Software AG
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
    74
              All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    75
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    76
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    77
 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
    78
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    79
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    80
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    81
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    82
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    83
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    85
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    86
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    87
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    88
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    89
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    90
    Due to some historic leftover, there are two mechanisms for menus:
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
    91
        1) the (very) old MenuView (which inherits from SelectionInListView)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
    92
        2) this new MenuPanel.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    93
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    94
    this will eventually replace most of the MenuView and PopUpMenu stuff.
4244
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    95
    (and hopefully be ST-80 compatible...)
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    96
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    97
    To create a menu, there exists a MenuEditor which can generate
23aa410880a8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4241
diff changeset
    98
    menu specifications, from which a MenuPanel can be dynamically created.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    99
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   100
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
   101
    Notice:
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   102
        This is going to replace the obsolete MenuView.
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
   103
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
    [author:]
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   105
        Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
    [see also:]
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   108
        Menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   109
        MenuItem
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   110
        MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   111
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   112
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
   113
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   115
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
"
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   120
  a PullDownMenu
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   121
                                                                                [exBegin]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   122
    |top subView mview labels|
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
    top := StandardSystemView new.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   125
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   126
    labels := #( 'foo' 'bar' 'baz' 'test') copy.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   127
    labels at:4 put:(LabelAndIcon label:'test' icon:(ToolbarIconLibrary cutIcon)).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   128
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   129
    mview := MenuPanel in:top.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   130
    mview labels:labels.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   131
    (mview itemAt:1) enabled:false.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   132
    (mview itemAt:4) enabled:false.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   133
    top extent:(mview preferredExtent + 20).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   134
    top open.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   135
                                                                                [exEnd]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   136
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   137
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   140
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   142
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   143
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   144
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   145
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   146
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   148
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   149
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   151
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   152
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   153
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   154
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   155
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   156
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   157
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   158
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   159
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   160
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   161
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   162
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   163
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   164
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   165
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   166
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   167
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   168
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   169
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   170
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   171
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   173
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   174
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   175
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   176
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   177
    top open.
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   178
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   179
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   180
  a PullDownMenu with applications
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   181
                                                                                [exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   182
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   183
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   184
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   185
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   186
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   187
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   188
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   189
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   190
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   191
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   192
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   193
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   194
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   195
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   196
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   197
    view := ImageView new.
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   198
    view image:(Image fromScreen:(0@0 corner:200@200)).
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   199
    view preferredExtent:(200@200).
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   200
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   201
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   202
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   203
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   204
    top open.
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   205
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   206
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   207
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   208
  a PopUpMenu
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   209
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   210
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   211
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   212
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   213
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   214
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   215
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   216
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   217
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   218
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   219
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   220
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   221
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   222
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   223
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   224
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   225
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   226
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   227
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   228
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   229
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   230
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   231
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   232
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   233
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   234
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   235
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   236
    mview startUp
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   237
                                                                                [exEnd]
4081
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   238
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   239
c9e21f4ccca1 changed: #examples
Claus Gittinger <cg@exept.de>
parents: 4076
diff changeset
   240
  a menu spec
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   241
                                                                                [exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   242
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   243
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   244
    menu := MenuPanel menu:
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   245
        #(#Menu #( #(#MenuItem
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   246
                    #label: 'File'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   247
                    #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   248
                      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   249
                                 (#MenuItem
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   250
                                    #label: 'edit'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   251
                                    #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   252
                                      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   253
                                                 #(#MenuItem #label: 'close' #value:#close)
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   254
                                               )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   255
                                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   256
                                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   257
                                       )
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
                                 #(#MenuItem #label: 'help' #value:#help )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   260
                               )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   261
                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   262
                               nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   263
                       )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   264
                 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   265
                #(#MenuItem #label: 'Inspect' #value:#inspectMenu )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   266
                #(#MenuItem #label: 'Bar'
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   267
                            #submenu:
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   268
                               #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   269
                                          #(#MenuItem #label: 'bar 2' #value:#bar2 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   270
                                        )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   271
                                        nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   272
                                        nil
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
                 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   275
              )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   276
              #( 2 )
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   277
              nil
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   278
         ) decodeAsLiteralArray.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
    Transcript showCR:(menu startUp).
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
   282
                                                                                [exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   289
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   290
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   291
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   292
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   295
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
    aSpec notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   297
        menu := Menu new.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   298
        menu receiver:aReceiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   299
        menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   301
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   302
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   304
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   309
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   314
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   315
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   318
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   320
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   321
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   322
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   323
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   324
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   325
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   326
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   327
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   328
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   329
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   330
menu:aMenu receiver:aReceiver
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   331
    |mPanel|
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   332
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   333
    "/ cg: the reasoning behind this code is absolutely unclear.
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   334
    "/ @ca: please add some comment...
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   335
    
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   336
    mPanel := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   337
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   338
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   339
        "/ no receiver specified in the menu; set the receiver immediately
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   340
        mPanel receiver:aReceiver
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   341
    ].
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   342
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   343
    mPanel menu:aMenu.
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   344
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   345
    "/ set the receiver late
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   346
    aReceiver notNil ifTrue:[
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   347
        mPanel receiver:aReceiver
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   348
    ].
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   349
    ^ mPanel
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   350
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
   351
    "Modified (format): / 03-04-2019 / 08:48:29 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   352
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   354
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   355
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   356
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   357
    InitialSelectionQuerySignal isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   358
        InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   359
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   360
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   361
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   362
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   363
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   364
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   365
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   366
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   367
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   368
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   369
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   370
delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   371
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   372
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   373
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   374
    "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
   375
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   376
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   377
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   378
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   379
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   380
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   381
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   382
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   383
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   384
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   385
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   386
        constantNamed:'MenuPanel class delayedMenuIndicator'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   387
        ifAbsentPut:[(Depth1Image width:7 height:6) bits:(ByteArray fromPackedString:'@@@@@HCB')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   388
            colorMapFromArray:#[0 0 0 255 255 255]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   389
            mask:((ImageMask width:7 height:6) bits:(ByteArray fromPackedString:'@J+V[C P'); yourself); yourself]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   390
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   391
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   392
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   393
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   394
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   395
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   396
    "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
   397
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   398
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   399
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   400
     self iconIndicationDisabledOff inspect
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   401
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   402
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   403
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   404
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   405
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   406
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   407
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   408
        constantNamed:'MenuPanel class iconIndicationDisabledOff'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   409
        ifAbsentPut:[(Depth8Image width:13 height:13) bits:(ByteArray fromPackedString:'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   410
@@@@@@@@@@@@@@@@@@@GA0\GA0\GA0\GA0@@A2@ HB@ HBH$G@\@@@\ L#H2L#DQB!!HG@@@GHCH2DC@WK!!(#A0@@A2@,G0HJG"XVC@\@@@\3DSP*E"DEARTG
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   411
@@@GB28)F3TA@PD(A0@@A04]FPTAA0$GEP\@@@\NFPTHA0XFA PG@@@G@1LTJ2<OFB4''A0@@A0\GA0\GA0\GA0\@@@@@@@@@@@@@@@@@@@@a')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   412
            colorMapFromArray:#[142 143 143 242 242 242 212 215 219 202 203 204 230 230 230 237 237 237 246 246 246 244 244 244 240 240 240 245 245 245 219 221 223 184 187 191 204 205 205 188 191 194 194 196 198 234 235 235 205 209 214 213 216 220 193 195 197 212 212 213 219 219 220 225 226 226 232 232 232 216 219 222 235 236 236 233 233 233 226 227 228 234 234 234 187 190 193 227 228 229 225 226 227 208 212 217 174 179 185 236 236 236 175 180 186 198 199 200 180 185 189 212 213 214 229 230 230 233 233 234 220 221 222 228 229 229 224 225 227 224 225 225 205 209 215 235 235 236 221 223 225 230 231 231 210 213 218 208 211 216 203 207 213 178 183 188 218 220 223 239 239 239]; yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   413
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   414
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   415
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   416
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   417
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   418
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   419
    "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
   420
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   421
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   422
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   423
     self iconIndicationDisabledOn inspect
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   424
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   425
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   426
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   427
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   428
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   429
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   430
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   431
        constantNamed:'MenuPanel class iconIndicationDisabledOn'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   432
        ifAbsentPut:[(Depth4Image width:13 height:13) bits:(ByteArray fromPackedString:'"H"H"H"H H&Y&YT,PXBI&Y%R1AFH"Y&UKDF; H&YH$F7L8BET$F7L@BA#DF7@@** HP[\J*&*(BK\0**)**@!!3B*)&Y& XLJ**Y&Y(B@**)&Y&ZD"H"H"H"H
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   433
 @@a')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   434
            colorMapFromArray:#[249 249 249 245 245 245 242 242 242 248 248 248 244 244 244 241 241 241 251 251 251 247 247 247 177 177 177 240 240 240 250 250 250 246 246 246 243 243 243]; yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   435
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   436
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   437
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   438
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   439
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   440
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   441
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   442
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   443
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   444
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   445
     self iconIndicationOff inspect
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   446
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   447
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   448
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   449
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   450
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   451
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   452
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   453
        constantNamed:'MenuPanel class iconIndicationOff'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   454
        ifAbsentPut:[(Depth8Image width:13 height:13) bits:(ByteArray fromPackedString:'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   455
@@@@@@@@@@@@@@@@@@@GA0\GA0\GA0\GA0@@A2@ HB@ HBH$G@\@@@\ L#H2L#DQB!!HG@@@GHCH2DC@WK!!(#A0@@A2@,G0HJG"XVC@\@@@\3DSP*E"DEARTG
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   456
@@@GB28)F3TA@PD(A0@@A04]FPTAA0$GEP\@@@\NFPTHA0XFA PG@@@G@1LTJ2<OFB4''A0@@A0\GA0\GA0\GA0\@@@@@@@@@@@@@@@@@@@@a')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   457
            colorMapFromArray:#[142 143 143 242 242 242 212 215 219 202 203 204 230 230 230 237 237 237 246 246 246 244 244 244 240 240 240 245 245 245 219 221 223 184 187 191 204 205 205 188 191 194 194 196 198 234 235 235 205 209 214 213 216 220 193 195 197 212 212 213 219 219 220 225 226 226 232 232 232 216 219 222 235 236 236 233 233 233 226 227 228 234 234 234 187 190 193 227 228 229 225 226 227 208 212 217 174 179 185 236 236 236 175 180 186 198 199 200 180 185 189 212 213 214 229 230 230 233 233 234 220 221 222 228 229 229 224 225 227 224 225 225 205 209 215 235 235 236 221 223 225 230 231 231 210 213 218 208 211 216 203 207 213 178 183 188 218 220 223 239 239 239]; yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   458
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   459
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   460
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   461
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   462
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   463
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   464
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   465
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   466
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   467
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   468
     self iconIndicationOn inspect
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   469
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   470
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   471
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   472
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   473
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   474
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   475
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   476
        constantNamed:'MenuPanel class iconIndicationOn'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   477
        ifAbsentPut:[(Depth8Image width:13 height:13) bits:(ByteArray fromPackedString:'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   478
E1\WE1\WE1\WE1\WE1\/K2</K2</MP(^K1\WK3\7M3\7B1=@H PWE2<7DQDQIB@IA1@^E1\/M1DQMDP(LPHEK1\WK3\%K!!X#BC@RGR<WE2<;C3<=KPD8MS(/
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   479
E1\/C@@0GAP3PQ8+K1\WK0L<CTL3C!!$/L"<WE2<XHRYBO"\JG X/E1\/F20UM#$SF"$*K1\WK2</A@(5AB</K2<WE1\WE1\WE1\WE1\WE0@a')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   480
            colorMapFromArray:#[110 127 170 73 94 150 101 119 165 205 207 209 245 245 245 231 231 232 230 230 230 68 90 146 94 113 161 87 106 157 249 249 249 201 204 208 222 224 225 72 93 149 97 115 164 201 207 221 185 191 208 203 207 213 188 195 214 242 243 246 103 120 167 223 226 233 213 216 220 142 143 143 198 200 202 248 249 250 236 237 237 202 203 204 207 212 226 219 220 220 246 246 246 157 167 192 237 238 241 234 236 240 220 223 228 242 243 244 204 208 214 213 217 221 139 153 187 176 185 209 175 184 207 235 235 236 233 233 234 220 221 222 218 218 219 186 193 213 223 226 229 244 244 244 71 92 148 69 90 146 225 226 226 75 96 151 205 209 214 248 248 248 140 153 186 174 179 185 100 118 165 144 157 189 213 213 214 197 201 205 222 225 233 237 238 238 76 97 152 163 174 200 119 134 171 183 191 213 74 95 151 73 95 150 224 226 230]; yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   481
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   482
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   483
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   484
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   485
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   486
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   487
    "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
   488
     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
   489
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   490
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   491
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   492
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   493
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   494
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   495
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   496
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   497
"/    IconDisabledRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   498
"/        IconDisabledRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   499
"/            constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   500
"/            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
   501
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   502
"/    ^ IconDisabledRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   503
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   504
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   505
    ^ RadioButton disabledPassiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   506
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   507
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   508
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   509
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   510
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   511
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   512
    "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
   513
     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
   514
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   515
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   516
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   517
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   518
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   519
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   520
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   521
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   522
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   523
"/    IconDisabledRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   524
"/        IconDisabledRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   525
"/            constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   526
"/            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
   527
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   528
"/    ^ IconDisabledRadioOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   529
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   530
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   531
    ^ RadioButton disabledActiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   532
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   533
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   534
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   535
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   536
    ^ RadioButton enteredPassiveForm
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   537
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   538
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   539
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   540
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   541
    ^ RadioButton enteredActiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   542
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   543
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   544
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   545
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   546
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   547
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   548
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   549
     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
   550
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   551
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   552
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   553
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   554
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   555
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   556
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   557
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   558
"/    IconRadioOff isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   559
"/        IconRadioOff := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   560
"/            constantNamed:#'MenuPanel iconRadioGroupOff'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   561
"/            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
   562
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   563
"/    ^ IconRadioOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   564
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   565
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   566
    ^ RadioButton passiveForm
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   567
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   568
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   569
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   570
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   571
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   572
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   573
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   574
     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
   575
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   576
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   577
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   578
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   579
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   580
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   581
"/    <resource: #image>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   582
"/
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   583
"/    IconRadioOn isNil ifTrue:[
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   584
"/        IconRadioOn := Icon
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   585
"/            constantNamed:#'MenuPanel iconRadioGroupOn'
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   586
"/            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
   587
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   588
"/    ^ IconRadioOn
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
    <resource: #programImage>
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
   591
    ^ RadioButton activeForm
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   592
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   593
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   594
menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   595
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   596
     by the ImageEditor of ST/X."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   597
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   598
    "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
   599
     the ImageEditor may not be able to read the specification."
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   600
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   601
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   602
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   603
     ImageEditor openOnClass:self andSelector:#menuIndicator
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   604
     Icon flushCachedIcons
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   605
    "
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   606
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   607
    <resource: #image>
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   608
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   609
    ^Icon
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   610
        constantNamed:'MenuPanel class menuIndicator'
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   611
        ifAbsentPut:[(Depth1Image width:7 height:4) bits:(ByteArray fromPackedString:'@@B@0 @a')
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   612
            colorMapFromArray:#[0 0 0 255 255 255]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   613
            mask:((ImageMask width:7 height:4) bits:(ByteArray fromPackedString:'?''08D@@a'); yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   614
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   615
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   616
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   617
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   618
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   619
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   620
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   621
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   622
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   623
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   624
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   625
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   626
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   627
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   628
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   629
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   630
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   631
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   632
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   633
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   634
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   635
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   636
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   637
maxShortCutSearchLevel
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   638
    "1 means: only search in top items.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   639
     2 means: search one level of menus.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   640
     used to be 10"
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   641
3384
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   642
    MaxShortCutSearchLevel isNil ifTrue:[MaxShortCutSearchLevel := 2.].
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   643
    ^ MaxShortCutSearchLevel
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   644
!
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   645
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   646
maxShortCutSearchLevel: anInteger
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   647
    "1 means: only search in top items.
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   648
     2 means: search one level of menus."
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   649
f42018cf8f9f class variable for MaxShortCutSearchLevel
fm
parents: 3383
diff changeset
   650
    MaxShortCutSearchLevel := anInteger
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   651
!
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
   652
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   653
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   654
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   655
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   656
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   657
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   658
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   659
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   660
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   661
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   662
     ex:
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   663
        &File   mnemonic := Cmdf
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   664
        F&ile   mnemonic := Cmdi
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
   665
        ....."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   666
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   667
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   668
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   669
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   670
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
   671
    "extract values from the styleSheet and cache them in class variables"
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   672
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   673
    <resource: #style (
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   674
        #'selection.disabledForegroundColor'
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   675
        #'pullDownMenu.foregroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   676
        #'pullDownMenu.backgroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   677
        #'pullDownMenu.level'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   678
        #'menu.itemHorizontalSpace' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   679
        #'menu.buttonItemHorizontalSpace' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   680
        #'menu.buttonItemSpace'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   681
        #'menu.itemSpace' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   682
        #'menu.buttonItemVerticalSpace'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   683
        #'menu.buttonActiveLevel' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   684
        #'menu.buttonPassiveLevel' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   685
        #'menu.buttonEnteredLevel'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   686
        #'menu.hilightLevel' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   687
        #'menu.enteredLevel'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   688
        #'menu.groupDividerSize' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   689
        #'menu.itemMargin'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   690
        #'menu.disabledEtchedForegroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   691
        #'menu.hilightForegroundColor'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   692
        #'menu.enteredBackgroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   693
        #'menu.enteredForegroundColor'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   694
        #'menu.disabledForegroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   695
        #'menu.buttonEnteredBackgroundColor'
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   696
        #'menu.selectionFollowsMouse'
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   697
        #'button.disabledEtchedForegroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   698
        #'button.disabledForegroundColor'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   699
        #'button.activeBackgroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   700
        #'button.backgroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   701
        #'button.lightColor'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   702
        #'button.enteredBackgroundColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   703
        #'button.halfLightColor' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   704
        #'button.halfShadowColor'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   705
        #'button.activeLevel' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   706
        #'button.passiveLevel' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   707
        #'button.edgeStyle'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   708
        #'menu.iconIndicationOn' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   709
        #'menu.iconIndicationOff'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   710
        #'menu.iconIndicationOn.bitmapFile' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   711
        #'menu.iconIndication.bitmapOffFile'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   712
        #'menu.iconDisabledIndicationOn' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   713
        #'menu.iconDisabledIndicationOff'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   714
        #'menu.iconDisabledIndicationOn.bitmapFile' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   715
        #'menu.iconDisabledIndication.bitmapOffFile'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   716
        #'menu.iconRadioOn' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   717
        #'menu.iconRadioOff'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   718
        #'menu.iconRadioOn.bitmapFile' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   719
        #'menu.iconRadioOff.bitmapFile'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   720
        #'menu.iconDisabledRadioOn' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   721
        #'menu.iconDisabledRadioOff'
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   722
        #'menu.iconDisabledRadioOn.bitmapFile' 
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   723
        #'menu.iconDisabledRadioOff.bitmapFile'
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   724
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   725
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   726
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   727
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel getBitmapOrFile|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   728
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   729
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
5464
ba69f1d9e99c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
   730
     which returns the default cached DefaultBackgroundColor
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   731
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   732
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   733
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   734
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   735
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   736
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   737
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   738
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   739
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   740
    DefaultFont     := MenuView defaultFont.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   741
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor'
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   742
                                                            default:[styleSheet
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   743
                                                                        colorAt:#'menu.foregroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   744
                                                                        default:Color black].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   745
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   746
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   747
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   748
    var isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   749
        style == #motif ifTrue:[ var := backgroundColor ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   750
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   751
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   752
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   753
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   754
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   755
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   756
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   757
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   758
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   759
    var isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   760
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   761
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   762
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   763
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   764
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   765
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   766
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   767
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   768
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   769
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   770
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   771
    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
   772
    "/ styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   773
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   774
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   775
    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
   776
    "/ styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   777
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   778
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   779
    "/ styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   780
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   781
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   782
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   783
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   784
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   785
    buttonPassiveBackgroundColor isNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   786
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   787
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   788
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   789
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   790
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   791
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   792
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   793
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   794
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   795
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   796
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   797
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   798
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   799
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   800
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   801
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   802
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   803
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   804
    getBitmapOrFile := [:key :fileKey |
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   805
        |var|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   806
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   807
        var := styleSheet at:key ifAbsent:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   808
        var isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   809
            var := styleSheet at:fileKey ifAbsent:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   810
            var notNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   811
                var := Smalltalk imageFromFileNamed:var forClass:self.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   812
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   813
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
   814
        var
2754
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   815
    ].
e1099c448aa9 more xp style
Claus Gittinger <cg@exept.de>
parents: 2752
diff changeset
   816
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   817
    IconIndicationOn := getBitmapOrFile value:#'menu.iconIndicationOn' value:#'menu.iconIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   818
    IconIndicationOff := getBitmapOrFile value:#'menu.iconIndicationOff' value:#'menu.iconIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   819
    IconDisabledIndicationOn := getBitmapOrFile value:#'menu.iconDisabledIndicationOn' value:#'menu.iconDisabledIndicationOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   820
    IconDisabledIndicationOff := getBitmapOrFile value:#'menu.iconDisabledIndicationOff' value:#'menu.iconDisabledIndicationOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   821
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   822
    IconRadioOn := getBitmapOrFile value:#'menu.iconRadioOn' value:#'menu.iconRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   823
    IconRadioOff := getBitmapOrFile value:#'menu.iconRadioOff' value:#'menu.iconRadioOff.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   824
    IconDisabledRadioOn := getBitmapOrFile value:#'menu.iconDisabledRadioOn' value:#'menu.iconDisabledRadioOn.bitmapFile'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
   825
    IconDisabledRadioOff := getBitmapOrFile value:#'menu.iconDisabledRadioOff' value:#'menu.iconDisabledRadioOff.bitmapFile'.
2752
1d1788de3393 more xp style
Claus Gittinger <cg@exept.de>
parents: 2737
diff changeset
   826
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   827
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   828
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   829
    "
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   830
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
   831
    "Modified: / 19-01-2012 / 13:17:59 / cg"
5464
ba69f1d9e99c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5439
diff changeset
   832
    "Modified (format): / 12-02-2017 / 12:04:25 / cg"
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   833
    "Modified: / 17-11-2018 / 10:11:43 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   834
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   835
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   836
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   837
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   838
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   839
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   840
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   841
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   842
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   843
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   844
    anImage device == aDevice ifTrue:[
5009
023fac61ed67 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5001
diff changeset
   845
        ^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   846
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   847
5246
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   848
    Images isNil ifTrue:[ 
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   849
        Images := IdentityDictionary new.
5246
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   850
    ].
3f2b38bf17ba #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5239
diff changeset
   851
    deviceImages := Images at:aDevice ifAbsentPut:[Dictionary new].
5009
023fac61ed67 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5001
diff changeset
   852
    ^ deviceImages at:anImage ifAbsentPut:[anImage copy onDevice:aDevice].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   853
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   854
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   855
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   856
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   857
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   858
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   859
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   860
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   861
    LigthenedImages isNil ifTrue:[LigthenedImages := IdentityDictionary new].
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   862
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   863
    deviceImages := LigthenedImages at:aDevice ifAbsentPut:[WeakIdentityDictionary new].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   864
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   865
        ^ image
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   866
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   867
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   868
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   869
    colorMap notNil ifTrue:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   870
        image := anImage lightened onDevice:aDevice.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   871
    ] ifFalse:[
5239
d6741794b7a6 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5193
diff changeset
   872
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   873
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   874
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   875
    ^ image
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   876
!
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   877
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   878
releaseCachedImagesFromDevice:aGraphicsDevice
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   879
    "flush cached resources before saving a snapshot
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   880
     (do not save them in the image)"
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   881
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   882
    aGraphicsDevice isNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   883
        Images := LigthenedImages := nil.
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   884
        ^ self.
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   885
    ].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   886
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   887
    Images notNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   888
        Images removeKey:aGraphicsDevice ifAbsent:[].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   889
    ].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   890
    LigthenedImages notNil ifTrue:[
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   891
        LigthenedImages removeKey:aGraphicsDevice ifAbsent:[].
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   892
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   893
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   894
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   895
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   896
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   897
subMenu:aSubMenu
5619
657eee4bfe48 #OTHER by mawalch
mawalch
parents: 5578
diff changeset
   898
    "create a submenu; can be redefined in derived classes"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   899
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   900
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   901
5619
657eee4bfe48 #OTHER by mawalch
mawalch
parents: 5578
diff changeset
   902
    "Modified: / 08-08-1998 / 02:13:11 / cg"
657eee4bfe48 #OTHER by mawalch
mawalch
parents: 5578
diff changeset
   903
    "Modified (comment): / 09-10-2017 / 14:33:34 / mawalch"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   904
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   905
5094
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   906
!MenuPanel class methodsFor:'startup & release'!
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   907
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   908
preSnapshot
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   909
    "flush cached resources before saving a snapshot
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   910
     (do not save them in the image)"
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   911
5248
b869436ed677 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5246
diff changeset
   912
    self releaseCachedImagesFromDevice:nil
5094
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   913
! !
5f32a7d62c65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5009
diff changeset
   914
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   915
!MenuPanel class methodsFor:'utilities'!
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   916
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   917
processAmpersandCharactersFor:aLabel withAccessCharacterPosition:accessCharacterPositionOrNil
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   918
    "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
   919
     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
   920
     or fix), or by an ampersand escape.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   921
     Double ampersands are replaced by a single one."
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   922
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   923
    |i label nextChar rest pos size|
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   924
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   925
    pos := accessCharacterPositionOrNil.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   926
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   927
    label := aLabel.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   928
    size := aLabel size.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   929
    i := 1.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   930
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < size])] whileTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   931
        nextChar := label at:(i+1).
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   932
        nextChar isSeparator ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   933
            i := i + 1
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   934
        ] ifFalse:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   935
            rest := label copyFrom:(i+1).
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   936
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   937
            i == 1 ifTrue:[label := rest]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   938
                  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   939
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   940
            (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   941
            size := size - 1.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   942
        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   943
    ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   944
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   945
    (pos isNil or:[(label at:pos ifAbsent:nil "access character") isNil]) ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   946
        ^ label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   947
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   948
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   949
    label isText ifFalse:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   950
        label := Text string:label
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   951
    ].
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   952
    label emphasisAt:pos add:#underline.
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   953
    ^ label
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
    "Created: / 15-02-2012 / 18:50:58 / cg"
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
   956
    "Modified (comment): / 15-03-2017 / 20:38:29 / stefan"
4108
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   957
! !
5d14a85e112e refactored ampersand processing for more reusability.
Claus Gittinger <cg@exept.de>
parents: 4098
diff changeset
   958
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   959
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   960
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   961
accept
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
   962
    ^ self acceptIsUserAction:true
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   963
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   964
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   965
accept:anItemOrNil
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   966
    "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
   967
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
   968
    ^ self accept:anItemOrNil isUserAction:true
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
   969
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   970
4053
dd0f1eb3e946 changed: #accept:
Claus Gittinger <cg@exept.de>
parents: 4046
diff changeset
   971
    "Modified: / 07-07-2011 / 18:08:41 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   972
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   973
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   974
accept:anItem index:anIndex toggle:aState receiver:aReceiver
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   975
    "really accept an item"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   976
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
   977
    |selectorOrBlock argument numArgs isValueModel rec args arg2
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   978
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   979
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   980
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   981
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   982
    hasPerformed := isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   983
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
   984
    (selectorOrBlock := anItem value) isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   985
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   986
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   987
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   988
    (argument := anItem argument) isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   989
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   990
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   991
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
   992
    (selectorOrBlock isSymbol or:[selectorOrBlock isArray]) ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   993
        "/ a valueHolder or block
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   994
        (selectorOrBlock respondsTo:#valueWithArguments:) ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   995
            '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
   996
             ^ self "/ ^ selectorOrBlock
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   997
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   998
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
   999
        numArgs := selectorOrBlock perform:#numArgs ifNotUnderstood:0.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1000
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1001
        numArgs == 0 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1002
            args := nil
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1003
        ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1004
            numArgs == 1 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1005
                args := Array with:argument
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1006
            ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1007
                args := Array with:argument with:self
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1008
            ]
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1009
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1010
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1011
        selectorOrBlock valueWithArguments:args.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1012
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1013
        hasPerformed := true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1014
        ^ self "/ ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1015
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1016
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1017
    anItem sendToOriginator ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1018
        rec := self originator.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1019
        rec isNil ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1020
            self error:'no originating widget (no target for message)' mayProceed:true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1021
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1022
    ] ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1023
        rec := aReceiver
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1024
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1025
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1026
    rec isNil ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1027
        'MenuPanel [warning]: menu has no receiver defined' infoPrintCR.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1028
        ^ self "/ ^ selectorOrBlock
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1029
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1030
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1031
    isValueModel ifTrue:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1032
        rec value:selectorOrBlock
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  1033
    ] ifFalse:[
5355
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1034
        selectorOrBlock isArray ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1035
            "/ a hack !!!!!! Must be compatible to old MenuView
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1036
            args := selectorOrBlock copyFrom:2.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1037
            selectorOrBlock := selectorOrBlock first.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1038
        ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1039
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1040
            arg2 := self.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1041
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1042
            "/ support for ST80 style applications
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1043
            "/ (expecting the message to go to the application
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1044
            "/  if not understood by the view)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1045
            "/ These expect the controller to be passed as argument.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1046
            "/ sigh.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1047
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1048
            (rec isView
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1049
            and:[(rec respondsTo:selectorOrBlock) not
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1050
            and:[(app := rec application) ~~ rec
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1051
            and:[app notNil]]]) ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1052
                arg2 := rec controller.       "/ the view's controller
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1053
                rec := app.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1054
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1055
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1056
            (numArgs := selectorOrBlock numArgs) == 0 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1057
                args := nil
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1058
            ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1059
                numArgs == 1 ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1060
                    args := Array with:argument
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1061
                ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1062
                    args := Array with:argument with:arg2
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1063
                ]
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1064
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1065
        ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1066
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1067
        fallBack :=
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1068
            [
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1069
                |val|
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1070
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1071
                "/ mhmh - the receiver did not respond to that message;
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1072
                "/ if there is a master-application, try that one
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1073
                "/ (recursive)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1074
                master := rec perform:#masterApplication ifNotUnderstood:nil.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1075
                master notNil ifTrue:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1076
                    rec := master.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1077
                    val := rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1078
                ] ifFalse:[
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1079
                    self
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1080
                        error:('Unimplemented (or error in) menu message: %1 for %2'
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1081
                                    bindWith:selectorOrBlock
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1082
                                    with:aReceiver printString)
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1083
                        mayProceed:true.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1084
                    val := nil.
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1085
                ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1086
                val
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1087
            ].
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1088
067fb3525c5f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5351
diff changeset
  1089
        rec perform:selectorOrBlock withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
  1090
    ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1091
    hasPerformed := true.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1092
    ^ self "/ ^ selectorOrBlock
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1093
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  1094
    "Modified: / 06-03-2012 / 14:49:00 / cg"
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1095
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1096
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1097
accept:anItemOrNil isUserAction:isUserAction
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1098
    "this is the topMenu: close the menu and accept the item (if not nil)"
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1099
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1100
    |itemAcceptedOrNil tgState itemIdx recv panel masterGroup winGrp focusView sensor|
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1101
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1102
    self superMenu notNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1103
        ^ self topMenu accept:anItemOrNil isUserAction:isUserAction
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1104
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1105
    prevFocusView ~~ self ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1106
        focusView := prevFocusView.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1107
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1108
    prevFocusView := nil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1109
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1110
    self openDelayed:nil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1111
    self scrollActivity stop.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1112
    self selection:nil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1113
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1114
    (anItemOrNil notNil and:[anItemOrNil canAccept]) ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1115
        "/ toggle if accepting due to a button release or return-key;
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1116
        "/ do NOT toggle, if coming via a forced accept (for example if the menu is inside a dialog
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1117
        "/ which accepts its components at the end, and my toggles are already set/cleared by the user.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1118
        "/ Concrete example: colorMenu inside a dialog https://expeccoalm.exept.de/D248316)
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1119
        isUserAction ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1120
            tgState := anItemOrNil toggleIndication.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1121
            panel := anItemOrNil menuPanel.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1122
            itemIdx := panel findFirst:[:el| el == anItemOrNil ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1123
            itemAcceptedOrNil := anItemOrNil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1124
            recv := panel receiver.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1125
        ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1126
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1127
    self doUngrab:true.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1128
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1129
    winGrp := self windowGroup.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1130
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1131
    self isPopUpView ifFalse:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1132
        self do:[:el| el updateIndicators].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1133
        winGrp notNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1134
            winGrp processExposeEvents.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1135
        ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1136
    ] ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1137
        self unmap.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1138
        device sync. "/ round trip - all expose events are now received
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1139
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1140
        winGrp notNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1141
            "/ give expose event a chance to arrive
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1142
            [shown and:[realized]] whileTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1143
                winGrp processExposeEventsFor:self
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1144
            ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1145
            masterGroup := winGrp previousGroup.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1146
        ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1147
        "/ cg: disabled-not needed - try PopUpList with destroy...
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1148
        "/ self destroy.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1149
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1150
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1151
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1152
    (focusView notNil and:[winGrp notNil]) ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1153
        winGrp focusView:focusView.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1154
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1155
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1156
    itemAcceptedOrNil isNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1157
        hasPerformed := true.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1158
        self isPopUpView ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1159
            lastItem := itemAcceptedOrNil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1160
        ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1161
        ^ itemAcceptedOrNil.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1162
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1163
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1164
    "/ using master maingroup, sensor in my current windowgroup
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1165
    "/ flushes its events if the window goes
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1166
    winGrp notNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1167
        winGrp mainGroup notNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1168
            sensor := winGrp mainGroup sensor.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1169
        ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1170
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1171
    sensor isNil ifTrue:[sensor := self sensor ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1172
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1173
    isUserAction ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1174
        sensor pushEvent:(
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1175
            MenuEvent
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1176
                selectMenuItem:itemAcceptedOrNil
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1177
                index:itemIdx
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1178
                text:nil
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1179
                value:tgState
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1180
                inMenu:self
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1181
                menuReceiver:recv).
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1182
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1183
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1184
    ^ anItemOrNil.  "/ stupid convention
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1185
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1186
"/    acceptAction := [ self accept:itemAcceptedOrNil index:itemIdx toggle:tgState receiver:recv ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1187
"/
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1188
"/    winGrpForBusyCursor := masterGroup ? winGrp.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1189
"/
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1190
"/    (itemAcceptedOrNil showBusyCursorWhilePerforming
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1191
"/    and:[winGrpForBusyCursor notNil])
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1192
"/    ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1193
"/        winGrpForBusyCursor withWaitCursorDo:acceptAction
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1194
"/    ] ifFalse:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1195
"/        acceptAction value
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1196
"/    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1197
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1198
    "Modified: / 07-07-2011 / 18:08:41 / cg"
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1199
!
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1200
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1201
acceptIsUserAction:isUserAction
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1202
    "accept the current selected item"
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1203
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1204
    |item|
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1205
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1206
    (item := self selection) isNil ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1207
        self topMenu
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1208
            openDelayed:nil;
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1209
            accept:nil isUserAction:isUserAction.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1210
    ] ifFalse:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1211
        self acceptItem:item inMenu:self isUserAction:isUserAction
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1212
    ]
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1213
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1214
    "Modified: / 29-06-2011 / 16:14:26 / cg"
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1215
!
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1216
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1217
acceptItem:anItemOrNil inMenu:aMenu
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1218
    self acceptItem:anItemOrNil inMenu:aMenu isUserAction:true
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1219
!
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1220
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1221
acceptItem:anItemOrNil inMenu:aMenu isUserAction:isUserAction
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1222
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1223
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1224
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  1225
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1226
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1227
    (anItemOrNil isNil or:[anItemOrNil hideMenuOnActivated]) ifTrue:[
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1228
        topMenu accept:anItemOrNil isUserAction:isUserAction
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1229
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1230
        anItemOrNil canAccept ifTrue:[
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1231
            "/ toggle if accepting due to a button release or return-key;
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1232
            "/ do NOT toggle, if coming via a forced accept (for example if the menu is inside a dialog
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1233
            "/ which accepts its components at the end, and my toggles are already set/cleared by the user.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1234
            "/ Concrete example: colorMenu inside a dialog https://expeccoalm.exept.de/D248316)
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1235
            isUserAction ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1236
                tgState := anItemOrNil toggleIndication.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1237
                self
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1238
                    accept:anItemOrNil
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1239
                    index:(aMenu selectionIndex)
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1240
                    toggle:tgState
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1241
                    receiver:(aMenu receiver).
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  1242
            ].
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1243
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1244
            aMenu do:[:el| el updateIndicators].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1245
            anItemOrNil hideMenuOnActivated ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1246
                aMenu invalidate
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1247
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1248
        ]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1249
    ]
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1250
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1251
    "Modified: / 29-06-2011 / 14:34:45 / cg"
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1252
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  1253
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1254
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1255
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1256
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1257
  ^ lastItem
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1258
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  1259
    "Modified: / 29-06-2011 / 16:24:48 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1260
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1261
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1262
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1263
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1264
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1265
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1266
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1267
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1268
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1270
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1271
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1272
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1273
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1274
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1276
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1277
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1278
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1279
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1280
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1282
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1283
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1284
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1285
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1286
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1287
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1288
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1289
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1290
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1291
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1292
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1293
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1294
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1295
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1296
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1297
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1299
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1300
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1301
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1302
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1303
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1306
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1307
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1308
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1309
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1312
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1313
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1314
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1317
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1318
doAccessCharacterTranslation
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1319
    "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
  1320
     Can be set to false to leave accessCharacter unchanged"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1321
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1322
    ^ doAccessCharacterTranslation ? true
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1323
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1324
    "Modified: / 02-11-2010 / 10:19:09 / cg"
3332
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1325
!
321b83142fc3 changed #doAccessCharacterTranslation
Claus Gittinger <cg@exept.de>
parents: 3328
diff changeset
  1326
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1327
doAccessCharacterTranslation:aBoolean
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1328
    "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
  1329
     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
  1330
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1331
    doAccessCharacterTranslation := aBoolean
3958
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1332
9b7f4a444c40 comments
Claus Gittinger <cg@exept.de>
parents: 3938
diff changeset
  1333
    "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
  1334
!
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  1335
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1336
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1337
    "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
  1338
     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
  1339
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1340
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1341
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1342
    "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
  1343
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1344
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1345
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1346
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1347
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1349
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1351
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1352
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1353
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1354
    aGroupSizes = groupSizes ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1355
        groupSizes := aGroupSizes copy.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1356
        self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1357
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1359
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1360
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1361
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1362
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1363
3725
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
    hideOnRelease := aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1366
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1367
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1368
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1369
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1370
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1372
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1373
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1374
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1375
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1376
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1377
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1378
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1379
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1380
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1381
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1382
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1383
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1384
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1385
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1386
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1387
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1388
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1389
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1390
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1391
    self disabledRedrawDo:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1392
        self removeAll.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1393
        size := labels size.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1394
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1395
        size > 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1396
            items := OrderedCollection new:size.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1397
            labels do:[:aLabel| items add:(Item in:self label:aLabel) ].
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1398
            self flushCachedPreferredExtent.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1399
        ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1400
    ].
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1401
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1402
    "Modified: / 09-11-2018 / 20:16:25 / Claus Gittinger"
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1403
!
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1404
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1405
menuPerformer:anObject
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1406
    "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
  1407
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1408
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1409
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1410
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1411
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1412
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1413
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1414
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1415
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1416
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1417
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1418
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1419
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1420
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1422
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1423
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1425
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1426
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1427
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1428
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1429
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1430
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1431
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1432
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1433
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1434
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1435
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1437
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1438
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1440
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1441
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1442
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1443
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1444
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1445
        ^ superMenu originator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1446
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1447
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1448
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1449
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1450
receiver
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1451
    "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
  1452
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1453
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1454
    (receiver isNil and:[superMenu notNil]) ifTrue:[
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1455
        ^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1457
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1459
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1460
receiver:anObject
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  1461
    "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
  1462
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1463
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  1464
    receiver := anObject.
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  1465
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  1466
    "Modified: / 03-04-2019 / 09:47:29 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1467
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1470
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1471
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1472
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1473
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1474
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1476
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1477
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1478
    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
  1479
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1482
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1483
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1484
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1488
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1489
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1494
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1495
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1496
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1497
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1499
valueAt:stringOrNumber put:aBlockOrValueHolderOrSelector
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1500
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1501
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  1502
    self itemAt:stringOrNumber do:[:el| el value:aBlockOrValueHolderOrSelector ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1506
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1507
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1508
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1509
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1510
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1511
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1512
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1513
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1514
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1515
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1516
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1520
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1521
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1522
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1523
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1525
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1526
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1527
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1528
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1530
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1531
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1532
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1533
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1537
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1538
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1539
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1540
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1541
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1542
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1543
enabled:aBooleanOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1544
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1545
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1546
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1547
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1548
    state := aBooleanOrNil ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1549
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1550
    enabled ~~ state ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1551
        enabled := state.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1552
        self invalidate.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1553
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1554
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1555
    "Modified (format): / 04-02-2017 / 21:32:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1556
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1557
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1558
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1559
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1560
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1561
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1562
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1563
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1564
enabledAt:stringOrNumber put:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1565
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1566
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1567
    self itemAt:stringOrNumber do:[:el| el enabled:aBoolean ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1568
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  1569
    "Modified (format): / 04-02-2017 / 21:33:01 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1570
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1571
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1572
exclusivePointer:aBoolean
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1573
    "Do nothing here. Compatibility with PopUpListController"
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1574
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1575
    ^ self
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1576
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  1577
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1578
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1579
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1580
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1581
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1582
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1583
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1584
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1585
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1586
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1587
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1588
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1589
    enableChannel notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1590
        enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1591
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1592
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1593
    (enableChannel := aValueHolder) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1594
        enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1595
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1596
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1597
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1598
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1599
menuChannel
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1600
    ^ self menuHolder
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1601
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1602
    "Created: / 27-03-2007 / 08:38:31 / cg"
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1603
!
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  1604
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1605
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1606
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1607
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1608
    menuHolder notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1609
        menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1610
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1611
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1612
    (menuHolder := aValueHolder) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1613
        menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1614
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1615
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1616
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1617
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1618
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1619
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1620
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1621
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1622
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1623
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1624
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1625
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1626
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1627
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1628
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1629
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1630
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1631
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1632
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1633
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1634
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1635
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1636
    self backgroundColor ~~ aColor ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  1637
        self viewBackground:aColor.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  1638
        self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1639
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1640
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  1641
    "Modified: / 06-06-1998 / 19:50:06 / cg"
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  1642
    "Modified: / 15-03-2017 / 17:58:45 / stefan"
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'
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
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:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
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
5978
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1735
    ^ styleSheet 
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1736
        colorAt:#'menu.enteredBackgroundColor'
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1737
        default:(self backgroundColor)
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1738
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1739
    "Modified (format): / 23-12-2018 / 00:30:28 / Claus Gittinger"
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1740
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1741
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1742
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1743
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1744
5978
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1745
    ^ styleSheet 
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1746
        colorAt:#'menu.enteredForegroundColor' 
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1747
        default:fgColor
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1748
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  1749
    "Modified (format): / 23-12-2018 / 00:30:37 / Claus Gittinger"
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1750
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1751
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1752
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1753
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1754
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1755
    (aFont isNil or:[aFont = gc font]) ifTrue:[ ^ self ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1756
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1757
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1758
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1759
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1760
    (shown and:[superMenu notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1761
        self extent:(self preferredExtent)
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1762
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1763
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1764
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1765
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1766
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1767
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1768
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1769
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1770
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1771
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1772
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1773
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1774
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1775
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1776
    aColor ~= fgColor ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1777
        fgColor := aColor onDevice:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1778
        self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1779
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1780
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1781
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1782
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1783
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1784
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1785
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1786
    ^ (styleSheet at:#'menuPanel.maxAbsoluteButtonLevel') ? 0
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1787
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  1788
    "Modified: / 19-01-2011 / 21:21:53 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1789
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1790
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1791
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1792
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1793
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  1794
    ^ self whiteColor
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1795
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1796
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1797
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1798
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1799
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  1800
    ^ self blackColor
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1801
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1802
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1803
setFont:aFont
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  1804
    "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
  1805
     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
  1806
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1807
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1808
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1809
    currentFont := gc font.
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  1810
    (aFont notNil and:[aFont ~= currentFont]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1811
        super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1812
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1813
    ^ currentFont
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1814
!
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1815
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1816
suppressSeparatingLines
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1817
    ^ self verticalLayout not
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1818
    and:[ (styleSheet at:#'menu.suppressSeparatingLinesInToolbar' default:false) ] 
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1819
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1820
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1821
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1822
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1823
computePreferredExtent
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1824
    "compute and returns my preferred extent"
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1825
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1826
    |maxExtent usedExtent|
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1827
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1828
    usedExtent := self preferredExtentOfItems.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1829
    superView isNil ifTrue:[
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1830
        "/ is standalone
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1831
        preferredWidth notNil ifTrue:[
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1832
            usedExtent x < preferredWidth ifTrue:[
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1833
                usedExtent := preferredWidth @ usedExtent y.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1834
            ]
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1835
        ]
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1836
    ].
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1837
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1838
    maxExtent := self maxExtent.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1839
    maxExtent notNil ifTrue:[
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1840
        usedExtent := usedExtent min:maxExtent.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1841
    ].
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1842
    "/ changed due to menu in horizontal panel
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1843
    (superView notNil and:[items isEmptyOrNil] ) ifTrue:[
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1844
        self isViewWrapper ifFalse:[ ^ usedExtent ].
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1845
    ].
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1846
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1847
    preferredExtent := usedExtent.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1848
    ^ usedExtent
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1849
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1850
    "Created: / 09-11-2018 / 19:56:47 / Claus Gittinger"
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1851
!
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  1852
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1853
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1854
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1855
3886
68183511e7ef code deobfuscated:
Claus Gittinger <cg@exept.de>
parents: 3881
diff changeset
  1856
    self hasExplicitExtent ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1857
        ^ self preferredHeight
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1858
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1859
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1860
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1861
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1862
maxExtent
4113
9172e1e60149 changed: #maxExtent
Stefan Vogel <sv@exept.de>
parents: 4112
diff changeset
  1863
    |minH pos|
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1864
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1865
    device notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1866
        "/ notice, the position-dependent query: if there is a higher secondary screen,
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1867
        "/ this makes a difference in where a popUpMenu is allowed...
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1868
        pos := self origin.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1869
        pos = (0@0) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1870
            "called too early"
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1871
            minH := device smallestMonitorHeight.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1872
        ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1873
            minH := device usableHeightAt:pos.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1874
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1875
        ^ device usableWidth @ (minH - 2)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1876
        "/ ^ 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
  1877
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1878
    superMenu notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  1879
        ^ superMenu maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1880
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1881
    "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
  1882
    self error:'don''t know maxExtent'.
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  1883
4110
e5d8fe91874e class definition
Claus Gittinger <cg@exept.de>
parents: 4109
diff changeset
  1884
    "Modified: / 15-02-2012 / 19:22:24 / cg"
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  1885
    "Modified: / 15-03-2017 / 18:02:50 / stefan"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1886
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1887
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1888
origin:origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1889
    "changed due to menu in horizontal panel, if the origin
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1890
     changed we have to rearrange the menu items if size not fixed"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1891
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1892
    |oldLeft|
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1893
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1894
    (shown and:[mustRearrange not and:[sizeFixed not]]) ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1895
        ^ super origin:origin
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1896
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1897
    "left partner in horizontal panel toggles visibility"
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1898
    oldLeft := self left.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1899
    super origin:origin.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1900
    oldLeft = self left ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1901
        "/ no change notification... so cannot call #mustRearrange
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1902
        mustRearrange := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  1903
        self invalidate.
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1904
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1905
!
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  1906
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1907
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1908
    "compute and returns my preferred extent including all items
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1909
        !!!!!! changes have influence on method #rearrangeItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1910
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1911
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1912
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1913
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1914
     size         "{ Class:SmallInteger }"
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1915
     buttonInsetX2 "{ Class:SmallInteger }"
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1916
     buttonInsetY2 "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1917
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1918
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1919
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1920
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1921
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1922
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1923
    (size := items size) == 0 ifTrue:[
5520
7c2bd6ea099f #BUGFIX by sr
sr
parents: 5519
diff changeset
  1924
        (self isViewWrapper 
7c2bd6ea099f #BUGFIX by sr
sr
parents: 5519
diff changeset
  1925
        and:[subViews notEmptyOrNil]) ifTrue:[ ^ subViews first extent ].
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1926
        ^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1927
    ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  1928
    stringOffsetX := nil.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1929
    buttonInsetX2 := 2 * buttonInsetX.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  1930
    buttonInsetY2 := 2 * buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1931
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1932
    self isPopUpView ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1933
        labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1934
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1935
        labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1936
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1937
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1938
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1939
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1940
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1941
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1942
    self verticalLayout ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1943
        items keysAndValuesDo:[:key :el| |eX eY|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1944
            extent := el preferredExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1945
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1946
            "/ check for visibility (extent x ~~ 0)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1947
            (eX := extent x) ~~ 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1948
                eY := extent y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1949
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1950
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1951
                    eX := eX + buttonInsetX2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1952
                    eY := eY + buttonInsetY2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1953
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1954
                    eX := eX + labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1955
                    eY := eY + labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1956
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1957
                key ~~ size ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1958
                    (self hasGroupDividerAt:key) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1959
                        x := x + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1960
                    ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1961
                        el needsItemSpaceWhenDrawing ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1962
                            x := x + itemSpace
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1963
                        ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1964
                    ]
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
                x := x + eX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1967
                y := y max:eY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1968
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1969
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1970
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1971
        hasMenu := false.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1972
        shCtKey := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1973
        showAcc := MenuView showAcceleratorKeys == true.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1974
        y := x.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1975
        x := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1976
        itemMargin := 2 * self itemMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1977
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1978
        items keysAndValuesDo:[:key :el| |eX eY|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1979
            extent := el preferredExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1980
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1981
            "/ check for visibility (extent x ~~ 0)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1982
            (eX := extent x) ~~ 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1983
                eY := extent y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1984
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1985
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1986
                    eX := eX + buttonInsetX2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1987
                    eY := eY + buttonInsetY2.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1988
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1989
                    eX := eX + labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1990
                    eY := eY + labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1991
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1992
                hasMenu ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1993
                    hasMenu := el hasSubmenu
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1994
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1995
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1996
                    shCtKey := shCtKey max:(sck widthOn:self)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1997
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1998
                key ~~ size ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  1999
                    (self hasGroupDividerAt:key) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2000
                        y := y + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2001
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2002
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2003
                y := y + eY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2004
                x := x max:eX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2005
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2006
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2007
        x := x + itemMargin.
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
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2010
            shortKeyInset := x + Item labelRightOffset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2011
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2012
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2013
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2014
                x := x + self shortcutKeyOffset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2015
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2016
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2017
"/ to have a small inset
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2018
        y := y + 1.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2019
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2020
    ].
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2021
    x := x + ((margin + extraMargin)*2).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2022
    y := y + ((margin + extraMargin)*2).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2023
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2024
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2025
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2026
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2027
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2028
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2029
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2030
     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
  2031
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2032
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2033
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  2034
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2035
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2036
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2037
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2038
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2039
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2040
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2041
sizeFixed:aBoolean
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  2042
    "set/clear the fix-size attribute.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2043
     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
  2044
     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
  2045
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2046
    sizeFixed := aBoolean.
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2047
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2048
    sizeFixed ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2049
        "/ changed due to menu in horizontal panel
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2050
        superView notNil ifTrue:[ superView addDependent:self ].
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2051
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2052
!
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  2053
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2054
stringOffsetXfor:anItem
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2055
    "return the x offset for a MenuItem where to draw the text
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2056
    "
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2057
    |label w|
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2058
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2059
    anItem isButton ifTrue:[ ^ 0 ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2060
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2061
    stringOffsetX isNil ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2062
        stringOffsetX := 0.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2063
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2064
        (self isPopUpView and:[self verticalLayout]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2065
            self do:[:el|
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2066
                el isVisible ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2067
                    (    (label := el indicatorForm) notNil
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2068
                     or:[(label := el choiceForm) notNil]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2069
                    ) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2070
                        stringOffsetX := stringOffsetX max:(label width + 2).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2071
                    ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2072
                        label := el displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2073
                        label isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2074
                            stringOffsetX := stringOffsetX max:(label xOfString).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2075
                        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2076
                    ].
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
        ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2080
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2081
    w := 0.
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2082
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2083
    (    (label := anItem indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2084
     or:[(label := anItem choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2085
    ) ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2086
        w := label width + 2.
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2087
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2088
    stringOffsetX == 0 ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2089
        ^ w
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2090
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2091
    w == 0 ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2092
        label := anItem displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2093
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2094
        label isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2095
            ^ stringOffsetX - label xOfString
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2096
        ].
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2097
    ].
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2098
    ^ stringOffsetX.
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2099
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2100
    "Modified: / 04-02-2017 / 22:11:38 / cg"
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2101
!
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  2102
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2103
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2104
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2105
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2106
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2107
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2108
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2109
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2110
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2111
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2112
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2113
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2114
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2115
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2116
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2117
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2118
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2119
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2120
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2121
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2122
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2123
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2124
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2125
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2126
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2127
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2128
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2129
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2130
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2131
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  2132
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2133
iconRadioGroupEnteredOff
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2134
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOff)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2135
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2136
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2137
iconRadioGroupEnteredOn
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2138
    ^ self registerImageOnDevice:(self class iconRadioGroupEnteredOn)
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2139
!
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2140
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2141
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2142
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2143
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2144
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2145
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2146
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2147
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  2148
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2149
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2150
4240
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2151
hasItems
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2152
    "return true, if I have items"
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2153
7360b48271a0 isEmpty -> hasItems
Claus Gittinger <cg@exept.de>
parents: 4239
diff changeset
  2154
    ^ items notEmptyOrNil
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
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2157
itemAt:stringOrNumber do:aOneArgBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2158
    "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
  2159
     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
  2160
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2161
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2162
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2163
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2164
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2165
    "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
  2166
     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
  2167
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2168
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2169
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2170
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2171
    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
  2172
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2173
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2174
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2175
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2176
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2177
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2178
    ^ 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
  2179
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2180
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2181
items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2182
    "returns the list of items or nil.
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2183
     Warning: do not change this list - it is mine !!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2184
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  2185
    ^ items
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2186
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2187
    "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
  2188
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2189
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2190
itemsDo:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2191
    items notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2192
        items do:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2193
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2194
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2195
    "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
  2196
!
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2197
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2198
itemsDoWithIndex:aBlock
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2199
    items notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2200
        items doWithIndex:aBlock
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2201
    ]
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2202
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2203
    "Created: / 09-11-2010 / 10:06:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2204
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2205
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2206
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2207
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2208
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2209
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2210
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2211
    ^ buttonActiveLevel "/ ? (styleSheet at:#'menuPanel.buttonActiveLevel') ? 0
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2212
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2213
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2214
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2215
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2216
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  2217
    ^ buttonPassiveLevel "/ ? (styleSheet at:#'menuPanel.buttonPassiveLevel') ? 0
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2218
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  2219
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2220
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2221
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2222
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2223
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2224
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2225
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2226
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  2227
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2228
fitFirstPanel
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  2229
    "gets true if the first panel in the menu hierarchy must be fit
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2230
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2231
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2232
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2233
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2234
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2235
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2236
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2237
fitFirstPanel:aBoolean
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2238
    "NOT SUPPORTED.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2239
     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
  2240
     to the extent of its superView"
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2241
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2242
    "Modified (comment): / 04-02-2017 / 21:33:36 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2243
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2244
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2245
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2246
    anInt ~~ level ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2247
        super level:anInt.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2248
        self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  2249
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2250
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2251
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2252
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2253
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2254
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2255
    rightArrow isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2256
        device isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2257
            ^ SelectionInListView rightArrowFormOn:Screen current
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2258
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2259
        rightArrow := SelectionInListView rightArrowFormOn:device
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2260
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2261
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2262
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2263
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2264
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2265
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2266
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2267
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2268
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2269
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2270
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2271
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2272
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2273
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2274
showGroupDivider:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2275
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2276
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2277
    showGroupDivider ~~ aBoolean ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2278
        showGroupDivider := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2279
        self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2280
    ]
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2281
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2282
    "Modified (format): / 04-02-2017 / 21:33:47 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2283
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2286
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2287
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2288
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2290
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2291
showSeparatingLines:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2292
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2293
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2294
    aBoolean ~~ showSeparatingLines ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2295
        showSeparatingLines := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2296
        self mustRearrange
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2297
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2298
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2299
    "Modified (format): / 04-02-2017 / 21:33:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2300
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2301
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2302
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2303
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2304
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2305
    verticalLayout isNil ifTrue:[
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2306
        superMenu notNil ifTrue:[ 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2307
            verticalLayout := true 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2308
        ] ifFalse:[ 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2309
            verticalLayout := self isPopUpView 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2310
        ].
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2311
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2312
    ^ verticalLayout
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2313
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2314
    "Modified: / 11-07-2018 / 09:56:45 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2315
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2316
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2317
verticalLayout:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2318
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2319
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2320
    aBoolean ~~ verticalLayout ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2321
        verticalLayout isNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2322
            verticalLayout := aBoolean
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2323
        ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2324
            verticalLayout := aBoolean.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2325
            self mustRearrange.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2326
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2327
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2328
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  2329
    "Modified (format): / 04-02-2017 / 21:33:58 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2330
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2331
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2332
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2333
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2334
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2335
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2336
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2337
    ^ buttonInsetX
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2338
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2339
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2340
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2341
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2342
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2343
    ^ buttonInsetY
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2344
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2345
3975
ca
parents: 3966
diff changeset
  2346
delayInSecondsBeforeOpeningSubmenu
ca
parents: 3966
diff changeset
  2347
    "answer the seconds a submenu will be delayed before
ca
parents: 3966
diff changeset
  2348
    open; an already open submenu than will be closed"
ca
parents: 3966
diff changeset
  2349
5995
2acec64a833b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5978
diff changeset
  2350
    ^ styleSheet at:#'menu.delayInSecondsBeforeOpeningSubmenu' default:0.4 "/ 0.25
2acec64a833b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5978
diff changeset
  2351
2acec64a833b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5978
diff changeset
  2352
    "Modified: / 12-02-2019 / 03:46:54 / Claus Gittinger"
3975
ca
parents: 3966
diff changeset
  2353
!
ca
parents: 3966
diff changeset
  2354
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2355
drawMenuIndicatorSeparatorLine
4235
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2356
    ^ true.
c7a96376eac2 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4232
diff changeset
  2357
"/    ^ styleSheet at:#'menu.drawMenuIndicatorSeparatorLine'  default:false
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2358
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2359
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2360
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2361
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2362
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2363
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2364
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2365
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2366
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2367
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2368
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2369
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2370
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2371
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2372
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2373
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2374
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2375
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2376
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2377
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2378
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2379
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2380
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  2381
    ^ itemSpace
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2382
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2383
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2384
menuIndicatorVerticalPosition
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2385
    "#center, #top or #bottom"
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2386
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2387
    ^ #center
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2388
    "/ ^ styleSheet at:#'menu.menuIndicatorVerticalPosition' default:#bottom
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2389
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  2390
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2391
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2392
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2393
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2394
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2395
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2396
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2397
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2398
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2399
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2400
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2401
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2402
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  2403
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2404
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2405
subMenuAt:stringOrNumber
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2406
    "gets the current submenu of an item; if the submenu is nil, the
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2407
     submenu is generated if specified otherwise nil is returned."
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2408
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2409
    |submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2410
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2411
    self itemAt:stringOrNumber do:[:anItem|
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2412
        submenu := anItem currentSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2413
        submenu isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2414
            submenu := anItem setupSubmenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2415
        ].
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2416
    ].
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2417
    ^ submenu
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2418
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  2419
    "Modified: / 22-09-2010 / 13:53:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2420
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2421
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2423
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2424
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2425
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2426
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2427
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2428
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2429
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2430
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2431
    |item submenu|
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2432
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2433
    item := self selection.
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2434
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  2435
    item notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2436
        submenu := item currentSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2437
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2438
        (submenu notNil and:[submenu shown]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2439
            ^ submenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2440
        ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2441
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2442
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2443
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2444
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  2445
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2446
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2447
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2448
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2449
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2450
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2451
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  2452
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2453
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2454
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2455
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2456
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  2457
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2458
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2459
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2460
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2461
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2462
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2463
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2464
     return the value of the selectedItem or nil, of none was selected
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2465
     (unless the menu has already performed its action, by sending an appropriate message
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2466
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2467
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2468
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2469
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2470
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2471
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2472
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2473
     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
  2474
     (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
  2475
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2476
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  2477
    ^ self showAt:aPoint resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2478
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2479
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2480
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2481
    "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
  2482
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2483
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2484
     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
  2485
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2486
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2487
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  2488
    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
  2489
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2490
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2491
    aBoolean ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2492
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2493
    ].
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2494
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2495
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2496
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2497
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2498
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2499
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2500
    self topMenu hasPerformed ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2501
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2502
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2503
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2504
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  2505
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  2506
    "Modified: / 29-06-2011 / 16:24:22 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2507
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2508
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2509
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2510
    "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
  2511
     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
  2512
     (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
  2513
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2514
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  2515
    ^ self showAt:(device pointerPosition) resizing:true
4064
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2516
b8060862ebe1 comment/format in: #showAtPointer
Claus Gittinger <cg@exept.de>
parents: 4061
diff changeset
  2517
    "Modified (format): / 22-07-2011 / 15:24:48 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2518
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2519
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2520
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2521
    "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
  2522
     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
  2523
     (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
  2524
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2525
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2526
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2527
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2529
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2530
    ^ 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
  2531
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2532
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2533
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2534
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2535
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2536
    "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
  2537
     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
  2538
     (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
  2539
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2540
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2541
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2542
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2543
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2544
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2545
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  2546
     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
  2547
     (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
  2548
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2549
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2550
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2551
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2552
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2553
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2554
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2555
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2556
    "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
  2557
     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
  2558
     (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
  2559
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2560
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2561
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2562
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2563
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2564
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2565
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2566
    "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
  2567
     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
  2568
     (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
  2569
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2570
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2571
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2572
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2573
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2574
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2575
5559
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2576
addSeparator
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2577
    |item|
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2578
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2579
    item := self createItemAtIndex:nil.
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2580
    item label:'-'.
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2581
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2582
    "Created: / 21-07-2017 / 13:02:28 / cg"
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2583
!
90b5376eb78d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5554
diff changeset
  2584
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2585
createAtIndex:anIndexOrNil
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2586
    <resource: #obsolete>
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2587
    
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2588
    "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
  2589
     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
  2590
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2591
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2592
    ^ self createItemAtIndex:anIndexOrNil
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2593
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2594
    "Modified (format): / 18-07-2017 / 13:45:53 / cg"
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2595
!
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2596
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2597
createItemAtIndex:anIndexOrNil
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2598
    "create an item and add this item to the index. 
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2599
     In case of nil, the item is added to the end. 
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2600
     If the index is not valid, nil is returned;
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2601
     otherwise the new created item is returned."
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2602
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2603
    |max item index|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2604
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2605
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2606
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2607
    (index := anIndexOrNil) notNil ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2608
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2609
            index := max.
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2610
            "/ ^ nil
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2611
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2612
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2613
    items isNil ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2614
        items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2615
    ] ifFalse:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2616
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2617
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2618
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2619
4046
6dc83104243b changed: #createAtIndex:
Claus Gittinger <cg@exept.de>
parents: 4042
diff changeset
  2620
    (index isNil or:[index == max]) ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2621
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2622
    ] ifFalse:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2623
        items add:item beforeIndex:index
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2624
    ].
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2625
    self flushCachedPreferredExtent.
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2626
    self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2627
    ^ item
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2628
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  2629
    "Created: / 18-07-2017 / 13:45:01 / cg"
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2630
    "Modified: / 09-11-2018 / 20:16:15 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2631
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2632
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2633
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2634
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2635
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2636
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2637
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2638
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2639
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2640
        items remove:item.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2641
        items := items asNilIfEmpty.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2642
        item destroy.
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2643
        self flushCachedPreferredExtent.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2644
        self mustRearrange.
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2645
    ].
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2646
    ^ item
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2647
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2648
    "Modified: / 09-11-2010 / 10:04:08 / cg"
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2649
    "Modified: / 09-11-2018 / 20:16:47 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2650
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2651
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2652
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2653
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2654
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2655
    self disabledRedrawDo:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2656
        self selection:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2657
        groupSizes := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2658
        items notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2659
            items copy do:[:el| el destroy ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2660
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2661
        items := nil.
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2662
        self flushCachedPreferredExtent.
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2663
    ].
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2664
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2665
    "Modified: / 15-11-2001 / 17:02:51 / cg"
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2666
    "Modified: / 09-11-2018 / 20:16:52 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2667
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2668
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2669
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2670
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2671
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2672
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2673
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2674
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2675
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2676
    changedObject == superView ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2677
        "/ changed due to menu in horizontal panel
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2678
        something == #sizeOfView ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2679
            (shown and:[sizeFixed not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2680
                "/ no change notification... so cannot call #mustRearrange
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2681
                mustRearrange := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2682
                self invalidate.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2683
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2684
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2685
        ^ self
4656
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2686
    ].
bd61671a8022 class: MenuPanel
ca
parents: 4632
diff changeset
  2687
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2688
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2689
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2690
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2691
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2692
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2693
asMenu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2694
    "convert contents to a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2695
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2696
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2697
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2698
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2699
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2700
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2701
    ^ menu
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2702
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2703
    "Modified: / 27-03-2007 / 08:39:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2704
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2705
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2706
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2707
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2708
3222
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2709
    self menu:(Menu decodeFromLiteralArray:aMenuSpec)
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2710
828febe4d844 use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 3206
diff changeset
  2711
    "Modified: / 27-03-2007 / 08:42:43 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2712
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2713
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2714
menu:aMenu
3965
bf89086ea0b5 layout fixes (mustRearrange was not always set)
Claus Gittinger <cg@exept.de>
parents: 3958
diff changeset
  2715
    "setup from a menu"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2716
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2717
    self disabledRedrawDo:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2718
        |menu newItems menuReceiver|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2719
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2720
        self removeAll.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2721
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2722
        (menu := aMenu) notNil ifTrue:[
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2723
            (menu isCollection) ifTrue:[
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2724
                menu := Menu decodeFromLiteralArray:menu.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2725
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2726
                menuReceiver := menu receiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2727
                menuReceiver notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2728
                    self receiver:menuReceiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2729
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2730
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2731
            (newItems := menu menuItems) notEmptyOrNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2732
                items := newItems collect:[:ni |
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2733
                                |i|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2734
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2735
                                i:= Item in:self.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2736
                                i menuItem:ni.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2737
                                i.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2738
                            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2739
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2740
            self groupSizes:(menu groupSizes).
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  2741
            self flushCachedPreferredExtent.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2742
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2743
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2744
3966
0badf955fd73 changed:
Claus Gittinger <cg@exept.de>
parents: 3965
diff changeset
  2745
    "Modified: / 09-11-2010 / 11:52:28 / cg"
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  2746
    "Modified: / 03-04-2019 / 08:44:16 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2747
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2748
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2749
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2750
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2751
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2752
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2753
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2754
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2755
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2756
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2757
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2758
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2759
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2760
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2761
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2762
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2763
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2764
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2765
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2766
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2767
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2768
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2769
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2770
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2771
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2772
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2773
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2774
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2775
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2776
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2777
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2778
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2779
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2780
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2781
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2782
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2783
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2784
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2785
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2786
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2787
    aLevel isNil ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2788
    aLevel == 0 ifTrue:[^ self].
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2789
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2790
    layout := anItem layout.
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2791
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2792
    (styleSheet at:'menuPanel.button3D' default:styleSheet is3D) ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2793
        self displayRectangle:layout.
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2794
    ] ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2795
        self drawEdgesForX:(layout left)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2796
                         y:(layout top)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2797
                     width:(layout width)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2798
                    height:(layout height)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2799
                     level:aLevel
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2800
                    shadow:(self buttonShadowColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2801
                     light:(self buttonLightColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2802
                halfShadow:(self buttonHalfShadowColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2803
                 halfLight:(self buttonHalfLightColor)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2804
                     style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2805
    ]
4482
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2806
2e8fb29f196d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4467
diff changeset
  2807
    "Modified: / 06-02-2014 / 14:55:05 / cg"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2808
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2809
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2810
drawFocusForItem:anItem
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2811
    |lytItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2812
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2813
    lytItem := anItem layout.
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2814
    self paint:(self blackColor).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2815
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2816
    self displayDottedRectangleX:(lytItem left)
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2817
                               y:(lytItem top)
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2818
                           width:(lytItem width)
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  2819
                          height:(lytItem height).
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2820
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  2821
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2822
drawGroupDividerFor:item inset:groupDivInset
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2823
    "draw a group divider"
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2824
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2825
    |isVertical layout 
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2826
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2827
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2828
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2829
     y2             "{ Class:SmallInteger }"
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2830
    |
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2831
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2832
    isVertical := self verticalLayout.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2833
    layout := item layout.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2834
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2835
    isVertical ifTrue:[
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2836
        x1 := layout left.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2837
        x2 := layout right.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2838
        y1 := layout bottom + groupDivInset.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2839
        y2 := y1.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2840
    ] ifFalse:[
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2841
        y1 := layout top.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2842
        y2 := layout bottom.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2843
        x1 := layout right + groupDivInset.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2844
        x2 := x1.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2845
    ].
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2846
    self paint:shadowColor.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2847
    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2848
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2849
    isVertical ifTrue:[y1 := y2 := y1 + 1. ]
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2850
              ifFalse:[x1 := x2 := x1 + 1. ].
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2851
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2852
    self paint:lightColor.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2853
    self displayLineFromX:x1 y:y1 toX:x2 y:y2
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2854
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2855
    "Created: / 11-07-2018 / 08:19:08 / Claus Gittinger"
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2856
!
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2857
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2858
drawItemsX:x y:y width:w height:h
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2859
    "redraw items and groups"
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2860
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2861
    |isVertical item prevClip
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2862
     x1             "{ Class:SmallInteger }" 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2863
     y1             "{ Class:SmallInteger }" 
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2864
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2865
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2866
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2867
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2868
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2869
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2870
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2871
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2872
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2873
    isVertical ifTrue:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2874
        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
  2875
        start == 0 ifTrue:[ ^ self ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2876
        y1 := y + h.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2877
        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
  2878
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2879
    ] ifFalse:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2880
        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
  2881
        start == 0 ifTrue:[ ^ self ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2882
        x1  := x + w.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2883
        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
  2884
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2885
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2886
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2887
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2888
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2889
        groupDivInset := self groupDividerSize // 2.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2890
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2891
        groupDivInset ~~ 0 ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2892
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2893
                start := start - 1
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2894
            ]
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2895
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2896
    ] ifFalse:[
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2897
        groupDivInset := 0
4523
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2898
    ].
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2899
e6e72982bd9e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4482
diff changeset
  2900
    prevClip := self clippingBoundsOrNil.
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2901
    self clippingBounds:(Rectangle left:x top:y width:w height:h).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2902
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2903
    start to:stop do:[:i|
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2904
        item := items at:i.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2905
        item draw.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2906
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2907
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2908
            self drawGroupDividerFor:item inset:groupDivInset.
5407
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2909
        ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2910
        selection == item ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2911
            self focusComesByTab ifTrue:[
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2912
                self drawFocusForItem:item.
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2913
            ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2914
        ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2915
    ].
1d9efe55031f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
  2916
    self clippingBounds:prevClip.
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2917
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2918
    "Modified (format): / 11-07-2018 / 08:21:26 / Claus Gittinger"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2919
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2920
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2921
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2922
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2923
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2924
    isSelected ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2925
        level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2926
    ] ifFalse:[
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2927
        (anItem == enteredItem) ifTrue:[ 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2928
            level := self enteredLevel 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2929
        ] ifFalse:[ 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2930
            level := 0 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2931
        ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2932
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2933
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2934
    level ~~ 0 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2935
        layout := anItem layout.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  2936
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2937
        self 
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2938
            drawEdgesForX:(layout left) y:(layout top)
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2939
            width:(layout width) height:(layout height)
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2940
            level:level
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2941
    ].
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2942
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  2943
    "Modified: / 11-07-2018 / 08:23:30 / Claus Gittinger"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2944
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2945
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2946
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2947
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2948
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2949
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2950
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2951
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2952
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2953
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2954
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2955
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2956
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2957
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2958
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2959
        level := styleSheet at:'menuPanel.scrollButtonActiveLevel' default:-2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2960
    ] ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2961
        level := styleSheet at:'menuPanel.scrollButtonPassiveLevel' default:1
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2962
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2963
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2964
    self isPopUpView ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2965
        self verticalLayout ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2966
            aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2967
                icon := scrolling class iconScrollRightM    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2968
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2969
                aDirection == #PREV ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2970
                    icon := scrolling class iconScrollLeftM    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2971
                ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2972
            ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2973
        ]     
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2974
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2975
    icon isNil ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2976
        icon := scrolling iconAt:aDirection on:self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2977
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2978
    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2979
    icon displayOn:self x:(x + ((w - icon width) // 2))
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2980
                        y:(y + 2 + ((h - 2 - icon height) // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2981
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2982
    level ~~ 0 ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2983
        self drawEdgesForX:x y:y width:w height:h level:level.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2984
    ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2985
"/        self paint:lightColor.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2986
"/        self displayLineFromX:x y:2 toX:x+w-1 y:2.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2987
"/        aDirection == #NEXT ifTrue:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2988
"/            self displayLineFromX:x y:2 toX:x y:h-1.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2989
"/        ] ifFalse:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2990
"/            aDirection == #PREV ifTrue:[    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2991
"/                self paint:shadowColor.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2992
"/                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
  2993
"/            ].    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2994
"/        ].    
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  2995
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2996
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2997
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2998
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2999
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3000
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3001
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3002
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3003
    (mustRearrange not and:[shown]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3004
        layout := anItem layout.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3005
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3006
        (layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3007
            self invalidate:(layout "insetBy:-1") repairNow:aBool
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3008
        ]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  3009
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  3010
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  3011
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  3012
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  3013
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3014
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3015
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3016
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  3017
    |oldPref|
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  3018
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3019
    mustRearrange ifFalse:[
5147
2bb6ca095860 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  3020
        oldPref := preferredExtent.
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  3021
        self flushCachedPreferredExtent.
5147
2bb6ca095860 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5127
diff changeset
  3022
        mustRearrange := true.
5276
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3023
        "/ if I am not yet created/was never created, do nothing
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3024
        device notNil ifTrue:[
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3025
            self invalidate. "/ RepairNow:true
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3026
            (oldPref notNil and:[oldPref ~= self preferredExtent]) ifTrue:[
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3027
                dependents notNil ifTrue:[ self changed:#preferredExtent ]
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3028
            ].
424244db8cc0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5257
diff changeset
  3029
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3030
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  3031
5959
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  3032
    "Modified: / 06-06-1998 / 19:51:07 / cg"
82dba601d848 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5942
diff changeset
  3033
    "Modified: / 09-11-2018 / 20:16:40 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3034
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3035
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3036
rearrangeGroups
3126
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  3037
    "implements the groupIdentifier #right/#conditionalRight in a horizontal menu"
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  3038
8dca3b01f1db new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3125
diff changeset
  3039
    <resource: #style (#'menuPanel.ignoreConditionalStartGroupRight')>
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3040
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3041
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3042
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3043
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3044
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3045
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3046
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3047
        ^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3048
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3049
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3050
    layout := items last layout.
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  3051
    layout notNil ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3052
        (dltX := width - margin - extraMargin - layout right) <= 0 ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3053
            ^ self  "/ no free space
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3054
        ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3055
    ].
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  3056
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3057
    "/ The behavior of #conditionalRight is controlled by the styleSheet.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3058
    "/ If menuPanel.ignoreConditionalStartGroupRight is true, it is ignored.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3059
    "/ otherwise, it is treated like #right.
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  3060
    "/ 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
  3061
    "/ non-right under win32 (as is used woth the help-menus).
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  3062
    (StyleSheet at:#'menuPanel.ignoreConditionalStartGroupRight' ifAbsent:false) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3063
        start := items findFirst:[:anItem| anItem startGroup == #right ].
3148
6b74db598eae conditionalRight revisited
Claus Gittinger <cg@exept.de>
parents: 3147
diff changeset
  3064
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3065
        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
  3066
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3067
    start == 0 ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3068
        ^ self  "/ no right-group item detected
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3069
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3070
    
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3071
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3072
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3073
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3074
    items from:start do:[:anItem|
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3075
        anItem isVisible ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3076
            anItem layout moveBy:point.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3077
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3078
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3079
    self updateEnteredItem.
3125
25a0bdbe879a startGroup-right is ignorable via styleSheet
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
  3080
3246
c9e0e6fe80a4 changed #rearrangeGroups
Claus Gittinger <cg@exept.de>
parents: 3242
diff changeset
  3081
    "Modified: / 10-10-2007 / 00:29:34 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3082
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3083
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3084
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3085
    "recompute the layout of each item
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3086
        !!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3087
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3088
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3089
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3090
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3091
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3092
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3093
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3094
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3095
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3096
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3097
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3098
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3099
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3100
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3101
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3102
    |
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3103
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3104
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3105
        mustRearrange := false.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3106
        ^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3107
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3108
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3109
"/  DON'T SET THIS!!
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3110
"/  item layout:  below of first item -> item invalidate
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3111
"/                                    -> menuPanel invalidateItem:repairDamage:
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3112
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3113
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3114
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3115
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  3116
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3117
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3118
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3119
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3120
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3121
    isPopUpMenu ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3122
        labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3123
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3124
        labelInsetX := labelInsetY := 0
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3125
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3126
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3127
    (isPopUpMenu or:[self hasExplicitExtent not]) ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3128
        |maxExtent extentToSet|
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3129
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3130
        extent := self preferredExtent.
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
        isPopUpMenu ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3133
            maxExtent := self maxExtent.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3134
            maxExtent notNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3135
                extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3136
                                          ifFalse:[(extent x min:(maxExtent x)) @ extent y].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3137
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3138
        ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3139
            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
  3140
        ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3141
        self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3142
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3143
        extent := self computeExtent
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3144
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3145
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3146
    x := y := margin + extraMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3147
    
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3148
    isVertical ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3149
        y0 := y.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3150
        y1 := extent y - margin - extraMargin.
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
        items keysAndValuesDo:[:anIndex :el|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3153
            el isVisible ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3154
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3155
            ] ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3156
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3157
                    insetX := buttonInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3158
                    insetY := buttonInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3159
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3160
                    insetX := labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3161
                    insetY := labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3162
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3163
                x0 := x  + insetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3164
                x1 := x0 + (el preferredWidth).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3165
                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
  3166
                x := x1 + insetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3167
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3168
                size ~~ anIndex ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3169
                    (self hasGroupDividerAt:anIndex) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3170
                        x := x + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3171
                    ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3172
                        el needsItemSpaceWhenDrawing ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3173
                            x := x + itemSpace
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3174
                        ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3175
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3176
                ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3177
            ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3178
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3179
    ] ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3180
        itemMargin := self itemMargin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3181
        x0 := margin.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3182
        x1 := extent x - margin - itemMargin.  "/ -1
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3183
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3184
        items keysAndValuesDo:[:anIndex :el|
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3185
            el isVisible ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3186
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3187
            ] ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3188
                el isButton ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3189
                    insetX := buttonInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3190
                    insetY := buttonInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3191
                ] ifFalse:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3192
                    insetX := labelInsetX.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3193
                    insetY := labelInsetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3194
                ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3195
                y0 := y  + insetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3196
                y1 := y0 + el preferredHeight.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3197
                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
  3198
                y := y1 + insetY.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3199
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3200
                size ~~ anIndex ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3201
                    (self hasGroupDividerAt:anIndex) ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3202
                        y := y + groupDividerSize
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3203
                    ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3204
                ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3205
            ]
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3206
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3207
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3208
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3209
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3210
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3211
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3212
    "Modified: / 13-11-2001 / 20:17:21 / cg"
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3213
    "Modified (format): / 15-03-2017 / 20:36:46 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3214
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3215
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3216
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3217
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3218
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3219
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  3220
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3221
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3222
    (items contains:[:item | item canChangeVisibility]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3223
        mustRearrange := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3224
        self rearrangeItems.
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3225
    ]
4456
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3226
2afa333249ad class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4455
diff changeset
  3227
    "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
  3228
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3229
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3230
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3231
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3232
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3233
    |y0 y1 x0 x1 prvBound mustDrawLeft mustDrawRight nxtBound|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3234
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3235
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3236
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3237
    mustRearrange ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3238
        self isPopUpView ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3239
            self explicitExtent:true.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3240
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3241
            "/ changed due to menu in horizontal panel
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3242
            sizeFixed ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3243
                self preferredExtent.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3244
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3245
                preferredExtent notNil ifTrue:[ |lw|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3246
                    lw := (superView width - self left) max: 1.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3247
                    self width:(preferredExtent x min:lw).
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3248
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3249
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3250
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3251
        self rearrangeItems.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3252
        self invalidate.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3253
        ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3254
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3255
2888
095d9fb3e846 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2884
diff changeset
  3256
    "/ self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3257
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3258
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3259
    items isEmptyOrNil ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3260
        ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3261
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3262
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3263
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3264
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3265
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3266
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3267
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3268
    "Draw the scroll handles - especially for Popup-Lists"
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3269
    mustDrawLeft := mustDrawRight := false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3270
    
3242
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3271
    self hasScrollers ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3272
        (self hasScrollerAt:#PREV) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3273
            prvBound := self scrollerBoundsAt:#PREV.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3274
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3275
            self verticalLayout ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3276
                (mustDrawLeft := (prvBound bottom > y)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3277
                    y0 := prvBound bottom.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3278
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3279
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3280
                (mustDrawLeft := (prvBound right > x)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3281
                    x0 := prvBound right.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3282
                ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3283
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3284
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3285
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3286
        (self hasScrollerAt:#NEXT) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3287
            nxtBound := self scrollerBoundsAt:#NEXT.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3288
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3289
            self verticalLayout ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3290
                (mustDrawRight := (nxtBound top < y1)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3291
                    y1 := nxtBound top.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3292
                ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3293
            ] ifFalse:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3294
                (mustDrawRight := (nxtBound left < x1)) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3295
                    x1 := nxtBound left.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3296
                ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3297
            ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3298
        ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3299
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3300
    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
  3301
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  3302
    (y1 > y0 and:[x1 > x0]) ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3303
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3304
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3305
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3306
    mustDrawLeft ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3307
        self drawScrollerAt:#PREV bounds:prvBound.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3308
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3309
    mustDrawRight ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3310
        self drawScrollerAt:#NEXT bounds:nxtBound.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  3311
    ].
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3312
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3313
    "Modified: / 15-03-2017 / 20:32:13 / stefan"
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3314
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3315
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3316
updateEnteredItem
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3317
    |mousePoint|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3318
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3319
    mousePoint  := device translatePoint:(device pointerPosition)
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3320
                           fromView:nil toView:self.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3321
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3322
    (self containsPoint:mousePoint) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  3323
        enteredItem := self itemAtPoint:mousePoint
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3324
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3325
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3326
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  3327
!MenuPanel methodsFor:'enumerating & searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3328
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3329
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3330
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3331
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3332
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3333
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3334
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3335
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3336
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3337
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3338
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3339
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3340
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3341
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3342
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3343
findFirst:aOneArgBlock
3206
48a66f672af3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3203
diff changeset
  3344
    "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
  3345
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3346
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3347
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3348
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3349
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3350
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3351
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3352
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3353
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3354
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3355
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3356
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3357
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3358
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3359
firstItemSelectable
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3360
    "returns the first item which is selectable or nil
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3361
    "
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3362
    items notEmptyOrNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3363
        ^ items detect:[:anItem| anItem canSelect ] ifNone:nil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3364
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3365
    ^ nil
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3366
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3367
    "Modified: / 15-03-2017 / 20:30:39 / stefan"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3368
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  3369
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3370
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3371
    "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
  3372
     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
  3373
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3374
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3375
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3376
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3377
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3378
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3379
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3380
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3381
    i ~~ 0 ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3382
        ^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3383
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3384
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3385
    something isSymbol ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3386
        i := self findFirst:[:el|
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3387
                                v := el value.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3388
                                v isSymbol and:[v == something]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3389
                            ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3390
        i ~~ 0 ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3391
            ^ i
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3392
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3393
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3394
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3395
    (something respondsTo:#string) ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3396
        v := something string.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3397
        ^ self findFirst:[:el | el textLabel = v].
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3398
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3399
    ^ 0
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3400
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3401
    "Modified (format): / 15-03-2017 / 20:16:53 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3402
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3403
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3404
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3405
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3406
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3407
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3408
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3409
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3410
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3411
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3412
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3413
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3414
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3415
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3416
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3417
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3418
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3419
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3420
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3421
    |menu motionPoint translatedPoint sensor anyButtonPressed|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3422
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3423
    self scrollActivity isActive ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3424
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3425
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3426
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3427
    sensor := self sensor.
4526
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3428
"/ cg: the following seems to lead to leftover submenus to remain unclosed...
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3429
"/    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3430
"/        ^ self
e404a71d6e4c class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4523
diff changeset
  3431
"/    ].
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3432
    menu := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3433
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3434
    motionPoint := x@y.
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3435
    translatedPoint := menu translateGrabPoint:motionPoint.
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3436
    menu handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3437
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3438
    "/ hideOnRelease := true.
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3439
    anyButtonPressed := sensor anyButtonPressed.
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3440
    
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3441
    (self isPopUpView or:[anyButtonPressed]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3442
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3443
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3444
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3445
    hideOnRelease ifTrue:[
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3446
        anyButtonPressed ifFalse:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3447
    ] ifFalse:[
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3448
        anyButtonPressed ifTrue:[^ self]
3826
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3449
    ].
608aa28e7676 changed: #buttonMotion:x:y:
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  3450
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3451
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3452
        "/ selection on grabView without a submenu (Button ...); check whether moving out
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3453
        (self containsPoint:motionPoint) ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3454
            ^ self accept:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3455
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3456
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3457
6021
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3458
    "Modified: / 13-11-2001 / 20:21:49 / cg"
15bfa1dd30de #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6011
diff changeset
  3459
    "Modified: / 02-03-2019 / 12:11:40 / Claus Gittinger"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3460
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3461
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3462
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3463
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3464
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3465
    |menu point screen screenPoint targetView targetPoint wg|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3466
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3467
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3468
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3469
    "/ 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
  3470
    wg := self windowGroup.
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3471
    wg notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3472
        wg focusMomentaryRelease.
4629
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3473
    ].
4376266b4b1a class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4628
diff changeset
  3474
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3475
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3476
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3477
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3478
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3479
    menu isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3480
        self accept:nil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3481
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3482
        "/ tell underlying view about the click...
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3483
        ((button ~~ 2)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3484
        or:[(button == 2 and:[UserPreferences current showRightButtonMenuOnRelease])]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3485
            screen := device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3486
            screenPoint := screen translatePointToRoot:point fromView:self.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3487
            targetView := screen viewFromPoint:screenPoint.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3488
            (targetView notNil and:[targetView ~~ self]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3489
                targetPoint := screen translatePoint:screenPoint fromView:screen rootView toView:targetView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3490
                targetView buttonPress:button x:targetPoint x y:targetPoint y.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3491
            ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3492
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3493
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3494
        point := menu translateGrabPoint:point.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3495
        menu handleButtonPress:button atPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3496
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3497
4082
e85a434b71ed changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4081
diff changeset
  3498
    "Modified: / 02-10-2011 / 09:20:08 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3499
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3500
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3501
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3502
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3503
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3504
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  3505
     releaseTime menuMapTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3506
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  3507
    hideOnRelease ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3508
        ^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3509
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3510
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3511
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3512
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3513
    self scrollActivity stop ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3514
        ^ self
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3515
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3516
    dstMenu := topMenu activeMenu.
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3517
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3518
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3519
    hideMenuAndPerformAction ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3520
        "open topMenu, a popup by click and release button in a short time period"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3521
        (topMenu == self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3522
        and:[mapTime notNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3523
        and:[dstMenu == self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3524
        and:[dstMenu isPopUpView]]]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3525
            hideMenuAndPerformAction := false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3526
        ].
4463
4b9a49eceadc class: MenuPanel
ca
parents: 4462
diff changeset
  3527
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3528
    hideMenuAndPerformAction ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3529
        hideOnRelease ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3530
            windowGroup isNil ifTrue:[ "/ race condition?!!
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3531
                hideMenuAndPerformAction := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3532
                self accept:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3533
                ^ self.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3534
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3535
            releaseTime := windowGroup lastEvent timeStamp.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3536
            menuMapTime := dstMenu mapTime ? releaseTime.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3537
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3538
            hideMenuAndPerformAction := (releaseTime millisecondDeltaFrom:menuMapTime)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3539
                                        > (PopUpMenu maxClickTimeToStayOpen).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3540
        ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3541
    ].
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  3542
    hideMenuAndPerformAction ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3543
        srcPoint := x@y.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3544
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3545
        (     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3546
         and:[(item    := dstMenu selection) notNil]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3547
        ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3548
            item visibleSubmenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3549
                dstMenu selection:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3550
                (selection isNil and:[self isPopUpView not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3551
                    self accept:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3552
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3553
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3554
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3555
            subm := item currentSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3556
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3557
            subm notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3558
                subm shown ifTrue:[^ self].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3559
                "/ test whether any action is assigned to the menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3560
                "/ if not ignorre accept
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3561
                item hasDelayedMenu ifFalse:[^ self].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3562
                "/ handle action defined for the delayed menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3563
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3564
            dstPoint := dstMenu translateGrabPoint:srcPoint.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3565
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3566
            (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3567
                item := nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3568
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3569
            topMenu acceptItem:item inMenu:dstMenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3570
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3571
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3572
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3573
        (selection notNil and:[dstMenu == self]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3574
            selection visibleSubmenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3575
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3576
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3577
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3578
        self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3579
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3580
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3581
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3582
handleSizeChanged:how
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3583
    "used to handle the scrollers and groups in a none popUpView
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3584
    "
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3585
    |layouts damage isVertical scrollBound|
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3586
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3587
    (mustRearrange or:[items isEmptyOrNil or:[self isPopUpView]]) ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3588
        ^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3589
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3590
    mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3591
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3592
    shown ifFalse:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3593
        ^ self
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3594
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3595
    layouts := OrderedCollection new.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3596
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3597
    items do:[:el| 
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3598
        |layout|
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3599
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3600
        (layout := el layout) isNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3601
            self invalidate.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3602
            ^ self.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3603
        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3604
        layouts add:layout.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3605
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3606
    isVertical  := self verticalLayout.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3607
    scrollBound := self scrollerBoundsAt:#NEXT.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3608
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3609
    self rearrangeItems.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3610
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3611
    items keysAndValuesDo:[:i :el| |newLyt oldLyt|
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3612
        damage isNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3613
            newLyt := el layout.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3614
            oldLyt := layouts at:i ifAbsent:newLyt.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3615
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3616
            newLyt ~= oldLyt ifTrue:[ |x y start|
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3617
                start := 0.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3618
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3619
                i > 1 ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3620
                    isVertical ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3621
                        x := 0.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3622
                        y := start := (oldLyt top min:(newLyt top)) min:(height - scrollBound height).
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3623
                    ] ifFalse:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3624
                        y := 0.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3625
                        x := start := (oldLyt left min:(newLyt left)) min:(width - scrollBound width).
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3626
                    ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3627
                ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3628
                start <= 20 ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3629
                    self invalidate.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3630
                    ^ self
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3631
                ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3632
                damage := Rectangle left:x top:y extent:(self extent).
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3633
            ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3634
        ].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3635
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3636
    damage isNil ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3637
        damage := scrollBound.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3638
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3639
    scrollBound := lastDrawnScrollerNextBounds.
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3640
    scrollBound notNil ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3641
        damage := damage merge:scrollBound
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3642
    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3643
    self invalidate:damage.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3644
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  3645
    "Modified: / 29-06-2011 / 16:24:59 / cg"
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3646
    "Modified (format): / 15-03-2017 / 20:42:46 / stefan"
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3647
!
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3648
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3649
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3650
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3651
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3652
    <resource: #keyboard (#Escape
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3653
                          #Tab #FocusNext #FocusPrevious
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3654
                          #CursorLeft #CursorRight )>
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3655
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3656
    |menu menusSuperMenu sensor|
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3657
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3658
    sensor := self sensor.
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3659
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3660
"/    sensor anyButtonPressed ifTrue:[
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3661
"/        ^ self  "/ ignored while any button is pressed
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  3662
"/    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3663
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3664
    self scrollActivity isActive ifTrue:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3665
        key ~~ #Escape ifTrue:[
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3666
            ^ self
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3667
        ].
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3668
        self scrollActivity stop
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3669
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3670
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3671
       (key == #Tab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3672
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3673
    or:[key == #FocusPrevious]]) ifTrue:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3674
        self accept:nil.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3675
        super keyPress:key x:x y:y.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3676
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3677
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3678
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3679
    menu := self detectGrabMenu.
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3680
    menusSuperMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3681
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  3682
    (key == #Escape) ifTrue:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3683
        "/ must hide the active menu
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3684
        menusSuperMenu notNil ifTrue:[
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3685
            "/ hide active menu but keep the grab
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3686
            menusSuperMenu selection hideSubmenu
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3687
        ] ifFalse:[
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3688
            "/ hide active menu and ungrab
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3689
            self accept:nil
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3690
        ].
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3691
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3692
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3693
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3694
    menu isViewWrapper ifFalse:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3695
        sensor compressKeyPressEventsWithKey:key.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3696
        menu handleKeyPress:key.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3697
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3698
    ].
2869
3e24a0b78c17 comment
Claus Gittinger <cg@exept.de>
parents: 2860
diff changeset
  3699
    menusSuperMenu == self ifFalse:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3700
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3701
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3702
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3703
        (self containsPoint:x@y) ifTrue:[
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3704
            self handleKeyPress:key.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3705
            ^ self
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3706
        ]
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3707
    ].
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3708
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3709
    super keyPress:key x:x y:y
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3710
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3711
    "Modified: / 17-08-2017 / 09:05:43 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3712
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3713
3834
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3714
mapped
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3715
    super mapped.
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3716
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3717
    "/ if I come up with a pressed button, react on release instead.
5191
61ec3a24b042 #BUGFIX by sr
sr
parents: 5190
diff changeset
  3718
    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
  3719
!
9ab4091d6829 if I come up with a pressed button, react on release instead.
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
  3720
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3721
mouseWheelMotion:buttonState x:x y:y amount:amount deltaTime:dTime
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3722
    "mousewheel action"
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3723
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3724
    |menu|
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3725
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3726
    menu := self detectGrabMenu.
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3727
    menu isViewWrapper ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3728
        menu superMenu ~~ self ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3729
        menu := self.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3730
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3731
    "/ support line and page scrolling
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3732
    menu shown ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3733
        self window sensor shiftDown ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3734
            amount > 0 ifTrue:[menu pageUp]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3735
                      ifFalse:[menu pageDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3736
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3737
            amount > 0 ifTrue:[menu scrollUp]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3738
                      ifFalse:[menu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  3739
        ].
3415
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3740
    ].
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3741
!
8cfa8d86bbc8 Mousewheel support
Stefan Vogel <sv@exept.de>
parents: 3414
diff changeset
  3742
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3743
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3744
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3745
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3746
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3747
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3748
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3749
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3750
    (selection isNil or:[self isPopUpView]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3751
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3752
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3753
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3754
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3755
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3756
    windowGroup focusView ~~ self ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3757
        self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  3758
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3759
        selection isButton ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3760
            sensor := self sensor.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3761
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3762
            sensor isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3763
                self accept:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3764
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3765
                "/ I'have the focus; if no button pressed, than keep the selection
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3766
                sensor anyButtonPressed ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3767
                    self selection:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3768
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3769
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  3770
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3771
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3772
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3773
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3774
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3775
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3776
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3777
"/    self isPopUpView ifFalse:[
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3778
"/        mustRearrange := true.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3779
"/        self invalidate
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3780
"/    ].
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3781
"/    ^ super sizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3782
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3783
    self handleSizeChanged:how.
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  3784
    super sizeChanged:how.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3785
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3786
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3787
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3788
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3789
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3790
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3791
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3792
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3793
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3794
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3795
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3796
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3797
5376
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3798
    device isNil ifTrue:[
5386
4a69442cbcd1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5376
diff changeset
  3799
        "/ 'MenuPanel - leftover event ignored' infoPrintCR.
5376
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3800
        ^ self
9c9894b8fa9f #BUGFIX by ab
ab
parents: 5355
diff changeset
  3801
    ].
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3802
    ev isDamage ifTrue:[
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3803
        super dispatchEvent:ev withFocusOn:focusView delegate:false.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3804
        ^ self.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3805
    ].
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3806
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3807
    (superMenu isNil and:[ev isButtonPressEvent]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3808
        focusView ~~ self ifTrue:[prevFocusView := focusView].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3809
    ].
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  3810
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3811
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3812
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3813
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3814
    implicitGrabView notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3815
        self sensor leftButtonPressed ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3816
            self clearImplicitGrab.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3817
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3818
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3819
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3820
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3821
        super dispatchEvent:ev withFocusOn:focusView delegate:false.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3822
        ^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3823
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3824
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3825
    implicitGrabView notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3826
        ev isButtonEvent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3827
            p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3828
            ev view:implicitGrabView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3829
            ev arguments at:2 put:p x.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3830
            ev arguments at:3 put:p y.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3831
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3832
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3833
            ev isButtonReleaseEvent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3834
                self clearImplicitGrab.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3835
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3836
            ^ self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3837
        ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3838
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3839
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3840
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3841
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3842
        self clearImplicitGrab.
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3843
        super dispatchEvent:ev withFocusOn:focusView delegate:false.
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3844
        ^ self    
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3845
    ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3846
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3847
    p := menu translateGrabPoint:(x@y).
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3848
    view := menu detectViewAt:p.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3849
    view == self ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3850
        "MB:changed - recursion"
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3851
        ^ self
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3852
    ].  
3630
1daf110f3011 recursion avoidance
Claus Gittinger <cg@exept.de>
parents: 3612
diff changeset
  3853
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3854
    p := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3855
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3856
    ev isButtonPressEvent ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3857
        (view wantsFocusWithButtonPress) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3858
            view requestFocus.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3859
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3860
        view ~~ self ifTrue:[ "/ can this ever be self ?
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3861
            implicitGrabView := view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3862
        ]
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3863
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3864
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3865
    ev isButtonMotionEvent ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3866
        lastPointerView ~~ view ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3867
            "/ must generate enter/leave ... (sigh)
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3868
            lastPointerView notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3869
                "/ XXX: should be fixed
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3870
                syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3871
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3872
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3873
            view notNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3874
                syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3875
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3876
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3877
            lastPointerView := view.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  3878
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3879
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3880
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3881
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3882
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3883
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3884
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3885
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3886
    "Modified (comment): / 15-03-2017 / 19:45:52 / stefan"
5578
68aef50b064e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5573
diff changeset
  3887
    "Modified: / 17-08-2017 / 09:26:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3888
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3889
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3890
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3891
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3892
6029
8b004782d14f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6025
diff changeset
  3893
    |menu item translatedPoint containsPoint direction delayTime
8b004782d14f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6025
diff changeset
  3894
     visibleSubmenu point|
8b004782d14f #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6025
diff changeset
  3895
     
6007
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3896
    false ifTrue:[
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3897
        state == 0 ifTrue:[
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3898
            "/ no button currently pressed
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3899
            self topMenu activeMenu ~~ self ifTrue:[
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3900
                "/ not for me - ignore
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3901
                ^ self
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3902
            ]
73962493037a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  3903
        ].            
6006
fb9398beb66a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  3904
    ].            
fb9398beb66a #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  3905
        
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3906
    containsPoint := self containsPoint:motionPoint.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3907
    (containsPoint not and:[items notEmptyOrNil]) ifTrue:[
6050
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3908
        "/ check if there is still an open menu,
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3909
        "/ which is not assigned to (i.e. a submenu of) the current selection
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3910
        item := items detect:[:el| el visibleSubmenu notNil ] ifNone:nil.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3911
        item notNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3912
            visibleSubmenu := item visibleSubmenu.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3913
            visibleSubmenu notNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3914
                point := self translateMenuPoint:motionPoint toMenu:visibleSubmenu.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3915
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3916
                (visibleSubmenu containsPoint:point) ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3917
                    selection notNil ifTrue:[ selection invalidate ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3918
                    selection := item.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3919
                    selection invalidate.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3920
                    visibleSubmenu becomesActiveMenu.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3921
                    ^ self.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3922
                ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3923
            ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3924
            item := nil.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3925
        ].
3975
ca
parents: 3966
diff changeset
  3926
    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  3927
    containsPoint ifTrue:[
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3928
        item := self itemAtPoint:motionPoint.
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3929
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3930
        delayTime := self delayInSecondsBeforeOpeningSubmenu.
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3931
        "/ to try: if the cursor is in the left third of the menu,
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3932
        "/ then shorten the delay time
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3933
        "/ motionPoint x < (self width//3) ifTrue:[
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3934
        "/    delayTime := delayTime / 2.
6003
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  3935
        "/ ]. 
6050
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3936
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3937
        "/ bad idea: popped up menu might overlap the next item.
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3938
        "/ (try lancher-windows and move down...)
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3939
        false ifTrue:[
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3940
            (self topMenu activeMenu isNil or:[self topMenu activeMenu == self]) ifTrue:[
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3941
                "/ no menu open currently
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3942
                "/ delayTime := 0.1.
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3943
                delayTime := 0.
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  3944
            ].
6003
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  3945
        ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  3946
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3947
4183
280e1f0f4030 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4173
diff changeset
  3948
    "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
  3949
    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
  3950
    direction notNil ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3951
        self pointerEntersItem:nil.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3952
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3953
        self sensor anyButtonPressed ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3954
            self scrollActivity startIfRequiredAt:direction on:self comesViaButtonPress:false.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3955
        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3956
        ^ 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
  3957
    ].
4d8c5bde0f98 Show scroll buttons, if menu is larger than screen (needed for PopupListm ComboBox, ...)
Stefan Vogel <sv@exept.de>
parents: 3233
diff changeset
  3958
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  3959
    self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3960
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3961
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3962
        (self selectionFollowsMouse
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3963
         and:[self topMenu focusComesByTab not]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3964
        ) ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3965
            self isPopUpView ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3966
                item isNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3967
                    superMenu notNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3968
                        translatedPoint := self translateMenuPoint:motionPoint toMenu:superMenu.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3969
                        superMenu handleButtonMotion:state atPoint:translatedPoint.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3970
                    ]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3971
                ] ifFalse:[
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3972
                    self selectAndOpenDelayed:item after:delayTime.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3973
                ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3974
            ] ifFalse:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3975
                "/ processing in the toolbar
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3976
                (item notNil and:[self hasSelection and:[item canSelect]]) ifTrue:[
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3977
                    self selectAndOpenDelayed:item after:delayTime.
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3978
"/                    self selection:item openMenu:true.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3979
                ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3980
            ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3981
        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3982
        ^ self
3975
ca
parents: 3966
diff changeset
  3983
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  3984
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3985
    containsPoint ifTrue:[
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  3986
        self selectAndOpenDelayed:item after:delayTime.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3987
"/        self isPopUpView ifFalse:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3988
"/            "/ also open delayed if I am the top-menu
4191
bd66cf091adb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4185
diff changeset
  3989
"/            self selection:item openMenu:true.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3990
"/        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3991
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3992
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3993
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3994
    menu := self superMenuAtPoint:motionPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3995
    menu notNil ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3996
        translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3997
        menu handleButtonMotion:state atPoint:translatedPoint.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  3998
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3999
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4000
    self isPopUpView ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4001
        self selection:nil
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4002
    ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4003
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4004
    "Modified: / 15-03-2017 / 20:41:07 / stefan"
6050
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  4005
    "Modified (comment): / 08-05-2019 / 10:44:03 / Claus Gittinger"
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4006
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4007
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  4008
handleButtonPress:button atPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4009
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4010
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4011
    |item scrollerDirectionOrNil wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4012
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4013
    "/ is a scroller-button present and hit ?
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4014
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4015
    scrollerDirectionOrNil notNil ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4016
        (self scrollActivity startIfRequiredAt:scrollerDirectionOrNil on:self comesViaButtonPress:true) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4017
            self pointerEntersItem:nil.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4018
            ^ self
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4019
        ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4020
    ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4021
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4022
    item := self itemAtPoint:aPoint.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4023
    item isNil ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4024
        self selection:nil openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4025
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4026
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4027
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4028
    "/ right button always immediately pulls the delayedMenu
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  4029
    button == 2 ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4030
        item hasDelayedMenu ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4031
            self selection:item openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4032
            self openDelayed:item afterSeconds:0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4033
            ^ self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4034
        ].
3383
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  4035
    ].
81b34d7be9b4 right-click delayed menu
Claus Gittinger <cg@exept.de>
parents: 3363
diff changeset
  4036
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4037
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4038
    wasSelected ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4039
        self selection:item openMenu:true.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4040
        "/ make sure that a momentary press is visible
5345
1411504c964d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5344
diff changeset
  4041
        (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
  4042
            self repairDamage.
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  4043
            Delay waitForSeconds:0.1.
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  4044
        ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4045
    ].
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4046
    item hasDelayedMenu ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4047
        "/ clicked on the arrow icon ?
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4048
        (item menuIndicatorContains:aPoint) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4049
            self selection:item openMenu:false.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4050
            self openDelayed:item afterSeconds:0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4051
            ^ self.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4052
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4053
        ^ self
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  4054
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4055
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4056
    (item isToggle or:[item triggerOnDown]) ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4057
        (wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4058
            item toggleSubmenuVisibility
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4059
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4060
        ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4061
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4062
    (item canAccept and:[item == self selection]) ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  4063
        ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4064
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4065
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4066
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4067
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4068
    "/ cg: what was this wait for???
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4069
    false ifTrue:[
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4070
        [ (device notNil and:[device anyButtonPressed]) ] whileTrue:[
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4071
            "/ using device - sensor is not updated sometimes
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4072
            Delay waitForSeconds:0.1.
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4073
        ].
3233
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  4074
    ].
50bec260bddc bugfix - waiting for anyButtonPressede not
ca
parents: 3224
diff changeset
  4075
    self sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4076
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4077
5344
61a9ac538689 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
  4078
    "Created: / 13-11-2001 / 14:12:04 / cg"
5345
1411504c964d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5344
diff changeset
  4079
    "Modified: / 20-11-2016 / 13:20:04 / cg"
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4080
    "Modified: / 11-06-2018 / 08:54:47 / Claus Gittinger"
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4081
    "Modified (comment): / 11-06-2018 / 09:58:04 / Claus Gittinger"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4082
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4083
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4084
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4085
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4086
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4087
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  4088
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4089
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  4090
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4091
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4092
    (size  := items size) == 0 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4093
        superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4094
        ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4095
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4096
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4097
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4098
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  4099
    selection isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4100
        (isVrt and:[aKey == #CursorDown]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4101
            idx := items findFirst:[:el | el notNil and:[ el canSelect ]].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4102
            idx ~~ 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4103
                self selection:(items at:idx).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4104
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4105
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4106
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4107
        (isVrt and:[aKey == #CursorUp]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4108
            idx := items findLast:[:el | el notNil and:[ el canSelect ]].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4109
            idx ~~ 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4110
                self selection:(items at:idx).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4111
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4112
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4113
        ]
4172
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  4114
    ].
3a90b8082486 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4167
diff changeset
  4115
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4116
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4117
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4118
    ) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4119
        selection isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4120
            (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4121
                ^ superMenu handleCursorKey:aKey
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4122
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4123
            idx := 0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4124
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4125
            isVrt ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4126
                "/ used because of vertical scrolling
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4127
                idx := items findFirst:[:el| el layout top > 0 ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4128
                idx ~~ 0 ifTrue:[idx := idx - 1 ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4129
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4130
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4131
            idx := self indexOf:selection.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4132
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4133
        next := aKey == #CursorRight or:[aKey == #CursorDown].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4134
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4135
        idx0 := idx.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4136
        size timesRepeat:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4137
            |el|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4138
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4139
            next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4140
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4141
            idx > size ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4142
                idx := 0 "1"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4143
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4144
                idx < 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4145
                    idx := size
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4146
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4147
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4148
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4149
            idx == 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4150
                self selection:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4151
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4152
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4153
                (el := items at:idx ifAbsent:nil) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4154
                    el canSelect ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4155
                        el hasDelayedMenu ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4156
                            "/ do not open menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4157
                            self selection:el openMenu:false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4158
                        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4159
                            "/ open comes from style-sheet
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4160
                            self selection:el.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4161
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4162
                        ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4163
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4164
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4165
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4166
            idx == idx0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4167
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4168
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4169
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4170
        ^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4171
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4172
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4173
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4174
        p1 := self translateGrabPoint:0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4175
        p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4176
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4177
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4178
    isVrt ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4179
        (superMenu notNil and:[p1 x > p2 x]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4180
            backKey := #CursorRight
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4181
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4182
            backKey := #CursorLeft.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4183
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4184
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4185
        (superMenu notNil and:[p1 y > p2 y]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4186
            backKey := #CursorDown
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4187
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4188
            backKey := #CursorUp.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4189
        ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4190
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4191
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4192
    aKey == backKey ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4193
        superMenu isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4194
            self accept:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4195
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4196
            superMenu verticalLayout ~~ isVrt ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4197
                superMenu handleCursorKey:aKey
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4198
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4199
                superMenu selection hideSubmenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4200
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4201
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4202
        ^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4203
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4204
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4205
    selection isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4206
        superMenu isNil ifTrue:[^ self accept:nil].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4207
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4208
        superMenu verticalLayout ~~ isVrt ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4209
            superMenu handleCursorKey:aKey
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4210
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4211
            (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4212
                self selectionIndex:item
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4213
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4214
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4215
        ^ self
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4216
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4217
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4218
    selection hasSubmenu ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4219
        (menu := selection visibleSubmenu) isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4220
            selection toggleSubmenuVisibility
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4221
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4222
            menu selectionIndex:1
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4223
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4224
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4225
        superMenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4226
            superMenu verticalLayout ~~ isVrt ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4227
                superMenu handleCursorKey:aKey
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4228
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4229
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4230
            self accept:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4231
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4232
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4233
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4234
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4235
handleKeyPress:key
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4236
    <resource: #keyboard (#CursorDown #CursorUp #CursorLeft #CursorRight #Return)>
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  4237
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4238
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4239
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4240
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4241
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4242
    (key == #Return or:[key == Character space]) ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4243
        self handleReturnPressed.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4244
        ^ true.
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4245
    ].
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4246
    key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4247
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4248
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4249
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4250
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  4251
"/            ].
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4252
        inMenu := self.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4253
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4254
        (item := inMenu detectItemForKey:key) notNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4255
            inMenu selection:item
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4256
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4257
        ^ true
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4258
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4259
    (key == #CursorDown
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4260
        or:[key == #CursorUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4261
        or:[key == #CursorLeft
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4262
        or:[key == #CursorRight]]])
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4263
    ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4264
        self handleCursorKey:key.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4265
        ^ true
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4266
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4267
    "/ handle scrolling keys"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4268
    key == #EndOfLine    ifTrue:[self scrollToBottom. ^ true ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4269
    key == #BeginOfLine  ifTrue:[self scrollToTop. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4270
    key == #NextPage     ifTrue:[self pageDown. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4271
    key == #PreviousPage ifTrue:[self pageUp. ^ true.].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  4272
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4273
    ^ false.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  4274
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4275
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4276
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4277
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4278
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4279
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4280
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4281
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4282
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4283
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4284
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4285
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4286
    (item := selection) isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4287
        superMenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4288
            item := superMenu selection.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4289
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4290
            item value notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4291
                "/ is a delayed menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4292
                self accept:item
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4293
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4294
                item toggleSubmenuVisibility
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4295
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4296
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4297
            self accept
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4298
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4299
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4300
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4301
    selection hasSubmenu ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4302
        selection hasDelayedMenu ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4303
            selection toggleSubmenuVisibility.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4304
          ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4305
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4306
        subm := selection currentSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4307
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4308
        (subm notNil and:[subm shown]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4309
            selection toggleSubmenuVisibility.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4310
          ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4311
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4312
        self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4313
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4314
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4315
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4316
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4317
    item isToggle ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4318
        self selection:item.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  4319
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4320
        (selection notNil and:[selection triggerOnDown]) ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4321
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4322
        ]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4323
    ].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4324
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4325
    (sensor := self sensor) isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4326
        ^ self
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4327
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4328
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4329
    [
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4330
        sensor flushKeyboardFor:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4331
        Delay waitForSeconds:0.1.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4332
        sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  4333
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4334
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4335
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4336
pointerEntersItem:anItemOrNil
6050
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  4337
    "the pointer moves over an item or nil; 
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  4338
     restore the old item and redraw the new item highlighted."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4339
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4340
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4341
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4342
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4343
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4344
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4345
     and:[self isPopUpView not]]]) ifTrue:[
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  4346
        (anItemOrNil isButton
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  4347
          and:[self isVerticalLayout not
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  4348
          and:[(styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  4349
        ]]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4350
            (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4351
             or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4352
            ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4353
                newItem := anItemOrNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4354
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4355
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4356
            (self enteredLevel ~~ 0
5978
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  4357
              or:[ (self enteredBackgroundColor ~= self backgroundColor)
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  4358
              or:[self enteredForegroundColor ~= self foregroundColor ]]
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4359
            ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4360
                newItem := anItemOrNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4361
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4362
        ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4363
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4364
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4365
    newItem ~~ enteredItem ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4366
        oldItem     := enteredItem.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4367
        enteredItem := newItem.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4368
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4369
        oldItem notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4370
            self invalidateItem:oldItem repairNow:(enteredItem isNil).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4371
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4372
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4373
        enteredItem notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4374
            self invalidateItem:enteredItem repairNow:true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4375
        ].
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4376
    ].
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  4377
5978
ff8cdfcb7007 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5972
diff changeset
  4378
    "Modified: / 23-12-2018 / 00:31:33 / Claus Gittinger"
6050
63d0cca05196 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6041
diff changeset
  4379
    "Modified (comment): / 08-05-2019 / 10:45:19 / Claus Gittinger"
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4380
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4381
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4382
processHideMenuEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4383
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4384
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4385
    "Modified: / 29-06-2011 / 16:39:36 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4386
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4387
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4388
processMenuEnterItemEvent:ev
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4389
    "to be filled..."
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4390
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4391
    "Created: / 29-06-2011 / 13:18:05 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4392
    "Modified: / 29-06-2011 / 16:39:29 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4393
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4394
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4395
processMenuSelectItemEvent:ev
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4396
    |winGrp masterGroup winGrpForBusyCursor item itemIndex itemValue menuReceiver|
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4397
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4398
    winGrp := self windowGroup.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4399
    winGrp notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4400
        masterGroup := winGrp previousGroup.
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4401
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4402
    winGrpForBusyCursor := masterGroup ? winGrp.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4403
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4404
    item := ev item.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4405
    itemIndex := ev itemIndex.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4406
    itemValue := ev itemValue.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4407
    menuReceiver := ev menuReceiver.
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4408
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4409
    (item showBusyCursorWhilePerforming
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4410
      and:[winGrpForBusyCursor notNil]
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4411
    ) ifTrue:[
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4412
        winGrpForBusyCursor withWaitCursorDo:[
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4413
            self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver 
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4414
        ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4415
    ] ifFalse:[
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4416
        self accept:item index:itemIndex toggle:itemValue receiver:menuReceiver 
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4417
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4418
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4419
    "Modified: / 29-06-2011 / 16:32:36 / cg"
6041
a8c62dc42ff2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6032
diff changeset
  4420
    "Modified: / 03-04-2019 / 08:38:34 / Claus Gittinger"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4421
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4422
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4423
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4424
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4425
canTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4426
    "depends whether I'am a toolbar and selectable items exists
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4427
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4428
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4429
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4430
    (super canTab and:[self isPopUpView not]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4431
        selectableItem := self firstItemSelectable.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4432
        ^ selectableItem notNil
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4433
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4434
    ^ false
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4435
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4436
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4437
focusComesByTab
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4438
    "returns true if focus comes by tab and should be drawn"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4439
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4440
    focusComesByTab == true ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4441
        (shown and:[self hasFocus]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4442
            ^ true
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4443
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4444
        focusComesByTab := false.
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4445
    ].
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4446
    ^ false
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4447
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4448
    "Modified: / 29-06-2011 / 16:23:09 / cg"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4449
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4450
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4451
focusComesByTab:aBoolean
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4452
    "only handled for toolBars"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4453
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4454
    |selectableItem|
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4455
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4456
    (self supportsFocusOnTab and:[self isPopUpView not]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4457
        focusComesByTab := aBoolean.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4458
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4459
        self hasSelection ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4460
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4461
        ].
5820
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4462
        false ifTrue:[
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4463
            aBoolean ifTrue:[
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4464
                selectableItem := self firstItemSelectable.
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4465
            ].
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4466
            self selection:selectableItem openMenu:false.
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4467
        ].
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4468
    ].
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4469
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  4470
    "Modified: / 29-06-2011 / 16:23:19 / cg"
5820
27c504a2f7bb #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5800
diff changeset
  4471
    "Modified: / 28-06-2018 / 16:23:11 / Claus Gittinger"
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4472
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4473
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4474
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4475
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4476
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4477
    self isPopUpView ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4478
        "/ not visible for popup menus
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4479
        ^ super hasKeyboardFocus:aBoolean
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4480
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4481
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4482
"/    (aBoolean not and:[hasImplicitGrap ~~ true]) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4483
"/        (windowGroup focusView ~~ self) ifTrue:[
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4484
"/            self selection:nil.
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4485
"/        ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  4486
"/    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4487
    super hasKeyboardFocus:aBoolean.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4488
!
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4489
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4490
showFocus:focusComesByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4491
    self focusComesByTab:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4492
    super showFocus:focusComesByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4493
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4494
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4495
showNoFocus:focusByTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4496
    self focusComesByTab:false.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4497
    super showNoFocus:focusByTab.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4498
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4499
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4500
supportsFocusOnTab
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4501
    "returns true if focus is supported
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4502
    "
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4503
    ^ (styleSheet at:#'focusHighlightStyle') == #win95
3158
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4504
!
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4505
fe0c2cb46fcb focus handling
ca
parents: 3148
diff changeset
  4506
wantsFocusWithButtonPress
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4507
    "needs only the focus if I'am a toolbar; all events are delegated
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4508
     to my subMenus"
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  4509
4342
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4510
    "/ I am not sure how this really should be -
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4511
    "/ I guess, it needs a more intelligent and dynamic decision.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4512
    "/ for now, the menuPanelTakesFocusOnClick returns true, otherwise,
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4513
    "/ we cannot control menus with the keyboard.
6c5506e02fbc class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4316
diff changeset
  4514
    self isPopUpView ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4515
        ^ false
5770
e6f4d3555293 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5768
diff changeset
  4516
    ].
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  4517
    
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  4518
    "/ FIXME - keyboard operation of menus (esp. popup menus) will not
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  4519
    "/ work, if we return false here
5770
e6f4d3555293 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5768
diff changeset
  4520
    ^ UserPreferences current menuPanelTakesFocusOnClick.
e6f4d3555293 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5768
diff changeset
  4521
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  4522
    "Modified (comment): / 28-05-2018 / 09:27:35 / Claus Gittinger"
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4523
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4524
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4525
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4526
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4527
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4528
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4529
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4530
    superMenu notNil ifTrue:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4531
        superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4532
    ] ifFalse:[
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4533
        hasImplicitGrap ~~ true ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4534
            self grabMouseAndKeyboard.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4535
            hasImplicitGrap := true
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  4536
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4537
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4538
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4539
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4540
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4541
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4542
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4543
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4544
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4545
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4546
        forceDo ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4547
            superMenu doUngrab:true
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4548
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4549
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4550
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4551
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4552
    hasImplicitGrap ~~ true ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4553
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4554
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4555
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4556
    forceDo ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4557
        (selection notNil or:[prevFocusView == self]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4558
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4559
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4560
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4561
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4562
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4563
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  4564
    prevFocusView   := nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4565
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4566
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4567
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4568
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4569
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4570
    previousKeyboardGrab := device activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  4571
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4572
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4573
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4574
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4575
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  4576
3754
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4577
    |winGroup sensor activeGrab|
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4578
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4579
    winGroup := self windowGroup.
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4580
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4581
    (realized and:[winGroup notNil]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4582
        prevFocusView isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4583
             prevFocusView := winGroup focusView.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4584
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4585
        sensor := self sensor.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4586
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4587
        device activePointerGrab ~~ self ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4588
            sensor flushMotionEventsFor:nil.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4589
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4590
            self grabPointer ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4591
                Delay waitForSeconds:0.1.
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4592
                self grabPointer ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4593
                    "give up"
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4594
                    Logger warning:'MenuPanel could not grab pointer'.
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4595
                    self unmap
6025
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4596
                ].
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4597
            ].
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4598
            device activePointerGrab ~~ self ifTrue:[
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4599
                Logger warning:'MenuPanel could not grab pointer'.
6025
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4600
            ].                
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4601
        ] ifFalse:[
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4602
            Logger warning:'MenuPanel already pointer owner'.
6025
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4603
        ].    
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4604
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4605
        (activeGrab := device activeKeyboardGrab) ~~ self ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4606
            device sync.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4607
            "/ 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
  4608
"/            activeGrab notNil ifTrue:[
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4609
"/                sensor flushKeyboardFor:activeGrab.
d59a0ea2fd7d code cleanup
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  4610
"/            ].
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4611
            sensor flushKeyboardFor:nil.
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4612
            self grabKeyboard ifFalse:[
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4613
                Logger warning:'MenuPanel could not grab keyboard'.
6025
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4614
            ].                
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4615
        ] ifFalse:[
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4616
            Logger warning:'MenuPanel already keyboard owner'.
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4617
        ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4618
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4619
6025
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4620
    "Modified: / 02-02-1998 / 23:43:59 / stefan"
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4621
    "Modified: / 15-03-1999 / 12:01:38 / cg"
2f06785c93ab #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 6021
diff changeset
  4622
    "Modified: / 05-03-2019 / 01:50:44 / Claus Gittinger"
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4623
    "Modified: / 07-03-2019 / 14:37:38 / Stefan Vogel"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4624
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4625
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4626
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4627
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4628
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4629
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4630
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4631
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4632
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4633
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4634
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4635
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4636
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4637
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4638
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4639
    (previousKeyboardGrab notNil
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4640
     and:[previousKeyboardGrab realized]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4641
        device grabKeyboardInView:previousKeyboardGrab.
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4642
    ].
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4643
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  4644
    "Modified (format): / 07-03-2019 / 14:33:14 / Stefan Vogel"
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4645
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4646
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4647
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4648
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4649
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4650
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4651
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4652
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4653
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4654
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4655
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4656
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4657
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4658
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4659
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  4660
    and:[ previousPointerGrab realized ]) ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4661
        device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  4662
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4663
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4664
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4665
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4666
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4667
helpSpec
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4668
    "allows subclasses to provide texts"
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4669
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4670
    pluggableHelpSpecProvider notNil ifTrue:[
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4671
        ^ pluggableHelpSpecProvider helpSpec.
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4672
    ].    
5190
516ad18734b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5168
diff changeset
  4673
    ^ Dictionary new.
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4674
!
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4675
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4676
helpSpecProvider:aSpecProvider
4910
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4677
    "pluggable helpspec provider"
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4678
963aca43a321 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4893
diff changeset
  4679
    pluggableHelpSpecProvider := aSpecProvider
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4680
!
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  4681
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4682
helpText
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4683
    "return the helpText for the currently selected item (empty if none)."
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4684
    "This is wrong - the helptext should ALWAYS refer to the item under the mouse pointer."
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4685
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4686
    ^ nil
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4687
    "/ ^ self helpTextForItem:selection
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4688
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  4689
    "Modified: / 07-06-2018 / 10:53:36 / Claus Gittinger"
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4690
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4691
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4692
helpTextAt:aPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  4693
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4694
     If there is a selection, that item's helpText is used (ignoring the given point).
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4695
     cg: this is wrong - should (and does) always show the helptext under the pointer"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4696
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4697
    |scrollerDirectionOrNil|
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4698
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4699
    "/ is a scroller-button present and hit ?
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4700
    scrollerDirectionOrNil := self scrollerDirectionAtPoint:aPoint.
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4701
    scrollerDirectionOrNil notNil ifTrue:[
5632
ffed52b62ff7 #UI_ENHANCEMENT by mawalch
mawalch
parents: 5631
diff changeset
  4702
        ^ resources string:'Scroll Menu Items'
3695
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4703
    ].
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4704
3d24467f66cc fixed flyByHelp for the scroll-buttons
Claus Gittinger <cg@exept.de>
parents: 3630
diff changeset
  4705
    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
  4706
    ^ nil
5631
b7db483cb0fb #DOCUMENTATION by mawalch
mawalch
parents: 5619
diff changeset
  4707
5632
ffed52b62ff7 #UI_ENHANCEMENT by mawalch
mawalch
parents: 5631
diff changeset
  4708
    "Modified: / 26-10-2017 / 21:46:16 / mawalch"
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4709
    "Modified (comment): / 11-06-2018 / 08:10:29 / Claus Gittinger"
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4710
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4711
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4712
helpTextForItem:anItem
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4713
    "returns the helpText for an item (nil if none)"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4714
2884
6e060df8f158 fix: MUST return nil, if there is no help text (not empty string !)
Claus Gittinger <cg@exept.de>
parents: 2883
diff changeset
  4715
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4716
    ^ anItem activeHelpText.
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4717
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4718
    "Modified (comment): / 11-06-2018 / 08:11:08 / Claus Gittinger"
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4719
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4720
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4721
helpTextForKey:aKey
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4722
    "first try my application to provide the text,
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4723
     then, in case I have a pluggable helpSpec, try that"
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4724
     
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4725
    |app text spec|
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4726
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4727
    app := self application.
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4728
    app notNil ifTrue:[
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4729
        text := app helpTextForKey:aKey.
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4730
        text notNil ifTrue:[^ text].
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4731
    ].
5797
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4732
    pluggableHelpSpecProvider notNil ifTrue:[
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4733
        spec := self helpSpec.
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4734
        spec notNil ifTrue:[
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4735
            ^ spec at:aKey ifAbsent:nil
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4736
        ]
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4737
    ].    
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4738
    ^ nil
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4739
a8f634337522 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5795
diff changeset
  4740
    "Modified: / 11-06-2018 / 08:14:16 / Claus Gittinger"
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4741
!
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4742
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4743
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
  4744
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4745
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  4746
    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
  4747
    dstMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4748
        dstPoint := dstMenu translateGrabPoint:srcPoint.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4749
        item := dstMenu itemAtPoint:dstPoint.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4750
        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
  4751
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4752
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  4753
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4754
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4755
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  4756
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4757
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4758
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4759
    ^ self class image:anImage value onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4760
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4761
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4762
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4763
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4764
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4765
    ^ self class lightenedImage:anImage onDevice:device
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4766
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4767
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  4768
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4769
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4770
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4771
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4772
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  4773
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4774
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4775
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4776
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4777
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4778
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4779
    self isPopUpView ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4780
        (PopUpView shadowsOnDevice:device) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4781
            shadowView isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4782
                shadowView := (ShadowView onDevice:device) for:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4783
            ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4784
                self saveUnder:true.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4785
            ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4786
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4787
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4788
        self hasExplicitExtent ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4789
            (self width) == (superView width) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4790
                self verticalLayout:false
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4791
            ]
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4792
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4793
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4794
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4795
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4796
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4797
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4798
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4799
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4800
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4801
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4802
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4803
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4804
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4805
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4806
    super destroy.
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  4807
    prevFocusView := superMenu := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4808
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4809
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4810
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4811
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4812
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4813
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4814
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4815
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4816
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4817
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4818
    superMenu notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4819
        styleSheet := superMenu styleSheet
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4820
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4821
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4822
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4823
5257
2ccd5c374e0b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5248
diff changeset
  4824
    "/ 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
  4825
    "/ (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
  4826
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4827
    superMenu isNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4828
        rightArrow isNil ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4829
            rightArrow := SelectionInListView rightArrowFormOn:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4830
        ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4831
        fgColor := fgColor onDevice:device.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4832
        style   := styleSheet name.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4833
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4834
        (style ~~ #os2 and:[style ~~ #win95 and:[style ~~ #winXP]]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4835
            rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4836
        ] ifFalse:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4837
            rightArrowShadow := nil
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4838
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4839
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4840
        rightArrow       := superMenu rightArrow.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4841
        rightArrowShadow := superMenu rightArrowShadow.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4842
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4843
        self foregroundColor:(superMenu foregroundColor).
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4844
        self             font:(superMenu font).
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4845
"/        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4846
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4847
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4848
    items notNil ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  4849
        items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4850
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  4851
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  4852
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4853
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4854
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4855
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4856
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4857
2919
0c83b23cb6c6 resource directive
Claus Gittinger <cg@exept.de>
parents: 2895
diff changeset
  4858
    <resource: #style (#'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4859
                       #'menu.buttonItemVerticalSpace'   #'menu.itemSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4860
                       #'menu.itemHorizontalSpace'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4861
                       #'menu.extraMargin'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4862
                       #'button.activeBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4863
                       #'button.buttonEnteredBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4864
                       #'button.buttonPassiveBackgroundColor'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4865
                       #'popup.hideOnRelease'
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4866
                       )>
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4867
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4868
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4869
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4870
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4871
    buttonInsetX := styleSheet at:#'menu.buttonItemHorizontalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4872
    buttonInsetX isNil ifTrue:[ buttonInsetX := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4873
    buttonInsetX := buttonInsetX abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4874
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4875
    buttonInsetY := styleSheet at:#'menu.buttonItemVerticalSpace'.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4876
    buttonInsetY isNil ifTrue:[ buttonInsetY := styleSheet at:#'menu.buttonItemSpace' default:0 ].
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4877
    buttonInsetY := buttonInsetY abs.
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4878
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4879
    itemSpace := styleSheet at:#'menu.itemHorizontalSpace'.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4880
    itemSpace isNil ifTrue:[ 
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4881
        itemSpace := styleSheet at:#'menu.itemSpace' default:[ gc font widthOf:' '] 
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4882
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4883
    extraMargin := styleSheet at:#'menu.extraMargin' default:0.
2883
58f2f296254d defaults
Claus Gittinger <cg@exept.de>
parents: 2877
diff changeset
  4884
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4885
    fgColor := DefaultForegroundColor.
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4886
    fgColor isNil ifTrue:[ fgColor := Color black ].
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4887
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  4888
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  4889
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  4890
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4891
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4892
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4893
    buttonActiveBackgroundColor := styleSheet colorAt:#'button.activeBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4894
    buttonEnteredBackgroundColor := styleSheet colorAt:#'button.buttonEnteredBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4895
    buttonPassiveBackgroundColor := styleSheet colorAt:#'button.buttonPassiveBackgroundColor'.
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4896
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4897
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4898
    buttonActiveLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4899
        buttonActiveLevel := styleSheet at:#'button.activeLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4900
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4901
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4902
    buttonPassiveLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4903
        buttonPassiveLevel := styleSheet at:#'button.passiveLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4904
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4905
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:nil.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4906
    buttonEnteredLevel isNil ifTrue:[
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4907
        buttonEnteredLevel := styleSheet at:#'button.enteredLevel' default:0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4908
    ].    
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4909
    
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4910
    self updateLevelAndBorder.
4061
7f2ab09c5702 changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4053
diff changeset
  4911
4098
98ff3ed9c62e fixed stupid change of stylesheet,
Claus Gittinger <cg@exept.de>
parents: 4092
diff changeset
  4912
    "Modified (format): / 19-01-2012 / 13:19:19 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4913
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  4914
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4915
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4916
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4917
4454
a22c7578f7ac class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4453
diff changeset
  4918
    mustRearrange       := false.
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  4919
    sizeFixed := true.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4920
    extraMargin := 0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  4921
    
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4922
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4923
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  4924
    self enableMotionEvents.  "/ for flyByHelp i.e. tooltips
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4925
    enabled := true.
3881
0db3473b4eca changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3878
diff changeset
  4926
    self originChangedFlag:false extentChangedFlag:false.
3334
50374a42b3d9 use accessors for hiddenOnrealize and explicitExtent
Claus Gittinger <cg@exept.de>
parents: 3332
diff changeset
  4927
    "/ explicitExtent      := nil.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4928
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4929
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4930
    showGroupDivider    := true.
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4931
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4932
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4933
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4934
map
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  4935
    "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
  4936
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4937
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4938
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4939
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4940
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  4941
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  4942
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4943
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4944
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  4945
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4946
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  4947
    loIndices := InitialSelectionQuerySignal query.
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4948
    loItems   := items ? #().
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4949
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4950
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4951
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4952
    self isPopUpView ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4953
        self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4954
    ] ifFalse:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4955
        self viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  4956
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4957
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4958
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4959
    loIndices notEmptyOrNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4960
        self redrawX:0 y:0 width:width height:height.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4961
        self openMenusFromItemIndices:loIndices.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4962
    ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4963
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4964
    "Modified: / 19-11-1998 / 12:59:00 / cg"
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  4965
    "Modified: / 15-03-2017 / 19:28:43 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4966
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4967
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4968
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4969
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4970
2761
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4971
    |bgColor|
611ecd331c14 more xp style
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
  4972
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4973
    self isPopUpView ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4974
        bgColor := styleSheet colorAt:'menu.backgroundColor'.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4975
        bgColor notNil ifTrue:[ self viewBackground:bgColor ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4976
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4977
        "Because of #saveUnder of ShadowView the order of realize is significant:
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4978
         shadowView must be realized before self"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4979
        self hiddenOnRealize:true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4980
        super realize.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4981
        self resize.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4982
        self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4983
"/        self mustRearrange.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4984
        shadowView notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4985
            shadowView realize.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4986
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4987
        self raise.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4988
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  4989
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  4990
        super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4991
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4992
    self allSubViewsDo:[:aView| aView realize ].
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  4993
    "/ hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4994
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4995
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4996
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  4997
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4998
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4999
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  5000
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5001
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5002
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5003
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5004
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5005
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5006
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5007
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5008
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5009
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5010
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5011
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5012
    self do:[:anItem |
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5013
        anItem reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5014
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5015
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5016
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  5017
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5018
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5019
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5020
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  5021
    "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
  5022
     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
  5023
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5024
    mapTime := nil.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5025
3975
ca
parents: 3966
diff changeset
  5026
    "hide all submenus opened within the menu"
ca
parents: 3966
diff changeset
  5027
    self itemsDo:[:eachItem|
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5028
        eachItem visibleSubmenu notNil ifTrue:[ eachItem hideSubmenu ].
3975
ca
parents: 3966
diff changeset
  5029
    ].
ca
parents: 3966
diff changeset
  5030
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  5031
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5032
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5033
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5034
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5035
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5036
"/    ].
3142
4f1c952048c5 focusView handling
ca
parents: 3133
diff changeset
  5037
    prevFocusView := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5038
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5039
    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
  5040
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5041
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5042
updateLevelAndBorder
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5043
    "update level & border"
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5044
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5045
    <resource: #style (#'popup.borderWidth'
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5046
                       #'popup.borderColor'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5047
                       #'popup.level'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5048
                       #'pullDownMenu.level'
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5049
                       )>
3820
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5050
8767ab1e2a24 borderColor from styleSheet
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
  5051
    |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
  5052
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5053
    self isPopUpView ifTrue:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5054
        bw  := styleSheet at:#'popup.borderWidth' default:1.
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5055
        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
  5056
    ] ifFalse:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5057
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5058
        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
  5059
    ].
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  5060
    bw ~~ 0 ifTrue:[
5168
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5061
        bc  := styleSheet at:#'popup.borderColor' default:self blackColor.
96310a1e5360 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 5147
diff changeset
  5062
        self borderColor:bc
3823
81781fb283b5 changed: #updateLevelAndBorder
Claus Gittinger <cg@exept.de>
parents: 3820
diff changeset
  5063
    ].
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5064
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  5065
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5066
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5067
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5068
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5069
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5070
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5071
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5072
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5073
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5074
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  5075
    |menu uKey lKey list index accessCharacterMatchQuery maxShortCutSearchLevel|
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5076
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5077
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5078
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5079
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5080
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5081
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5082
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  5083
    accessCharacterMatchQuery :=
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5084
        [:el|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5085
            |k|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5086
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5087
            k := el accessCharacter.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5088
            k == uKey or:[k == lKey]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5089
        ].
3363
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  5090
    maxShortCutSearchLevel := self class maxShortCutSearchLevel.
33e881abd5b2 accelerator search limited to 2-levels;
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  5091
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5092
    selection notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5093
        "first lookup the current grapMenu before starting in the topMenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5094
        "
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5095
        menu := self detectGrabMenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5096
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5097
        [ menu ~~ self ] whileTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5098
            index := menu selectionIndex.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5099
            list  := menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5100
                        selectItemIndicesFor:accessCharacterMatchQuery
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5101
                        maxDepth:maxShortCutSearchLevel from:(index + 1) to:99999
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5102
                        ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5103
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5104
            list size ~~ 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5105
                "/ has item which responds to the mnemonic
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5106
                menu processCollectedShortcutIndices:list.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5107
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5108
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5109
            menu := menu superMenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5110
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5111
        index := self selectionIndex.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5112
        list  := self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5113
                    selectItemIndicesFor:accessCharacterMatchQuery
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5114
                    maxDepth:maxShortCutSearchLevel from:(1 + index) to:99999
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5115
                    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
  5116
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5117
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5118
        index := 99999.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5119
        list  := nil.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5120
    ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5121
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5122
    list isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5123
        list := self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5124
                    selectItemIndicesFor:accessCharacterMatchQuery
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5125
                    maxDepth:maxShortCutSearchLevel from:1 to:index
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5126
                    ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5127
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5128
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5129
        list isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5130
            "/ must clear existing selection
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5131
            self selection:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5132
            ^ nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5133
        ]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5134
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5135
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5136
    "/ has item which responds to the mnemonic
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5137
    self processCollectedShortcutIndices:list.
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5138
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5139
    "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
  5140
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5141
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5142
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5143
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5144
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5145
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5146
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5147
    anItemIndiceList isEmptyOrNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5148
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5149
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5150
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5151
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5152
    (item notNil and:[item enabled]) ifTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5153
        InitialSelectionQuerySignal answer:anItemIndiceList do:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5154
            self selection:item openMenu:true.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5155
        ]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5156
    ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5157
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5158
    "Modified: / 15-03-2017 / 20:22:56 / stefan"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5159
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5160
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5161
processCollectedShortcutIndices:indices
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5162
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5163
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5164
    indices isEmptyOrNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5165
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5166
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5167
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5168
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  5169
    "/ first lookup in current open submenus
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5170
    [menu selectionIndex == indices first] whileTrue:[
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5171
        (    (item := menu selection) isNil
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5172
         or:[(menu := item currentSubmenu) isNil]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5173
        ) ifTrue:[ "/ selected but no submenu open - not handled
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5174
            ^ self
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5175
        ].
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5176
        indices removeFirst.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5177
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5178
        indices isEmpty ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5179
           menu selection:nil.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5180
            ^ self
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5181
        ]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5182
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5183
    menu openMenusFromItemIndices:indices.
4026
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  5184
ed8b8c2f6c98 comment/format in: #processCollectedIndices:
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
  5185
    "Modified: / 24-03-2011 / 11:19:38 / cg"
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5186
    "Created: / 06-10-2011 / 16:19:30 / cg"
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5187
    "Modified: / 15-03-2017 / 20:31:55 / stefan"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5188
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5189
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5190
processShortcut:aKeyEvent
2926
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  5191
    "a shortcutKey event as forwarded from the keyboardProcessor.
0d6dc899b49f ignoreShortcutKeys also blocks individual items
Claus Gittinger <cg@exept.de>
parents: 2919
diff changeset
  5192
     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
  5193
     Otherwise return false."
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5194
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5195
    |menu rawKey logicalKey list item selectableItem|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5196
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5197
    superMenu notNil ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5198
        ^ superMenu processShortcut:aKeyEvent
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5199
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5200
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5201
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5202
    logicalKey := aKeyEvent key.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5203
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5204
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5205
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  5206
    ( #( CursorDown CursorUp CursorRight CursorLeft Return Escape
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5207
       ) includes:logicalKey
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5208
    ) ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5209
        ^ false.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5210
    ].
4628
8b0ef25f1b21 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4627
diff changeset
  5211
3431
ee7ea52cc2ad code refactored
Claus Gittinger <cg@exept.de>
parents: 3421
diff changeset
  5212
    rawKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5213
    item := nil.
3328
037d6d506879 no access character translation for the combo-list
Claus Gittinger <cg@exept.de>
parents: 3321
diff changeset
  5214
    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
  5215
3394
90e7bc4402b5 Alt-key alone catches focus and selects first item
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  5216
    "/ 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
  5217
    aKeyEvent isKeyReleaseEvent ifTrue:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5218
        selection isNil ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5219
            prevFocusView := self windowGroup focusView.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5220
            self requestFocus. "/ self windowGroup focusView:self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5221
            selectableItem := self firstItemSelectable.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5222
            self selection:selectableItem openMenu:false.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5223
        ] ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5224
            prevFocusView requestFocus.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5225
            self selection:nil.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5226
        ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5227
        ^ true
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5228
    ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5229
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5230
    "sr: bugfix:
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5231
     the submenu can be cached,
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5232
     so if we don't care about resources here (which seams like a performance optimization),
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5233
     we have non translated sub menus (when using them later for viewing).
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5234
     Problem expecco Menu 'View' was somethimes untranslated and somethimes not.
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5235
     Dependent if this code was called before the user did open (instantiate) the menu via the application.
6032
6f88e34cb865 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6029
diff changeset
  5236
     May also the shortcuts itself could vary when translated 'Open &File' -> 'Datei &öffnen' ????"
5732
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5237
    Menu::NeedResourcesQuery answer:true do:[
e0a1d523567c #BUGFIX by sr
sr
parents: 5707
diff changeset
  5238
"/    Menu::NeedResourcesQuery answer:false do:[
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5239
        [true] whileTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5240
            list := menu
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5241
                        selectItemIndicesFor:[:el|
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5242
                            |skey|
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5243
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5244
                            item := el.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5245
                            el ignoreShortcutKeys ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5246
                                false
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5247
                            ] ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5248
                                skey := el shortcutKey.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5249
                                skey == rawKey or:[skey == logicalKey]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5250
                            ]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5251
                        ]
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5252
                        maxDepth:(self class maxShortCutSearchLevel) from:1 to:99999
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5253
                        ignoreSubmenuBlock:[:anItem | anItem ignoreShortcutKeys ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5254
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5255
            list size ~~ 0 ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5256
                "/ has item which responds to the shortcut
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5257
                item hasSubmenu ifFalse:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5258
                    menu accept:item
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5259
                ] ifTrue:[
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5260
                    menu processCollectedShortcutIndices:list.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5261
                    self requestFocus. "/ self windowGroup focusView:self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5262
                ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5263
                ^ true
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5264
            ].
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5265
5824
04608830f559 #REFACTORING by sr
sr
parents: 5823
diff changeset
  5266
            menu == self ifTrue:[ ^ false ].
5320
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5267
            menu := self.
63b2866bfd30 #TUNING by sr
sr
parents: 5276
diff changeset
  5268
        ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5269
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5270
    ^ false     "/ never reached
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5271
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  5272
    "Modified: / 06-10-2011 / 16:19:27 / cg"
5824
04608830f559 #REFACTORING by sr
sr
parents: 5823
diff changeset
  5273
    "Modified (comment): / 11-04-2018 / 17:52:03 / sr"
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5274
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5275
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5276
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
  5277
    "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
  5278
     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
  5279
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5280
     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
  5281
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5282
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5283
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5284
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5285
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5286
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5287
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5288
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5289
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  5290
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5291
    start to:stop do:[:i|
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5292
        |item menu result|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5293
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5294
        item := items at:i.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5295
        (item enabled and:[item isVisible]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5296
            (aOneArgBlock value:item) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5297
                ^ OrderedCollection with:i
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5298
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5299
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5300
            maxDepth > 1 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5301
                (item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5302
                    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5303
                        menu := item setupSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5304
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5305
                        (menu notNil and:[menu isEnabled]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5306
                            result := menu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5307
                                        selectItemIndicesFor:aOneArgBlock
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5308
                                        maxDepth:(maxDepth - 1) from:1 to:99999
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5309
                                        ignoreSubmenuBlock:ignoreSubmenueBlock.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5310
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5311
                            result notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5312
                                result addFirst:i.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5313
                                ^ result
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5314
                            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5315
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5316
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5317
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5318
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5319
        ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5320
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5321
    ^ nil
3128
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5322
9b92638bbd58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3127
diff changeset
  5323
    "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
  5324
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  5325
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5326
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5327
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5328
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5329
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5330
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5331
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5332
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  5333
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5334
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5335
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5336
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5337
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5338
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5339
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5340
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5341
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5342
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5343
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5344
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5345
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5346
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5347
    [(smenu := menu superMenu) notNil] whileTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5348
        menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5349
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  5350
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5351
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5352
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  5353
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5354
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5355
printOn:aStream
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5356
    |label|
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5357
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5358
    aStream nextPutAll:'Menu:'.
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5359
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5360
    self do:[:eachItem|
5193
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5361
        label := eachItem label.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5362
        label notEmptyOrNil ifTrue:[
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5363
            aStream nextPutAll:'  '.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5364
            label printOn:aStream.
a3a380b5f148 #OTHER by mawalch
mawalch
parents: 5191
diff changeset
  5365
        ].
3360
f329bc4a2254 Define #printOn: for each method defining #printString
Stefan Vogel <sv@exept.de>
parents: 3334
diff changeset
  5366
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5367
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5368
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5369
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5370
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5371
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5372
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5373
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5374
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5375
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5376
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5377
        application := superMenu application.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5378
        ^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5379
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  5380
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5381
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  5382
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  5383
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5384
detectItem:aBlock
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5385
    "returns the item for which aBlock returns true."
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5386
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5387
    items notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5388
        items keysAndValuesDo:[:anIndex :anItem|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5389
            (aBlock value:anItem) ifTrue:[^ anItem].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5390
        ].
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5391
    ].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5392
    ^ nil
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5393
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5394
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5395
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5396
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5397
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5398
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5399
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5400
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5401
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5402
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5403
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5404
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5405
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5406
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  5407
    items keysAndValuesDo:[:anIndex :anItem|
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5408
        |char label|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5409
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5410
        (     anIndex ~~ cIdx
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5411
         and:[anItem canSelect
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5412
         and:[(label := anItem textLabel) notNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5413
         and:[label size ~~ 0]]]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5414
        ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5415
            (char := anItem accessCharacter) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5416
                (char == uKey or:[char == lKey]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5417
                    ^ anItem
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5418
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5419
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5420
                char := label at:1.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5421
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5422
                (char == uKey or:[char == lKey]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5423
                    anIndex > cIdx ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5424
                        ^ anItem
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5425
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5426
                    item isNil ifTrue:[item := anItem]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5427
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5428
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5429
        ]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5430
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5431
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5432
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  5433
3725
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5434
detectItemForLabel:aLabel
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5435
    ^ self detectItem:[:anItem | anItem label = aLabel].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5436
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5437
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5438
detectItemForNameKey:aKey
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5439
    ^ self detectItem:[:anItem | anItem nameKey == aKey].
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5440
!
d26ee7a0a8ac oops AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 3695
diff changeset
  5441
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5442
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5443
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5444
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5445
    aList isCollection ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5446
        items size >= aList size ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5447
            aList keysAndValuesDo:[:anIndex :anArg|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5448
                (items at:anIndex) perform:aSelector with:anArg
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5449
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5450
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5451
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5452
        self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5453
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5454
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5455
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5456
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5457
    anImage isNil ifTrue:[ ^ nil ].
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  5458
    ^ self class image:anImage onDevice:device
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5459
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5460
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5461
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5462
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5463
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5464
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5465
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5466
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5467
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5468
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  5469
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5470
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5471
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5472
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5473
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5474
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5475
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5476
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5477
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5478
        styleSheet       := superMenu styleSheet.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5479
        rightArrow       := superMenu rightArrow.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5480
        rightArrowShadow := superMenu rightArrowShadow.
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  5481
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5482
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5483
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5484
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5485
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5486
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5487
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5488
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5489
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5490
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5491
    "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
  5492
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5493
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5494
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5495
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5496
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5497
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5498
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5499
    "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
  5500
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5501
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5502
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5503
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5504
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5505
    mapTime isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5506
        "/ set the mapTime if not yet done
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5507
        mapTime := Timestamp now.
3224
96aba140912d bugfix for mapTime
ca
parents: 3222
diff changeset
  5508
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5509
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5510
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5511
    "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
  5512
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5513
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5514
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5515
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5516
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5517
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5518
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5519
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5520
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5521
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5522
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5523
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5524
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  5525
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5526
    top activeMenu == self ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5527
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5528
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5529
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5530
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5531
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5532
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5533
mapTime
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5534
    "get the time the menu was activated or nil"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5535
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5536
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5537
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5538
    "Modified: / 27.2.1998 / 17:41:18 / cg"
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5539
!
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5540
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5541
mapTime:aTimestamp
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5542
    "set the time the menu was activated"
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5543
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5544
    mapTime := aTimestamp.
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5545
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  5546
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5547
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  5548
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5549
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5550
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5551
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5552
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5553
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5554
    self hasScrollers ifTrue:[ |layout item|
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5555
        aDirection == #PREV ifTrue:[
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5556
            item   := items detect:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5557
            layout := item layout.
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5558
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5559
          ^ self verticalLayout ifTrue:[ layout top  < margin]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5560
                               ifFalse:[ layout left < margin]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5561
        ].
5328
4285558b7c86 #BUGFIX by Maren
matilk
parents: 5320
diff changeset
  5562
        aDirection == #NEXT ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5563
            "/ must check for visibility
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5564
            item   := items detectLast:[:each|(each layout notNil and:[each isVisible])] ifNone:[^ false ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5565
            layout := item layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5566
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5567
          ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5568
                               ifFalse:[ layout right  > (width  - margin)]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5569
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5570
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5571
    ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5572
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5573
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5574
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5575
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5576
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5577
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5578
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5579
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5580
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5581
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5582
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5583
    superView notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5584
        ((first := items first layout) isNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5585
         or:[(last  := items last layout) isNil]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5586
        ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5587
            ^ false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5588
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5589
        isVert ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5590
            ^ first top < 0 or:[last bottom > height]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5591
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5592
        ^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5593
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5594
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5595
    isVert ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5596
        ^ (height >= maxExtent y)
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5597
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  5598
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5599
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5600
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5601
indexOfFirstItemShown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5602
    "answer the index of the first item shown (scrolling) or 0"
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5603
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5604
    items isEmptyOrNil ifTrue:[^ 0].
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5605
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5606
    self verticalLayout ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5607
        ^ items findFirst:[:each|(each layout notNil and:[each layout top >= 0 and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5608
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5609
    ^ items findFirst:[:each|(each layout notNil and:[each layout left >= 0 and:[each isVisible]])].
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5610
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5611
    "Modified: / 15-03-2017 / 20:17:17 / stefan"
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5612
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5613
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5614
indexOfItemAtScroller:aDirection
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5615
     <resource: #obsolete>
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5616
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5617
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5618
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5619
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5620
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5621
    self hasScrollers ifFalse:[ ^ 0 ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5622
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5623
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5624
    self verticalLayout ifTrue:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5625
        min := bounds top.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5626
        max := bounds bottom.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5627
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5628
        items keysAndValuesDo:[:anIndex :anItem|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5629
            anItem isVisible ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5630
                layout := anItem layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5631
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5632
                (layout top < max and:[layout bottom > min]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5633
                    ^ anIndex
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5634
                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5635
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5636
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5637
    ] ifFalse:[
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5638
        min := bounds left.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5639
        max := bounds right.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5640
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5641
        items keysAndValuesDo:[:anIndex :anItem|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5642
            anItem isVisible ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5643
                layout := anItem layout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5644
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5645
                (layout left < max and:[layout right > min]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5646
                    ^ anIndex
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5647
                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5648
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5649
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5650
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5651
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5652
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5653
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5654
indexOfLastItemShown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5655
    "answer the index of the last item shown (scrolling) or 0"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5656
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5657
    items isEmptyOrNil ifTrue:[^ 0].
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5658
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5659
    self verticalLayout ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5660
        ^ items findLast:[:each|(each layout notNil and:[each layout bottom <= height and:[each isVisible]])].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5661
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5662
    ^ items findLast:[:each|(each layout notNil and:[each layout right <= width and:[each isVisible]])].
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5663
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  5664
    "Modified: / 15-03-2017 / 20:18:13 / stefan"
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5665
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5666
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5667
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5668
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5669
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5670
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5671
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5672
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5673
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5674
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5675
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5676
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5677
    ) ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5678
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5679
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5680
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5681
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5682
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5683
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5684
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5685
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5686
    isVertical ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5687
        boundsMin := boundsPREV bottom.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5688
        boundsMax := boundsNEXT top.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5689
        layoutMin := layout top.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5690
        layoutMax := layout bottom.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5691
        windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5692
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5693
        boundsMin := boundsPREV right.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5694
        boundsMax := boundsNEXT left.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5695
        layoutMin := layout left.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5696
        layoutMax := layout right.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5697
        windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5698
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5699
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5700
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5701
    layoutMin < boundsMin ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5702
        layoutMin >= 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5703
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5704
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5705
        "/ test whether is first visible item
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5706
        index := items findLast:[:el| el isVisible] startingAt:(index - 1).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5708
        index == 0 ifTrue:[ scr0 := margin ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5709
                  ifFalse:[ scr0 := boundsMin ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5710
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5711
        delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5712
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5713
        layoutMax > boundsMax ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5714
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5715
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5716
        "/ test whether is last visible item
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5717
        index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5718
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5719
        index == 0 ifTrue:[ scr0 := windowSz - margin ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5720
                  ifFalse:[ scr0 := boundsMax ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5721
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5722
        delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5723
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5724
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5725
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5726
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5727
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5728
    shown ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5729
        delta abs < (windowSz / 2) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5730
            doScroll := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5731
            self repairDamage
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5732
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5733
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5734
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5735
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5736
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5737
    doScroll ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5738
        self invalidate.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5739
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5740
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5741
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5742
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5743
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5744
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5745
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5746
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5747
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  5748
    delta < 0 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5749
        isVertical ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5750
            self copyFrom:self x:margin y:scr1 toX:margin y:scr0
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5751
                           width:windowSz height:scrSz async:false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5752
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5753
            scr1 := scr0 + scrSz.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5754
            inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5755
            "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5756
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5757
            self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5758
                           width:scrSz height:windowSz async:false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5759
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5760
            scr1 := scr0 + scrSz.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5761
            inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5762
            "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5763
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5764
        inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5765
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5766
        isVertical ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5767
            self copyFrom:self x:margin y:scr0 toX:margin y:scr1
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5768
                           width:windowSz height:scrSz async:false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5769
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5770
            inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5771
            "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5772
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5773
            self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5774
                           width:scrSz height:windowSz async:false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5775
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5776
            inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5777
            "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5778
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5779
        inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5780
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5781
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  5782
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5783
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  5784
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5785
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5786
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5787
pageDown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5788
    "scroll one page down"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5789
    |index delta foundItem isVertical|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5790
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5791
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5792
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5793
    index := self indexOfLastItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5794
    index == 0 ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5795
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5796
    isVertical := self verticalLayout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5797
    delta := isVertical ifTrue:[self height] ifFalse:[self width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5798
    delta := delta - 15. "/ bounds
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5799
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5800
    [delta > 0] whileTrue:[ |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5801
        item := items at:index ifAbsent:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5802
        item isNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5803
            delta := 0
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5804
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5805
            (item layout notNil and:[item isVisible]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5806
                isVertical ifTrue:[delta := delta - item layout height]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5807
                          ifFalse:[delta := delta - item layout width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5808
                foundItem := item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5809
            ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5810
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5811
        index := index + 1.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5812
     ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5813
     self makeItemVisible:foundItem.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5814
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5815
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5816
pageUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5817
    "scroll one page up"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5818
    |index delta foundItem isVertical|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5819
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5820
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5821
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5822
    index := self indexOfFirstItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5823
    index == 0 ifTrue:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5824
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5825
    isVertical := self verticalLayout.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5826
    delta := isVertical ifTrue:[self height] ifFalse:[self width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5827
    delta := delta - 15. "/ bounds
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5828
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5829
    [delta > 0] whileTrue:[ |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5830
        item := items at:index ifAbsent:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5831
        item isNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5832
            delta := 0
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5833
        ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5834
            (item layout notNil and:[item isVisible]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5835
                isVertical ifTrue:[delta := delta - item layout height]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5836
                          ifFalse:[delta := delta - item layout width].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5837
                foundItem := item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5838
            ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5839
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5840
        index := index - 1.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5841
     ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5842
     self makeItemVisible:foundItem.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5843
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5844
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5845
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5846
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5847
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5848
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5849
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5850
        ^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5851
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5852
    scrollActivity isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5853
        scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5854
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5855
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5856
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5857
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5858
scrollDown
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5859
    "scroll one line down"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5860
    |item index|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5861
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5862
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5863
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5864
    index := self indexOfLastItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5865
    index > 0 ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5866
        item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5867
            detect:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5868
            startingAt:(index + 1)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5869
            ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5870
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5871
    item notNil ifTrue:[self makeItemVisible:item]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5872
               ifFalse:[self scrollToBottom].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5873
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5874
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5875
scrollToBottom
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5876
    "scroll to last visible item"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5877
    |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5878
    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5879
    (self hasScrollerAt:#NEXT) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5880
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5881
    item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5882
        detectLast:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5883
        ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5884
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5885
    self makeItemVisible:item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5886
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5887
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5888
scrollToTop
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5889
    "scroll to first visible item"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5890
    |item|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5891
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5892
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5893
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5894
    item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5895
        detect:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5896
        ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5897
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5898
    self makeItemVisible:item.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5899
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5900
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5901
scrollUp
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5902
    "scroll one line up"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5903
    |item index|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5904
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5905
    (self hasScrollerAt:#PREV) ifFalse:[^ self].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5906
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5907
    index := self indexOfFirstItemShown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5908
    index > 1 ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5909
        item := items
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5910
            detectLast:[:each| (each layout notNil and:[each isVisible]) ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5911
            startingAt:(index - 1)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5912
            ifNone:nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5913
    ].    
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5914
    item notNil ifTrue:[self makeItemVisible:item]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5915
               ifFalse:[self scrollToTop].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5916
!
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  5917
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5918
scrollerBoundsAt:aDirection
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  5919
    "returns the bounds of the scroller at a direction"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5920
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5921
    |y x w h|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5922
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5923
    x := 0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5924
    y := 0.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5925
    w := 15.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5926
    h := 15.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5927
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5928
    self verticalLayout ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5929
        aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5930
            y := height - h.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5931
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5932
        w := width.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5933
    ] ifFalse:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5934
        aDirection == #NEXT ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5935
            x := width - w.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5936
        ].
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5937
        h := height.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5938
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5939
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5940
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5941
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5942
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5943
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5944
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5945
    self hasScrollers ifTrue:[
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5946
        #( PREV NEXT ) do:[:aDirection| 
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5947
            |bounds|
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5948
            
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5949
            (self hasScrollerAt:aDirection) ifTrue:[
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5950
                bounds := self scrollerBoundsAt:aDirection.
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5951
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5952
                (bounds containsPoint:aPoint) ifTrue:[^ aDirection]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5953
            ]
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  5954
        ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5955
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5956
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5957
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5958
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5959
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5960
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5961
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5962
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5963
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5964
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5965
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5966
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5967
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5968
    selection notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5969
        (subMenu := selection visibleSubmenu) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5970
            ^ subMenu detectGrabMenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5971
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5972
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5973
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5974
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5975
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5976
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5977
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5978
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5979
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5980
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5981
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5982
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5983
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5984
        firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5985
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5986
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5987
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  5988
        ^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5989
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5990
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  5991
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5992
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5993
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5994
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5995
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5996
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  5997
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5998
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  5999
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6000
    stringOrNumberOrPoint isPoint ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6001
        ^ self itemAtPoint:stringOrNumberOrPoint
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6002
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6003
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6004
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6005
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6006
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6007
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6008
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6009
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6010
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6011
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  6012
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6013
    items notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6014
        x := aPoint x.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6015
        y := aPoint y.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6016
        ^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6017
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6018
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6019
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6020
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  6021
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6022
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6023
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6024
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6025
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  6026
    (self containsPoint:aPoint) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6027
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6028
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6029
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  6030
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6031
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6032
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6033
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6034
        (superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6035
            ^ superMenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6036
        ]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6037
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6038
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6039
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  6040
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6041
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6042
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6043
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6044
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6045
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6046
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6047
    aView notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6048
        "/ I am no longer a popUpView
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6049
        self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6050
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6051
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  6052
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6053
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6054
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6055
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6056
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6057
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6058
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6059
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6060
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6061
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  6062
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6063
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6064
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6065
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6066
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6067
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6068
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6069
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6070
    groupSizes notNil ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6071
        i := 0.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6072
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6073
        groupSizes do:[:eachSize|
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6074
            i := i + eachSize.
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6075
            i == anIndex ifTrue:[
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6076
                ^ true
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6077
            ]
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6078
        ]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6079
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6080
    ^ false
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6081
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6082
    "Modified: / 15-03-2017 / 19:57:29 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6083
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6084
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6085
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6086
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6087
5516
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6088
    ^ (items notEmptyOrNil and:[groupSizes notEmptyOrNil])
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6089
565035d19b67 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5515
diff changeset
  6090
    "Modified: / 15-03-2017 / 19:58:09 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6091
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6092
4042
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6093
hasPerformed
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6094
    ^ hasPerformed ? false
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6095
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6096
    "Created: / 29-06-2011 / 16:24:14 / cg"
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6097
!
c67a4227f0e3 eliminated the ugly adornment
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
  6098
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6099
isFitPanel
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6100
    "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
  6101
     and must be fit to the extent of its superView;
ba9b2e98323d class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4383
diff changeset
  6102
     Obsolete: NO LONGER SUPPORTED"
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6103
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6104
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6105
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6106
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6107
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6108
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6109
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6110
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6111
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6112
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6113
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6114
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6115
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6116
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6117
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  6118
!
c05874084d4c implement
ca
parents: 407
diff changeset
  6119
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  6120
isViewWrapper
5519
7bbbab6dfb5b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5516
diff changeset
  6121
    ^ items isEmptyOrNil and:[subViews notEmptyOrNil]
7bbbab6dfb5b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5516
diff changeset
  6122
7bbbab6dfb5b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5516
diff changeset
  6123
    "Modified: / 16-03-2017 / 10:23:23 / stefan"
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  6124
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  6125
416
c05874084d4c implement
ca
parents: 407
diff changeset
  6126
type
428
ca
parents: 427
diff changeset
  6127
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  6128
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6129
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6130
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6131
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6132
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6133
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6134
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6135
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6136
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6137
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6138
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6139
openDelayed:anItem
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6140
    self openDelayed:anItem afterSeconds:0.5.
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6141
!
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6142
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6143
openDelayed:anItemOrNil afterSeconds:seconds
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6144
    |b|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6145
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6146
    superMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6147
        superMenu openDelayed:anItemOrNil afterSeconds:seconds.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6148
        ^ self
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6149
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6150
    (b := openDelayedMenuBlock notNil) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6151
        openDelayedMenuBlock := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6152
        Processor removeTimedBlock:b.
4185
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6153
    ].
e6cf65890e79 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4183
diff changeset
  6154
    (anItemOrNil notNil and:[anItemOrNil hasSubmenu]) ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6155
        openDelayedMenuBlock := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6156
        ^ self
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6157
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6158
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6159
    openDelayedMenuBlock :=
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6160
        [
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6161
            openDelayedMenuBlock := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6162
            anItemOrNil openDelayedSubmenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6163
        ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  6164
3187
f97f27a9d496 focus handling
ca
parents: 3158
diff changeset
  6165
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:seconds.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6166
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6167
    "Modified: / 29-08-2013 / 09:40:28 / cg"
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6168
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6169
3975
ca
parents: 3966
diff changeset
  6170
selectAndOpenDelayed:anItemOrNil
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6171
    <resource: #obsolete>
3975
ca
parents: 3966
diff changeset
  6172
    "change selection to an item or nil"
ca
parents: 3966
diff changeset
  6173
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6174
    self selectAndOpenDelayed:anItemOrNil after:self delayInSecondsBeforeOpeningSubmenu
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6175
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6176
    "Modified: / 29-08-2013 / 09:44:06 / cg"
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6177
    "Modified: / 28-05-2018 / 09:18:24 / Claus Gittinger"
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6178
!
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6179
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6180
selectAndOpenDelayed:anItemOrNil after:delayTimeInSeconds
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6181
    "change selection to an item or nil;
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6182
     If the item has a submenu, open it after some delay time.
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6183
     The delay time is needed, in case you try to move into the
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6184
     just opened submenu, and come across another item (if the supermenu)
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6185
     while doing so (i.e. moving to down-east from the selected item)"
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6186
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6187
    |helpListener oldSelect delayedOpenSeconds b|
3975
ca
parents: 3966
diff changeset
  6188
ca
parents: 3966
diff changeset
  6189
    anItemOrNil == selection ifTrue:[ ^ self ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  6190
    "/ self openDelayed:nil.
3975
ca
parents: 3966
diff changeset
  6191
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6192
    (b := closeDelayedMenuBlock notNil) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6193
        closeDelayedMenuBlock := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6194
        Processor removeTimedBlock:b.
4455
29a32d3d5a84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4454
diff changeset
  6195
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6196
    (b := openDelayedMenuBlock notNil) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6197
        openDelayedMenuBlock := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6198
        Processor removeTimedBlock:b.
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6199
    ].
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6200
6003
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  6201
    (delayedOpenSeconds := delayTimeInSeconds) isNil ifTrue:[
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  6202
        delayedOpenSeconds := self delayInSecondsBeforeOpeningSubmenu.
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  6203
    ].
4617
0922a5f9c84a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4605
diff changeset
  6204
    "/ self verticalLayout ifFalse:[ delayedOpenSeconds := 0.1 ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6205
3975
ca
parents: 3966
diff changeset
  6206
    oldSelect := selection.
ca
parents: 3966
diff changeset
  6207
    selection := nil.
ca
parents: 3966
diff changeset
  6208
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  6209
    "/ redraw current selection cleared
3975
ca
parents: 3966
diff changeset
  6210
    oldSelect notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6211
        |oldSubmenu|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6212
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6213
        oldSubmenu := oldSelect visibleSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6214
        oldSubmenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6215
            "/ if the new item has a submenu, any current submenu will be closed, when that
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6216
            "/ one eventuall opens. However, if it is a simple item,
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6217
            "/ it would remain open. So schedule a delayed close action for it.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6218
            closeDelayedMenuBlock :=
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6219
                [
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6220
                    "/ but only if we have not reentered the item with the submenu we want to close
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6221
                    selection ~~ oldSelect ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6222
                        (oldSelect hasSubmenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6223
                        and:[ oldSelect visibleSubmenu notNil ]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6224
                            oldSelect hideSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6225
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6226
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6227
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6228
            Processor addTimedBlock:closeDelayedMenuBlock afterSeconds:delayedOpenSeconds.
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6229
            "/ mhmh - seems to be not only unneeded, but actually hurting (leftover menus)
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6230
            "/            Processor addTimedBlock:[
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6231
            "/                selection ~~ anItemOrNil ifTrue:[
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6232
            "/                    "cancels the current delayed operation"
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6233
            "/                    oldSelect hideSubmenu.
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6234
            "/
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6235
            "/                    ( selection notNil
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6236
            "/                    and:[selection hasSubmenu
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6237
            "/                    and:[selection visibleSubmenu isNil]]
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6238
            "/                    ) ifTrue:[
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6239
            "/                        "setup new delayed operation.."
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6240
            "/                        self openDelayed:selection afterSeconds:delayedOpenSeconds "0.1"
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6241
            "/                    ].
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6242
            "/                ].
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6243
            "/            ] afterSeconds:delayedOpenSeconds.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6244
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6245
        oldSelect invalidate.
3975
ca
parents: 3966
diff changeset
  6246
    ].
ca
parents: 3966
diff changeset
  6247
ca
parents: 3966
diff changeset
  6248
    anItemOrNil notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6249
        self makeItemVisible:anItemOrNil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6250
        anItemOrNil canSelect ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6251
            selection := anItemOrNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6252
        ].
3975
ca
parents: 3966
diff changeset
  6253
    ].
ca
parents: 3966
diff changeset
  6254
    selection isNil ifTrue:[^ self].
ca
parents: 3966
diff changeset
  6255
ca
parents: 3966
diff changeset
  6256
    ActiveHelp isActive ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6257
        helpListener := ActiveHelp currentHelpListener.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6258
        helpListener initiateHelpFor:self at:nil now:true.
3975
ca
parents: 3966
diff changeset
  6259
    ].
4193
b9bd0aa9631a class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4191
diff changeset
  6260
3975
ca
parents: 3966
diff changeset
  6261
    shown ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6262
        "/ self rearrangeItems.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6263
        selection invalidate.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6264
        selection hasSubmenu ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6265
            "/ cg: disabled: prevents delayed menu when moving over a separator item
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6266
            false "(oldSelect isNil or:[oldSelect visibleSubmenu isNil])" ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6267
                self openDelayed:selection afterSeconds:0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6268
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6269
                self openDelayed:selection afterSeconds:delayedOpenSeconds.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6270
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6271
        ].
3975
ca
parents: 3966
diff changeset
  6272
    ].
4347
2b11c2f96dc4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4343
diff changeset
  6273
5775
dd78620e6205 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5770
diff changeset
  6274
    "Created: / 28-05-2018 / 09:17:12 / Claus Gittinger"
6003
d2d8b837acdd #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
  6275
    "Modified: / 15-02-2019 / 08:59:09 / Claus Gittinger"
3975
ca
parents: 3966
diff changeset
  6276
!
ca
parents: 3966
diff changeset
  6277
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6278
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6279
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6280
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6281
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6282
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6284
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6285
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6286
     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
  6287
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6288
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6289
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6290
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6291
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6292
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6293
        self selection:anItemOrNil openMenu:false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6294
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6295
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6296
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6297
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6298
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6299
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6300
    openMenu ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6301
        openMenu := openOnSelect.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6302
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6303
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6304
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6305
    openOnSelect ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6306
        "/ select first item in submenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6307
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6308
        submenu := anItemOrNil currentSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6309
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6310
        submenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6311
            item := submenu itemAt:1.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6312
            (item notNil and:[item hasSubmenu not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6313
                submenu selection:item openMenu:false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6314
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6315
        ].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6316
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6317
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6318
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6319
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6320
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6321
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6322
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6323
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6324
    anItemOrNil == selection ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6325
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6326
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6327
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6328
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6329
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6330
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6331
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6332
    anItemOrNil notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6333
        self makeItemVisible:anItemOrNil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6334
        anItemOrNil canSelect ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6335
            selection := anItemOrNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6336
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6337
            oldSelect isNil ifTrue:[^ self].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6338
        ].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6339
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  6340
    oldSelect notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6341
        "/ clear current selection
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6342
        oldSelect isSelected:false.
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6343
    ].
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6344
    selection isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6345
        ^ self
4631
f0c1c7b621eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4629
diff changeset
  6346
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  6347
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6348
"/    selection == enteredItem ifTrue:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6349
"/        enteredItem := nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6350
"/    ] ifFalse:[
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6351
"/        self pointerEntersItem:nil
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  6352
"/    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  6353
    ActiveHelp isActive ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6354
        helpListener := ActiveHelp currentHelpListener.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6355
        helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6356
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6357
    shown ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6358
        "/ self rearrangeItems.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6359
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6360
        openMenu ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6361
            selection invalidate.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6362
        ]
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6363
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6364
    openMenu ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6365
        selection isSelected:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  6366
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6367
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6368
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6369
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6370
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6371
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6372
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6373
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6374
    (item := self selection) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6375
        ^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6376
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6377
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6378
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6379
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6380
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6381
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6382
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6383
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6384
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6385
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6386
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6387
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6388
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6389
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6390
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6391
    superMenu isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6392
        "I am the grabView"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6393
        aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6394
        ^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6395
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6396
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6397
    relativeGrabOrigin isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6398
        relativeGrabOrigin := self topMenu translatePoint:0 to:self.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6399
        relativeGrabOrigin isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6400
            "I am the grabView"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6401
            aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6402
            ^ aGrabPoint
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6403
        ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6404
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6405
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6406
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6407
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6408
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6409
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6410
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6411
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6412
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6413
    aMenu == self ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6414
        ^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6415
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6416
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6417
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6418
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6419
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6420
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6421
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  6422
    "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
  6423
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6424
    ^ device
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6425
        translatePoint:aPoint asPoint
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6426
        fromView:self
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  6427
        toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6428
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  6429
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6430
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  6431
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6432
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6433
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6434
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6435
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6436
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6437
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6438
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6439
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6440
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6441
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6442
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  6443
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6444
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6445
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6446
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6447
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6448
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6449
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6450
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6451
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6452
halfSeparatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6453
    "returns the size of a space-separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6454
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6455
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6456
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  6457
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6458
separatorSize
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6459
    "returns the size of a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6460
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6461
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6462
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6463
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6464
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6465
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6466
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6467
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6468
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  6469
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6470
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6471
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6472
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6473
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6474
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6475
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  6476
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  6477
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6478
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6479
     self updateStyleCache
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2772
diff changeset
  6480
    "
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  6481
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6482
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6483
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6484
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6485
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6486
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6487
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6488
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6489
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6490
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6491
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6492
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6493
    item label:aLabel.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6494
    ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6495
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6496
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6497
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6498
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6499
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6500
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6501
    item menuItem:aMenuItem.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6502
    ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6503
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6504
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6505
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6506
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6507
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6508
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  6509
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6510
420
ca
parents: 417
diff changeset
  6511
canAccept
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6512
    "returns true if item is acceptable"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6513
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6514
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6515
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6516
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  6517
    self hasDelayedMenu ifFalse:[^ false ].
3558
979876192524 variable renamed
Claus Gittinger <cg@exept.de>
parents: 3486
diff changeset
  6518
    ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6519
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6520
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6521
toggleIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6522
    "toggle indication or choice"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6523
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6524
    indication notNil ifTrue:[
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6525
        |arg|
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6526
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6527
        arg := self indicationValue not.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6528
        self indicationValue:arg.
5768
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6529
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6530
        ^ arg    
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6531
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6532
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6533
    (choice notNil and:[choice isValueModel]) ifTrue:[
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6534
        choice value:menuItem choiceValue.
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6535
        ^ true
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6536
    ].
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6537
55f5f683cf0a #BUGFIX by sr
sr
parents: 5732
diff changeset
  6538
    ^ nil
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6539
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6540
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6541
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6542
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6543
accessCharacter
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6544
    "returns my accessCharacter or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6545
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6546
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6547
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6548
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6549
accessCharacterPosition
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6550
    "get the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6551
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6552
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6553
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6554
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6555
accessCharacterPosition:anIndex
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6556
    "set the access character position or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6557
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6558
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6559
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6560
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6561
argument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6562
    "gets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6563
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6564
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6565
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6566
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6567
argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6568
    "sets the argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6569
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6570
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6571
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6572
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6573
displayLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6574
    "returns my printable Label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6575
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6576
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6577
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6578
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6579
displayLabelExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6580
    "returns the labels extent"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6581
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6582
    |myFont prevFont w h|
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6583
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6584
    displayLabelExtent notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6585
        ^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6586
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6587
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6588
    displayLabel isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6589
        displayLabelExtent := 0@0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6590
        ^ displayLabelExtent
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6591
    ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6592
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6593
    myFont := self font.
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6594
    myFont isNil ifTrue:[ self font:(myFont := menuPanel font) ].
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6595
    myFont := myFont onDevice:menuPanel device.
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6596
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6597
    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
  6598
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6599
    displayLabel isString ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6600
        w := displayLabel widthOn:menuPanel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6601
        h := displayLabel heightOn:menuPanel.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6602
"/        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
  6603
"/        h := myFont heightOf:displayLabel.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6604
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6605
        displayLabel isArray ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6606
            w := h := 0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6607
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6608
            displayLabel do:[:aSubLabel|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6609
                aSubLabel notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6610
                    w := w max:(aSubLabel widthOn:menuPanel).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6611
                    h := h + 1 + (aSubLabel heightOn:menuPanel).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6612
                ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6613
                    h := h + (self spaceBetweenEmptyLines)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6614
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6615
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6616
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6617
            w := displayLabel widthOn:menuPanel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6618
            h := displayLabel heightOn:menuPanel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6619
        ].
3845
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6620
    ].
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6621
81fa525dcfa7 fixed wrong item-width computation for text (with bold or italic fonts)
Claus Gittinger <cg@exept.de>
parents: 3837
diff changeset
  6622
    menuPanel setFont:prevFont.     "/ restore previous font
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6623
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6624
    "/ care for italic fonts - give a few more pixels at the end
3837
22b2190b32ea changed:
Claus Gittinger <cg@exept.de>
parents: 3835
diff changeset
  6625
    myFont italic ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6626
        w := w + 2.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6627
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6628
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6629
    ^ displayLabelExtent
3928
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6630
d175aca884ce fixed a font bug: used current font for extent computation,
Claus Gittinger <cg@exept.de>
parents: 3921
diff changeset
  6631
    "Modified: / 17-08-2010 / 10:46:06 / cg"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6632
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6633
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6634
font
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6635
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6636
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6637
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6638
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6639
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6640
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6641
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6642
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6643
    font notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6644
        font := font onDevice:(menuPanel device).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6645
        menuItem font:font.
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6646
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6647
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6648
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6649
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6650
font:aFont
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6651
    "returns the user configured font or nil (default menu font)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6652
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6653
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6654
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6655
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6656
ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6657
    "if true, mnemonic (access character) in the submenus under the item are ignored.
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6658
     Set this to speedup accelerator key processing for slow dynamci menus"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6659
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6660
    ^ menuItem ignoreMnemonicKeys
4076
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6661
Claus Gittinger <cg@exept.de>
parents: 4064
diff changeset
  6662
    "Modified (comment): / 08-09-2011 / 04:29:47 / cg"
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6663
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6664
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6665
ignoreMnemonicKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6666
    "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
  6667
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6668
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6669
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6670
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6671
ignoreShortcutKeys
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6672
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6673
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6674
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6675
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6676
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6677
ignoreShortcutKeys:aBoolean
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6678
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6679
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6680
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6681
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  6682
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6683
itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6684
    "gets the item's value"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6685
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6686
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6687
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6688
    "Modified (comment): / 06-03-2012 / 14:41:27 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6689
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6690
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6691
itemValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6692
    "argument could be a value holder, an action or selector"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6693
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6694
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6695
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  6696
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6697
label
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6698
    "returns the label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6699
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6700
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6701
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6702
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6703
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6704
    "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
  6705
     handle characters $& (ST-80 compatibility)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6706
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6707
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6708
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6709
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6710
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6711
    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
  6712
baefcb629718 Remove string specific acent handling instead of the generic #ascentOn: approach.
Stefan Vogel <sv@exept.de>
parents: 3447
diff changeset
  6713
    "Stefan: Why do we use #value two times??"
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6714
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6715
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6716
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6717
    displayLabel isString ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6718
        "CHECK FOR SEPARATOR"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6719
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6720
        (menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6721
            size := displayLabel size.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6722
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6723
            size == 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6724
                displayLabel := nil.            "blank separator"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6725
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6726
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6727
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6728
            size == 1 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6729
                char := displayLabel first.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6730
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6731
                (char == $- or:[char == $=]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6732
                    label := displayLabel.      "line separator"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6733
                    displayLabel := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6734
                    ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6735
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6736
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6737
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6738
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6739
        displayLabel isCollection ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6740
            displayLabel := displayLabel asArray.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6741
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6742
    ].
4218
ade9025919d7 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4209
diff changeset
  6743
    menuPanel notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6744
        menuPanel doAccessCharacterTranslation ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6745
            displayLabel notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6746
                displayLabel isArray ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6747
                    displayLabel keysAndValuesDo:[:i :el|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6748
                        el notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6749
                            displayLabel at:i put:(self updateAccessCharacterFor:el).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6750
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6751
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6752
                ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6753
                    displayLabel isImageOrForm ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6754
                        displayLabel := self updateAccessCharacterFor:displayLabel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6755
                    ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6756
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6757
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6758
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6759
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6760
        menuPanel shown ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6761
            self fetchImages.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6762
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6763
            oldExtent = self displayLabelExtent ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6764
                self invalidate
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6765
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6766
                menuPanel mustRearrange
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6767
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6768
        ].
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6769
    ].
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6770
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  6771
    "Modified: / 06-10-2011 / 16:36:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6772
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6773
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6774
menuPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6775
    "returns my menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6776
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  6777
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6778
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6779
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6780
nameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6781
    "gets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6782
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6783
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6784
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6785
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6786
nameKey:aNameKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6787
    "sets the nameKey"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6788
5705
c3db8e3414b3 #QUALITY by mawalch
mawalch
parents: 5700
diff changeset
  6789
    self assert:(aNameKey isNil or:[aNameKey isString]).
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6790
    menuItem nameKey:aNameKey.
5705
c3db8e3414b3 #QUALITY by mawalch
mawalch
parents: 5700
diff changeset
  6791
c3db8e3414b3 #QUALITY by mawalch
mawalch
parents: 5700
diff changeset
  6792
    "Modified: / 14-02-2018 / 12:23:24 / mawalch"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6793
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6794
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6795
rawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6796
    "returns my raw, unprocessed label"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6797
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6798
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6799
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6800
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6801
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6802
    "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
  6803
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6804
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6805
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6806
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6807
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6808
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6809
    "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
  6810
     no submenu exists evaluate the action assigned to the item (accept)."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6811
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6812
    menuItem shortcutKey ~= aKey ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6813
        menuItem shortcutKey:aKey.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6814
        self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6815
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  6816
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6817
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6818
startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6819
    "start group #left #right #conditionalRight ... or nil
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6820
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6821
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6822
    ^ menuItem startGroup
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6823
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6824
    "Modified: / 16-10-2006 / 13:06:25 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6825
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6826
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6827
startGroup:aSymbol
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6828
    "start group #left #right #conditionalRight ...
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6829
     at the moment only #right and #conditionalRight are implemented"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6830
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6831
    menuItem startGroup:aSymbol.
3127
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6832
9b522d37eca0 new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 3126
diff changeset
  6833
    "Modified: / 16-10-2006 / 13:06:37 / cg"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6834
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  6835
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6836
submenu
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6837
    "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
  6838
     May return nil, if there is really no menu"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6839
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6840
    subMenu isNil ifTrue:[
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6841
        self setupSubmenu
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6842
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6843
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6844
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6845
    "Modified: / 07-11-2006 / 11:09:49 / cg"
5473
6015183249c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5469
diff changeset
  6846
    "Modified (comment): / 13-02-2017 / 20:26:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6847
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6848
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6849
submenu:aSubMenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  6850
    "set a new submenu; an existing submenu will be destroyed.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6851
     This might lead to a redraw if 'hasSubmenu' changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6852
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6853
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6854
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6855
    subMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6856
        subMenu ~~ aSubMenu ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6857
            subMenu destroy.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6858
            subMenu := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6859
        ].
4196
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6860
    ].
fa01dec84e31 class: Menuca fix to release menu resources
Michael Beyl <mb@exept.de>
parents: 4193
diff changeset
  6861
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6862
    aSubMenu isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6863
        subMenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6864
            subMenu destroy.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6865
            subMenu := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6866
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6867
        ^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6868
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6869
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6870
    (aSubMenu isKindOf:Menu) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6871
        subMenu := MenuPanel new.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6872
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6873
        menuPanel notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6874
            subMenu receiver:menuPanel receiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6875
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6876
        subMenu superMenu:menuPanel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6877
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6878
        menuItem horizontalLayout == true ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6879
            subMenu verticalLayout:false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6880
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6881
        subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  6882
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6883
        aSubMenu isView ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6884
            (aSubMenu isKindOf:ApplicationModel) ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6885
                "/ ... mhhhh ....
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6886
                ^ menuItem submenuChannel:aSubMenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6887
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6888
            widget := SimpleView new.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6889
            widget client:aSubMenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6890
        ] ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6891
            widget := aSubMenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6892
            subMenu perform:#superMenu: with:menuPanel ifNotUnderstood:[].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6893
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6894
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6895
        (widget isKindOf:MenuPanel) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6896
            subMenu := widget.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6897
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6898
            menuItem horizontalLayout == true ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6899
                subMenu verticalLayout:false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6900
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6901
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6902
            subMenu := MenuPanel new.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6903
            subMenu receiver:menuPanel receiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6904
            subMenu addSubView:widget.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6905
            subMenu extent:(widget preferredExtent).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6906
            widget origin:0.0@0.0 corner:1.0@1.0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6907
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6908
        subMenu superMenu:menuPanel.
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6909
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6910
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6911
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6912
submenuOrNil
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6913
    "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
  6914
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6915
    ^ subMenu
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6916
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6917
    "Created: / 07-11-2006 / 11:04:47 / cg"
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6918
!
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  6919
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6920
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6921
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6922
     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
  6923
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6924
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6925
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6926
    displayLabel notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6927
        displayLabel isArray ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6928
            ^ displayLabel perform:#string ifNotUnderstood:nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6929
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6930
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6931
        displayLabel do:[:el|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6932
            (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6933
                ^ txt
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6934
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6935
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6936
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6937
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6938
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6939
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6940
triggerOnDown
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6941
    "return true if triggering the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6942
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6943
    menuItem triggerOnDown ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6944
        self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6945
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6946
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6947
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6948
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6949
triggerOnDown:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6950
    "setup to trigger the action if pressed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6951
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6952
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6953
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  6954
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6955
value
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6956
    "gets the item's value
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6957
     Left here for ST80 compatibility - value is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6958
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6959
    ^ menuItem itemValue
4112
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6960
df82e28ca882 changed: #accept:index:toggle:receiver:
Claus Gittinger <cg@exept.de>
parents: 4110
diff changeset
  6961
    "Modified (comment): / 06-03-2012 / 14:41:23 / cg"
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6962
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6963
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6964
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6965
    "could be a value holder, an action or selector
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6966
     Left here for ST80 compatibility - value: is a bad name"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6967
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6968
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6969
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6970
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  6971
value:aValue argument:anArgument
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6972
    "set the value and an argument"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6973
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6974
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  6975
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6976
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6977
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  6978
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6979
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6980
choice
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6981
    "implements a radio group; the field"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6982
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6983
    ^ choice
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6984
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6985
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6986
choice:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6987
    "set choice indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  6988
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6989
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6990
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6991
    choice isValueModel ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6992
        choice removeDependent:self
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6993
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6994
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6995
    choice := something.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  6996
    choice notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6997
        choice isSymbol ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6998
            choice := (self aspectAt:choice) ? choice.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  6999
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7000
        choice isValueModel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7001
            choice addDependent:self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7002
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7003
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7004
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7005
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7006
choiceValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7007
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7008
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7009
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7010
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7011
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7012
choiceValue:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7013
    "implements a radio group; the value writen to the choice if selected"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7014
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7015
    menuItem choiceValue ~= something ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7016
        menuItem choiceValue:something.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7017
        choice notNil ifTrue:[ self invalidate ].
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7018
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7019
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7020
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7021
enabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7022
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7023
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7024
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7025
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7026
    menuPanel isNil ifTrue:[ ^ false].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7027
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7028
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7029
    enableChannel isSymbol ifTrue:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7030
        state := self aspectAt:enableChannel.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7031
        state isValueModel ifTrue:[
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7032
            enableChannel := state.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7033
            enableChannel addDependent:self.
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7034
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7035
    ] ifFalse:[
4756
58b910fe4513 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4755
diff changeset
  7036
        state := enableChannel.
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7037
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  7038
    ^ state value ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7039
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7040
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7041
enabled:aBooleanOrBooleanHolder
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7042
    "change the enabled state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7043
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7044
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7045
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7046
    enableChannel isNil ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7047
        oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7048
    ] ifFalse:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7049
        oldState := enableChannel value.
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7050
        enableChannel isValueModel ifTrue:[
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7051
            enableChannel removeDependent:self
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7052
        ]
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7053
    ].
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7054
    enableChannel := aBooleanOrBooleanHolder.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7055
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7056
    enableChannel isNil ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7057
        menuPanel shown ifFalse:[^ self].
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7058
        newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7059
    ] ifFalse:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7060
        enableChannel isValueModel ifTrue:[
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7061
            enableChannel addDependent:self
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7062
        ] ifFalse:[
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7063
            enableChannel isSymbol ifTrue:[^ self]
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7064
        ].
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7065
        menuPanel shown ifFalse:[^ self].
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7066
        newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7067
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7068
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7069
    newState ~~ oldState ifTrue:[
5554
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7070
        self invalidate
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7071
    ].
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7072
332d4e2abcd8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5549
diff changeset
  7073
    "Modified (format): / 18-07-2017 / 14:20:48 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7074
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7075
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7076
hideMenuOnActivated
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7077
    "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7078
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7079
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7080
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7081
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7082
hideMenuOnActivated:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7083
   "hide the menu when the item was activated; the default is true"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7084
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7085
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7086
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  7087
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7088
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7089
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7090
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7091
    |app|
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7092
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7093
    app := menuPanel application.
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7094
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7095
    (menuPanel receiver isNil
3732
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7096
    and:[ app notNil
1f08b49d9426 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3725
diff changeset
  7097
    and:[ app askFor:#isUIPainter]])
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7098
    ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7099
        ^ self "/ suppressed
3414
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  7100
    ].
b0fb84e3e809 more info about missing channel
Claus Gittinger <cg@exept.de>
parents: 3411
diff changeset
  7101
    aMessage infoPrint.
3833
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  7102
"/    app notNil ifTrue:[
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  7103
"/        ' Application: ' infoPrint. app infoPrint
1b0bc0acc161 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3830
diff changeset
  7104
"/    ].
3444
b7d2f3fe5055 avoid ultra-long lines in Transcript
Claus Gittinger <cg@exept.de>
parents: 3441
diff changeset
  7105
    '' infoPrintCR.
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7106
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  7107
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7108
indication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7109
    "get on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7110
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7111
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7112
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7113
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  7114
indication:aValueHolder
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7115
    "set on/off indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7116
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  7117
    indication == aValueHolder ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7118
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7119
    indication isValueModel ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7120
        indication removeDependent:self
4226
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  7121
    ].
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  7122
73442f136108 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4218
diff changeset
  7123
    (indication := aValueHolder) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7124
        indication isValueModel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7125
            indication addDependent:self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7126
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7127
            "/ to force an update of the value
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7128
            self indicationValue
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7129
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7130
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7131
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7132
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  7133
keepLinkedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7134
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7135
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7136
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7137
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7138
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7139
keepLinkedMenu:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7140
    "get the keepLinkedMenu flag"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7141
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7142
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  7143
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  7144
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7145
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7146
    "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
  7147
     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
  7148
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7149
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7150
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7151
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7152
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7153
    "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
  7154
     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
  7155
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7156
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7157
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  7158
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7159
submenuChannel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7160
    "get the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7161
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7162
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7163
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7164
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  7165
submenuChannel:aSelectorOrNil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7166
    "returns the submenu channel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7167
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7168
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7169
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7170
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  7171
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7172
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7173
moveBy:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7174
    "move the layouts origin"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7175
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7176
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7177
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7178
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7179
preferredExtent
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7180
    "compute my preferred extent excluding the shortCutKey and the menu identifier"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7181
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7182
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7183
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7184
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7185
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7186
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7187
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7188
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7189
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7190
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7191
    isButton ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7192
        s := menuPanel maxAbsoluteButtonLevel ? 0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7193
        x := s + HorizontalButtonInset.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7194
        y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7195
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7196
        x  := HorizontalInset.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7197
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7198
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7199
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7200
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7201
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7202
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7203
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7204
    self isSeparator ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7205
        s := self class separatorSize.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7206
        label = '' ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7207
            s := self class halfSeparatorSize.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7208
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7209
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7210
        "width of doubleSeparator is 5 !!!!"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7211
        isVertical ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7212
            x := x max:s.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7213
            y := y + 5.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7214
        ] ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7215
            y := y max:s.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7216
            x := x + 5.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7217
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7218
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7219
        labelExtent := self displayLabelExtent.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7220
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7221
        x := x + labelExtent x.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7222
        y := y + labelExtent y.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7223
        x := x + (menuPanel stringOffsetXfor:self).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7224
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7225
        isButton ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7226
            menuPanel showSeparatingLines ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7227
                "width of separator is 2 plus right offset 1 := 3"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7228
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7229
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7230
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7231
        wIcon := 0.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7232
        self hasMenuIndicator ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7233
            icon := MenuPanel menuIndicator.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7234
            wIcon := MenuPanel menuIndicatorOffset + icon width.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7235
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7236
            self hasDelayedMenuIndicator ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7237
                icon := MenuPanel delayedMenuIndicator.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7238
                wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7239
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7240
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7241
        x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7242
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7243
    ^ x@y
3987
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  7244
361db9c224b3 changed:
Claus Gittinger <cg@exept.de>
parents: 3976
diff changeset
  7245
    "Modified: / 19-01-2011 / 21:20:35 / cg"
3421
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7246
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7247
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7248
preferredHeight
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7249
    ^ self preferredExtent y
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7250
!
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7251
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7252
preferredWidth
de7368c2dd11 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3415
diff changeset
  7253
    ^ self preferredExtent x
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7254
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7255
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  7256
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7257
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7258
activeHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7259
    "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
  7260
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7261
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7262
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7263
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7264
activeHelpKey:aHelpKey
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7265
    "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
  7266
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7267
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7268
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7269
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7270
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7271
activeHelpText
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7272
    "get the active helpText or nil if not yet resolved.
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7273
     Here, a few attributes are tried as fallback key,
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7274
     in case no activeHelpKey was defined in the menuSpec.
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7275
     As a last fallback, the raw label is returned,
5787
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7276
     iff the displayLabel is empty; this might help if the item is an iconic item.
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7277
     This should actually be FIXED by adding an activeHelpKey,
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7278
     and therefore, a warning is generated if running in the IDE.
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7279
     Special for hooking (non-app menu entries added by extensions):
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7280
     these require that their own helpSpec is used; 
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7281
     for those, the activeHelpKey can be an association providing helpSpec provider
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7282
     and helpSpec key."
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7283
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7284
    |app text key1 key2 key3 key4 key5 rawLabel keyFromLabel|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7285
5691
86f9fd0b17d7 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5675
diff changeset
  7286
    "/ explicitly assigned (probably dynamic)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7287
    activeHelpText notNil ifTrue:[^ activeHelpText].
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7288
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
5698
cbb99238ece2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  7289
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7290
    rawLabel := self rawLabel.
5789
ca580c5de55e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5788
diff changeset
  7291
    ((rawLabel = '-') or:[(rawLabel = '=') or:[rawLabel = '']]) ifTrue:[^ nil].
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7292
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7293
    "/ if activeHelpKey is unassigned try nameKey, itemValue, indication as fallback
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7294
    (key1 := menuItem activeHelpKey) isNil ifTrue:[
5907
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7295
        "/ but only if the label is not a text label
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7296
        label isString ifFalse:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7297
            ActiveHelp debuggingHelpText ifTrue:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7298
                Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7299
                    (menuPanel notNil and:[menuPanel isPopUpView]) ifFalse:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7300
                        ('** no activeHelpKey in item: ',menuItem printString) printCR.
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7301
                    ].
5799
6b5dd8dc6b1b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5798
diff changeset
  7302
                ].
5795
26cb086b7d66 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5789
diff changeset
  7303
            ].
5907
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7304
            key2 := self nameKey.
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7305
            key2 isSymbol ifTrue:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7306
                key3 := key2 asLowercaseFirst asSymbolIfInterned
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7307
            ].    
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7308
            self itemValue isSymbol ifTrue:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7309
                key4 := self itemValue
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7310
            ].
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7311
            (menuItem notNil and:[menuItem indication isSymbol]) ifTrue:[
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7312
                key5 := menuItem indication
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7313
            ]
5f8b0523fb67 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5903
diff changeset
  7314
        ].
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7315
    ].
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7316
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7317
    key1 isAssociation ifTrue:[
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7318
        "/ a special hooked-in) helpKey;
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7319
        "/ the assoc's key is the helpSpec provider (a class),
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7320
        "/ and the assoc's value is the key in there
5942
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7321
        Error handle:[:ex |
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7322
            Logger warn:'caught error in helpTextForKey: ',ex description
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7323
        ] do:[
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7324
            text := key1 key helpTextForKey:key1 value.
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7325
        ].
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7326
        text notNil ifTrue:[^ text].
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7327
        key1 := nil. "/ nope - ignore it.
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7328
    ].
5876
26bb50f6c6e5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5829
diff changeset
  7329
    
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7330
    (app := menuPanel application) notNil ifTrue:[
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7331
        "/ try each possible key (incl. fallbacks) in sequence
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7332
        { key1 . key2 . key3 . key4 . key5} do:[:key |
5880
1ef7062bca9c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5878
diff changeset
  7333
            key notNil ifTrue:[
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7334
                text := app helpTextForKey:key.
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7335
                text notNil ifTrue:[^ text].
5789
ca580c5de55e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5788
diff changeset
  7336
                key == key1 ifTrue:[
5800
ee6056db8570 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5799
diff changeset
  7337
                    ActiveHelp debuggingHelpText ifTrue:[
5799
6b5dd8dc6b1b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5798
diff changeset
  7338
                        Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
6b5dd8dc6b1b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5798
diff changeset
  7339
                            ('no help for key: "%1" in spec of "%2"' bindWith:key with:app class name) infoPrintCR.
6b5dd8dc6b1b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5798
diff changeset
  7340
                        ].    
5789
ca580c5de55e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5788
diff changeset
  7341
                    ].    
ca580c5de55e #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5788
diff changeset
  7342
                ].    
5698
cbb99238ece2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  7343
            ].
cbb99238ece2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5691
diff changeset
  7344
        ].
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7345
6011
7e276c8f8e27 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6007
diff changeset
  7346
        "/ trying the rawLabel is usually not helpful:
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7347
        "/  a) we must care for ampersand in labels
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7348
        "/  b) only helpful if label is an icon (then there might be a label)
5786
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7349
        rawLabel notEmptyOrNil ifTrue:[
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7350
            keyFromLabel := (String withoutAmpersandEscapes:rawLabel) asSymbolIfInterned.
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7351
            keyFromLabel notNil ifTrue:[
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7352
                text := app helpTextForKey:keyFromLabel.
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7353
                text = keyFromLabel ifTrue:[
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7354
                    "/ no real return
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7355
                    text := nil.
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7356
                ].
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7357
            ].    
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7358
        ].
463541b7bca9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5785
diff changeset
  7359
    ].
5787
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7360
    text isNil ifTrue:[
5788
120902ad9fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5787
diff changeset
  7361
        (displayLabel isEmptyOrNil or:[displayLabel isImage]) ifTrue:[
5787
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7362
            ^ rawLabel
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7363
        ].    
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7364
    ].    
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7365
    ^ text
d46575b1220c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5786
diff changeset
  7366
5942
7e83db3b547d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5917
diff changeset
  7367
    "Modified: / 09-11-2018 / 08:54:58 / Claus Gittinger"
6011
7e276c8f8e27 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6007
diff changeset
  7368
    "Modified (comment): / 27-02-2019 / 11:33:19 / Claus Gittinger"
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7369
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7370
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7371
activeHelpText:aText
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7372
    "set the active helpText"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7373
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7374
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7375
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7376
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7377
flyByHelpText:aText
5785
82bf9b1da5e1 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5782
diff changeset
  7378
    <resource: #obsolete>
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7379
    "obsolete: provided for backward compatibility
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7380
     explicitly set the flyBy helpText. For example, to dynamically change it."
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7381
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7382
    self helpText:aText.
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7383
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7384
    "Modified (comment): / 29-11-2017 / 14:38:52 / mawalch"
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7385
!
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7386
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7387
helpText
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7388
    "get the tooltip helpText or nil."
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7389
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7390
    |text key app keyUsed itemsActionSelector|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7391
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7392
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7393
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  7394
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  7395
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7396
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7397
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7398
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  7399
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7400
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  7401
    "/ if an activeHelpKey was explicitely given, use that one
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7402
    key := keyUsed := self activeHelpKey.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7403
    keyUsed isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7404
        "/ try action as key
4717
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7405
        (itemsActionSelector := menuItem itemValue) isSymbol ifTrue:[
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7406
            keyUsed := itemsActionSelector.
8e09ca1b8751 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4716
diff changeset
  7407
        ].
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7408
    ].
2895
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  7409
4e63ee409513 flyByHelpText in Launcher
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
  7410
    "/ 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
  7411
    (keyUsed isAssociation) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7412
        app := keyUsed key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7413
        keyUsed := keyUsed value.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7414
    ] ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7415
        app := menuPanel application.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7416
    ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7417
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7418
    keyUsed notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7419
        app notNil ifTrue:[
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7420
            text := app helpTextForKey:keyUsed.
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7421
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7422
        text isNil ifTrue:[
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7423
            text := menuPanel helpTextForKey:keyUsed.
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7424
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7425
        "/ if the key used is NOT the activeHelpKey, but the action name,
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7426
        "/ then do not accept the default
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7427
        ((text = keyUsed) and:[key isNil]) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7428
            text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7429
        ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7430
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7431
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  7432
    "/ 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
  7433
    text isNil ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7434
        self hasSubmenu ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7435
            ^ key
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7436
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7437
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7438
        "/ then use the original activeHelpKey (but not the action)
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7439
        text := key.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7440
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7441
            displayLabel isString ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7442
                text := displayLabel string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7443
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7444
        ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7445
        text isNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7446
            text := self rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7447
            text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7448
                text := menuItem rawLabel.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7449
                text isString ifFalse:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7450
                    text := nil.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7451
                ]
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7452
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7453
            text notNil ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7454
                (text includes:$&) ifTrue:[
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7455
                    text := (self updateAccessCharacterFor:text) string.
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7456
                ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7457
            ].
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7458
        ].
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7459
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7460
3402
5941cc1ff429 flybyhelp - give menuPanel achance to provide a text
Claus Gittinger <cg@exept.de>
parents: 3394
diff changeset
  7461
    (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
  7462
    text = displayLabel ifTrue:[
4712
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7463
        "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
  7464
         (i.e. in a pull down menu)"
5084bb88bd02 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4679
diff changeset
  7465
        ^ nil
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  7466
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7467
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7468
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7469
5675
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7470
helpText:aText
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7471
    "explicitly set the tooltip helpText. 
5c69a959093e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5651
diff changeset
  7472
     For example, to dynamically change it."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7473
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  7474
    flyByHelpText := aText.
5649
40ca2ab39142 #DOCUMENTATION by mawalch
mawalch
parents: 5632
diff changeset
  7475
40ca2ab39142 #DOCUMENTATION by mawalch
mawalch
parents: 5632
diff changeset
  7476
    "Modified (comment): / 29-11-2017 / 14:38:52 / mawalch"
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7477
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  7478
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7479
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7480
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7481
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7482
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7483
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7484
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7485
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7486
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7487
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7488
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7489
    "on default submenus has a vertical layout;
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7490
     true, the submenu has a horizontal layout."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7491
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7492
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7493
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7494
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7495
isButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7496
    "returns whether the item looks like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7497
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7498
    ^ menuItem isButton
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  7499
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  7500
    "Modified: / 17-11-2018 / 16:59:16 / Claus Gittinger"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7501
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7502
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7503
isButton:aBool
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7504
    "set/clear the item to look like a Button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7505
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7506
    menuItem isButton ~~ aBool ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7507
        menuItem isButton:aBool.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7508
        self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7509
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7510
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7511
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7512
layout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7513
    "returns my layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7514
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7515
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7516
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7517
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7518
layout:aLayout
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7519
    "set a new layout ( Rectangle )"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7520
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7521
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7522
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7523
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7524
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7525
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7526
    "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
  7527
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7528
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7529
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7530
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7531
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7532
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7533
    "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
  7534
     while performing the menu action. Defaults to false."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7535
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7536
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7537
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7538
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  7539
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7540
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7541
currentSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7542
    "returns the current submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7543
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7544
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7545
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7546
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7547
hideSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7548
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7549
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7550
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7551
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7552
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7553
hideSubmenu:aSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7554
    "hide submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7555
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7556
    |id wg|
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7557
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7558
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7559
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7560
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7561
    aSubmenu realized ifFalse:[
5917
2908aa3e562a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5907
diff changeset
  7562
        id := aSubmenu drawableId.
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7563
        id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7564
    ] ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7565
        aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7566
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7567
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7568
    aSubmenu windowGroup:nil.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7569
    (wg := menuPanel windowGroup) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7570
        wg removeView:aSubmenu.
2871
c74f2a6ff335 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2870
diff changeset
  7571
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7572
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7573
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7574
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7575
        menuItem keepLinkedMenu ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7576
            subMenu := nil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7577
        ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7578
    ].
5917
2908aa3e562a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5907
diff changeset
  7579
2908aa3e562a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5907
diff changeset
  7580
    "Modified: / 01-10-2018 / 17:04:20 / Claus Gittinger"
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7581
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7582
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7583
openDelayedSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7584
    "called to open now my delayed submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7585
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7586
    |subMenuBeforeOpening|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7587
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7588
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7589
    subMenu notNil ifTrue:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7590
        subMenu realized ifTrue:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7591
            "/ already open
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7592
            ^ self
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7593
        ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7594
    ].
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7595
5651
d738050e4ed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5649
diff changeset
  7596
    "/ bugfix : check if delayed menu can be open (only for toolbars and items having a delayed menu)
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7597
    (menuPanel isPopUpView                      
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7598
    or:[self hasDelayedMenu not
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7599
    or:[menuPanel sensor anyButtonPressed]]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7600
    ) ifFalse:[
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7601
        "/ check if any menu already is open than accept otherwise ignore
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7602
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7603
        menuPanel items
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7604
            detect:[:el|(el currentSubmenu isView and:[el currentSubmenu realized])]
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7605
            ifNone:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7606
    ].
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  7607
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7608
    self setupSubmenu.
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7609
    subMenu isNil ifTrue:[^ self].
4241
9b3b8041c18f class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4240
diff changeset
  7610
    subMenu hasItems ifFalse:[^ self].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7611
    subMenuBeforeOpening := subMenu.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7612
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7613
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7614
    (subMenuBeforeOpening == subMenu and:[self isSelected]) ifFalse:[
4726
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7615
        "/ closed during building or opening the submenu
cf0207f9c847 class: MenuPanel
ca
parents: 4717
diff changeset
  7616
        self hideSubmenu:subMenuBeforeOpening.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7617
    ].
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7618
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7619
    "Modified: / 07-11-2006 / 11:07:57 / cg"
5651
d738050e4ed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5649
diff changeset
  7620
    "Modified (comment): / 29-11-2017 / 17:34:05 / cg"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  7621
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7622
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7623
openSubmenu
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7624
    "opens the submenu; make sure that the submenu and the menuPanel
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7625
     is fully visible by shifting it into the visible screen area if
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7626
     necessary."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7627
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7628
    |p o device isVertical topMenu windGrp prefExtent lastEvent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7629
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7630
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7631
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7632
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7633
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7634
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7635
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7636
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7637
    (subMenu isNil or:[subMenu shown or:[self isSelected not or:[menuPanel realized not]]]) ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7638
        ^ self
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7639
    ].
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7640
    "close all other open submenus assigned to the menuPanel I am located in"
3975
ca
parents: 3966
diff changeset
  7641
ca
parents: 3966
diff changeset
  7642
    menuPanel itemsDo:[:eachItem|
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7643
        (eachItem ~~ self and:[eachItem visibleSubmenu notNil]) ifTrue:[
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7644
            eachItem hideSubmenu.
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7645
        ].
3975
ca
parents: 3966
diff changeset
  7646
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7647
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7648
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7649
        subMenu releaseDeviceResources.
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7650
        subMenu setDevice:topMenu device id:nil gcId:nil.
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7651
        subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7652
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  7653
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7654
    windGrp := topMenu windowGroup.
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7655
    windGrp notNil ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7656
        lastEvent := windGrp lastEvent.
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7657
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7658
        (lastEvent notNil and:[lastEvent isButtonPressEvent]) ifTrue:[
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7659
            subMenu mapTime:(lastEvent timeStamp).
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7660
        ].
3203
97d6c1d7b7d7 get timeStamp from buttonPress and buttonRelease event
ca
parents: 3192
diff changeset
  7661
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  7662
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7663
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7664
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7665
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7666
    windGrp notNil ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7667
        subMenu windowGroup:windGrp.
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7668
        windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7669
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7670
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7671
    "Q&D kludge - test whether the layout is nil;
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7672
                  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7673
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7674
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  7675
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7676
    isVertical := menuPanel verticalLayout.
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7677
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7678
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7679
    menuPanel isPopUpView ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7680
        o := menuPanel origin + p
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7681
    ] ifFalse:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7682
        o := menuPanel translatePoint:p to:nil.   "/ translate to root window
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7683
    ].
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7684
    subMenu origin:o.   "set temporary origin to compute preferredExtent"
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7685
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7686
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7687
      TODO: only invoke mustRearrange if any are blocks
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7688
            (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7689
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7690
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7691
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7692
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7693
    "compute origin of subMenu"
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7694
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7695
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7696
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  7697
    width      := prefExtent x.
4150
7228edcc3fa0 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4139
diff changeset
  7698
    devBot     := device  usableHeightAt:o.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7699
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7700
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7701
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7702
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7703
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7704
    top + height > devBot ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7705
        top := isVertical ifTrue:[devBot - height]
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7706
                         ifFalse:[top - layout height - height + 2]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7707
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7708
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7709
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7710
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7711
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7712
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7713
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7714
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7715
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7716
"/    ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7717
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7718
    left + width > devRight ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7719
        left := isVertical ifTrue:[left - layout width - width + 2]
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7720
                          ifFalse:[devRight - width]
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7721
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7722
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7723
"/ ***** MULTI SCREEN
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7724
"/    top := top max:0.
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  7725
"/    left := left max:0.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7726
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7727
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7728
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7729
    subMenu realized ifFalse:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7730
        subMenu realize.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7731
    ] ifTrue:[
5549
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7732
        topMenu device mapWindow:(subMenu id).
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7733
    ].
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7734
7d669a6613bc #OTHER by mawalch
mawalch
parents: 5545
diff changeset
  7735
    "Modified (comment): / 30-05-2017 / 17:35:47 / mawalch"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7736
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7737
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7738
toggleSubmenuVisibility
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7739
    "toggle the visibility of the submenu"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7740
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7741
    subMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7742
        subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7743
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7744
        self setupSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7745
        subMenu isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7746
            "/ cannot open a submenu
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7747
            ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7748
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7749
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7750
    self openSubmenu.
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7751
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  7752
    "Modified: / 07-11-2006 / 11:06:42 / cg"
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7753
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7754
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7755
visibleSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7756
    "returns the current visible submenu or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7757
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7758
    subMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7759
        subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7760
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  7761
    ^ nil
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7762
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7763
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7764
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7765
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7766
aspectAt:aKey
3092
a1dee282cab7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2972
diff changeset
  7767
    "returns the value assigned to key or nil"
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7768
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7769
    |appl|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7770
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7771
    appl := menuPanel receiver.
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  7772
    appl isNil ifTrue:[
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7773
        appl := menuPanel application.
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7774
        appl isNil ifTrue:[ 
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7775
            ^ nil
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7776
        ].
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7777
    ] ifFalse:[appl isValueModel ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7778
        ^ appl value:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7779
    ]].
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7780
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7781
    ^ [
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7782
        aKey argumentCount == 1 ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7783
            appl perform:aKey with:(menuItem argument ? self).
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7784
        ] ifFalse:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7785
            (appl respondsTo:#aspectFor:) ifTrue:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7786
                appl aspectFor:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7787
            ] ifFalse:[
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7788
                appl perform:aKey
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7789
            ]
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7790
        ]
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7791
    ] on:MessageNotUnderstood do:[:ex|
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7792
        ex selector ~~ aKey ifTrue:[
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7793
            ex reject.
4782
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7794
        ].
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7795
        self ifNotInUIBuilderInfoPrintCR:
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  7796
            ('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
  7797
             bindWith:appl classNameWithArticle
e43a7165041e class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4757
diff changeset
  7798
             with:aKey
5903
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7799
             with:(label isString 
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7800
                    ifTrue:[label] 
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7801
                    ifFalse:[
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7802
                        self nameKey notNil 
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7803
                            ifTrue:[ self nameKey ]
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7804
                            ifFalse:[ 
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7805
                                self itemValue isString
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7806
                                    ifTrue:[self itemValue]
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7807
                                    ifFalse:['???']]])).
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7808
        nil
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7809
    ].
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  7810
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  7811
    "Modified: / 02-08-2013 / 16:44:28 / cg"
5515
f87f470e99c9 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5473
diff changeset
  7812
    "Modified (format): / 15-03-2017 / 17:00:31 / stefan"
5903
81a21a4e0d27 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 5880
diff changeset
  7813
    "Modified: / 12-09-2018 / 07:44:28 / Claus Gittinger"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7814
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  7815
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7816
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7817
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7818
fontChanged
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7819
    "called whenever the font changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7820
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7821
    displayLabel notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7822
        displayLabelExtent := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7823
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7824
        subMenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7825
            subMenu font:(menuPanel font).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7826
        ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7827
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7828
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  7829
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7830
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7831
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7832
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7833
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7834
    (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
  7835
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7836
    self isSeparator ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7837
        "/ NOT A SEPARATOR
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7838
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7839
        menuPanel shown ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7840
            changedObject == enableChannel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7841
                (enableChannel value == false and:[self isSelected]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7842
                    ^ menuPanel selection:nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7843
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7844
                ^ self invalidate
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7845
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7846
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7847
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7848
                menuItem isButton ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7849
                    self invalidate
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7850
                ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7851
                    "/ invalidate the interactor only
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7852
                    "/ take any interactor; interactors has the same extent
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7853
                    form := menuPanel iconIndicationOff.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7854
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7855
                    rect := Rectangle left:(layout left + HorizontalInset)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7856
                                       top:(layout top)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7857
                                     width:(form width)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7858
                                    height:(layout height).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7859
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7860
                    menuPanel invalidate:rect repairNow:false
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7861
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7862
                ^ self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7863
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7864
            self invalidate.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7865
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7866
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7867
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7868
    changedObject == isVisible ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7869
        menuPanel mustRearrange.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7870
        "/ actually: the following is wrong, because we have to delay the rearrangement
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7871
        "/ until the next redraw event comes. Otherwise, we might compute new layouts
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7872
        "/ too early if more items change their visibility.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7873
        "/ redraw will call rearrangeItems, if the mustRearrange is set.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7874
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7875
        "/ menuPanel rearrangeItems.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7876
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7877
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7878
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  7879
    super update:something with:aParameter from:changedObject
4090
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7880
9f67a25034b7 fixed visibiity change action
Claus Gittinger <cg@exept.de>
parents: 4089
diff changeset
  7881
    "Modified (comment): / 24-11-2011 / 19:01:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7882
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7883
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7884
updateIndicators
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7885
    "update indicators "
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7886
2934
b4ec1cbb3302 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2926
diff changeset
  7887
    indication notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7888
        (indication isSymbol
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7889
        or:[menuItem hideMenuOnActivated not])
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7890
        ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7891
            "indication is a selector;
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7892
             otherwise no need to redraw, because
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7893
             a change notification is raised from the model !!!!"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7894
            self update:nil with:nil from:indication
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7895
        ]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  7896
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7897
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  7898
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7899
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7900
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7901
asMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7902
    "convert to a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7903
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7904
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7905
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7906
2827
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7907
menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7908
    ^ menuItem
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7909
!
139c1089bcb6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  7910
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7911
menuItem:aMenuItem
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7912
    "setup attributes from a MenuItem"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7913
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7914
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  7915
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7916
    menuPanel disabledRedrawDo:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7917
        menuItem := aMenuItem.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7918
        menuItem isNil ifTrue:[ menuItem := MenuItem new].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7919
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7920
        label := displayLabel := activeHelpText := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7921
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7922
        self    enabled:(menuItem enabled).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7923
        self indication:(menuItem indication).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7924
        self     choice:(menuItem choice).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7925
        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
  7926
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7927
"/ 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
  7928
"/ but ... ??
2855
c7f3481ff14a redraw when a valueHolder changes.
Claus Gittinger <cg@exept.de>
parents: 2844
diff changeset
  7929
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7930
        (lbl := menuItem labelImage value) isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7931
            lbl := menuItem rawLabel. "/ avoid translating &'s twice
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7932
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7933
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7934
        self submenu:(menuItem submenu).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7935
        self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7936
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  7937
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  7938
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7939
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7940
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7941
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7942
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7943
addDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7944
    "add all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7945
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7946
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7947
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7948
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7949
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7950
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7951
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7952
removeDependencies
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7953
    "remove all dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7954
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7955
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7956
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7957
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7958
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7959
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  7960
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7961
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7962
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7963
choiceForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7964
    "returns choice form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7965
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7966
    |isOn|
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7967
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7968
    choice isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7969
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7970
    isOn := (choice value = menuItem choiceValue).
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7971
    self enabled ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7972
        ^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7973
               ifFalse:[menuPanel iconRadioGroupDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7974
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7975
    self isSelected ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7976
        ^ isOn == true
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7977
            ifTrue:[menuPanel iconRadioGroupEnteredOn]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7978
            ifFalse:[menuPanel iconRadioGroupEnteredOff]
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  7979
    ].
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7980
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7981
           ifFalse:[menuPanel iconRadioGroupOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7982
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  7983
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7984
draw
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7985
    "redraw this item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  7986
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7987
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7988
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7989
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7990
     w  "{ Class:SmallInteger }"
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  7991
     h  "{ Class:SmallInteger }" |
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7992
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7993
    self isVisible ifFalse:[^ self].
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7994
    layout isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7995
        "/ cg: why does this happen - it does!!
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  7996
        ^ self
4152
bf6d57e88e84 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4150
diff changeset
  7997
    ].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7998
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7999
    self isSeparator ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8000
        self drawSeparator.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8001
        ^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8002
    ].
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8003
    
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8004
    (menuItem isButton
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8005
      and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8006
    ]) ifTrue:[
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8007
        self drawButton.
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8008
        ^ self
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8009
    ].
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8010
    (indication notNil
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8011
      and:[menuPanel isVerticalLayout not
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8012
      and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false)
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8013
    ]]) ifTrue:[ 
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8014
        self drawButton.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8015
        ^ self
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8016
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8017
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8018
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8019
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8020
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8021
    bgColor    := menuPanel backgroundColor.
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8022
    isSelected ifTrue:[
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8023
        paint := self activeBackgroundColor
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8024
    ] ifFalse:[
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8025
        (self isEnabled and:[ self isEntered ]) ifTrue:[
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8026
            paint := menuPanel enteredBackgroundColor
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8027
        ] ifFalse:[
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8028
            paint := bgColor
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8029
        ]
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8030
    ].
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8031
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8032
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8033
        paint := ownBgCol
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8034
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8035
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8036
    paint ~= bgColor ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8037
        menuPanel paint:paint.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8038
        menuPanel fillRectangle:layout.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8039
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8040
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8041
    menuPanel showSeparatingLines ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8042
        self drawSeparatingLines
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8043
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8044
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8045
    self drawLabel.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8046
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8047
    (ownBgCol notNil and:[isSelected]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8048
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8049
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8050
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8051
        x := layout left.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8052
        y := layout top.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8053
        w := layout width.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8054
        h := layout height.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8055
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8056
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8057
        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
  8058
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8059
    menuPanel drawLabelEdgeFor:self selected:isSelected.
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8060
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8061
    "Modified: / 19-11-2018 / 15:08:36 / Claus Gittinger"
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8062
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8063
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8064
drawButton
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8065
    "draw as button"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8066
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8067
    |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
  8068
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  8069
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8070
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8071
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8072
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  8073
    isSelected := self isSelected.
4632
de5377ba14e4 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4631
diff changeset
  8074
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8075
    isSelected ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8076
        "/ test whether button has pressed toggle behaviour
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8077
        showSelected := (self isToggle and:[self indicationValue]).
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8078
    ] ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8079
        showSelected := isSelected
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8080
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8081
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8082
    showSelected ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8083
        bg := self activeBackgroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8084
        fg := self activeForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8085
        isEnabled ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8086
            fg := menuPanel disabledForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8087
        ].    
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8088
    ] ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8089
        self isEntered ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8090
            bg := self buttonEnteredBackgroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8091
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8092
            bg := self backgroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8093
        ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8094
        isEnabled ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8095
            fg := menuPanel foregroundColor
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8096
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8097
            fg := menuPanel disabledForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8098
            etchFg := menuPanel disabledEtchedForegroundColor.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8099
            drawObject := self disabledRawLabel
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8100
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8101
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8102
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  8103
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8104
        bg := ownBgCol
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  8105
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  8106
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8107
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8108
    bg ~= menuPanel backgroundColor ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8109
        menuPanel paint:bg.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8110
        menuPanel fillRectangle:layout.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8111
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8112
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8113
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8114
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8115
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8116
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  8117
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8118
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8119
    isSelected ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8120
        "check whether button should be drawn selected; indicator or radio button"
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8121
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8122
        indication notNil ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8123
            "button is indicator and set"
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8124
            isSelected := self indicationValue
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8125
        ] ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8126
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8127
        ]
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8128
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  8129
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8130
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8131
    isSelected ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8132
        level := menuPanel buttonActiveLevel.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8133
        x     := x + 1 "level abs".
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8134
        y     := y + 1 "level abs".
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8135
    ] ifFalse:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8136
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8137
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8138
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8139
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  8140
    drawObject notEmptyOrNil ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8141
        etchFg notNil ifTrue:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8142
            "/ donot draw images twice.. images are shown lightened
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8143
            drawObject isImageOrForm ifFalse:[
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8144
                self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8145
            ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8146
        ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8147
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8148
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8149
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8150
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8151
    level ~~ 0 ifTrue:[
5469
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8152
        menuPanel drawButtonEdgesFor:self level:level
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8153
    ].
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8154
5bc43ecbfc54 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5464
diff changeset
  8155
    "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
  8156
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8157
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8158
drawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8159
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8160
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8161
    |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
  8162
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8163
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8164
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8165
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8166
     t "{ Class:SmallInteger }"
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8167
     isImage|
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8168
     
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8169
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8170
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8171
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8172
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8173
    isSelected ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8174
        fg := self activeForegroundColor
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8175
    ] ifFalse:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8176
        isEnabled ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8177
            self isEntered ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8178
                fg := menuPanel enteredForegroundColor
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8179
            ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8180
                fg := menuPanel foregroundColor
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8181
            ]
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8182
        ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8183
            fg          := menuPanel disabledForegroundColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8184
            etchFg      := menuPanel disabledEtchedForegroundColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8185
            drawObject  := self disabledRawLabel
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8186
        ]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8187
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8188
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8189
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8190
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8191
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8192
3131
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  8193
    (    (form := self indicatorForm) notNil
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  8194
     or:[(form := self choiceForm) notNil]
611b833f2ac9 *** empty log message ***
ca
parents: 3128
diff changeset
  8195
    ) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8196
        y := t + ((h - form height) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8197
        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
  8198
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8199
2817
805bb3b2ef28 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2793
diff changeset
  8200
    drawObject notEmptyOrNil ifTrue:[
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8201
        isImage := drawObject isImageOrForm.
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8202
        x := x + (menuPanel stringOffsetXfor:self).
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8203
        
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8204
        etchFg notNil ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8205
            "/ do not draw images twice.. images are shown lightened
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8206
            isImage ifFalse:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8207
                self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8208
            ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8209
        ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8210
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8211
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8212
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8213
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8214
    "/ DRAW SHORTCUT KEY
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8215
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8216
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8217
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8218
    ) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8219
        x := layout left + x.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8220
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8221
        y := y + menuPanel font ascent.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8222
        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
  8223
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8224
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  8225
    "/ DRAW SUBMENU INDICATION (if a vertical menu with submenu)
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  8226
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
5351
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8227
        arrow := menuPanel rightArrow.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8228
        x := layout right - arrow width - HorizontalInset.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8229
        y := t + ((h - arrow height) // 2).
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8230
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8231
        (menuPanel styleSheet is3D not
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8232
        or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8233
            menuPanel displayForm:arrow x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8234
        ] ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8235
            cLa := menuPanel shadowColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8236
            cLb := menuPanel lightColor.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8237
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8238
            isSelected ifFalse:[
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8239
                fg  := cLa.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8240
                cLa := cLb.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8241
                cLb := fg
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8242
            ].
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8243
            menuPanel paint:cLa.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8244
            menuPanel displayForm:arrow x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8245
            menuPanel paint:cLb.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8246
            menuPanel displayForm:drawObject x:x y:y.
219e2046b694 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5345
diff changeset
  8247
        ].
3403
e7e2d3ba54b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3402
diff changeset
  8248
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8249
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8250
    "Modified: / 06-09-1998 / 21:48:53 / cg"
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8251
    "Modified: / 17-11-2018 / 12:57:41 / Claus Gittinger"
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8252
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8253
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8254
drawMenuIndicator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8255
    "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
  8256
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8257
    |x y icon bAbsLevel verticalPosition|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8258
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8259
    icon := self menuIndicatorIcon.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8260
    icon isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8261
        ^ self
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8262
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  8263
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8264
    x := layout right  - icon width.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8265
    verticalPosition := menuPanel menuIndicatorVerticalPosition.
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8266
    verticalPosition == #center ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8267
        y := (layout height - icon height) // 2 + layout top.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8268
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8269
        verticalPosition == #top ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8270
            y := layout top + 2.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8271
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8272
            y := layout bottom - icon height - 2.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8273
        ]
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8274
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8275
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8276
    bAbsLevel := 0.
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8277
    (menuItem isButton
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8278
      and:[menuPanel isVerticalLayout not
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8279
      and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8280
    ]]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8281
        self isSelected ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8282
            x := x + 1.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8283
            y := y + 1.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8284
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8285
        bAbsLevel := menuPanel maxAbsoluteButtonLevel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8286
        x := x - bAbsLevel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8287
        y := y - bAbsLevel.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8288
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8289
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8290
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8291
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8292
        icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8293
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8294
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  8295
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8296
    (menuPanel drawMenuIndicatorSeparatorLine
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8297
        and:[ self isEntered
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8298
        and:[ menuPanel buttonEnteredLevel ~~ 0] ])
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8299
    ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8300
        menuPanel paint:menuPanel buttonShadowColor.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8301
        menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8302
        menuPanel paint:menuPanel buttonLightColor.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8303
        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
  8304
    ].
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8305
5966
6d5dcada0845 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5965
diff changeset
  8306
    "Modified: / 19-11-2018 / 15:08:29 / Claus Gittinger"
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8307
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  8308
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8309
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8310
    "draw a labeled entry; no button, no separator."
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8311
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8312
    |oldFont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8313
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8314
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8315
     x0 "{ Class:SmallInteger }"
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8316
     isSelected|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8317
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8318
    isSelected := self isSelected.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8319
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8320
    oldFont := menuPanel setFont:(self font).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8321
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  8322
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  8323
4232
8193baee0399 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4226
diff changeset
  8324
    y := layout top + ((layout height - labelExtent y) // 2) + yOffset.
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8325
    aLabel isArray ifFalse:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8326
        |printLabel|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8327
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8328
        (aLabel isText or:[aLabel isLabelAndIcon]) ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8329
            "/ background of label has already been drawn
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8330
            "/ 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
  8331
            isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8332
                printLabel := aLabel withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8333
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8334
                printLabel := aLabel withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8335
            ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8336
        ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8337
            printLabel := aLabel.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8338
        ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8339
        y := y + (printLabel ascentOn:menuPanel).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8340
        printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8341
    ] ifTrue:[
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8342
        aLabel do:[:eachLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8343
            |shownLine|
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8344
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8345
            eachLine notNil ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8346
                "/ 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
  8347
                isSelected ifTrue:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8348
                    shownLine := eachLine withoutAnyColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8349
                ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8350
                    shownLine := eachLine withoutBackgroundColorEmphasis.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8351
                ].
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8352
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8353
                y0 := y + (shownLine ascentOn:menuPanel).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8354
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8355
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8356
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8357
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  8358
"/                ].
4679
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8359
                x0 := x + ((labelExtent x - (shownLine widthOn:menuPanel)) // 2).
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8360
                shownLine displayOn:menuPanel x:x0 y:y0.
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8361
                y := y + 1 + (shownLine heightOn:menuPanel)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8362
            ] ifFalse:[
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8363
                y := y + (self spaceBetweenEmptyLines)
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8364
            ]
83769eea6e94 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4657
diff changeset
  8365
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  8366
    ].
3486
c54b6691e60e variable naming
Stefan Vogel <sv@exept.de>
parents: 3457
diff changeset
  8367
    menuPanel setFont:oldFont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8368
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8369
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8370
drawSeparatingLines
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8371
    "draw separating lines"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8372
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8373
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8374
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8375
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8376
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8377
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8378
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  8379
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8380
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8381
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8382
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8383
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8384
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8385
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8386
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8387
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8388
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8389
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8390
    (lfSep or:[rtSep]) ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8391
        ^ self
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8392
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8393
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8394
    menuPanel suppressSeparatingLines ifTrue:[^ self].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8395
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8396
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8397
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8398
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8399
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8400
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8401
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8402
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8403
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  8404
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8405
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8406
    menuPanel verticalLayout ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8407
        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
  8408
        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
  8409
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8410
        menuPanel paint:shadowColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8411
        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
  8412
        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
  8413
    ] ifFalse:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8414
        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
  8415
        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
  8416
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8417
        menuPanel paint:shadowColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8418
        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
  8419
        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
  8420
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8421
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8422
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8423
drawSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8424
    "draw as separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8425
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8426
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8427
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8428
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8429
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8430
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8431
     y1  "{ Class:SmallInteger }"
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8432
     verticalInset "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8433
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8434
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8435
    menuPanel level == 0 ifTrue:[
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8436
        verticalInset := layout height // 5.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8437
    ] ifFalse:[
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8438
        verticalInset := 0.
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8439
    ].
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8440
    
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8441
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8442
    (type isNil or:[type == #blankLine]) ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8443
        ^ self
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8444
    ].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8445
    menuPanel suppressSeparatingLines ifTrue:[^ self].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8446
    
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8447
    isDouble := (type == #doubleLine).
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8448
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8449
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8450
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8451
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8452
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8453
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  8454
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8455
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8456
    menuPanel verticalLayout ifTrue:[
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8457
        x0 := left  + HorizontalInset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8458
        x1 := layout right - HorizontalInset.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8459
        y0 := top   - 1 + (layout height // 2).
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8460
        isDouble ifTrue:[y0 := y0 - 2].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8461
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8462
        menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8463
        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
  8464
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8465
        menuPanel paint:lightColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8466
        menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8467
        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
  8468
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8469
    ] ifFalse:[
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8470
        y1 := layout bottom - verticalInset.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8471
        x0 := left - 1 + (layout width // 2).
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8472
        y0 := top + verticalInset.
4893
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8473
        isDouble ifTrue:[x0 := x0 - 2].
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8474
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8475
        menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8476
        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
  8477
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8478
        menuPanel paint:lightColor.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8479
        menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
2c0fb2f55914 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4887
diff changeset
  8480
        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
  8481
    ]
5829
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8482
86f8951725b8 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  8483
    "Modified: / 11-07-2018 / 09:55:12 / Claus Gittinger"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8484
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  8485
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8486
indicatorForm
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8487
    "returns indication form or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8488
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8489
    |isOn|
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8490
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8491
    indication isNil ifTrue:[^ nil].
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8492
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8493
    isOn := self indicationValue.
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8494
    self enabled ifFalse:[
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8495
        isOn == true
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8496
            ifTrue:[^ menuPanel iconIndicationDisabledOn]
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8497
            ifFalse:[^ menuPanel iconIndicationDisabledOff]
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8498
    ].
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8499
"/    self isSelected ifTrue:[
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8500
"/        isOn == true
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8501
"/            ifTrue:[^ menuPanel iconIndicationEnteredOn]
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8502
"/            ifFalse:[^ menuPanel iconIndicationEnteredOff]
3565
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8503
"/    ].
8147249b4aa6 better icons
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8504
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8505
    isOn == true
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8506
        ifTrue:[^ menuPanel iconIndicationOn]
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8507
        ifFalse:[^ menuPanel iconIndicationOff]
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8508
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8509
    "Modified (comment): / 17-11-2018 / 13:00:20 / Claus Gittinger"
2768
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8510
!
9c79a348a443 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  8511
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8512
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8513
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8514
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  8515
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8516
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8517
        menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8518
    ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8519
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8520
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8521
menuIndicatorIcon
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8522
    "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
  8523
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8524
    self hasDelayedMenuIndicator ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8525
        ^ MenuPanel delayedMenuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8526
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8527
    self hasMenuIndicator ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8528
        ^ MenuPanel menuIndicator.
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8529
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  8530
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8531
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8532
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8533
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8534
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8535
destroy
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8536
    "destroy submenus, remove dependencies"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8537
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8538
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  8539
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8540
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8541
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8542
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8543
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8544
in:aPanel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8545
    "create item in a menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8546
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8547
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8548
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8549
    menuItem isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8550
        self breakPoint:#ca.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8551
        menuItem := MenuItem new
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8552
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8553
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8554
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8555
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8556
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8557
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8558
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8559
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8560
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8561
    subMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8562
        subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8563
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8564
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8565
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  8566
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8567
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8568
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8569
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8570
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8571
disabledRawLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8572
    "returns the label used if the item is disabled"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8573
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8574
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8575
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8576
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8577
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8578
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8579
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8580
    disabledDisplayLabel isString ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8581
        ^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8582
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8583
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8584
    block := [:el| |rslt|
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8585
        (rslt := el) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8586
            el isImageOrForm ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8587
                el colorMap notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8588
                    rslt := menuPanel lightenedImageOnDevice:el
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8589
                ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8590
            ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8591
                (displayLabel isLabelAndIcon) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8592
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8593
                        form := menuPanel lightenedImageOnDevice:form
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8594
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8595
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8596
                        image := menuPanel lightenedImageOnDevice:image
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8597
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8598
                    rslt := LabelAndIcon form:form image:image string:(el string).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8599
                ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8600
            ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8601
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8602
        rslt
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8603
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8604
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8605
    displayLabel isArray ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8606
        disabledDisplayLabel := Array new:(displayLabel size).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8607
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8608
        displayLabel keysAndValuesDo:[:anIndex :aLabel|
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8609
            disabledDisplayLabel at:anIndex put:(block value:aLabel)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8610
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8611
    ] ifFalse:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8612
        disabledDisplayLabel := block value:displayLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8613
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8614
    ^ disabledDisplayLabel
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8615
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8616
    "Modified: / 04-02-2017 / 22:11:45 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8617
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  8618
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8619
fetchDeviceResources
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8620
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8621
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8622
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  8623
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  8624
fetchImages
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8625
    "fetch my icon images"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8626
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8627
    |icon device makeDeviceImage|
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  8628
5972
ff50c3fbee4f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5966
diff changeset
  8629
    (menuPanel isNil 
ff50c3fbee4f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5966
diff changeset
  8630
     or:[displayLabel isNil 
ff50c3fbee4f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5966
diff changeset
  8631
     or:[displayLabel isString
ff50c3fbee4f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5966
diff changeset
  8632
     or:[(device := menuPanel device) isNil]]]) ifTrue:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8633
        ^ self
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8634
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8635
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8636
    makeDeviceImage :=
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8637
        [:thingy |
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8638
            thingy isImageOrForm ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8639
                thingy onDevice:device.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8640
                "/ menuPanel imageOnMyDevice:thingy.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8641
            ] ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8642
                (thingy isLabelAndIcon) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8643
                    (icon := thingy image) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8644
                        thingy image:(icon onDevice:device)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8645
                        "/ thingy image:(menuPanel imageOnMyDevice:icon)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8646
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8647
                    (icon := thingy icon) notNil ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8648
                        thingy icon:(icon onDevice:device)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8649
                        "/ thingy icon:(menuPanel imageOnMyDevice:icon)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8650
                    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8651
                ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8652
                thingy
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8653
            ].    
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8654
       ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8655
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8656
    displayLabel isArray ifFalse:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8657
        displayLabel := makeDeviceImage value:displayLabel.
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8658
    ] ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8659
        displayLabel doWithIndex:[:el :i |
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8660
            (el notNil and:[el isString not]) ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8661
                displayLabel at:i put:(makeDeviceImage value:el)
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8662
            ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8663
        ]
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8664
    ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8665
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8666
    "Modified: / 04-02-2017 / 22:08:43 / cg"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8667
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8668
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8669
updateAccessCharacterFor:aLabel
4086
d4818ca73683 added: #processCollectedShortcutIndices:
Claus Gittinger <cg@exept.de>
parents: 4082
diff changeset
  8670
    "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
  8671
3192
a64a9c9143c4 shortcuts... processing
ca
parents: 3189
diff changeset
  8672
    accessCharacter notNil ifTrue:[^ aLabel].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8673
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8674
    aLabel isString ifFalse:[
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8675
        aLabel isLabelAndIcon ifTrue:[
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8676
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8677
        ].
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8678
        ^ aLabel
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8679
    ].
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8680
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8681
    ^ MenuPanel
5439
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8682
                processAmpersandCharactersFor:aLabel
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8683
                withAccessCharacterPosition:(menuItem accessCharacterPosition).
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8684
ab2f6d6f41de #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5416
diff changeset
  8685
    "Modified: / 04-02-2017 / 22:09:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8686
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8687
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8688
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8689
4556
fe119476cba3 class: MenuPanel
Stefan Vogel <sv@exept.de>
parents: 4554
diff changeset
  8690
printOn:aGCOrStream
4657
1cc679f1716d oops local variable named w
ca
parents: 4656
diff changeset
  8691
    aGCOrStream
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8692
        nextPutAll:self class name;
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8693
        nextPut:$(.
4139
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8694
    label displayOn:aGCOrStream.
77a120ffc684 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 4122
diff changeset
  8695
    aGCOrStream nextPut:$).
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8696
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  8697
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8698
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8699
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8700
activeBackgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8701
    "returns the active background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8702
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8703
    menuItem isButton ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8704
        ^ menuPanel buttonActiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8705
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8706
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8707
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8708
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8709
activeForegroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8710
    "returns the active foreground color derived from menuPanel"
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8711
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8712
    menuItem isButton ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8713
        ^ menuPanel buttonActiveForegroundColor
3441
b19a4c77490e flyby help fixed
Claus Gittinger <cg@exept.de>
parents: 3431
diff changeset
  8714
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8715
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8716
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  8717
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8718
backgroundColor
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8719
    "returns the background color derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8720
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8721
    menuItem isButton ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8722
        ^ menuPanel buttonPassiveBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8723
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8724
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8725
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  8726
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8727
backgroundColorFromLabel
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8728
    "returns the background color derived from label or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8729
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8730
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8731
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8732
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8733
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8734
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8735
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8736
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8737
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8738
    run size == 0 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8739
        (run value isColor and:[run key == #backgroundColor]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8740
            ^ run value
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8741
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8742
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8743
        run do:[:r|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8744
            (r value isColor and:[r key == #backgroundColor]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8745
                ^ r value
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8746
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8747
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8748
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8749
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8750
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8751
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8752
buttonEnteredBackgroundColor
5545
7743d24c910c #OTHER by mawalch
mawalch
parents: 5520
diff changeset
  8753
    "returns the background color to use when the mouse has entered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8754
     derived from menuPanel"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8755
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8756
    menuItem isButton ifTrue:[
5545
7743d24c910c #OTHER by mawalch
mawalch
parents: 5520
diff changeset
  8757
        ^ menuPanel buttonEnteredBackgroundColor
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  8758
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8759
    ^ menuPanel backgroundColor
5545
7743d24c910c #OTHER by mawalch
mawalch
parents: 5520
diff changeset
  8760
7743d24c910c #OTHER by mawalch
mawalch
parents: 5520
diff changeset
  8761
    "Modified (comment): / 23-05-2017 / 16:11:41 / mawalch"
5965
b4e8300e93ed #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
  8762
    "Modified: / 17-11-2018 / 11:00:38 / Claus Gittinger"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8763
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8764
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8765
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8766
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8767
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8768
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8769
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  8770
3866
fbdbf71489d8 show no menu, if there is no menu.
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  8771
    |subm sel numArgs gotMenu|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8772
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8773
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8774
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8775
    sel := menuItem submenuChannel.
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8776
    (sel isString or:[sel isSymbol]) ifFalse:[^ nil].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8777
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8778
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8779
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  8780
    numArgs == 0 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8781
        gotMenu := false.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8782
        MessageNotUnderstood handle:[:ex |
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8783
            |selector|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8784
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8785
            ((selector := ex selector) == sel
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8786
            or:[selector == #aspectFor:]) ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8787
                ex reject
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8788
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8789
        ] do:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8790
            subm := aRecv aspectFor:sel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8791
            gotMenu := true.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8792
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8793
        "/ used to be subm notNil; however, this is a bad test,
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8794
        "/ as it does not allow for the app to return nil for no-menu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8795
        gotMenu ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8796
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8797
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8798
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8799
    do:[:aPossibleReceiver |
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8800
        MessageNotUnderstood handle:[:ex|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8801
            ex message selector == sel ifFalse:[ ex reject ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8802
        ] do:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8803
            numArgs == 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8804
                subm := aPossibleReceiver perform:sel
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8805
            ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8806
                numArgs == 1 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8807
                    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8808
                ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8809
                    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8810
                ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8811
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8812
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8813
        subm notNil ifTrue:[^ subm].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8814
        Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8815
            "/ ('MenuPanel [info]: no submenu for "%1" from %2' bindWith:sel with:aPossibleReceiver) infoPrintCR.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8816
        ]
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8817
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  8818
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8819
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  8820
4027
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
  8821
    "Modified: / 24-03-2011 / 11:20:24 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8822
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  8823
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8824
indicationValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8825
    "returns indication value or nil in case of no indication"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8826
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8827
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8828
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8829
    indication isNil ifTrue:[^ nil].       "no indication specified"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8830
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8831
    indication isSymbol ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8832
        ^ 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
  8833
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8834
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8835
    numArgs := indication numArgs.
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  8836
    numArgs == 2 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8837
        recv := menuPanel receiver ? menuPanel application.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8838
        (recv notNil and:[recv isValueModel not]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8839
            sel := indication copyFrom:1 to:(indication indexOf:$:).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8840
            sel := sel asSymbol.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8841
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8842
            MessageNotUnderstood handle:[:ex|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8843
                ex selector ~~ sel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8844
                    ex reject.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8845
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8846
            ] do:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8847
                sel := recv perform:sel with:(menuItem argument).
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8848
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8849
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8850
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8851
        numArgs == 0 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8852
            sel := indication
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8853
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8854
            sel := (indication copyButLast:1) asSymbol.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8855
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8856
        sel := self aspectAt:sel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8857
        sel isValueModel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8858
            indication := sel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8859
            indication addDependent:self.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8860
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8861
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8862
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8863
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8864
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8865
indicationValue:aValue
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8866
    "set the indication value"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8867
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8868
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8869
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8870
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8871
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8872
    indication isSymbol ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8873
        indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8874
        ^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8875
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8876
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8877
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8878
        ^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8879
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8880
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  8881
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8882
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8883
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  8884
    recv isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8885
        recv := menuPanel application.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8886
        recv isNil ifTrue:[^ self].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8887
    ].
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8888
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8889
    MessageNotUnderstood handle:[:ex|
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8890
        (ex selector ~~ indication) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8891
            ex reject
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8892
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8893
        self ifNotInUIBuilderInfoPrintCR:
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8894
            ('MenuPanel::Item [info]: application (%1) does not respond to: %2'
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8895
             bindWith:recv classNameWithArticle
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8896
             with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  8897
    ] do:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8898
        numArgs == 1 ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8899
            recv perform:indication with:aValue
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8900
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8901
            recv perform:indication with:(menuItem argument ? self) with:aValue
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8902
        ]
4316
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8903
    ].
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8904
d3bab8fca92e class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4274
diff changeset
  8905
    "Modified (format): / 02-08-2013 / 16:42:20 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8906
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  8907
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8908
isEntered
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8909
    "returns true if the mouse pointer is over the item"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8910
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8911
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8912
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8913
    "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
  8914
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  8915
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  8916
separatorType
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8917
    "returns type of separator line or nil"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  8918
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8919
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8920
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8921
    self isSeparator ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8922
        ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8923
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8924
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8925
    (lbl := label value) isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8926
        ^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8927
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  8928
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  8929
    lbl size == 1 ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8930
        c := lbl first.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8931
        c == $- ifTrue:[^ #singleLine].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8932
        c == $= ifTrue:[^ #doubleLine].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8933
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  8934
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8935
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8936
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  8937
setupSubmenu
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  8938
    |appl submenuProvider master recv submenuHolder newSubmenu submenuEncoding
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8939
     channel whoProvidedMenu t|
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8940
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8941
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8942
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8943
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8944
    subMenu notNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8945
        menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8946
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8947
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8948
    channel isSymbol ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8949
        submenuHolder := channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  8950
    ] ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8951
        "/ submenu is specified by a selector in submenuChannel.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8952
        "/ who gets me the menu:
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8953
        "/ 1) submenuProvider (if not nil)
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8954
        "/ 2) menuPanel application
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8955
        "/ 3) menuPanel receiver
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8956
        "/ 4) menuPanel application master-chain
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8957
        "/ 5) menuPanel receiver master-chain
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8958
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8959
        (submenuProvider := menuItem submenuProvider) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8960
            submenuHolder := self findSubMenuIn:submenuProvider.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8961
            whoProvidedMenu := submenuProvider.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8962
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8963
        submenuHolder isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8964
            appl := menuPanel application.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8965
            (appl notNil and:[appl ~~ submenuProvider]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8966
                submenuHolder := self findSubMenuIn:appl.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8967
                whoProvidedMenu := appl.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8968
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8969
            submenuHolder isNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8970
                recv := menuPanel receiver.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8971
                (recv notNil and:[recv ~~ appl and:[recv ~~ submenuProvider]]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8972
                    submenuHolder := self findSubMenuIn:recv.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8973
                    whoProvidedMenu := recv.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8974
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8975
                (submenuHolder isNil and:[appl notNil]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8976
                    t := appl.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8977
                    [ submenuHolder isNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8978
                       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8979
                    ] whileTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8980
                       ( master ~~ appl
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8981
                        and:[ master ~~ recv
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8982
                        and:[ master ~~ submenuProvider ]] ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8983
                            submenuHolder := self findSubMenuIn:master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8984
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8985
                        t := master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8986
                        whoProvidedMenu := master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8987
                    ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8988
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8989
                (submenuHolder isNil and:[recv notNil]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8990
                    t := recv.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8991
                    [ submenuHolder isNil
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8992
                       and:[ (master := t perform:#masterApplication ifNotUnderstood:nil) notNil ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8993
                    ] whileTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8994
                       ( master ~~ appl
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8995
                        and:[ master ~~ recv
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8996
                        and:[ master ~~ submenuProvider ]] ) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8997
                            submenuHolder := self findSubMenuIn:master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8998
                        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  8999
                        t := master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9000
                        whoProvidedMenu := master.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9001
                    ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9002
                ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9003
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9004
        ].
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  9005
"/        submenuHolder isNil ifTrue:[
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  9006
"/            self halt:'did not find any menu'
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  9007
"/        ].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9008
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9009
"/        appl := menuPanel application.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9010
"/        appl isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9011
"/            appl := menuPanel receiver.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9012
"/            appl notNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9013
"/                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9014
"/                    [submenuHolder isNil
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9015
"/                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9016
"/                          and:[master ~~ appl]]] whileTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9017
"/                        appl := master.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9018
"/                        submenuHolder := self findSubMenuIn:appl.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9019
"/                    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9020
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9021
"/            ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9022
"/        ].
3938
21863d167bd7 Multi Screen Support
Michael Beyl <mb@exept.de>
parents: 3935
diff changeset
  9023
"/        submenuHolder isNil ifTrue:[
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9024
"/            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9025
"/                (recv := menuPanel receiver) ~~ appl ifTrue:[
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9026
"/                    appl := recv.
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9027
"/                    submenuHolder := self findSubMenuIn:appl
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9028
"/                ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9029
"/            ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9030
"/        ]
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9031
    ].
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9032
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9033
    (newSubmenu := submenuHolder value) isArray ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9034
        submenuEncoding := newSubmenu.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9035
        newSubmenu := Menu decodeFromLiteralArray:submenuEncoding.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9036
        "/ cg: linked menus also may contain translations ...
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9037
        newSubmenu notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9038
            whoProvidedMenu "appl" notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9039
                newSubmenu findGuiResourcesIn:whoProvidedMenu "appl".
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9040
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9041
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  9042
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  9043
    "/ appl notNil ifTrue:[submenu application:appl].
3934
5d1150f0174c fixed setupSubmenu;
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  9044
    self submenu:newSubmenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  9045
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  9046
3935
852001cc6bd5 no halt, if no menu is found
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
  9047
    "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
  9048
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  9049
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  9050
spaceBetweenEmptyLines
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9051
        ^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9052
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9053
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9054
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9055
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  9056
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  9057
    "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
  9058
     otherwise there is a change notification raised if the model changed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9059
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  9060
    ^ isVisible isSymbol or:[isVisible isValueModel]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  9061
"/  ^ isVisible notNil and:[isVisible ~~ true]
3112
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  9062
01341303806d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
  9063
    "Modified: / 11-10-2006 / 21:43:31 / cg"
3122
81ab6b6b4ff2 *** empty log message ***
fm
parents: 3112
diff changeset
  9064
    "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
  9065
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  9066
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9067
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  9068
    "returns true if item is selectable; no separator, visible and enabled.
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9069
     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
  9070
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  9071
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  9072
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  9073
    (self isVisible and:[self enabled]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9074
        (choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9075
            ^ true
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9076
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  9077
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  9078
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9079
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9080
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9081
containsPoint:aPoint
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9082
    "returns true if aPoint is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9083
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9084
    (self isVisible and:[layout notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9085
        ^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9086
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9087
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9088
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9089
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9090
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  9091
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9092
containsPointX:x y:y
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9093
    "returns true if point is contained in my layout"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9094
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9095
    (self isVisible and:[layout notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9096
        ^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  9097
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  9098
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9099
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9100
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9101
hasDelayedMenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9102
    "returns true if a delayed menu exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9103
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  9104
    self hasSubmenu ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9105
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9106
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  9107
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  9108
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  9109
    (indication isNil and:[choice isNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9110
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9111
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9112
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9113
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9114
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9115
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9116
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9117
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9118
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9119
    menuPanel isPopUpView ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9120
        ^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9121
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9122
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9123
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  9124
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  9125
hasIndication
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9126
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9127
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  9128
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  9129
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  9130
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9131
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9132
    "returns true if the item has a delayed menu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9133
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9134
5878
dd6288b8e551 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5877
diff changeset
  9135
    menuItem hasMenuIndicator ifTrue:[^ true]. 
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9136
    menuPanel isPopUpView ifFalse:[
5877
318821c17a46 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5876
diff changeset
  9137
        ^ (self hasSubmenu and:[menuItem isButton])
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9138
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9139
    ^ false
5877
318821c17a46 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5876
diff changeset
  9140
5878
dd6288b8e551 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5877
diff changeset
  9141
    "Modified: / 09-08-2018 / 17:11:49 / Claus Gittinger"
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9142
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  9143
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9144
hasSubmenu
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9145
    "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
  9146
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9147
    ^ subMenu notNil or:[ menuItem submenuChannel notNil ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9148
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9149
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9150
isEnabled
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9151
    "returns the enabled state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9152
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9153
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9154
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9155
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  9156
isSeparator
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9157
    "returns true if item is a separator"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9158
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  9159
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  9160
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  9161
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  9162
isToggle
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9163
    "returns true if on/off indication exists"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9164
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  9165
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  9166
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  9167
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9168
isVisible
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9169
    "returns the visibility state"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9170
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9171
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9172
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9173
    menuPanel isNil ifTrue:[^ false].
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9174
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9175
    isVisible isSymbol ifTrue:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9176
        state := self aspectAt:isVisible.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9177
        state isValueModel ifTrue:[
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9178
            isVisible := state.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9179
            isVisible addDependent:self.
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9180
        ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9181
    ] ifFalse:[
4757
b977993f91f2 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4756
diff changeset
  9182
        state := isVisible
4119
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  9183
    ].
f5cb7a477fbe Do not log duplicate error messages fpr missing aspect method
Stefan Vogel <sv@exept.de>
parents: 4118
diff changeset
  9184
    ^ state value ~~ false
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  9185
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  9186
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9187
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9188
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9189
isVisible:something
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9190
    "change the visibility state; if the state changed, a redraw is performed"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9191
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9192
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9193
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9194
    isVisible isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9195
        oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9196
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9197
        oldState := isVisible value.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9198
        isVisible isValueModel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9199
            isVisible removeDependent:self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9200
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9201
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9202
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9203
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9204
    isVisible isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9205
        newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9206
    ] ifFalse:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9207
        isVisible isValueModel ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9208
            isVisible addDependent:self
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9209
        ] ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9210
            isVisible isSymbol ifTrue:[^ self]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9211
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9212
        menuPanel shown ifFalse:[^ self].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9213
        newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9214
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9215
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9216
    newState ~~ oldState ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9217
        menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9218
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  9219
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  9220
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9221
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  9222
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9223
menuIndicatorContains:aPoint
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9224
    "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
  9225
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9226
    |icon xSep|
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9227
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9228
    (self isVisible and:[layout notNil]) ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9229
        (layout containsPoint:aPoint) ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9230
            icon := self menuIndicatorIcon.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9231
            icon notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9232
                xSep := layout right - icon width.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9233
                ^ aPoint x >= xSep
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9234
            ]
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9235
        ]
3411
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9236
    ].
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9237
    ^ false
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9238
!
a7a58a10cdcd extra menu-indicator click behavior
Claus Gittinger <cg@exept.de>
parents: 3403
diff changeset
  9239
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  9240
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  9241
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  9242
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  9243
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9244
shortcutKeyAsString
3601
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  9245
    "converts shortcutKey to a text object for the menu-label-hint.
e6e26baefa03 comment
Claus Gittinger <cg@exept.de>
parents: 3580
diff changeset
  9246
     returns nil, if the key has no assignment."
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9247
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  9248
    |shortcutKey|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  9249
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  9250
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  9251
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  9252
    shortcutKey isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9253
        ^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  9254
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  9255
    shortcutKey isCharacter ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9256
        shortcutKey == Character space ifFalse:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9257
            ^ 'Space'
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9258
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9259
        ^ shortcutKey asString
2972
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  9260
    ].
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  9261
    ^ menuPanel device shortKeyStringFor:shortcutKey.
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  9262
65841fbd0933 shortKey handling moved to device (shared between menu and menuPanel)
Claus Gittinger <cg@exept.de>
parents: 2936
diff changeset
  9263
    "Modified: / 08-08-2006 / 15:46:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9264
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9266
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9267
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9268
isSelected
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9269
    "returns true if item is selected"
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  9270
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  9271
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9272
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9273
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  9274
isSelected:isSelected
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9275
    "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
  9276
     submenu and perform a redraw"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9277
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  9278
    (isSelected and:[menuPanel notNil]) ifFalse:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9279
        self invalidate.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9280
        self hideSubmenu.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9281
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  9282
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  9283
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9284
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9285
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  9286
    (indication isNil or:[menuItem isButton not]) ifTrue:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9287
        self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9288
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9289
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9290
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9291
    self hasDelayedMenu ifTrue:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9292
        menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9293
    ] ifFalse:[
5127
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9294
        self setupSubmenu.
bdd70bb582e2 #OTHER by mawalch
mawalch
parents: 5094
diff changeset
  9295
        subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  9296
    ].
3133
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  9297
dd8417f3373b code cleanup; comments
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  9298
    "Modified: / 07-11-2006 / 11:08:03 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9299
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9300
4755
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9301
!MenuPanel::Item methodsFor:'testing'!
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9302
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9303
isMenuItem
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9304
    "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
  9305
     true is returned here - I am a menuitem"
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9306
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9307
    ^ true
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9308
! !
71a9b07691d8 class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4726
diff changeset
  9309
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9310
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9311
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9312
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9313
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9314
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9315
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9316
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9317
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9318
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9319
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9320
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  9321
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9322
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9323
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9324
icon
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9325
    ^ self iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9326
! !
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9327
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9328
!MenuPanel::ScrollActivity class methodsFor:'image specs'!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9329
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9330
iconBlack
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9331
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9332
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9333
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9334
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9335
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9336
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9337
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9338
     self iconBlack inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9339
     ImageEditor openOnClass:self andSelector:#iconBlack
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9340
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9341
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9342
4587
aab0e076929e Use ImageMask instead of Depth1Image for masks
Stefan Vogel <sv@exept.de>
parents: 4556
diff changeset
  9343
    <resource: #image>
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9344
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9345
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9346
        constantNamed:'MenuPanel::ScrollActivity iconBlack'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9347
        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
  9348
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9349
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9350
iconGrey
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9351
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9352
     by the ImageEditor of ST/X."
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9353
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9354
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9355
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9356
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9357
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9358
     self iconGrey inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9359
     ImageEditor openOnClass:self andSelector:#iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9360
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9361
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9362
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9363
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9364
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9365
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9366
        constantNamed:'MenuPanel::ScrollActivity iconGrey'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9367
        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
  9368
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9369
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9370
iconGrey3D
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9371
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9372
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9373
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9374
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9375
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9376
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9377
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9378
     self iconGrey inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9379
     ImageEditor openOnClass:self andSelector:#iconGrey
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9380
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9381
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9382
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9383
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9384
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9385
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9386
        constantNamed:'MenuPanel::ScrollActivity iconGrey'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9387
        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
  9388
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9389
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9390
iconScrollLeft
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9391
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9392
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9393
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9394
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9395
     the ImageEditor may not be able to read the specification."
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9396
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9397
    "
4843
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9398
     self iconScrollLeft inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9399
     ImageEditor openOnClass:self andSelector:#iconScrollLeft
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9400
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9401
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9402
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9403
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9404
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9405
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9406
        constantNamed:'MenuPanel::ScrollActivity iconScrollLeft'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9407
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9408
@@@@@@@@@@@@@@@@@@@@@@@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
  9409
@@@@@@@@@@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
  9410
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9411
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9412
iconScrollLeftM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9413
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9414
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9415
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9416
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9417
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9418
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9419
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9420
     self iconScrollLeftM inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9421
     ImageEditor openOnClass:self andSelector:#iconScrollLeftM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9422
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9423
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9424
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9425
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9426
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9427
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9428
        constantNamed:'MenuPanel::ScrollActivity iconScrollLeftM'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9429
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9430
@@@@@@@@@@@@@@@@@@@@@@@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
  9431
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
  9432
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9433
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9434
iconScrollRight
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9435
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9436
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9437
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9438
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9439
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9440
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9441
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9442
     self iconScrollRight inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9443
     ImageEditor openOnClass:self andSelector:#iconScrollRight
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9444
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9445
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9446
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9447
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9448
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9449
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9450
        constantNamed:'MenuPanel::ScrollActivity iconScrollRight'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9451
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9452
@@@@@@@@@@@@@@@@@@@@@A4#LP@@@@@@@@@@@A@@D!!4@@@@@@@@@@B BBP8(@@@@@@@@@A8AJR8KH@@@@@@@@@@^A!! ZIA$@@@@@@@@@G (VK@PL@@@@@@@@
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9453
@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
  9454
!
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9455
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9456
iconScrollRightM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9457
    "This resource specification was automatically generated
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9458
     by the ImageEditor of ST/X."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9459
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9460
    "Do not manually edit this!! If it is corrupted,
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9461
     the ImageEditor may not be able to read the specification."
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9462
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9463
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9464
     self iconScrollRightM inspect
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9465
     ImageEditor openOnClass:self andSelector:#iconScrollRightM
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9466
     Icon flushCachedIcons
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9467
    "
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9468
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9469
    <resource: #image>
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9470
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9471
    ^Icon
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9472
        constantNamed:'MenuPanel::ScrollActivity iconScrollRightM'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9473
        ifAbsentPut:[(Depth8Image width:12 height:14) bits:(ByteArray fromPackedString:'
44fa167c61ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 4826
diff changeset
  9474
@@@@@@@@@@@@@@@@@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
  9475
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
  9476
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9477
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9478
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9479
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9480
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9481
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9482
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9483
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9484
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9485
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9486
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9487
    "returns the active menu the scrolling is activated on; nil
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9488
     is returned if scrolling is deactivated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9489
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9490
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9491
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9492
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9493
direction
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9494
    "returns the scroll-direction"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9495
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9496
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9497
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9498
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9499
iconAt:aDirection on:aMenu
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9500
    |icon menusDevice index|
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9501
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9502
    menusDevice := aMenu device.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9503
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9504
    aDirection == #PREV ifTrue:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9505
        aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9506
                            ifFalse:[index := 2]    "/ 2 - 1 * 90  90
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9507
    ] ifFalse:[
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9508
        aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9509
                            ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9510
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9511
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9512
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9513
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9514
    (icon isNil or:[icon device ~~ menusDevice]) ifTrue:[
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9515
        icon := self class icon.
5333
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9516
        index > 1 ifTrue:[ icon := icon rotated:((index - 1) * 90) ]
5001
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9517
                 ifFalse:[ icon := icon copy ].
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9518
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9519
        icon := icon onDevice:menusDevice.
8e6f4f872865 device access
Claus Gittinger <cg@exept.de>
parents: 4910
diff changeset
  9520
        icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9521
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9522
    ^ icon
5333
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9523
2b7391c82d5c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  9524
    "Modified (format): / 16-11-2016 / 23:12:59 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9525
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9526
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9527
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9528
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9529
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9530
5573
1be3b54eeb1d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5559
diff changeset
  9531
    semaLock := RecursionLock name:'MenuPanel ScrollActivity'.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  9532
    icons    := Array new:4.
5573
1be3b54eeb1d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5559
diff changeset
  9533
1be3b54eeb1d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5559
diff changeset
  9534
    "Modified: / 09-08-2017 / 11:55:24 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9535
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9536
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9537
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9538
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9539
isActive
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9540
    "returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9541
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9542
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9543
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9544
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  9545
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9546
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  9547
startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9548
    "start scrolling; returns true if scrolling is activated"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9549
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9550
    |isScrolledMenu|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9551
"/true ifTrue:[^ self __startIfRequiredAt:aDirection on:aMenu comesViaButtonPress:comesViaButtonPress].
2860
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  9552
300aa94bb73e A2989: redraw optimieren
ca
parents: 2855
diff changeset
  9553
    isScrolledMenu := (aDirection notNil and:[aMenu notNil and:[aMenu hasScrollers]]).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9554
4826
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9555
    semaLock critical:[ |bounds boundsOnRoot|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9556
        self stop.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9557
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9558
        (aMenu notNil and:[aMenu shown and:[aMenu hasScrollerAt:aDirection]]) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9559
            bounds := aMenu scrollerBoundsAt:aDirection.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9560
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9561
            comesViaButtonPress ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9562
                boundsOnRoot := Rectangle origin:(aMenu device translatePointToRoot:(bounds origin) fromView:aMenu)
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9563
                                          extent:(bounds extent).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9564
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9565
            "clear selection"
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9566
            aMenu selection:nil openMenu:false.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9567
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9568
            activeMenu := aMenu.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9569
            direction  := aDirection.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9570
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9571
            (aMenu hasScrollerAt:aDirection) ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9572
                scrollTask :=
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9573
                    [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9574
                        |continue|
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9575
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9576
                        [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9577
                            aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9578
                            Delay waitForSeconds:(ButtonController defaultInitialDelay).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9579
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9580
                            [
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9581
                                continue := aMenu shown.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9582
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9583
                                boundsOnRoot notNil ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9584
                                    continue ifTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9585
                                        continue := boundsOnRoot containsPoint:aMenu sensor mousePoint.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9586
                                    ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9587
                                        boundsOnRoot := nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9588
                                    ]
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9589
                                ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9590
                                continue
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9591
                            ]  whileTrue:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9592
                                aDirection == #PREV ifTrue:[aMenu scrollUp] ifFalse:[aMenu scrollDown].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9593
                                Delay waitForSeconds:(ButtonController defaultRepeatDelay).
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9594
                            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9595
                        ] ensure:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9596
                            activeMenu := direction := scrollTask := nil.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9597
                            aMenu invalidate:bounds.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9598
                        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9599
                    ] forkAt:8.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9600
            ] ifFalse:[
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9601
                aMenu invalidate:bounds.
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9602
            ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9603
        ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9604
    ].
75fcddc0d086 class: MenuPanel
ca
parents: 4786
diff changeset
  9605
    ^ scrollTask notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  9606
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9607
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9608
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  9609
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9610
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9611
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9612
stop
2870
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9613
    "stop scrolling; returns true if the scrolling was activated otherwise false"
0a92cf0052f5 ugly comments
Claus Gittinger <cg@exept.de>
parents: 2869
diff changeset
  9614
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9615
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9616
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9617
    activeMenu isNil ifTrue:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9618
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9619
    ].
3295
53616022ca5f activate scroller if button is pressed and moved over scroller
ca
parents: 3246
diff changeset
  9620
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9621
    semaLock critical:[
5707
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9622
        resp := activeMenu notNil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9623
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9624
        (task := scrollTask) notNil ifTrue:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9625
            scrollTask := nil.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9626
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9627
            Error handle:[:ex|
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9628
            ] do:[
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9629
                task terminateWithAllSubprocessesInGroup.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9630
                task waitUntilTerminated.
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9631
            ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9632
        ].
1344a1eaf146 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5705
diff changeset
  9633
        activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9634
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9635
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9636
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  9637
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9638
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9639
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9640
version
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  9641
    ^ '$Header$'
4109
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9642
!
ed4578d2f007 changed: #maxExtent
Claus Gittinger <cg@exept.de>
parents: 4108
diff changeset
  9643
3780
14184c505e24 changed:
Claus Gittinger <cg@exept.de>
parents: 3754
diff changeset
  9644
version_CVS
4786
7ade4c08f4eb class: MenuPanel
Claus Gittinger <cg@exept.de>
parents: 4782
diff changeset
  9645
    ^ '$Header$'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9646
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  9647
4167
9b0b4f8a3b90 changed: #keyPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4153
diff changeset
  9648
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  9649
MenuPanel initialize!