MenuPanel.st
author Stefan Vogel <sv@exept.de>
Tue, 13 Jul 2004 10:46:33 +0200
changeset 2731 7382424af8d9
parent 2729 d28bc8243494
child 2736 f6869c5b9108
permissions -rw-r--r--
Don't carsh when typing SPACE in PopUpList
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     1
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
     3
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     4
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     5
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     6
 only in accordance with the terms of that license and with the
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
     9
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    10
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    11
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    12
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
2182
59a770bbb95a changed superclass to View (to inherit model)
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
    16
View subclass:#MenuPanel
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    17
	instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    18
		shortKeyInset selection items groupSizes receiver enabled
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    19
		lastActiveMenu enteredItem prevFocusView previousPointerGrab
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
    20
		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
    21
		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
    22
		showSeparatingLines showGroupDivider implicitGrabView
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
    23
		lastPointerView openDelayedMenuBlock preferredWidth application
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
    24
		originator centerItems hideOnRelease defaultHideOnRelease'
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
    25
	classVariableNames:'InitialSelectionQuerySignal Images LigthenedImages
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
    26
		DefaultForegroundColor DefaultBackgroundColor'
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    27
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    28
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    29
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    30
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    31
Object subclass:#Item
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    32
	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    33
		disabledDisplayLabel enableChannel label activeHelpText
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
    34
		flyByHelpText isVisible indication choice accessCharacter'
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    35
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    36
		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    37
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    38
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    39
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    40
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    41
Object subclass:#Adornment
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    42
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    43
		choice choiceValue'
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    44
	classVariableNames:''
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    45
	poolDictionaries:''
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    46
	privateIn:MenuPanel::Item
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    47
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
    48
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
    49
Object subclass:#ScrollActivity
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    50
	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    51
	classVariableNames:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    52
	poolDictionaries:''
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    53
	privateIn:MenuPanel
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    54
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
    55
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    56
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    57
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    58
copyright
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    59
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    60
 COPYRIGHT (c) 1997 by eXept Software AG
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
    61
	      All Rights Reserved
2005
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    62
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    63
 This software is furnished under a license and may be used
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    64
 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
    65
 inclusion of the above copyright notice.   This software may not
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    66
 be provided or otherwise made available to, or used by, any
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    67
 other person.  No title to or ownership of the software is
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    68
 hereby transferred.
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    69
"
a85fab2cc6f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2004
diff changeset
    70
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    71
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    72
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    73
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    74
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    75
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    76
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    77
    this will eventually replace most of the MenuView and PopUpMenu stuff.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    80
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    81
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    82
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    83
2061
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    84
    Notice:
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    85
        This is going to replace the obsolete MenuView.
faf64f2cd28e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2059
diff changeset
    86
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    87
    [author:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    88
        Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    89
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    90
    [see also:]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    91
        Menu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    92
        MenuItem
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
    93
        MenuEditor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    94
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    95
    cg: this code is so ugly - needs a complete rewrite...
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
    96
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    97
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    98
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    99
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   100
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
    start as PullDownMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   104
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   108
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   109
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   110
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   111
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   115
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   121
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   122
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   123
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   126
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   127
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   128
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   130
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   131
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   133
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   134
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   136
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   137
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   140
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   142
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   143
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
    top open.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   145
										[exEnd]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   146
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   147
										[exBegin]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   148
    |top menu view item|
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   149
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   150
    top  := StandardSystemView extent:240@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   151
    menu := MenuPanel in:top.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   152
    menu labels:#( 'foo' 'Application' 'Clock' ).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   153
    menu verticalLayout:false.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   154
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   155
    menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   156
    menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   157
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   158
    view := ClockView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   159
    view preferredExtent:100@100.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   160
    item := menu itemAt:3.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   161
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   162
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   163
    view := SimpleView new.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   164
    view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   165
    view preferredExtent:(400@50).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   166
    item := menu itemAt:2.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   167
    item submenu:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   168
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   169
    menu origin:0@0 corner:1.0@30.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
   170
    top open.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   171
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   173
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   174
    start as PopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   175
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   176
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   177
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   178
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   179
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   180
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   181
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   182
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   183
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   184
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   185
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   186
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   187
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   188
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   189
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   190
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   191
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   192
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   193
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   195
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   196
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   197
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   198
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   199
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   200
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   201
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   202
    mview startUp
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   203
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   204
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   205
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   206
    start from menu spec
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   207
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   208
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   209
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   210
    menu := MenuPanel menu:
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   211
	#(#Menu #( #(#MenuItem 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   212
		    #label: 'File' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   213
		    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   214
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   215
				 (#MenuItem 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   216
				    #label: 'edit' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   217
				    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   218
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   219
						 #(#MenuItem #label: 'close' #value:#close)     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   220
					       )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   221
					       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   222
					       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   223
				       )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   224
				  )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   225
				 #(#MenuItem #label: 'help' #value:#help )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   226
			       )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   227
			       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   228
			       nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   229
		       )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   230
		 ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   231
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   232
		#(#MenuItem #label: 'Bar' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   233
			    #submenu:
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   234
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   235
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   236
					)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   237
					nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   238
					nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   239
				)     
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   240
		 ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   241
	      ) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   242
	      #( 2 )
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   243
	      nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   244
	 ) decodeAsLiteralArray.  
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   245
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   246
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   247
    Transcript showCR:(menu startUp).
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   248
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   249
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   250
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   251
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   255
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   256
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   257
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   261
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   263
    aSpec notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   264
	menu := Menu new.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   265
	menu receiver:aReceiver.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   266
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   289
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   290
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   291
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   292
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   295
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   297
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   299
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   300
    mview := self new.
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   301
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   302
    (aMenu notNil and:[aMenu receiver isNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   303
	"/ no receiver specified in the menu; thus set the receiver immediately
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   304
	mview receiver:aReceiver
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   305
    ].
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   306
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   308
1955
dea13bc1f1e0 bug fix when setting the receiver
ca
parents: 1929
diff changeset
   309
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   310
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   311
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   313
    aReceiver notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   314
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   315
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   316
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   317
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   318
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   319
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   320
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   321
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   322
    InitialSelectionQuerySignal isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   323
        InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   324
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   325
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   326
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   327
     self initialize
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   328
    "
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   329
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   330
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   331
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   332
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   333
preSnapshot
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   334
    "remove all resources"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   335
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   336
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   337
    LigthenedImages := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   338
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   339
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   340
!MenuPanel class methodsFor:'default icons'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   341
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   342
delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   343
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   344
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   345
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   346
    "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
   347
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   348
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   349
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   350
     self delayedMenuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   351
     ImageEditor openOnClass:self andSelector:#delayedMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   352
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   353
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   354
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   355
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   356
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   357
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   358
        constantNamed:#'MenuPanel class delayedMenuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   359
        ifAbsentPut:[(Depth1Image new) width: 7; height: 6; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@HCB') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 6; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@J+V[C P') ; yourself); yourself]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   360
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   361
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   362
iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   363
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   364
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   365
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   366
    "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
   367
     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
   368
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   369
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   370
     self iconIndicationDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   371
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   372
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   373
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   374
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   375
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   376
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   377
	constantNamed:#'MenuPanel iconIndicationDisabledOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   378
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A:***@^*** G***(A:***@^*** G***(A:***@^*** G***(A:***@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   379
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   380
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   381
iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   382
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   383
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   384
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   385
    "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
   386
     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
   387
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   388
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   389
     self iconIndicationDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   390
     ImageEditor openOnClass:self andSelector:#iconIndicationDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   391
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   392
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   393
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   394
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   395
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   396
	constantNamed:#'MenuPanel iconIndicationDisabledOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   397
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBO???P#???4H??<=BO?<OP#O<C4H0<C=BL@C?P#0C?4H?C?=BO???P/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   398
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   399
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   400
iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   401
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   402
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   403
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   404
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   405
     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
   406
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   407
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   408
     self iconIndicationOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   409
     ImageEditor openOnClass:self andSelector:#iconIndicationOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   410
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   411
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   412
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   413
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   414
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   415
	constantNamed:#'MenuPanel iconIndicationOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   416
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   417
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   418
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   419
iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   420
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   421
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   422
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   423
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   424
     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
   425
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   426
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   427
     self iconIndicationOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   428
     ImageEditor openOnClass:self andSelector:#iconIndicationOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   429
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   430
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   431
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   432
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   433
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   434
	constantNamed:#'MenuPanel iconIndicationOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   435
	ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   436
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   437
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   438
iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   439
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   440
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   441
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   442
    "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
   443
     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
   444
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   445
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   446
     self iconRadioGroupDisabledOff inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   447
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOff
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   448
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   449
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   450
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   451
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   452
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   453
	constantNamed:#'MenuPanel iconRadioGroupDisabledOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   454
	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]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   455
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   456
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   457
iconRadioGroupDisabledOn
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   458
    "This resource specification was automatically generated
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   459
     by the ImageEditor of ST/X."
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   460
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   461
    "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
   462
     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
   463
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   464
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   465
     self iconRadioGroupDisabledOn inspect
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   466
     ImageEditor openOnClass:self andSelector:#iconRadioGroupDisabledOn
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   467
     Icon flushCachedIcons
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   468
    "
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   469
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   470
    <resource: #image>
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   471
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   472
    ^Icon
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   473
        constantNamed:#'MenuPanel class iconRadioGroupDisabledOn'
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
   474
        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]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   475
!
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
   476
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   477
iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   478
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   479
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   480
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   481
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   482
     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
   483
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   484
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   485
     self iconRadioGroupOff inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   486
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOff
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   487
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   488
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   489
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   490
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   491
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   492
	constantNamed:#'MenuPanel iconRadioGroupOff'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   493
	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]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   494
!
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   495
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   496
iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   497
    "This resource specification was automatically generated
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   498
     by the ImageEditor of ST/X."
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   499
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   500
    "Do not manually edit this!! If it is corrupted,
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   501
     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
   502
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   503
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   504
     self iconRadioGroupOn inspect
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   505
     ImageEditor openOnClass:self andSelector:#iconRadioGroupOn
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   506
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   507
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   508
    <resource: #image>
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   509
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   510
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   511
	constantNamed:#'MenuPanel iconRadioGroupOn'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   512
	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]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   513
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   514
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   515
menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   516
    "This resource specification was automatically generated
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   517
     by the ImageEditor of ST/X."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   518
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   519
    "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
   520
     the ImageEditor may not be able to read the specification."
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   521
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   522
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   523
     self menuIndicator inspect
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   524
     ImageEditor openOnClass:self andSelector:#menuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   525
     Icon flushCachedIcons
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   526
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   527
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   528
    <resource: #image>
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   529
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   530
    ^Icon
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   531
        constantNamed:#'MenuPanel::Item class menuIndicator'
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   532
        ifAbsentPut:[(Depth1Image new) width: 7; height: 4; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@B@0 @a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 7; height: 4; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?''08D@@a') ; yourself); yourself]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
   533
! !
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
   534
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   535
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   536
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   537
defaultBackgroundColor
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   538
    DefaultBackgroundColor notNil ifTrue:[^ DefaultBackgroundColor].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   539
    ^ StyleSheet at:#'pullDownMenu.backgroundColor' default:DefaultViewBackgroundColor.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   540
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   541
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   542
defaultLevel
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   543
    ^ StyleSheet at:#'pullDownMenu.level' default:1
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   544
"
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   545
self defaultLevel
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   546
"
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   547
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   548
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   549
delayedMenuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   550
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   551
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   552
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   553
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   554
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   555
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   556
menuIndicatorOffset
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   557
    "returns an additional offset between the label and the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   558
     delayedMenu indication (i.e. the down-arrow icon)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   559
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   560
    ^ 1 "2"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   561
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
   562
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   563
mnemonicIdentifier
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   564
    "returns the identifier each mnemonic starts with;
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   565
     ex:
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   566
        &File   mnemonic := Cmdf
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   567
        F&ile   mnemonic := Cmdi
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   568
        ....."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   569
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   570
    ^ 'Cmd'
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   571
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
   572
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   573
updateStyleCache
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   574
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   575
    <resource: #style (
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   576
        #'popup.borderWidth' #'popup.level' 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   577
        #'selection.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   578
        #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   579
        #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   580
        #'menu.buttonItemVerticalSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   581
        #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   582
        #'menu.hilightLevel' #'menu.enteredLevel'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   583
        #'menu.groupDividerSize' #'menu.itemMargin'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   584
        #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   585
        #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   586
        #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   587
        #'menu.selectionFollowsMouse'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   588
        #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   589
        #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   590
        #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   591
        #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   592
    )>
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   593
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   594
    |styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   595
    buttonActiveLevel buttonPassiveLevel buttonEnteredLevel|
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   596
2611
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   597
    "clear DefaultBackgroundColor caused by accessing the #defaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   598
     which returns the default cashed DefaultBackgroundColor
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   599
    "
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   600
    DefaultBackgroundColor := nil.
9814b5547d63 bugfix: backgroundColor after loading new style
ca
parents: 2610
diff changeset
   601
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   602
    MenuView            updateStyleCache.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   603
    SelectionInListView updateStyleCache.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   604
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   605
    styleSheet  := StyleSheet.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   606
    style       := styleSheet name.
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
   607
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   608
    DefaultFont     := MenuView defaultFont.
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   609
    foregroundColor := DefaultForegroundColor := styleSheet colorAt:#'pullDownMenu.foregroundColor' default:Color black.
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
   610
    backgroundColor := DefaultBackgroundColor := self defaultBackgroundColor.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   611
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   612
    var := styleSheet at:#'menu.buttonItemHorizontalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   613
    var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   614
    styleSheet at:#'menuPanel.buttonInsetX' put:(var abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   615
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   616
    var := styleSheet at:#'menu.buttonItemVerticalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   617
    var isNil ifTrue:[ var := styleSheet at:#'menu.buttonItemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   618
    styleSheet at:#'menuPanel.buttonInsetY' put:(var abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   619
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   620
    var := styleSheet at:#'menu.itemHorizontalSpace'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   621
    var isNil ifTrue:[ var := styleSheet at:#'menu.itemSpace' default:0 ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   622
    styleSheet at:#'menuPanel.itemSpace' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   623
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   624
    var := styleSheet colorAt:#'menu.hilightBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   625
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   626
        style == #motif ifTrue:[ var := backgroundColor ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   627
                       ifFalse:[ var := styleSheet is3D ifFalse:[foregroundColor] ifTrue:[backgroundColor] ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   628
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   629
    styleSheet at:#'menuPanel.activeBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   630
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   631
    var := styleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   632
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledEtchedForegroundColor' ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   633
    styleSheet at:#'menuPanel.disabledEtchedFgColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   634
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   635
    var := styleSheet colorAt:#'menu.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   636
    var isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   637
        var := styleSheet colorAt:#'selection.disabledForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   638
        var isNil ifTrue:[ var := styleSheet colorAt:#'button.disabledForegroundColor' default:Color darkGray ]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   639
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   640
    styleSheet at:#'menuPanel.disabledForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   641
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   642
    var := styleSheet colorAt:#'menu.hilightForegroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   643
    var isNil ifTrue:[ var := styleSheet is3D ifTrue:[foregroundColor] ifFalse:[backgroundColor] ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   644
    styleSheet at:#'menuPanel.activeForegroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   645
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   646
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   647
    buttonActiveLevel := styleSheet at:#'menu.buttonActiveLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]).
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   648
    buttonActiveLevel isNil ifTrue:[ buttonActiveLevel := styleSheet at:#'button.activeLevel' default:(styleSheet is3D ifTrue:[-2] ifFalse:[0]) ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   649
    styleSheet at:#'menuPanel.buttonActiveLevel' put:buttonActiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   650
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   651
    buttonPassiveLevel := styleSheet at:#'menu.buttonPassiveLevel'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   652
    buttonPassiveLevel isNil ifTrue:[ buttonPassiveLevel :=  styleSheet at:#'button.passiveLevel' default:(styleSheet is3D ifTrue:[2] ifFalse:[0])].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   653
    styleSheet at:#'menuPanel.buttonPassiveLevel' put:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   654
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   655
    buttonEnteredLevel := styleSheet at:#'menu.buttonEnteredLevel' default:buttonPassiveLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   656
    styleSheet at:#'menuPanel.buttonEnteredLevel' put:buttonEnteredLevel.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   657
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   658
    var := (buttonActiveLevel abs max:(buttonPassiveLevel abs)) max:(buttonEnteredLevel abs).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   659
    styleSheet at:#'menuPanel.maxAbsoluteButtonLevel' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   660
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   661
    buttonPassiveBackgroundColor := styleSheet at:#'button.backgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   662
    buttonPassiveBackgroundColor isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   663
        buttonPassiveBackgroundColor := (styleSheet at:'viewBackground') ? backgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   664
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   665
    styleSheet at:#'menuPanel.buttonPassiveBackgroundColor' put:buttonPassiveBackgroundColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   666
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   667
    var := styleSheet at:#'button.lightColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   668
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   669
    styleSheet at:#'menuPanel.buttonLightColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   670
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   671
    var :=  styleSheet at:#'button.shadowColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   672
    var isNil ifTrue:[ var := (buttonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   673
    styleSheet at:#'menuPanel.buttonShadowColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   674
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   675
    var := styleSheet colorAt:#'menu.buttonEnteredBackgroundColor'.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   676
    var isNil ifTrue:[ var := styleSheet colorAt:#'button.enteredBackgroundColor' default:buttonPassiveBackgroundColor ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   677
    styleSheet at:#'menuPanel.buttonEnteredBackgroundColor' put:var.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   678
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   679
    Item updateStyleCache.
2607
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   680
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   681
    "
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   682
     self updateStyleCache
5eecd27af4e4 *** empty log message ***
ca
parents: 2604
diff changeset
   683
    "
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   684
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   685
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   686
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   687
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   688
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   689
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   690
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   691
"
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   692
    |deviceImages|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   693
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   694
    anImage device == aDevice ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   695
        ^ anImage
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   696
    ].
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   697
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   698
    Images isNil ifTrue:[ Images := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   699
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   700
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   701
        Images at:aDevice put:(deviceImages := Dictionary new)
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   702
    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   703
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   704
    ^ deviceImages at:anImage ifAbsentPut:[ |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   705
        image := anImage copy onDevice:aDevice.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   706
        image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   707
        deviceImages at:anImage put:image.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   708
        image
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
   709
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   710
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   711
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   712
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   713
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   714
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   715
"
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   716
    |deviceImages image colorMap|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   717
1853
399e2eac3b99 Use WeakIdentityDictionaries to cache images per Workstation.
Stefan Vogel <sv@exept.de>
parents: 1841
diff changeset
   718
    LigthenedImages isNil ifTrue:[ LigthenedImages := WeakIdentityDictionary new ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   719
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   720
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   721
        LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   722
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   723
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   724
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   725
        ^ image
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   726
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   727
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   728
    colorMap := anImage perform:#colorMap ifNotUnderstood:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   729
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   730
    colorMap notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   731
        image := anImage copy lightened onDevice:aDevice.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   732
        image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   733
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
   734
        image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   735
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   736
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   737
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   738
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   739
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   740
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   741
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   742
subMenu:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   743
    "create a submenu; can be redifined in derived classes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   744
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   745
    ^ (self new) menu:aSubMenu.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   746
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   747
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   748
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   749
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   750
!MenuPanel methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   751
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   752
accept
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   753
    "accept current selected item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   754
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   755
    ^ self acceptItem:(self selection) inMenu:self
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   756
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   757
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   758
accept:anItem 
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   759
    "this is the topMenu: accept item "
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
   760
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   761
    |value item tgState itemIdx recv panel masterGroup winGrp acceptAction|
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   762
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   763
    self superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   764
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   765
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   766
    self openDelayed:nil.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
   767
    self scrollActivity stop.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   768
    self selection:nil.
420
ca
parents: 417
diff changeset
   769
ca
parents: 417
diff changeset
   770
    (anItem notNil and:[anItem canAccept]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   771
        tgState := anItem toggleIndication.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   772
        panel   := anItem menuPanel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   773
        itemIdx := panel findFirst:[:el| el == anItem ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   774
        item    := anItem.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   775
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   776
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   777
    self doUngrab:true.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   778
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   779
    self isPopUpView ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   780
        self do:[:el| el updateIndicators].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   781
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   782
    ] ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   783
        self unmap.
2712
8a5f94b10261 late expose event bug fixed
ca
parents: 2696
diff changeset
   784
        self device sync. "/ round trip - all expose events are now received
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   785
        (winGrp := self windowGroup) notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   786
            "/ give expose event a chance to arrive
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   787
            [shown and:[realized]] whileTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   788
                winGrp processExposeEventsFor:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   789
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   790
            masterGroup := winGrp previousGroup.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   791
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   792
        "/ cg: disabled-not needed - try PopUpList with destroy...
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   793
        "/ self destroy.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   794
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   795
    ].
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   796
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   797
    acceptAction := [ value := self accept:item index:itemIdx toggle:tgState receiver:recv ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   798
1710
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   799
    (item notNil 
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   800
    and:[item showBusyCursorWhilePerforming
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   801
    and:[(winGrp := (masterGroup ? (self windowGroup))) notNil]])
bb9bb814e7c4 showBusy code moved
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
   802
    ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   803
        winGrp withWaitCursorDo:acceptAction
2132
fd5b29a20fe1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
   804
    ] ifFalse:[acceptAction value].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   805
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   806
    self isPopUpView ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   807
        self menuAdornmentAt:#item put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   808
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
   809
    ^ item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   810
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   811
    "Modified: / 15.11.2001 / 17:05:40 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   812
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   813
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   814
accept:anItem index:anIndex toggle:aState receiver:aReceiver
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   815
    "accept an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   816
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   817
    |value argument numArgs isValueModel rec args arg2 
1697
345d3664e10c added 'showBusyCursorWhileActive' attribute
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
   818
     app master fallBack|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   819
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   820
    anItem isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   821
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   822
      ^ nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   823
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   824
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   825
    isValueModel := aReceiver isValueModel.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   826
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   827
    self menuAdornmentAt:#hasPerformed put:isValueModel.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   828
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   829
    (value := anItem value) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   830
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   831
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   832
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   833
    (argument := anItem argument) isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   834
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   835
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   836
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   837
    value isSymbol ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   838
        "/ a valueHolder or block
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   839
        (value respondsTo:#valueWithArguments:) ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   840
             ^ value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   841
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   842
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   843
        numArgs := value perform:#numArgs ifNotUnderstood:0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   844
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   845
        numArgs == 0 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   846
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   847
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   848
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   849
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   850
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   851
                args := Array with:argument with:self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   852
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   853
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   854
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   855
        value valueWithArguments:args.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   856
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   857
        self menuAdornmentAt:#hasPerformed put:true.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   858
        ^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   859
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   860
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   861
    anItem sendToOriginator ifTrue:[
2473
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   862
        rec := self originator.
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   863
        rec isNil ifTrue:[
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   864
            self error:'no originating widget (no target for message)'.
6ace3a7234b0 care for nil originator
Claus Gittinger <cg@exept.de>
parents: 2471
diff changeset
   865
        ].
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   866
    ] ifFalse:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   867
        rec := aReceiver
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   868
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   869
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   870
    rec isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   871
        ^ value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   872
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   873
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   874
    isValueModel ifTrue:[
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   875
        rec value:value
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   876
    ] ifFalse:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   877
        arg2 := self.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   878
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   879
        "/ support for ST80 style applications
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   880
        "/ (expecting the message to go to the application
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   881
        "/  if not understood by the view)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   882
        "/ These expect the controller to be passed as argument.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   883
        "/ sigh.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   884
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   885
        (rec isView
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   886
        and:[(rec respondsTo:value) not
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   887
        and:[(app := rec application) ~~ rec
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   888
        and:[app notNil]]]) ifTrue:[
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
   889
            arg2 := rec controller.       "/ the Views controller
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   890
            rec := app.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   891
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   892
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   893
        (numArgs := value numArgs) == 0 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   894
            args := nil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   895
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   896
            numArgs == 1 ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   897
                args := Array with:argument
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   898
            ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   899
                args := Array with:argument with:arg2
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   900
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   901
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   902
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   903
        fallBack := 
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   904
            [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   905
                "/ mhmh - the receiver did not respond to that message;
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   906
                "/ if there is a master-application, try that one
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   907
                "/ (recursive)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   908
                master := rec perform:#masterApplication ifNotUnderstood:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   909
                master notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   910
                    rec := master.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   911
                    rec perform:value withArguments:args ifNotUnderstood:fallBack
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   912
                ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   913
                    self 
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   914
                        error:'unimplemented (or error in) menu message: ' , value
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   915
                        mayProceed:true
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   916
                ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   917
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   918
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   919
        rec perform:value withArguments:args ifNotUnderstood:fallBack.
420
ca
parents: 417
diff changeset
   920
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   921
    self menuAdornmentAt:#hasPerformed put:true.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   922
    ^ value
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
   923
1719
ba7ebb56e6fd recursively try masterApps when performing
Claus Gittinger <cg@exept.de>
parents: 1715
diff changeset
   924
    "Modified: / 19.2.2000 / 11:08:22 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   925
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   926
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   927
acceptItem:anItem inMenu:aMenu
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   928
    |tgState topMenu|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   929
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   930
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
   931
    topMenu openDelayed:nil.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   932
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
   933
    (anItem isNil or:[anItem hideMenuOnActivated]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   934
	topMenu accept:anItem
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   935
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   936
	anItem canAccept ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   937
	    tgState := anItem toggleIndication.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   938
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   939
	    self accept:anItem
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   940
		  index:(aMenu selectionIndex)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   941
		 toggle:tgState 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   942
	       receiver:(aMenu receiver).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   943
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   944
	    aMenu do:[:el| el updateIndicators].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
   945
	]
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   946
    ]
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   947
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
   948
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   949
lastItemAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   950
    "returns last item selected or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   951
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   952
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   953
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   954
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   955
lastValueAccepted
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   956
    "returns last value accepted or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   957
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
   958
    ^ self lastItemAccepted value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   959
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   960
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   961
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   962
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   963
accessCharacterPositionAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   964
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   965
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
   966
    ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   967
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   968
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   969
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   970
    "get the access character position for a textLabel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   971
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   972
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   973
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   974
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   975
accessCharacterPositions
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   976
    "returns a collection of accessCharacterPositions or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   977
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   978
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   979
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   980
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   981
accessCharacterPositions:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   982
    "define accessCharacterPositions for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   983
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   984
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   985
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   986
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   987
args
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   988
    "returns a collection of arguments or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   989
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   990
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   991
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   992
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   993
args:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   994
    "define arguments for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
   995
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   996
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   997
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   998
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   999
argsAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1000
    "gets the argument of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1001
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1002
    ^ self itemAt:stringOrNumber do:[:el| el argument ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1003
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1004
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1005
argsAt:stringOrNumber put:anArgument
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1006
    "sets the argument of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1007
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1008
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1009
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1010
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1011
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1012
    "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
  1013
     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
  1014
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1015
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1016
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1017
    "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
  1018
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1019
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1020
groupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1021
    "gets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1022
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1023
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1024
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1025
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1026
groupSizes:aGroupSizes
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1027
    "sets collection of group sizes"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1028
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1029
    aGroupSizes = groupSizes ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1030
        groupSizes := aGroupSizes copy.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1031
        self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1032
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1033
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1034
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1035
hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1036
    ^ hideOnRelease
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1037
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1038
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1039
hideOnRelease:something
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1040
    hideOnRelease := something.
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1041
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1042
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1043
labelAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1044
    "gets the label of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1045
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1046
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1047
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1048
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1049
labelAt:stringOrNumber put:aLabel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1050
    "sets the label of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1051
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1052
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1053
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1054
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1055
labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1056
    "returns a collection of labels's or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1057
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1058
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1059
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1060
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1061
labels:labels
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1062
    "define labels for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1063
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1064
    |size|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1065
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1066
    self disabledRedrawDo:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1067
        self removeAll.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1068
        size := labels size.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1069
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1070
        size > 0 ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1071
            items := OrderedCollection new:size.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1072
            labels do:[:aLabel| items add:(Item in:self label:aLabel) ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1073
        ]
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  1074
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1075
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1076
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1077
menuPerformer:anObject 
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1078
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1079
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1080
1999
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1081
    ^ self receiver:anObject
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1082
!
56a97236e72d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1998
diff changeset
  1083
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1084
nameKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1085
    "gets the nameKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1086
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1087
    ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1088
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1089
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1090
nameKeyAt:stringOrNumber put:aNameKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1091
    "sets the nameKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1092
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1093
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1094
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1095
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1096
nameKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1097
    "returns a collection of nameKeyss or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1098
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1099
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1100
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1102
nameKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1103
    "define nameKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1104
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1105
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1106
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1107
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1108
numberOfItems
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1109
    "gets number of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1110
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1111
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1112
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1113
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1114
originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1115
    originator notNil ifTrue:[^ originator].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1116
    superMenu notNil ifTrue:[
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1117
        ^ superMenu originator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1118
    ].
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1119
    ^ nil
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1120
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  1121
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1122
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1123
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1124
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1125
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1126
    (receiver isNil and:[superMenu notNil]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1127
        ^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1128
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1129
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1130
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1131
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1132
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1133
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1134
     from all submenus no specific receiver is defined )."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1135
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1136
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1137
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1138
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1139
shortcutKeyAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1140
    "gets the shortCutKey of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1141
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1142
    ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1143
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1144
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1145
shortcutKeyAt:stringOrNumber put:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1146
    "sets the shortCutKey of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1147
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  1148
    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
  1149
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1150
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1151
shortcutKeys
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1152
    "returns a collection of shortcutKeys or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1153
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1154
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1155
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1156
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1157
shortcutKeys:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1158
    "define shortcutKeys for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1159
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1160
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1161
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1162
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1163
valueAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1164
    "gets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1165
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1166
    ^ self itemAt:stringOrNumber do:[:el| el value ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1167
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1168
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1169
valueAt:stringOrNumber put:someThing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1170
    "sets value of an item; a block, valueHolder, ..."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1171
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1172
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1173
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1175
values:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1176
    "define values for each item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1177
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1178
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1179
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1180
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1181
!MenuPanel methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1182
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1183
disableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1184
    "disable all items; not the menu in case of enabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1185
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1186
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1187
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1188
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1189
disableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1190
    "disable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1191
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1192
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1193
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1195
enableAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1196
    "enable all items; not the menu in case of disabled"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1197
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1198
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1199
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1200
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1201
enableAll:collectionOfIndicesOrNames
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1202
    "enable an collection of items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1203
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1204
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1205
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1206
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1207
enabled
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1208
    "returns enabled state"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1209
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1210
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1211
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1212
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1213
enabled:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1214
    "change enabled state of menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1215
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
  1216
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1217
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1218
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1219
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1220
    enabled ~~ state ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1221
        enabled := state.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1222
        self invalidate.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1223
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1225
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1226
enabledAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1227
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1228
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1229
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1230
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1231
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1232
enabledAt:stringOrNumber put:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1233
    "sets the enabled state of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1234
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1235
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1236
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1237
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1238
exclusivePointer:aBoolean
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1239
    "Do nothing here. Compatibility with PopUpListController"
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1240
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1241
    ^ self
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1242
!
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  1243
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1244
isEnabled:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1245
    "gets the enabled state of an item or false"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1246
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1247
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1248
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1249
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1250
!MenuPanel methodsFor:'accessing-channels'!
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1251
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1252
enableChannel:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1253
    "set my enableChannel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1254
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1255
    enableChannel notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1256
        enableChannel removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1257
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1258
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1259
    (enableChannel := aValueHolder) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1260
        enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1261
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1262
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1263
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1264
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1265
menuHolder:aValueHolder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1266
    "set my menuHolder"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1267
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1268
    menuHolder notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1269
        menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1270
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1271
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1272
    (menuHolder := aValueHolder) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1273
        menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1274
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1275
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1276
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1277
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1278
!MenuPanel methodsFor:'accessing-color & font'!
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1279
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1280
activeBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1281
    "get the background drawing color used to highlight selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1282
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1283
    ^ styleSheet colorAt:#'menuPanel.activeBackgroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1284
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1285
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1286
activeForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1287
    "get the foreground color used to highlight selections"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1288
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1289
    ^ styleSheet colorAt:#'menuPanel.activeForegroundColor'
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1290
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1291
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1292
backgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1293
    "return the background color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1294
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1295
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1296
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1297
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1298
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1299
    "set the background drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1300
     instead, leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1301
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1302
    self backgroundColor ~~ aColor ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1303
        super viewBackground:aColor.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1304
        self invalidate "/ RepairNow:true
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1305
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1306
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1307
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1308
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1309
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1310
buttonActiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1311
    "get the background drawing color used to highlight button selection"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1312
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1313
    ^ styleSheet colorAt:#'button.activeBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1314
                 default:(self viewBackground)
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1315
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1316
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1317
buttonEdgeStyle
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1318
    "get the button edge style"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1319
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1320
    ^ styleSheet at:#'button.edgeStyle'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1321
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1322
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1323
buttonEnteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1324
    "get the background drawing color used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1325
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1326
    ^ styleSheet colorAt:#'menuPanel.buttonEnteredBackgroundColor'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1327
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1328
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1329
buttonEnteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1330
    "get the 3D-level used to highlight entered button items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1331
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1332
    ^ styleSheet at:#'menuPanel.buttonEnteredLevel'
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1333
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1334
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1335
buttonHalfLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1336
    "get the background drawing color used to half light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1337
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1338
    ^ styleSheet colorAt:#'button.halfLightColor'
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1339
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1340
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1341
buttonHalfShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1342
    "get the background drawing color used to half shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1343
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1344
    ^ styleSheet colorAt:#'button.halfShadowColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1345
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1346
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1347
buttonLightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1348
    "get the background drawing color used to light button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1349
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1350
    ^ styleSheet colorAt:#'menuPanel.buttonLightColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1351
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1352
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1353
buttonPassiveBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1354
    "get the background drawing color used for button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1355
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1356
    ^ styleSheet colorAt:#'menuPanel.buttonPassiveBackgroundColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1357
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1358
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1359
buttonShadowColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1360
    "get the background drawing color used to shadow button frame"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1361
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1362
    ^ styleSheet colorAt:#'menuPanel.buttonShadowColor'
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1363
!
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1364
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1365
disabledEtchedForegroundColor
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1366
    "return the color used for etching disabled items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1367
     If nil, no 3D effect is drawn."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1368
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1369
    ^ styleSheet colorAt:#'menuPanel.disabledEtchedFgColor'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1370
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1371
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1372
disabledForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1373
    "return the foreground color used by disabled items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1374
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1375
    ^ styleSheet colorAt:#'menuPanel.disabledForegroundColor'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1376
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1377
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1378
enteredBackgroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1379
    "return the background color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1380
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1381
    ^ styleSheet colorAt:#'menu.enteredBackgroundColor'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1382
                 default:(self backgroundColor)
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1383
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1384
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1385
enteredForegroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1386
    "return the foreground color for entered items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1387
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1388
    ^ styleSheet colorAt:#'menu.enteredForegroundColor' default:fgColor
2170
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1389
!
e76171113581 enteredFG / enteredBG
Claus Gittinger <cg@exept.de>
parents: 2166
diff changeset
  1390
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1391
font:aFont
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1392
    "set the font"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1393
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1394
    (aFont isNil or:[aFont = font]) ifTrue:[ ^ self ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1395
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1396
    super font:aFont.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1397
    self do:[:anItem| anItem fontChanged ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1398
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1399
    (shown and:[superMenu notNil]) ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1400
        self extent:(self preferredExtent)
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1401
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  1402
    self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1403
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1404
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1405
foregroundColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1406
    "return the passive foreground color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1407
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  1408
    ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1409
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1410
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1411
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1412
    "set the foregroundColor drawing color. You should not use this method;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1413
     instead leave the value as defined in the styleSheet."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1414
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1415
    aColor ~= fgColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1416
        fgColor := aColor onDevice:device.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  1417
        self invalidate
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1418
    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1419
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1420
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1421
maxAbsoluteButtonLevel
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1422
    "returns the maximum absolute button level; used to compute the preferred
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1423
     extent of a button"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1424
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1425
    ^ styleSheet at:#'menuPanel.maxAbsoluteButtonLevel'
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1426
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1427
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1428
selectionFrameBrightColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1429
    "get the selection frame bright color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1430
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1431
    ^ Color white
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1432
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1433
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1434
selectionFrameDarkColor
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1435
    "get the selection frame dark color"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1436
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1437
    ^ Color black
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1438
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1439
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1440
setFont:aFont
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1441
    "set the font if the argument is nonNil; 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1442
     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
  1443
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1444
    |currentFont|
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1445
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1446
    (aFont notNil and:[aFont ~= font]) ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1447
        currentFont := font.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  1448
        super font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1449
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  1450
    ^ currentFont
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1451
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1452
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1453
!MenuPanel methodsFor:'accessing-dimensions'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
height
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1456
    "default height"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1457
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
    (explicitExtent ~~ true) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1459
        ^ self preferredExtent y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1460
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1464
maxExtent
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1465
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1466
    device notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1467
        ^ device usableExtent - 2.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1468
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1469
    superMenu notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1470
        ^ superMenu maxExtent
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1471
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1472
    "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
  1473
    self error:'don''t know maxExtent'.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1474
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1475
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
preferredExtent
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1477
    "compute and returns my preferred extent"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1478
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1479
    |maxExtent usedExtent|
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1480
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1481
    preferredExtent notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1482
        ^ preferredExtent
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1483
    ].
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1484
    usedExtent := self preferredExtentOfItems.
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1485
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1486
    superView isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1487
        "/ is standalone
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1488
        preferredWidth notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1489
            usedExtent x < preferredWidth ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1490
                usedExtent := preferredWidth @ usedExtent y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1491
            ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1492
        ]
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1493
    ].
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1494
        
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1495
    maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1496
    maxExtent notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1497
        usedExtent := usedExtent min:maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1498
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  1499
    ^ usedExtent
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1500
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1501
    "Modified: / 10.10.2001 / 14:57:25 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1502
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1503
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1504
preferredExtentOfItems
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  1505
    "compute and returns my preferred extent including all items
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1506
        !!!!!! changes have influence on method #rearrangeItems !!!!!!"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1507
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1508
    |hasMenu shCtKey extent showAcc sck
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1509
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1510
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1511
     size         "{ Class:SmallInteger }"
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1512
     buttonInsetX "{ Class:SmallInteger }"
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1513
     buttonInsetY "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1514
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1515
     labelInsetY  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1516
     itemSpace    "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1517
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1518
     groupDividerSize "{ Class:SmallInteger }"
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  1519
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1521
    (size := items size) == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1522
        self isViewWrapper ifTrue:[ ^ subViews first extent ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1523
        ^ 32 @ 32
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1524
    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1525
    buttonInsetX := 2 * self buttonInsetX.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1526
    buttonInsetY := 2 * self buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1527
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1528
    self isPopUpView ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1529
        labelInsetX := labelInsetY := 2 * (self enteredLevel abs).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1530
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1531
        labelInsetX := labelInsetY := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1532
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1533
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1534
    x := 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1535
    y := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1536
    groupDividerSize := self groupDividerSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1537
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1538
    self verticalLayout ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1539
        itemSpace := self itemSpace.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1540
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1541
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1542
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1543
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1544
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1545
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1546
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1547
                
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1548
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1549
                    eX := eX + buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1550
                    eY := eY + buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1551
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1552
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1553
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1554
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1555
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1556
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1557
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1558
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1559
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1560
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  1561
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1562
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1563
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1564
                x := eX + x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1565
                y := eY max:y.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1566
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1567
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1568
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1569
        hasMenu := false.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1570
        shCtKey := 0.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1571
        showAcc := MenuView showAcceleratorKeys == true.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1572
        y := x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1573
        x := 0.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1574
        itemMargin := 2 * self itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1575
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1576
        items keysAndValuesDo:[:key :el| |eX eY|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1577
            extent := el preferredExtent.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1578
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1579
            "/ check for visibility (extent x ~~ 0)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1580
            (eX := extent x) ~~ 0 ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1581
                eY := extent y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1582
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1583
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1584
                    eX := eX + buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1585
                    eY := eY + buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1586
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1587
                    eX := eX + labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  1588
                    eY := eY + labelInsetY.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1589
                ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1590
                hasMenu ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1591
                    hasMenu := el hasSubmenu
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1592
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1593
                (showAcc and:[(sck := el shortcutKeyAsString) notNil]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1594
                    shCtKey := shCtKey max:(sck widthOn:self)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1595
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1596
                key ~~ size ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1597
                    (self hasGroupDividerAt:key) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1598
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1599
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1600
                ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1601
                y := eY + y.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1602
                x := eX max:x.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1603
            ].
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1604
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1605
        x := x + itemMargin.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1606
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1607
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1608
            shortKeyInset := x + Item labelRightOffset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1609
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1610
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1611
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1612
                x := x + self shortcutKeyOffset. 
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1613
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1614
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1615
"/ to have a small inset
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1616
        y := y + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1617
"/        x := x + 1.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1618
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1619
    x := x + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1620
    y := y + margin + margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1621
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  1622
    ^ x @ y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1623
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1624
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1625
preferredWidth:aWidthOrNil
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1626
    "used for example by combo box to setup the preferred width for the popup menu.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1627
     If nil (default), the width is computed from the contained items.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1628
     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
  1629
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1630
    preferredWidth := aWidthOrNil.
2024
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1631
!
1214769c0441 + #preferredWidth:
Claus Gittinger <cg@exept.de>
parents: 2020
diff changeset
  1632
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1633
shortKeyInset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1634
    "left inset of shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1635
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1636
    ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1637
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1638
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1639
subMenuIndicationWidth
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1640
    ^ self rightArrow width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1643
!MenuPanel methodsFor:'accessing-interactors'!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1644
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1645
iconIndicationDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1646
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1647
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1648
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1649
iconIndicationDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1650
    ^ self registerImageOnDevice:(self class iconIndicationDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1651
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1652
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1653
iconIndicationOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1654
    ^ self registerImageOnDevice:(self class iconIndicationOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1655
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1656
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1657
iconIndicationOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1658
    ^ self registerImageOnDevice:(self class iconIndicationOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1659
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1660
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1661
iconRadioGroupDisabledOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1662
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOff)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1663
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1664
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1665
iconRadioGroupDisabledOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1666
    ^ self registerImageOnDevice:(self class iconRadioGroupDisabledOn)
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1667
!
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  1668
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1669
iconRadioGroupOff
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1670
    ^ self registerImageOnDevice:(self class iconRadioGroupOff)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1671
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1672
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1673
iconRadioGroupOn
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1674
    ^ self registerImageOnDevice:(self class iconRadioGroupOn)
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1675
! !
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  1676
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1677
!MenuPanel methodsFor:'accessing-items'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1678
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1679
itemAt:stringOrNumber do:aOneArgBlock
2505
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1680
    "evaluate the block for an item and return the result from the block. In case that  
56607624d05a Fix pidgin spelling: 'does not exists' and 'not exists'
Stefan Vogel <sv@exept.de>
parents: 2504
diff changeset
  1681
     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
  1682
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1683
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1684
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1685
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1686
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1687
    "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
  1688
     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
  1689
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1690
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1691
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1692
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1693
    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
  1694
    ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1695
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1696
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1697
itemAtIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1698
    "returns item at an index or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1699
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1700
    ^ 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
  1701
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1702
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1703
items
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1704
    "returns list of items or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1705
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  1706
    ^ items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1707
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1708
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1709
!MenuPanel methodsFor:'accessing-look'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1710
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1711
buttonActiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1712
    "get the buttons active level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1713
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1714
    ^ styleSheet at:#'menuPanel.buttonActiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1715
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1716
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1717
buttonPassiveLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1718
    "get the buttons passive level"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1719
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1720
    ^ styleSheet at:#'menuPanel.buttonPassiveLevel'
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1721
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1722
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1723
centerItems
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1724
    ^ centerItems ? false
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1725
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1726
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1727
centerItems:aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1728
    centerItems := aBoolean
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1729
!
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  1730
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1731
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1732
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1733
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1734
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1735
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1736
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1737
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1738
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1739
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1740
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1741
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1742
     to the extent of its superView
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  1743
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1744
     NOT SUPPORTED"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1745
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1746
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1747
level:anInt
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1748
    anInt ~~ level ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1749
	super level:anInt.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1750
	self mustRearrange
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  1751
    ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1752
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1753
    "Modified: / 15.11.2001 / 17:42:07 / cg"
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1754
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1755
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1756
rightArrow
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1757
    rightArrow isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1758
        device isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1759
            ^ SelectionInListView rightArrowFormOn:Display
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1760
        ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1761
        rightArrow := SelectionInListView rightArrowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1762
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1763
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1764
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1765
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1766
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1767
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1768
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1769
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1770
showGroupDivider
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1771
    "get the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1772
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1773
    ^ showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1774
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1775
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1776
showGroupDivider:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1777
    "set the enabled flag for showing groupDiveders"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1778
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1779
    showGroupDivider ~~ aState ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1780
        showGroupDivider := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1781
        self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1782
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1783
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1784
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1785
showSeparatingLines
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1786
    "gets true if drawing of separating lines is enabled."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1787
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1788
    ^ showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1789
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1790
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1791
showSeparatingLines:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1792
    "turn on/off drawing of separating lines."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1793
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1794
    aState ~~ showSeparatingLines ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1795
        showSeparatingLines := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1796
        self mustRearrange
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1797
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1798
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1799
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1800
verticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1801
    "get the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1802
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1803
    verticalLayout notNil ifTrue:[ ^ verticalLayout ].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1804
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1805
    superMenu notNil ifTrue:[ verticalLayout := true ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1806
                    ifFalse:[ verticalLayout := self isPopUpView ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  1807
    ^ verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1808
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1810
verticalLayout:aState
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1811
    "set the layout: vertical( true ) or horizontal( false )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1812
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1813
    aState ~~ verticalLayout ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1814
        verticalLayout isNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1815
            verticalLayout := aState
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1816
        ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1817
            verticalLayout := aState.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1818
            self mustRearrange.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1819
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  1820
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1821
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1822
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1823
!MenuPanel methodsFor:'accessing-style'!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1824
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1825
buttonInsetX
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1826
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1827
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1828
    ^ styleSheet at:#'menuPanel.buttonInsetX'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1829
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1830
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1831
buttonInsetY
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1832
    "returns the verical button space"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1833
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1834
    ^ styleSheet at:#'menuPanel.buttonInsetY'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1835
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1836
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1837
enteredLevel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1838
    "returns the enter-level for an unselected item moved through"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1839
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1840
    ^ styleSheet at:#'menu.enteredLevel'  default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1841
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1842
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1843
groupDividerSize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1844
    "returns the width of a group divider"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1845
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1846
    ^ styleSheet at:#'menu.groupDividerSize' default:6
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1847
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1848
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1849
itemMargin
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1850
    "returns the margin of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1851
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1852
    ^ styleSheet at:#'menu.itemMargin' default:0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1853
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1854
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1855
itemSpace
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1856
    "returns the additional space for an item in a (vertical) panel"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1857
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1858
    ^ styleSheet at:#'menuPanel.itemSpace'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1859
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1860
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1861
selectionFollowsMouse
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1862
    "returns true if the selection follows the mouse"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1863
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1864
    ^ styleSheet at:#'menu.selectionFollowsMouse' default:false
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1865
!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1866
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1867
shortcutKeyOffset
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1868
    "returns the offset for a shortcutKey"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1869
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1870
    ^ 5
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1871
! !
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  1872
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  1873
!MenuPanel methodsFor:'accessing-submenu'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1874
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1875
subMenuAt:stringOrNumber
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1876
    "gets the submenu of an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1877
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1878
    ^ self itemAt:stringOrNumber do:[:el| el submenu ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1879
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1880
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1881
subMenuAt:stringOrNumber put:aSubMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1882
    "sets the submenu of an item"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1883
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1884
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1885
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1886
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1887
subMenuShown
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1888
    "return the currently visible submenu - or nil if there is none"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1889
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1890
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1891
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1892
    (item := self selection) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1893
        ^ item submenu
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1894
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1895
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1896
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1897
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1898
!MenuPanel methodsFor:'activation & deactivation'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1899
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1900
closeMenus
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1901
    "close all menus without accepting"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1902
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1903
    self topMenu accept:nil.
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1904
!
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  1905
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1906
hide
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1907
    "hide the view, leave its modal event loop"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1908
2407
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  1909
    "/ TODO: replace with LeaveSignal raise.
d8cdc13f677b checkin from browser
penk
parents: 2374
diff changeset
  1910
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1911
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1912
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1913
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1914
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1915
show
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1916
    "realize the view at its last position;
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1917
     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
  1918
     (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
  1919
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1920
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1921
    ^ self showAt:(self origin) resizing:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1922
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1923
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1924
showAt:aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1925
    "realize the view at aPoint.
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1926
     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
  1927
     (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
  1928
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1929
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1930
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1931
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1932
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1933
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1934
    "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
  1935
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1936
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1937
     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
  1938
     menu (i.e. the view or controller), which will perform the action
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1939
     if a non-nil is returned."
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1940
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1941
    self rearrangeItemsIfItemVisibilityChanged.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1942
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1943
    aBoolean ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1944
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1945
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1946
    self origin:aPoint.
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1947
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1948
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1949
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1950
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1951
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1952
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1953
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1954
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1955
    ].
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1956
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1957
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1958
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1959
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1960
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1961
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1962
showAtPointer
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1963
    "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
  1964
     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
  1965
     (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
  1966
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1967
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1968
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1969
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1970
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1971
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1972
    "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
  1973
     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
  1974
     (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
  1975
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1976
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1977
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1978
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1979
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1980
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1981
    ^ 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
  1982
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1983
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1984
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1985
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1986
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1987
    "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
  1988
     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
  1989
     (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
  1990
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1991
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1992
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1993
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1994
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1995
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1996
    "realize the menu at aPoint
1836
89a1b938c09e fixed returned value from non-performing menu
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
  1997
     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
  1998
     (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
  1999
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2000
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2001
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2002
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  2003
    "Created: / 21.5.1998 / 14:15:57 / cg"
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2004
!
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2005
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2006
startUpFor:originatingWidget
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2007
    "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
  2008
     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
  2009
     (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
  2010
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2011
2332
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2012
    originator := originatingWidget.
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2013
    ^ self startUp
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2014
!
7e98cc0c92b7 can now specify if menu action is to be performed by
ca
parents: 2331
diff changeset
  2015
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2016
startUpOrNil
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2017
    "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
  2018
     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
  2019
     (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
  2020
      to some performer)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2021
1750
f9e5700bd99a compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 1737
diff changeset
  2022
    ^ self showAtPointer
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2023
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2024
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2025
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2026
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2027
createAtIndex:anIndexOrNil
1800
600f247a2846 comment
Claus Gittinger <cg@exept.de>
parents: 1799
diff changeset
  2028
    "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
  2029
     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
  2030
     otherwise the new created item is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2031
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2032
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2033
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2034
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2035
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2036
    anIndexOrNil notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2037
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2038
            ^ nil
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2039
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2040
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2041
    items isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2042
        items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  2043
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2044
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2045
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2047
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2048
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2049
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2050
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2051
        items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2052
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2053
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2054
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2055
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2056
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2057
    "remove the first item which is assigned to stringOrNumber;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2058
     if found, remove and return it"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2059
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2060
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2063
        items remove:item.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2064
        item  destroy.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2065
        items isEmpty ifTrue:[items := nil].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2066
        self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2067
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2068
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2069
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2070
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2071
removeAll
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2072
    "remove all items and submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2073
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2074
    self disabledRedrawDo:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2075
        self selection:nil.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2076
        groupSizes := nil.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2077
        items notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2078
            items copy do:[:el| el destroy ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2079
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2080
        items := nil
2050
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2081
    ].
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2082
ef5517d7a2d0 do not destroy myself after accepting (for PopUpList)
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
  2083
    "Modified: / 15.11.2001 / 17:02:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2085
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2086
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2087
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2088
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2089
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2090
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2091
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2092
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2093
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2094
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2095
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2096
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2097
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2098
asMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2099
    "convert contents to menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2100
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2101
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2102
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2103
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2104
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2105
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2106
    ^ menu
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2107
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2108
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2109
fromSpec:aMenuSpec
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2110
    "build from spec"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2111
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2112
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2113
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2114
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2115
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2116
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2117
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2118
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2119
menu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2120
    "convert to Menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2121
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2122
    self disabledRedrawDo:[
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2123
        |menu newItems menuReceiver|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2124
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2125
        self removeAll.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2126
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2127
        (menu := aMenu) notNil ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2128
            (aMenu isCollection) ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2129
                menu := Menu new.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2130
                menu fromLiteralArrayEncoding:aMenu.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2131
            ] ifFalse:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2132
                menuReceiver := menu receiver.        
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2133
                menuReceiver notNil ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2134
                    receiver := menuReceiver.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2135
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2136
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2137
            (newItems := menu menuItems) size > 0 ifTrue:[
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2138
                items := newItems collect:[:ni | 
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2139
                                |i|
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2140
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2141
                                i:= Item in:self.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2142
                                i menuItem:ni.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2143
                                i.
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2144
                            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2145
            ].
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2146
            self groupSizes:(menu groupSizes).
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  2147
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2148
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2149
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2150
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2151
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2153
!MenuPanel methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2154
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2155
addDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2156
    "add all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2157
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2158
    self do:[:anItem| anItem addDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2159
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2160
    menuHolder    notNil ifTrue:[menuHolder    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2161
    enableChannel notNil ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2162
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2163
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2164
removeDependencies
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2165
    "remove all dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2166
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2167
    self do:[:anItem| anItem removeDependencies ].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2168
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2169
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2170
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2171
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  2172
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2173
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2174
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2175
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2176
    "evaluate a block without redrawing within the block; after processing
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2177
     of the block a redraw might be performed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2178
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2179
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2180
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2181
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2182
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2183
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2184
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2185
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2186
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2187
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2188
drawButtonEdgesFor:anItem level:aLevel
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2189
    |layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2190
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2191
    aLevel ~~ 0 ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2192
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2193
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2194
        styleSheet is3D ifFalse:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2195
            self displayRectangle:layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2196
        ] ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2197
            self drawEdgesForX:(layout left)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2198
                             y:(layout top)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2199
                         width:(layout width)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2200
                        height:(layout height)
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2201
                         level:aLevel 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2202
                        shadow:(self buttonShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2203
                         light:(self buttonLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2204
                    halfShadow:(self buttonHalfShadowColor) 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2205
                     halfLight:(self buttonHalfLightColor)
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2206
                         style:(self buttonEdgeStyle)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2207
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2208
    ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2209
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2210
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2211
drawItemsX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2212
    "redraw items and groups in a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2213
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2214
    |isVertical item layout prevClip
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2215
     x1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2216
     x2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2217
     y1             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2218
     y2             "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2219
     start          "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2220
     stop           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2221
     size           "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2222
     groupDivInset  "{ Class:SmallInteger }"
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2223
    |
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2224
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2225
    size := items size.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2226
    isVertical := self verticalLayout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2227
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2228
    isVertical ifTrue:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2229
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2230
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2231
        y1 := y + h.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2232
        stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2233
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2234
    ] ifFalse:[
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2235
        start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2236
        start == 0 ifTrue:[ ^ self ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2237
        x1  := x + w.
2064
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2238
        stop := items findFirst:[:el| |l| l := el layout.l notNil and:[l left > x1]] 
0e0d1fe431fb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  2239
                     startingAt:(start + 1).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2240
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2241
    stop  == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2242
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2243
    (groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2244
        groupDivInset := self groupDividerSize // 2.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2245
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2246
        groupDivInset ~~ 0 ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2247
            (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2248
                start := start - 1
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2249
            ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2250
        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2251
    ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2252
        groupDivInset := 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2253
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2254
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2255
    prevClip := clipRect.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2256
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2257
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2258
    start to:stop do:[:i|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2259
        item := items at:i.
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  2260
        item draw.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2261
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2262
        (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2263
            layout := item layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2264
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2265
            isVertical ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2266
                x1 := layout left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2267
                x2 := layout right.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2268
                y1 := layout bottom + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2269
                y2 := y1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2270
            ] ifFalse:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2271
                y1 := layout top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2272
                y2 := layout bottom.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2273
                x1 := layout right + groupDivInset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2274
                x2 := x1.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2275
            ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2276
            self paint:shadowColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2277
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2278
            self paint:lightColor.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2279
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2280
            isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2281
                      ifFalse:[x1 := x1 + 1. x2 := x1 ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2282
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2283
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2284
        ]
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2285
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2286
    self clippingRectangle:prevClip.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2287
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2288
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2289
drawLabelEdgeFor:anItem selected:isSelected
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2290
    |level layout|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2291
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2292
    isSelected ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2293
        level := styleSheet at:#'menu.hilightLevel' default:0.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2294
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2295
        anItem == enteredItem ifTrue:[ level := self enteredLevel ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2296
                             ifFalse:[ level := 0 ]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2297
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2298
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2299
    level ~~ 0 ifTrue:[
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2300
        layout := anItem layout.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2301
1691
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2302
        self drawEdgesForX:(layout left)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2303
                         y:(layout top)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2304
                     width:(layout width)
8e1a9d7a298e bugfix in drawLableEdge...
ca
parents: 1690
diff changeset
  2305
                    height:(layout height)
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2306
                     level:level
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2307
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2308
!
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2309
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2310
drawScrollerAt:aDirection bounds:bounds
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2311
    "draw a scroller"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2312
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2313
    |scrolling icon level x y w h|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2314
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2315
    x := bounds left.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2316
    y := bounds top.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2317
    w := bounds width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2318
    h := bounds height.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2319
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2320
    scrolling := self scrollActivity.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2321
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2322
    (scrolling activeMenu == self and:[scrolling direction == aDirection]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2323
        level := -2
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2324
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2325
        level := 1
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2326
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2327
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2328
    level ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2329
        self drawEdgesForX:x y:y width:w height:h level:level.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2330
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2331
    icon := scrolling iconAt:aDirection on:self.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2332
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2333
    icon displayOn:self x:(x + (w - icon width  // 2))
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2334
                        y:(y + (h - icon height // 2)).
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2335
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2336
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2337
invalidateItem:anItem repairNow:aBool
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2338
    "an item changed; invalidate the items layout"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2339
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2340
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2341
2073
26c30a04413d do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2342
    self sensor isNil ifTrue:[^ self].
26c30a04413d do not invalidate if sensor is nil
Claus Gittinger <cg@exept.de>
parents: 2069
diff changeset
  2343
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  2344
    (mustRearrange not and:[shown]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2345
        layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2346
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2347
        (layout bottom > margin and:[layout top < (height - margin)]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2348
            self invalidate:(layout copy insetBy:-1) repairNow:aBool
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2349
        ]
1728
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2350
    ].
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2351
fc0bd6482feb kludge redraw bug fix
Claus Gittinger <cg@exept.de>
parents: 1727
diff changeset
  2352
    "Modified: / 29.2.2000 / 11:28:59 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2353
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  2354
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2355
mustRearrange
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2356
    "force rearrange (i.e. set the rearrange flag)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2357
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2358
    mustRearrange ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2359
        mustRearrange := true.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2360
        self invalidate "/ RepairNow:true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2361
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  2362
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  2363
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2364
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2365
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2366
rearrangeGroups
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2367
    "implements the groupIdentifier #right in a horizontal menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2368
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2369
    |layout point
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2370
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2371
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2372
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2373
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2374
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2375
        ^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2376
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2377
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2378
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2379
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2380
    (dltX := width - margin - layout right) <= 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2381
        ^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2382
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2383
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2384
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2385
    start == 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2386
        ^ self  "/ no item detected
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2387
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2388
    point := dltX @ 0.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2389
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2390
    "/ move items layout to right
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2391
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2392
    items from:start do:[:anItem|
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2393
        anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2394
            anItem layout moveBy:point.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2395
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2396
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2397
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2398
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
rearrangeItems
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2400
    "recompute the layout of each item
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2401
        !!!!!! changes have influence on method #preferredExtentOfItems !!!!!!"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2402
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2403
    |isVertical extent isPopUpMenu
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2404
     x            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2405
     y            "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2406
     x0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2407
     y0           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2408
     x1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2409
     y1           "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2410
     size         "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2411
     insetX       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2412
     insetY       "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2413
     labelInsetX  "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2414
     labelInsetY  "{ Class:SmallInteger }"
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2415
     buttonInsetX "{ Class:SmallInteger }"
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2416
     buttonInsetY "{ Class:SmallInteger }"
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2417
     itemMargin   "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2418
     itemSpace    "{ Class:SmallInteger }"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2419
     groupDividerSize "{ Class:SmallInteger }"
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2420
    |
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2421
    (mustRearrange and:[(size := items size) ~~ 0]) ifFalse:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2422
        mustRearrange := false.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2423
        ^ self
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2424
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2425
2080
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2426
"/  DON'T SET THIS!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2427
"/  item layout:  below of first item -> item invalidate 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2428
"/                                    -> menuPanel invalidateItem:repairDamage: 
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2429
"/                                    -> invalidate:rapairDamage:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2430
"/                                    -> redrawX:y:width:height:
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2431
"/                                    tries to get uninitialized layout from second item.
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2432
"/ This happens in a modal debugger!!
f37673e44158 Fix rearrangeItem stuff
Stefan Vogel <sv@exept.de>
parents: 2079
diff changeset
  2433
"/    mustRearrange := false.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2434
    isVertical       := self verticalLayout.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2435
    itemSpace        := self itemSpace.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2436
    groupDividerSize := self groupDividerSize.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2437
    buttonInsetX     := self buttonInsetX.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2438
    buttonInsetY     := self buttonInsetY.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2439
    isPopUpMenu      := self isPopUpView.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2440
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  2441
    isPopUpMenu ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2442
        labelInsetX := labelInsetY := self enteredLevel abs.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2443
    ] ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2444
        labelInsetX := labelInsetY := 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2445
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2446
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2447
    (isPopUpMenu or:[explicitExtent ~~ true]) ifTrue:[ |saveExtent maxExtent extentToSet|
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2448
        extent := self preferredExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2449
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2450
        isPopUpMenu ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2451
            maxExtent := self maxExtent.
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2452
            maxExtent notNil ifTrue:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2453
                extentToSet := isVertical ifTrue:[extent x @ (extent y min:(maxExtent y))] 
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2454
                                          ifFalse:[(extent x min:(maxExtent x)) @ extent y].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2455
            ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2456
        ] ifFalse:[
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2457
            extent := extentToSet := isVertical ifTrue:[extent x @ 1.0] ifFalse:[1.0 @ extent y].
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2458
        ].
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  2459
        self extent:extentToSet.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2460
    ] ifFalse:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2461
        extent := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2462
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2463
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2464
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  2465
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2466
    isVertical ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2467
        y0 := margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2468
        y1 := extent y - margin.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2469
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2470
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2471
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2472
                el layout:(Rectangle left:x top:y0 right:x bottom:y1)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2473
            ] ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2474
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2475
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2476
                    insetY := buttonInsetY.
2062
31ba9af25394 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
  2477
                ] ifFalse:[            
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2478
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2479
                    insetY := labelInsetY.
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2480
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2481
                x0 := x  + insetX.
2171
90a7393eb53c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2170
diff changeset
  2482
                x1 := x0 + (el preferredExtent x).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2483
                el layout:(Rectangle left:x0 top:(y0 + insetY) right:x1 bottom:(y1 - insetY)).
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2484
                x := x1 + insetX.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2485
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2486
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2487
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2488
                        x := x + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2489
                    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2490
                        el needsItemSpaceWhenDrawing ifTrue:[
1723
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2491
                            x := x + itemSpace
f633725a0ace use itemSpace only for horizontal menus and between labeled items
ca
parents: 1719
diff changeset
  2492
                        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2493
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2494
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2495
            ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2496
        ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2497
    ] ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2498
        itemMargin := self itemMargin.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2499
        x0 := margin.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2500
        x1 := extent x - margin - itemMargin.  "/ -1
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2501
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2502
        items keysAndValuesDo:[:anIndex :el|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2503
            el isVisible ifFalse:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2504
                el layout:(Rectangle left:x0 top:y right:x1 bottom:y)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2505
            ] ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2506
                el isButton ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2507
                    insetX := buttonInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2508
                    insetY := buttonInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2509
                ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2510
                    insetX := labelInsetX.
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2511
                    insetY := labelInsetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2512
                ].
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2513
                y0 := y  + insetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2514
                y1 := y0 + el preferredExtent y.
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2515
                el layout:(Rectangle left:(x0 + insetX + itemMargin) top:y0 right:(x1 - insetX) bottom:y1).
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  2516
                y := y1 + insetY.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2517
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2518
                size ~~ anIndex ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2519
                    (self hasGroupDividerAt:anIndex) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2520
                        y := y + groupDividerSize
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2521
                    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2522
                ]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2523
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  2524
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2525
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2526
    self rearrangeGroups.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2527
    selection notNil ifTrue:[self makeItemVisible:selection].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
    mustRearrange := false.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2529
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2530
    "Modified: / 13.11.2001 / 20:17:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2531
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2532
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2533
rearrangeItemsIfItemVisibilityChanged
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2534
    "check for items which can change its visibility;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2535
     if at least one item exists, rearrange all items"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2536
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  2537
    items isNil ifTrue:[^ self].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2538
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2539
    items do:[:item |
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2540
        item canChangeVisibility ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2541
            mustRearrange := true.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2542
            self rearrangeItems.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2543
            ^ self
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2544
        ].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2545
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2546
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  2547
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2548
redrawX:x y:y width:w height:h
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2549
    "redraw a damage"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2550
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2551
    |y0 y1 x0 x1 bounds mustDrawPrevScroller mustDrawNextScroller|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2552
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  2553
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2554
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2555
    mustRearrange ifTrue:[
2569
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
  2556
        self isPopUpView ifFalse:[explicitExtent := true].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2557
        self rearrangeItems.
2569
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
  2558
        self invalidate.
bfe9e33b545e not ifTrue -> ifFalse
Claus Gittinger <cg@exept.de>
parents: 2550
diff changeset
  2559
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2560
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  2561
    self paint:(self viewBackground).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2562
    self clearRectangleX:x y:y width:w height:h.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2563
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2564
    items size == 0 ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2565
        ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2566
    ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2567
    y0 := y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2568
    y1 := y + h.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2569
    x0 := x.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2570
    x1 := x + w.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2571
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2572
    self hasScrollers ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2573
        (self hasScrollerAt:#PREV) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2574
            bounds := self scrollerBoundsAt:#PREV.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2575
            mustDrawPrevScroller := false.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2576
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2577
            self verticalLayout ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2578
                bounds bottom > y ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2579
                    y0 := bounds bottom.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2580
                    mustDrawPrevScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2581
                ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2582
            ] ifFalse:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2583
                bounds right > x ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2584
                    x0 := bounds right.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2585
                    mustDrawPrevScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2586
                ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2587
            ].
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2588
            mustDrawPrevScroller ifTrue:[
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2589
                self drawScrollerAt:#PREV bounds:bounds.
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2590
            ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2591
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2592
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2593
        (self hasScrollerAt:#NEXT) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2594
            bounds := self scrollerBoundsAt:#NEXT.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2595
            mustDrawNextScroller := false.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2596
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2597
            self verticalLayout ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2598
                bounds top < y1 ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2599
                    y1 := bounds top.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2600
                    mustDrawNextScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2601
                ]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2602
            ] ifFalse:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2603
                bounds left < x1 ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2604
                    x1 := bounds left.
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2605
                    mustDrawNextScroller := true.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2606
                ]
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2607
            ].
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2608
            mustDrawNextScroller ifTrue:[
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2609
                self drawScrollerAt:#NEXT bounds:bounds.
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2610
            ].
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2611
        ]
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2612
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2613
    (y1 > y0 and:[x1 > x0]) ifTrue:[
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2614
        self drawItemsX:x0 y:y0 width:(x1 - x0) height:(y1 - y0)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2615
    ].
2052
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2616
61367c7a47aa *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  2617
    "Modified: / 15.11.2001 / 20:57:32 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2618
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2619
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2620
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2621
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2622
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2623
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2624
     and return a collection of the results"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2625
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2626
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  2627
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2628
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2629
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2630
do:aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2631
    "evaluate the argument, aOneArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2632
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2633
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2634
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2635
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2636
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2637
    "find the first item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2638
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2639
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2640
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2641
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2642
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2643
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2644
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2645
    "find the last item, for which evaluation of the argument, aOneArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2646
     returns true; return its index or 0 if none detected."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2647
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2648
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2649
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2650
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2651
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2652
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2653
    "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
  2654
     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
  2655
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2656
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2657
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2658
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2659
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2660
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2661
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2662
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2663
    i ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2664
        ^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2665
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2666
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2667
    something isSymbol ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2668
        i := self findFirst:[:el|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2669
                                v := el value.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2670
                                v isSymbol and:[v == something]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2671
                            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2672
        i ~~ 0 ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2673
            ^ i
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2674
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2675
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2676
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2677
    (something respondsTo:#string) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2678
        v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2679
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2680
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2681
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2682
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2683
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2684
indexOfItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2685
    "returns the index of the item or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2686
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2687
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2688
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2689
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2690
keysAndValuesDo:aTwoArgBlock
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2691
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2692
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2693
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2694
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2695
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2696
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2697
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2698
buttonMotion:state x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2699
    "open or close the corresponding submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2700
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2701
    |menue motionPoint translatedPoint sensor|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2702
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2703
    self scrollActivity isActive ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2704
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2705
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2706
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2707
    sensor := self sensor.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2708
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2709
    (sensor isNil or:[sensor hasButtonMotionEventFor:nil]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2710
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2711
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2712
    menue := self detectGrabMenu.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  2713
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2714
    motionPoint := x@y.
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2715
    translatedPoint := menue translateGrabPoint:motionPoint.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2716
    menue handleButtonMotion:state atPoint:translatedPoint.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2717
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2718
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2719
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2720
    (self isPopUpView or:[sensor anyButtonPressed]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2721
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2722
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2723
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2724
    (selection notNil and:[selection visibleSubmenu isNil]) ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2725
        "/ selection on grabView withou a submenu (Button ...); check whether moving out
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2726
        (self containsPoint:motionPoint) ifFalse:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2727
            ^ self accept:nil
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2728
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2729
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2730
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  2731
    "Modified: / 13.11.2001 / 20:21:49 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2732
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2733
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2734
buttonPress:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2735
    "any button pressed; open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2736
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2737
    |menu point|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2738
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2739
    hideOnRelease := true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2740
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2741
    self scrollActivity stop.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2742
    point := x@y.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2743
    menu  := self detectMenuAtGrabPoint:point.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2744
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2745
    menu isNil ifTrue:[
2133
293dadf237ad hide on buttonRelease outside (instead of buttonPress outside)
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2746
"/        self accept:nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2747
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2748
        point := menu translateGrabPoint:point.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2749
        menu handleButtonPressAtPoint:point.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2750
    ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2751
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  2752
    "Modified: / 13.11.2001 / 14:12:32 / cg"
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2753
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2754
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2755
buttonRelease:button x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2756
    "button release action; accept selection and close all views"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2757
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2758
    |topMenu dstMenu item srcPoint dstPoint subm hideMenuAndPerformAction 
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2759
     buttonReleaseTime menuOpenTime|
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2760
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2761
    topMenu := self topMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  2762
    topMenu openDelayed:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2763
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2764
    self scrollActivity stop ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2765
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2766
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2767
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2768
    dstMenu := topMenu activeMenu.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2769
2679
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2770
    hideMenuAndPerformAction := dstMenu selection notNil or:[dstMenu isPopUpView not].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2771
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2772
    hideMenuAndPerformAction ifFalse:[
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2773
        hideOnRelease ifTrue:[
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2774
            buttonReleaseTime := Time millisecondClockValue.
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2775
            menuOpenTime := dstMenu mapTime.
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2776
"/ t := windowGroup lastEvent timeStamp.
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2777
            hideMenuAndPerformAction := (OperatingSystem millisecondTimeDeltaBetween:buttonReleaseTime and:menuOpenTime)
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2778
                        > (PopUpMenu maxClickTimeToStayOpen).
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2779
        ].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2780
    ].
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2781
302ab06d7110 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2676
diff changeset
  2782
    hideMenuAndPerformAction ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2783
        srcPoint := x@y.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2784
        
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2785
        (     (dstMenu := self detectMenuAtGrabPoint:srcPoint) notNil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2786
         and:[(item    := dstMenu selection) notNil]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2787
        ) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2788
            item visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2789
                dstMenu selection:nil.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2790
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2791
                (selection isNil and:[self isPopUpView not]) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2792
                    self accept:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2793
                ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2794
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2795
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2796
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2797
            subm := item currentSubmenu.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2798
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2799
            subm notNil ifTrue:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2800
                subm shown ifTrue:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2801
                "/ test whether any action is assigned to the menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2802
                "/ if not ignorre accept
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2803
                item hasDelayedMenu ifFalse:[^ self].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2804
                "/ handle action defined for the delayed menu
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2805
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2806
            dstPoint := dstMenu translateGrabPoint:srcPoint.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2807
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2808
            (dstMenu itemAtPoint:dstPoint) == dstMenu selection ifFalse:[
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2809
                item := nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2810
            ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2811
            topMenu acceptItem:item inMenu:dstMenu.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  2812
            ^ self
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2813
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2814
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2815
        (selection notNil and:[dstMenu == self]) ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2816
            selection visibleSubmenu notNil ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2817
                ^ self
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2818
            ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2819
        ].
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2820
        self accept:nil.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2821
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2822
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2823
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2824
keyPress:key x:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2825
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2826
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2827
    |menu superMenu sensor|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2828
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2829
    sensor := self sensor.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2830
    sensor isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2831
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2832
    sensor anyButtonPressed ifTrue:[
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2833
        ^ self  "/ ignored while any button is pressed
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2834
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2835
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2836
    self scrollActivity isActive ifTrue:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2837
        key ~~ #Escape ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2838
            ^ self
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2839
        ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2840
        self scrollActivity stop
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2841
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2842
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2843
       (key == #Tab 
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2844
    or:[key == #FocusNext
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2845
    or:[key == #FocusPrevious]]) ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2846
        self accept:nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2847
        ^ super keyPress:key x:x y:y
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2848
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2849
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2850
    menu := self detectGrabMenu.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2851
    superMenu := menu superMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2852
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2853
    key == #Escape ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2854
        "/ must hide the active menu
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2855
        (superMenu notNil and:[superMenu ~~ self]) ifTrue:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2856
            "/ hide active menu but keep the grab
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2857
            superMenu selection:nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2858
        ] ifFalse:[
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  2859
            "/ hide active menu and ungrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2860
            self accept:nil
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2861
        ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2862
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2863
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2864
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2865
    menu isViewWrapper ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2866
        sensor compressKeyPressEventsWithKey:key.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2867
        menu handleKeyPress:key.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2868
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2869
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2870
    superMenu == self ifFalse:[^ self].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2871
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2872
    "/ allow cursor movement
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2873
    (key == #CursorLeft or:[key == #CursorRight]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2874
        (self containsPoint:x@y) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2875
            self handleKeyPress:key.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2876
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  2877
    ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2878
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2879
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2880
pointerLeave:state
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2881
    |sensor|
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2882
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  2883
    self scrollActivity isActive ifTrue:[^ self].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2884
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2885
    self detectGrabMenu handlePointerLeave:state.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2886
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2887
    (selection isNil or:[self isPopUpView]) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2888
        ^ self
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2889
    ].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2890
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  2891
    selection visibleSubmenu notNil ifTrue:[^ self].
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2892
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2893
    windowGroup focusView ~~ self ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2894
        self accept:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2895
    ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2896
        selection isButton ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2897
            sensor := self sensor.
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2898
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2899
            sensor isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2900
                self accept:nil
2255
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2901
            ] ifFalse:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2902
                "/ I'have the focus; if no button pressed, than keep the selection
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2903
                sensor anyButtonPressed ifTrue:[
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2904
                    self selection:nil
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2905
                ]
e8bf6618da02 #pointerLeave: depends on selection, focusView, mouseButton...
ca
parents: 2253
diff changeset
  2906
            ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  2907
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2908
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2909
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2910
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2911
sizeChanged:how
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2912
    "redraw #right groups"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  2913
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  2914
    self isPopUpView ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2915
        mustRearrange := true.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  2916
        self invalidate
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2917
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2918
    super sizeChanged:how
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2919
! !
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2920
2503
4f34d55dae21 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  2921
!MenuPanel methodsFor:'event handling-processing'!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  2922
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2923
clearImplicitGrab
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2924
    implicitGrabView := lastPointerView := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2925
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2926
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2927
dispatchEvent:ev withFocusOn:focusView delegate:doDelegate
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2928
    "dispatch and handle an event"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  2929
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2930
    |view x y p syntheticEvent menu|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2931
2658
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  2932
    ev isDamage ifTrue:[
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  2933
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  2934
    ].
04f9fdd74b8e event handling
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  2935
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2936
    "/ situation: we get a buttonPress, set implicitGrab (for scrollbars etc.)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2937
    "/ but never get the buttonRelease, since someone else (a popUp) grabbed the
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2938
    "/ pointer in the meantime, and has eaten the release event ... (double-sigh)
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2939
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2940
        self sensor leftButtonPressed ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2941
            self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2942
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2943
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2944
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2945
    ((x := ev x) isNil or:[(y := ev y) isNil]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2946
        ^ super dispatchEvent:ev withFocusOn:focusView delegate:false.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2947
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2948
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2949
    implicitGrabView notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2950
        ev isButtonEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2951
            p := device translatePoint:(x@y) fromView:self toView:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2952
            ev view:implicitGrabView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2953
            ev arguments at:2 put:p x.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2954
            ev arguments at:3 put:p y.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2955
            implicitGrabView dispatchEvent:ev withFocusOn:focusView delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2956
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2957
            ev isButtonReleaseEvent ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2958
                self clearImplicitGrab.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2959
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2960
            ^ self
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2961
        ]
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2962
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2963
    menu := self detectMenuAtGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2964
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  2965
    (menu isNil or:[menu isViewWrapper not]) ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2966
        self clearImplicitGrab.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2967
      ^ super dispatchEvent:ev withFocusOn:focusView delegate:false
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2968
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2969
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2970
    p    := menu translateGrabPoint:(x@y).
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2971
    view := self detectViewAtX:(p x) y:(p y) in:menu.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  2972
    p    := device translatePoint:(x@y) fromView:self toView:view.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2973
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2974
    ev isButtonPressEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2975
        (view wantsFocusWithButtonPress) ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2976
            view requestFocus.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2977
        ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2978
        view ~~ self ifTrue:[ "/ can this ever be self ?
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2979
            implicitGrabView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2980
        ]
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2981
    ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2982
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2983
    ev isButtonMotionEvent ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2984
        lastPointerView ~~ view ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2985
            "/ must generate enter/leave ... (sigh)
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2986
            lastPointerView notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2987
                "/ XXX: should be fixed
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2988
                syntheticEvent := WindowEvent pointerLeave:0 view:lastPointerView.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2989
                lastPointerView dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2990
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2991
            view notNil ifTrue:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2992
                syntheticEvent := WindowEvent pointerEnter:0 x:x y:y view:view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2993
                view dispatchEvent:syntheticEvent withFocusOn:nil delegate:false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2994
            ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2995
            lastPointerView := view.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  2996
        ].
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2997
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2998
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  2999
    ev view:view.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3000
    ev x:p x.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3001
    ev y:p y.
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3002
    view dispatchEvent:ev withFocusOn:focusView delegate:false.
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3003
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  3004
    "Modified: / 10.10.2001 / 13:54:47 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3005
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3006
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3007
handleButtonMotion:state atPoint:motionPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3008
    "open or close the corresponding submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3009
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3010
    |menu item translatedPoint containsPoint|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3011
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3012
    containsPoint    := self containsPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3013
    containsPoint ifTrue:[ item := self itemAtPoint:motionPoint ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3014
                 ifFalse:[ item := nil ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3015
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3016
    self pointerEntersItem:item.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3017
1910
119f91172b70 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1902
diff changeset
  3018
    (state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3019
        "/ only update pointerEnter
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3020
        ^ self
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3021
    ].
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  3022
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3023
    containsPoint ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3024
        self selection:item openMenu:true.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3025
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3026
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3027
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3028
    menu := self superMenuAtPoint:motionPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3029
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3030
    menu notNil ifTrue:[
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3031
        translatedPoint := self translateMenuPoint:motionPoint toMenu:menu.
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3032
        menu handleButtonMotion:state atPoint:translatedPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3033
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3034
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3035
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3036
        self selection:nil
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3037
    ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3038
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3039
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3040
handleButtonPressAtPoint:aPoint
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3041
    "a button pressed; open or close the corresponding submenus"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3042
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3043
    | item sensor direction wasSelected|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3044
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3045
    item := self itemAtPoint:aPoint.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3046
    item isNil ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3047
        self selection:nil openMenu:false.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3048
        ^ self
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3049
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3050
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3051
    direction := self scrollerDirectionAtPoint:aPoint.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3052
    direction notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3053
        (self scrollActivity startIfRequiredAt:direction on:self) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3054
            self pointerEntersItem:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3055
            ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3056
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3057
    ].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3058
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3059
    wasSelected := (selection == item).
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3060
    wasSelected ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3061
        self selection:item openMenu:true
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3062
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  3063
    item hasDelayedMenu ifTrue:[^ self].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  3064
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3065
    (item isToggle or:[item triggerOnDown]) ifFalse:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3066
        (wasSelected and:[item hasSubmenu and:[item visibleSubmenu isNil]]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3067
            item toggleSubmenuVisibility
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3068
        ].
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3069
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3070
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3071
    (item canAccept and:[item == self selection]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3072
        ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3073
    ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3074
    self invalidateItem:item repairNow:true.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3075
    self acceptItem:item inMenu:self.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3076
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3077
    sensor := self sensor.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3078
    [sensor anyButtonPressed] whileTrue:[ Delay waitForSeconds:0.1 ].
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3079
    sensor flushUserEvents.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3080
    self selection:nil.
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3081
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  3082
    "Created: / 13.11.2001 / 14:12:04 / cg"
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  3083
    "Modified: / 13.11.2001 / 19:50:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3084
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3085
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3086
handleCursorKey:aKey
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3087
    "handle a cursor key"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3088
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3089
    |next menu item isVrt backKey p1 p2
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3090
     idx0  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3091
     idx   "{ Class:SmallInteger }"
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  3092
     size  "{ Class:SmallInteger }"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3093
    |
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3094
    (size  := items size) == 0 ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3095
        superMenu notNil ifTrue:[superMenu handleCursorKey:aKey].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3096
        ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3097
    ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3098
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3099
    isVrt := self verticalLayout.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3100
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3101
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3102
    (    (isVrt     and:[aKey == #CursorUp    or:[aKey == #CursorDown]])
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3103
     or:[(isVrt not and:[aKey == #CursorRight or:[aKey == #CursorLeft]])]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3104
    ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3105
        selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3106
            (superMenu notNil and:[superMenu verticalLayout == isVrt]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3107
                ^ superMenu handleCursorKey:aKey
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3108
            ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3109
            idx := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3110
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3111
            isVrt ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3112
                "/ used because of vertical scrolling
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3113
                idx := items findFirst:[:el| el layout top > 0 ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3114
                idx ~~ 0 ifTrue:[idx := idx - 1 ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3115
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3116
        ] ifFalse:[
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  3117
            idx := self indexOf:selection.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3118
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3119
        next := aKey == #CursorRight or:[aKey == #CursorDown].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3120
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3121
        idx0 := idx.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3122
        size timesRepeat:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3123
            |el|
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3124
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3125
            next ifTrue:[idx := idx + 1] ifFalse:[idx := idx - 1].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3126
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3127
            idx > size ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3128
                idx := 0 "1"
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3129
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3130
                idx < 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3131
                    idx := size
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3132
                ] 
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3133
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3134
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3135
            idx == 0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3136
                self selection:nil.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3137
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3138
            ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3139
                (el := items at:idx ifAbsent:nil) notNil ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3140
                    el canSelect ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3141
                        el hasDelayedMenu ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3142
                            "/ do not open menu
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3143
                            self selection:el openMenu:false
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3144
                        ] ifFalse:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3145
                            "/ open comes from style-sheet
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3146
                            self selection:el.
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3147
                        ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3148
                        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3149
                    ].
2354
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3150
                ]
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3151
            ].
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3152
            idx == idx0 ifTrue:[
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3153
                ^ self
1bd2ac73b73c cursorUp/Down behavior
Claus Gittinger <cg@exept.de>
parents: 2347
diff changeset
  3154
            ].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3155
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3156
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3157
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3158
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3159
    superMenu notNil ifTrue:[
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3160
        p1 := self translateGrabPoint:0.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3161
        p2 := superMenu translateGrabPoint:0.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3162
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3163
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3164
    isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3165
        (superMenu notNil and:[p1 x > p2 x]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3166
            backKey := #CursorRight
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3167
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3168
            backKey := #CursorLeft.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3169
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3170
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3171
        (superMenu notNil and:[p1 y > p2 y]) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3172
            backKey := #CursorDown
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3173
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3174
            backKey := #CursorUp.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3175
        ]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3176
    ].    
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3177
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3178
    aKey == backKey ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3179
        superMenu isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3180
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3181
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3182
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3183
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3184
            ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3185
                superMenu selection hideSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3186
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3187
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3188
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3189
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3190
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3191
    selection isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3192
        superMenu isNil ifTrue:[^ self accept:nil].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3193
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3194
        superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3195
            superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3196
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3197
            (item := items findFirst:[:el| el canSelect]) notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3198
                self selectionIndex:item
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3199
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3200
        ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3201
        ^ self
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3202
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3203
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3204
    selection hasSubmenu ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3205
        (menu := selection visibleSubmenu) isNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3206
            selection toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3207
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3208
            menu selectionIndex:1
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3209
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3210
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3211
        superMenu notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3212
            superMenu verticalLayout ~~ isVrt ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3213
                superMenu handleCursorKey:aKey
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3214
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3215
        ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3216
            self accept:nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3217
        ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3218
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3219
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3220
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3221
handleKeyPress:key
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3222
    "any key is pressed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3223
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3224
    |item inMenu|
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3225
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3226
    (key == #Return or:[key == Character space]) ifTrue:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3227
        self handleReturnPressed
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3228
    ] ifFalse:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3229
        key isCharacter ifTrue:[
1862
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3230
"/            selection notNil ifTrue:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3231
"/                inMenu := self
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3232
"/            ] ifFalse:[
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3233
"/                (inMenu := superMenu) isNil ifTrue:[^ self].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3234
"/            ].
ffbe4c06defd handleKeyPress: search character-key in wrapped menu
ca
parents: 1853
diff changeset
  3235
            inMenu := self.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3236
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3237
            (item := inMenu detectItemForKey:key) notNil ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3238
                inMenu selection:item
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3239
            ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3240
        ] ifFalse:[
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3241
            (     key == #CursorDown or:[key == #CursorUp
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3242
              or:[key == #CursorLeft or:[key == #CursorRight]]]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3243
            ) ifTrue:[
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3244
                self handleCursorKey:key
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3245
            ]
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3246
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3247
    ]
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3248
!
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3249
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3250
handlePointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3251
    self  pointerEntersItem:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3252
    super pointerLeave:state
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3253
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3254
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3255
handleReturnPressed
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3256
    "any key is pressed"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3257
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3258
    |sensor subm item|
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3259
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3260
    (item := selection) isNil ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3261
        superMenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3262
            item := superMenu selection.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3263
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3264
            item value notNil ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3265
                "/ is a delayed menu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3266
                self accept:item
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3267
            ] ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3268
                item toggleSubmenuVisibility
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3269
            ]
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3270
        ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3271
            self accept
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3272
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3273
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3274
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3275
    selection hasSubmenu ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3276
        selection hasDelayedMenu ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3277
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3278
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3279
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3280
        subm := selection currentSubmenu.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3281
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3282
        (subm notNil and:[subm shown]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3283
            selection toggleSubmenuVisibility.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3284
          ^ self
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3285
        ].
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3286
        self openDelayed:nil
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3287
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3288
    self accept.
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3289
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3290
    " test for toggle "
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3291
    item isToggle ifTrue:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3292
        self selection:item.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3293
    ] ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3294
        (selection notNil and:[selection triggerOnDown]) ifFalse:[
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3295
            ^ self
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3296
        ]
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3297
    ].    
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3298
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3299
    (sensor := self sensor) isNil ifTrue:[
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3300
        ^ self
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3301
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3302
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3303
    [   
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3304
        sensor flushKeyboardFor:nil.
2238
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3305
        Delay waitForSeconds:0.1.
68ecae98bcd2 bug fix for toggles (buttun motion ...)
ca
parents: 2235
diff changeset
  3306
        sensor hasKeyPressEventFor:nil.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  3307
    ] whileTrue.
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3308
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  3309
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3310
pointerEntersItem:anItemOrNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3311
    "the pointer moves over an item or nil; restore the old item and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3312
     redraw the new item highlighted."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3313
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3314
    |oldItem newItem|
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3315
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3316
    (     anItemOrNil notNil
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3317
     and:[anItemOrNil canSelect
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3318
     and:[selection isNil
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3319
     and:[self isPopUpView not]]]) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3320
        anItemOrNil isButton ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3321
            (    self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3322
             or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3323
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3324
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3325
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3326
        ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3327
            (self enteredLevel ~~ 0 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3328
              or:[self enteredBackgroundColor ~= self backgroundColor]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3329
            ) ifTrue:[
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3330
                newItem := anItemOrNil
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3331
            ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3332
        ]
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3333
    ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3334
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3335
    newItem ~~ enteredItem ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3336
        oldItem     := enteredItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3337
        enteredItem := newItem.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3338
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3339
        oldItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3340
            self invalidateItem:oldItem repairNow:(enteredItem isNil).
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3341
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3342
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3343
        enteredItem notNil ifTrue:[
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3344
            self invalidateItem:enteredItem repairNow:true.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3345
        ].
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3346
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3347
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3348
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3349
!MenuPanel methodsFor:'focus handling'!
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3350
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3351
hasKeyboardFocus:aBoolean
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3352
    "notification from the windowGroup that I got/lost the keyboard focus."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3353
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3354
    |focusView|
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3355
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3356
    self isPopUpView ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3357
        "/ not visible for popup menus
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3358
        ^ super hasKeyboardFocus:aBoolean
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3359
    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3360
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3361
    (aBoolean not and:[selection notNil]) ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3362
        hasImplicitGrap ~~ true ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3363
            focusView := windowGroup focusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3364
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3365
            focusView == self ifFalse:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3366
                self selection:nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3367
            ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3368
        ]
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3369
    ].            
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3370
    super hasKeyboardFocus:aBoolean.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3371
! !
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  3372
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3373
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3374
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3375
doGrab
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3376
    relativeGrabOrigin := nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3377
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3378
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3379
	superMenu doGrab
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3380
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3381
	hasImplicitGrap ~~ true ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3382
	    self grabMouseAndKeyboard.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3383
	    hasImplicitGrap := true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3384
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3385
    ]
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3386
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3387
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3388
doUngrab:forceDo
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3389
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3390
    relativeGrabOrigin := nil.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3391
    self clearImplicitGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3392
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3393
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3394
	forceDo ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3395
	    superMenu doUngrab:true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3396
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3397
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3398
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3399
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3400
    hasImplicitGrap ~~ true ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3401
	^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3402
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3403
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3404
    forceDo ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3405
	(selection notNil or:[prevFocusView == self]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3406
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3407
	].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3408
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3409
    self ungrabMouseAndKeyboard.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3410
    self selection:nil.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3411
    hasImplicitGrap := nil.
1703
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3412
    prevFocusView   := nil.
e127eff742bb bugfix: request focus
ca
parents: 1701
diff changeset
  3413
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3414
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3415
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3416
grabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3417
    "grap the keyboard; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3418
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3419
    previousKeyboardGrab := device activeKeyboardGrab.
2713
9e417aa397c0 *** empty log message ***
ca
parents: 2712
diff changeset
  3420
    ^ super grabKeyboard
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3421
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3422
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3423
grabMouseAndKeyboard
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3424
    "get exclusive access to pointer and keyboard"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3425
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3426
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3427
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3428
    realized ifTrue:[
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3429
        prevFocusView := self windowGroup focusView.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3430
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3431
        sensor := self sensor.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3432
        device activePointerGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3433
            sensor flushMotionEventsFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3434
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3435
            (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3436
                Delay waitForSeconds:0.1.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3437
                (self grabPointer) ifFalse:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3438
                    "give up"
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3439
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3440
                    self unmap
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3441
                ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3442
            ]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3443
        ].
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3444
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3445
        device activeKeyboardGrab ~~ self ifTrue:[
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3446
            device sync.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3447
            sensor flushKeyboardFor:nil.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3448
            self grabKeyboard.
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2481
diff changeset
  3449
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3450
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3451
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3452
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  3453
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3454
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3455
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3456
grabPointerWithCursor:aCursorOrNil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3457
    "grap the pointer; keep previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3458
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3459
    previousPointerGrab := device activePointerGrab.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3460
    hasImplicitGrap := true.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3461
    ^ super grabPointerWithCursor:aCursorOrNil
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3462
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3463
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3464
ungrabKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3465
    "ungrap the keyboard; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3466
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3467
    super ungrabKeyboard.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3468
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3469
    (previousKeyboardGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3470
    and:[ previousKeyboardGrab realized ]) ifTrue:[
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3471
        device grabKeyboardInView:previousKeyboardGrab.
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3472
    ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3473
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3474
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3475
ungrabMouseAndKeyboard
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3476
    "ungrab resources (mouse and keyboard)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3477
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3478
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3479
    self ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3480
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3481
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3482
ungrabPointer
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3483
    "ungrap the pointer; restore previous grab"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3484
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3485
    super ungrabPointer.
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3486
2579
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3487
    (previousPointerGrab notNil
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3488
    and:[ previousPointerGrab realized ]) ifTrue:[
114e5cf689a2 care for previous-grab-window still being visible
james
parents: 2574
diff changeset
  3489
        device grabPointerInView:previousPointerGrab.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  3490
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3491
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3492
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3493
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3494
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3495
flyByHelpTextAt:srcPoint
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3496
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3497
     If there is a selection, that items helpText is used (ignoring the given point)."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3498
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3499
    self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu flyByHelpTextForItem:item].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3500
    ^ nil
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3501
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3502
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3503
flyByHelpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3504
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3505
2063
8bff9e49f1e9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
  3506
    anItem isNil ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3507
    ^ anItem flyByHelpText.
2058
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3508
!
f0a23f80454e flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
  3509
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3510
helpText
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3511
    "return the helpText for the currently selected item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3512
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3513
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3514
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3515
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3516
helpTextAt:srcPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  3517
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3518
     If there is a selection, that items helpText is used (ignoreing the given point)."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3519
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3520
    self withMenuAndItemAt:srcPoint do:[:menu :item | ^ menu helpTextForItem:item].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3521
    ^ ''
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3522
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3523
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3524
helpTextForItem:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3525
    "returns the helpText for an item (empty if none)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3526
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3527
    anItem isNil ifTrue:[^ ''].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3528
    ^ anItem activeHelpText.
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3529
!
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3530
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3531
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
  3532
    |dstMenu dstPoint item|
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3533
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3534
    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
  3535
    dstMenu notNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3536
        dstPoint := dstMenu translateGrabPoint:srcPoint.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3537
        item := dstMenu itemAtPoint:dstPoint.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3538
        aBlock value:dstMenu value:item.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  3539
    ]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3540
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  3541
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3542
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3543
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  3544
imageOnMyDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3545
    "returns image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3546
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3547
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3548
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3549
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3550
lightenedImageOnDevice:anImage
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3551
    "returns lightened image registered on device"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3552
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3553
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3554
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  3555
1688
271829d6a2e4 category changes
Claus Gittinger <cg@exept.de>
parents: 1679
diff changeset
  3556
!MenuPanel methodsFor:'initialization & release'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3557
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3558
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3559
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3560
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  3561
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3562
create
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3563
    "create the shadow view for a none contained submenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3564
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3565
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3566
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3567
    self isPopUpView ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3568
        (PopUpView shadowsOnDevice:device) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3569
            shadowView isNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3570
                shadowView := (ShadowView onDevice:device) for:self
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3571
            ] ifFalse:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3572
                self saveUnder:true.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3573
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3574
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3575
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3576
        explicitExtent == true ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3577
            (self width) == (superView width) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3578
                self verticalLayout:false
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3579
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3580
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3581
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3582
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3583
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3584
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3585
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3586
destroy
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3587
    "destroy items and shadowView; remove dependencies"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3588
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3589
    self clearLastActiveMenu.
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3590
    items notNil ifTrue:[items copy do:[:el|el destroy]].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3591
    items := nil.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3592
    self removeDependencies.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3593
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3594
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3595
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3596
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3597
2051
d958c12cc08e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3598
    "Modified: / 15.11.2001 / 17:08:45 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3599
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3600
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3601
fetchDeviceResources
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3602
    "fetch device colors, to avoid reallocation at redraw time"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3603
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3604
    |style|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3605
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3606
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3607
        styleSheet := superMenu styleSheet
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3608
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3609
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3610
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3611
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3612
    "/ thats a kludge - will be replaced by values from the styleSheet ...
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  3613
    "/ (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
  3614
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3615
    superMenu isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3616
        rightArrow isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3617
            rightArrow := SelectionInListView rightArrowFormOn:device.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  3618
        ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3619
        fgColor := fgColor onDevice:device.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3620
        style   := styleSheet name.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3621
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3622
        (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3623
            rightArrowShadow := SelectionInListView rightArrowShadowFormOn:device
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3624
        ] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3625
            rightArrowShadow := nil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3626
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3627
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3628
        rightArrow       := superMenu rightArrow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3629
        rightArrowShadow := superMenu rightArrowShadow.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3630
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3631
        self foregroundColor:(superMenu foregroundColor).
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  3632
        self             font:(superMenu font).
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3633
        self  viewBackground:(superMenu viewBackground).
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3634
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3635
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3636
    items notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3637
        items do:[:eachItem| eachItem fetchDeviceResources ]
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3638
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  3639
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  3640
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3641
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3642
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3643
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3644
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3645
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  3646
    |fn|
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  3647
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3648
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3649
2609
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  3650
    fgColor := DefaultForegroundColor ? Color black.
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  3651
    DefaultBackgroundColor notNil ifTrue:[ viewBackground := DefaultBackgroundColor ].
b927f450c4c8 *** empty log message ***
ca
parents: 2607
diff changeset
  3652
    fn := self class defaultFont.
2610
a30fc1fb35d7 *** empty log message ***
ca
parents: 2609
diff changeset
  3653
    fn notNil ifTrue:[ self font:fn ].
1923
530426a3d692 support #level:
ca
parents: 1922
diff changeset
  3654
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3655
    defaultHideOnRelease := styleSheet at:#'popup.hideOnRelease' default:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3656
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3657
    self updateLevelAndBorder.
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3658
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3659
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3660
initialize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3661
    "set default configuration"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3662
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3663
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3664
1730
4936edfc2eee must enable motion events in #initialize (not in map)
Claus Gittinger <cg@exept.de>
parents: 1728
diff changeset
  3665
    self enableMotionEvents.
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3666
    enabled := true.
1877
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3667
    self extentChangedFlag:false.
3b415fa4710f only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents: 1874
diff changeset
  3668
    self originChangedFlag:false.
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3669
    explicitExtent      := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3670
    shortKeyInset       := 0.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3671
    mustRearrange       := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3672
    showSeparatingLines := false.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  3673
    showGroupDivider    := true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3674
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3675
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3676
map
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3677
    "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
  3678
     If the grab fails, try again and unmap myself if that fails too."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3679
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3680
    |loIndices loItems|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3681
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3682
    enteredItem := nil.
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  3683
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  3684
    self enableMotionEvents.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3685
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3686
    super map.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3687
    self addDependencies.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3688
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3689
    loIndices := InitialSelectionQuerySignal query.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3690
    loItems   := items ? #[].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3691
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3692
    loItems do:[:anItem| anItem fetchImages ].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3693
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3694
    self isPopUpView ifTrue:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3695
        self doGrab
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3696
    ] ifFalse:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3697
        super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3698
    ].
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  3699
    loItems do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3700
1785
efa4cc8ca917 mnemonic behaviour changed
ca
parents: 1775
diff changeset
  3701
    loIndices size > 0 ifTrue:[
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3702
        self redrawX:0 y:0 width:width height:height.
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3703
        self openMenusFromItemIndices:loIndices.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3704
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3705
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  3706
    "Modified: / 19.11.1998 / 12:59:00 / cg"
1257
79a40d3f8c2f Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 1255
diff changeset
  3707
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3708
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3709
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3710
realize
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3711
    "realize menu and shadowView"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3712
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3713
    self isPopUpView ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3714
        "Because of #saveUnder of ShadowView the order of realize is significant:
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3715
         shadowView must be realized before self"
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3716
        self hiddenOnRealize:true.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3717
        super realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3718
        self resize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3719
        self makeFullyVisible.
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3720
"/        self mustRearrange.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3721
        shadowView notNil ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3722
            shadowView realize.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3723
        ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3724
        self raise.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3725
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  3726
    ] ifFalse:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3727
        super realize.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3728
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  3729
    self allSubViewsDo:[:aView| aView realize ].
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  3730
    hideOnRelease := defaultHideOnRelease.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3731
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3732
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3733
recreate
1832
f6e6640e99a3 comment
Claus Gittinger <cg@exept.de>
parents: 1829
diff changeset
  3734
    "this is called after a snapin or a migration.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3735
     If the image was saved with an active menu, hide the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3736
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  3737
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3738
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3739
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3740
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3741
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3742
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3743
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3744
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3745
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3746
    self fetchDeviceResources.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3747
    self mustRearrange.      "/ care for changed font sizes etc.
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3748
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3749
    self do:[:anItem |
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3750
        anItem reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3751
    ].
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3752
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3753
    "Created: / 10.9.1998 / 21:37:05 / cg"
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  3754
    "Modified: / 17.8.2000 / 18:01:33 / cg"
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3755
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  3756
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3757
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  3758
    "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
  3759
     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
  3760
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  3761
    self removeDependencies.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3762
    self clearLastActiveMenu.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3763
    self doUngrab:(superMenu isNil).
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3764
"/    self isPopUpView ifTrue:[
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3765
"/         self doUngrab:(superMenu isNil)
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3766
"/    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  3767
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3768
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3769
    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
  3770
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3771
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3772
updateLevelAndBorder
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3773
    "update level & border, when it is known if I am a popUpView"
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3774
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3775
    |bw lvl|
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3776
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3777
    self isPopUpView ifTrue:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3778
        bw  := styleSheet at:#'popup.borderWidth' default:1.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3779
        lvl := styleSheet at:#'popup.level'       default:0.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3780
    ] ifFalse:[
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3781
        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
2372
d136f6d4b7c5 bugfix if font is nil
ca
parents: 2364
diff changeset
  3782
        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
  3783
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3784
    self borderWidth:bw.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  3785
    self level:lvl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3786
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3787
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3788
!MenuPanel methodsFor:'keyboard control'!
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3789
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3790
mnemonicViewNext:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3791
    "a  mnemonicKey event as forwarded from the keyboardProcessor - if there
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3792
     is the mnemonic-key defined for any menuItem, handle the menuItem and
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3793
     return the topMenu otherwise nil."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3794
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3795
    |menu uKey lKey list index|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3796
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3797
    superMenu notNil ifTrue:[ ^ superMenu mnemonicViewNext:aKeyEvent ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3798
    shown ifFalse:[^ nil].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3799
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3800
    uKey := aKeyEvent rawKey last asUppercase.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3801
    lKey := uKey asLowercase.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3802
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3803
    selection notNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3804
        "first lookup the current grapMenu before starting in the topMenu
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3805
        "
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3806
        menu := self detectGrabMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3807
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3808
        [ menu ~~ self ] whileTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3809
            index := menu selectionIndex.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3810
            list  := menu selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey]]
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3811
                                      maxDepth:10 from:(index + 1) to:99999
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3812
                            ignoreSubmenuBlock:[:anItem| anItem ignoreMnemonicKeys ].
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3813
        
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3814
            list size ~~ 0 ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3815
                "/ has item which responds to the mnemonic
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3816
                menu processCollectedIndices:list.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3817
                ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3818
            ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3819
            menu := menu superMenu.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3820
        ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3821
        index := self selectionIndex.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3822
        list  := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ]
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3823
                                  maxDepth:10 from:(1 + index) to:99999
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3824
                        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
  3825
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3826
    ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3827
        index := 99999.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3828
        list  := nil.
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3829
    ].    
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3830
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3831
    list isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3832
        list := self selectItemIndicesFor:[:el||k| k := el accessCharacter. k == uKey or:[k == lKey] ]
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3833
                                 maxDepth:1 from:1 to:index
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3834
                       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
  3835
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3836
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3837
        list isNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3838
            "/ must clear existing selection
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3839
            self selection:nil.
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3840
            ^ nil
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  3841
        ]
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3842
    ].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3843
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3844
    "/ has item which responds to the mnemonic
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3845
    self processCollectedIndices:list.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3846
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3847
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3848
openMenusFromItemIndices:anItemIndiceList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3849
    "open all menus derived from sequence of item indices"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3850
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3851
    |item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3852
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3853
    anItemIndiceList size == 0 ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3854
        ^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3855
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3856
    item := self itemAt:(anItemIndiceList removeFirst).
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3857
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3858
    (item notNil and:[item enabled]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3859
        InitialSelectionQuerySignal answer:anItemIndiceList do:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3860
            self selection:item openMenu:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  3861
        ]
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3862
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3863
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3864
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3865
processCollectedIndices:indices
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3866
    |menu item|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3867
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3868
    indices size == 0 ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3869
	^ self
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3870
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3871
    menu := self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3872
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3873
    [menu selectionIndex == indices first] whileTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3874
	(    (item := menu selection) isNil             "/ shouldn't happen
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3875
	 or:[(menu := item submenu) isNil]              "/ no more indices; done
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3876
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3877
	    ^ true
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3878
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3879
	indices removeFirst.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3880
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3881
	indices isEmpty ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3882
	   menu selection:nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3883
	 ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3884
	]
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3885
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3886
    menu openMenusFromItemIndices:indices.
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3887
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3888
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3889
processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3890
    "a  shortcutKey event as forwarded from the keyboardProcessor - if there is the
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3891
     shortcut-key defined process the shortcut and return true otherwise false."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3892
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3893
    |menu rKey lKey list item|
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3894
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3895
    superMenu notNil ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3896
        ^ superMenu processShortcut:aKeyEvent
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3897
    ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3898
    shown ifFalse:[^ false].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3899
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3900
    lKey := aKeyEvent key.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3901
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3902
    "/ fast check, cursor keys are not supported
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3903
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3904
    ( #( CursorDown CursorUp CursorRight CursorLeft 
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3905
       ) includes:lKey
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3906
    ) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3907
        ^ false.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3908
    ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3909
    rKey := aKeyEvent rawKey.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3910
    item := nil.
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3911
    menu := self detectGrabMenu. "/ first lookup the current grapMenu before starting in the topMenu
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3912
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3913
    [true] whileTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3914
        list := menu selectItemIndicesFor:[:el||skey|
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3915
                                                item := el.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3916
                                                skey := el shortcutKey.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3917
                                                skey == rKey or:[skey == lKey]
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3918
                                          ]
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3919
                                 maxDepth:10 from:1 to:99999
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3920
                       ignoreSubmenuBlock:[:anItem| anItem ignoreShortcutKeys ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3921
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3922
        list size ~~ 0 ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3923
            "/ has item which responds to the shortcut
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3924
            item hasSubmenu ifFalse:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3925
                menu accept:item
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3926
            ] ifTrue:[
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3927
                menu processCollectedIndices:list.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3928
                self windowGroup focusView:self.
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3929
            ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3930
          ^ true
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3931
        ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3932
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3933
        menu == self ifTrue:[ ^ false ].
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3934
        menu := self.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3935
    ].
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  3936
    ^ false     "/ never reached
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3937
!
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3938
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3939
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
  3940
    "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
  3941
     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
  3942
     true. If no item is detected, nil is returned.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3943
     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
  3944
     is created and passed through if the block returns false.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3945
     Otherwise the item is not asked for its submenu."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3946
2112
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3947
    |start stop|
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3948
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3949
    maxDepth <= 0 ifTrue:[^ nil].
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3950
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3951
    start := aStart max:1.
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3952
    stop  := aStop  min:(items size).
c4cd07f21fac processing mnemonic's (search next from current)
ca
parents: 2111
diff changeset
  3953
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3954
    start to:stop do:[:i| |item menu result|
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3955
        item := items at:i.
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3956
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3957
        (aOneArgBlock value:item) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3958
            (item enabled and:[item isVisible]) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3959
                ^ OrderedCollection with:i
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3960
            ]
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3961
        ] ifFalse:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3962
            (item hasSubmenu and:[item hasDelayedMenu not]) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3963
                (item enabled and:[item isVisible]) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3964
                    (ignoreSubmenueBlock isNil or:[(ignoreSubmenueBlock value:item) not]) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3965
                        menu := item submenu.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3966
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3967
                        (menu notNil and:[menu isEnabled]) ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3968
                            result := menu selectItemIndicesFor:aOneArgBlock
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3969
                                                       maxDepth:(maxDepth - 1) from:1 to:99999
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3970
                                             ignoreSubmenuBlock:ignoreSubmenueBlock.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3971
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3972
                            result notNil ifTrue:[
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3973
                                result addFirst:i.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3974
                              ^ result
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3975
                            ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3976
                        ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3977
                    ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3978
                ].
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  3979
            ].
2603
edb5408fd3e7 prepared to test an item whether the submenu should be created caused by mnemonic or accelorator key
ca
parents: 2579
diff changeset
  3980
        ].
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3981
    ].
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3982
    ^ nil
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  3983
! !
1878
1afc5cdf3002 mnemonic-key and shortcut-key support;
ca
parents: 1877
diff changeset
  3984
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3985
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3986
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3987
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3988
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3989
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3990
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3991
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  3992
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3993
superMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3994
    "returns supermenu or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  3995
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3996
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3997
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3998
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3999
topMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4000
    "returns the topMenu; the one having no superMenu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4001
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4002
    |menu smenu|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4003
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4004
    menu := self.
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4005
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4006
    [(smenu := menu superMenu) notNil] whileTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4007
        menu := smenu
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4008
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4009
    ^ menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4010
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4011
1825
962390f1b499 category change
Claus Gittinger <cg@exept.de>
parents: 1824
diff changeset
  4012
!MenuPanel methodsFor:'printing & storing'!
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4013
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4014
printString
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4015
    "return a printed representation of the menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4016
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4017
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4018
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4019
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4020
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4021
    self do:[:anItem|
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4022
        label  := anItem label ? ''.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4023
        string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4024
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4025
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4026
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4027
    "Modified: / 27.2.1998 / 17:41:22 / cg"
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4028
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4029
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4030
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4031
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4032
application
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4033
    "optimize access to retrive the application"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4034
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4035
    application notNil ifTrue:[^ application ].
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4036
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4037
    superMenu notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4038
        application := superMenu application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4039
        ^ application
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4040
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4041
    application := super application.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4042
    ^ application
1872
b20e27632fd8 application fetch fix
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  4043
!
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4044
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4045
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4046
    "returns the item assigned to a key, accessCharacter or starts with.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4047
     if no item is detected nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4048
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4049
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4050
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4051
    items isNil ifTrue:[^ nil].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4052
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4053
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4054
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4055
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4056
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4057
    items keysAndValuesDo:[:anIndex :anItem| |char label|
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4058
        (     anIndex ~~ cIdx
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4059
         and:[anItem canSelect
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4060
         and:[(label := anItem textLabel) notNil
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4061
         and:[label size ~~ 0]]]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4062
        ) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4063
            (char := anItem accessCharacter) notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4064
                (char == uKey or:[char == lKey]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4065
                    ^ anItem
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4066
                ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4067
            ] ifFalse:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4068
                char := label at:1.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4069
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4070
                (char == uKey or:[char == lKey]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4071
                    anIndex > cIdx ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4072
                        ^ anItem
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4073
                    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4074
                    item isNil ifTrue:[item := anItem]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4075
                ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4076
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4077
        ]
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4078
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4079
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4080
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4081
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4082
menuAdornmentAt:aSymbol
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4083
    "returns a value derived from adornment"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4084
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4085
    adornment isNil ifTrue:[^ nil].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4086
    ^ adornment at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4087
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4088
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4089
menuAdornmentAt:aSymbol put:something
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4090
    "sets a value for the specific menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4091
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4092
    |oldValue|
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4093
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4094
    adornment isNil ifTrue:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4095
        something isNil ifTrue:[^ self].
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4096
        adornment := IdentityDictionary new.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4097
    ] ifFalse:[
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4098
        oldValue := adornment at:aSymbol ifAbsent:nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4099
        oldValue == something ifTrue:[^ self].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4100
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  4101
    adornment at:aSymbol put:something.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4102
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4103
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4104
onEachPerform:aSelector withArgList:aList
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4105
    "on each item perform selector with an argument derived from aList"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4106
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4107
    aList isCollection ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4108
        items size >= aList size ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4109
            aList keysAndValuesDo:[:anIndex :anArg|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4110
                (items at:anIndex) perform:aSelector with:anArg
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4111
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4112
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4113
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4114
        self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4115
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4116
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4117
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4118
registerImageOnDevice:anImage
2269
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4119
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4120
    anImage isNil ifTrue:[ ^ nil ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4121
  ^ self class image:anImage onDevice:device
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4122
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4123
"/    |image|
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4124
"/
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4125
"/    (image := anImage) notNil ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4126
"/        image device ~~ device ifTrue:[
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4127
"/            image := image copy.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4128
"/        ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4129
"/        image := image onDevice:device.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4130
"/        image := image clearMaskedPixels.
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4131
"/    ].
e250e3adfc56 registration of images
ca
parents: 2255
diff changeset
  4132
"/    ^ image
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4133
!
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4134
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4135
superMenu:aSuperMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4136
    "set my supermenu from which i'am activated"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4137
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4138
    superMenu := aSuperMenu.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4139
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4140
    superMenu notNil ifTrue:[
2355
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4141
        styleSheet       := superMenu styleSheet.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4142
        rightArrow       := superMenu rightArrow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4143
        rightArrowShadow := superMenu rightArrowShadow.
cd91ed4dc4c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2354
diff changeset
  4144
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4145
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4146
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4147
!MenuPanel methodsFor:'private-activation'!
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4148
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4149
activeMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4150
    "returns the current active menu or self (the top menu)"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4151
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4152
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4153
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4154
    "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
  4155
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4156
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4157
activeMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4158
    "set the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4159
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4160
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4161
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4162
    "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
  4163
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4164
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4165
becomesActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4166
    "submenu becomes the active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4167
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4168
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4169
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4170
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4171
    "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
  4172
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4173
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4174
clearLastActiveMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4175
    "reset the current active menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4176
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4177
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4178
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4179
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4180
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4181
"/    prevFocusView notNil ifTrue:[
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4182
"/        self windowGroup focusView:prevFocusView.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4183
"/        prevFocusView := nil.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4184
"/    ].
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4185
"/
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4186
    top activeMenu == self ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4187
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4188
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4189
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4190
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4191
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4192
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4193
mapTime
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4194
    "returns the time when the menu becomes active"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4195
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4196
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4197
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  4198
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4199
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  4200
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4201
!MenuPanel methodsFor:'private-scrolling'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4202
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4203
hasScrollerAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4204
    "returns true if a visible scroller at a direction exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4205
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4206
    |layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4207
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4208
    self hasScrollers ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4209
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4210
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4211
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4212
    aDirection == #PREV ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4213
        layout := items first layout.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4214
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4215
      ^ self verticalLayout ifTrue:[ layout top  < margin]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4216
                           ifFalse:[ layout left < margin]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4217
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4218
    layout := items last layout.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4219
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4220
  ^ self verticalLayout ifTrue:[ layout bottom > (height - margin)]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4221
                       ifFalse:[ layout right  > (width  - margin)]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4222
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4223
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4224
hasScrollers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4225
    "returns true if scrollers are needed"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4226
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4227
    |maxExtent first last isVert|
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4228
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4229
    (mustRearrange or:[items size <= 1]) ifTrue:[^ false].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4230
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4231
    isVert := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4232
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4233
    superView notNil ifTrue:[
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4234
        ((first := items first layout) isNil
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4235
         or:[(last  := items last layout) isNil]
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4236
        ) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4237
            ^ false
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4238
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4239
        isVert ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4240
            ^ first top < 0 or:[last bottom > height]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4241
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4242
        ^ first left < 0 or:[last right > width]
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4243
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4244
    maxExtent := self maxExtent.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4245
    isVert ifTrue:[
2729
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4246
        ^ (height >= maxExtent y)
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4247
    ].
d28bc8243494 Do not set maxExtent (to the Screen size) in StandartSystemView.
Stefan Vogel <sv@exept.de>
parents: 2715
diff changeset
  4248
    ^ (width >= maxExtent x)
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4249
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4250
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4251
indexOfItemAtScroller:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4252
    "returns the index of the item under the scroller or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4253
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4254
    |bounds min max layout|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4255
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4256
    bounds := self scrollerBoundsAt:aDirection.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4257
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4258
    bounds isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4259
        ^ 0
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4260
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4261
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4262
    self verticalLayout ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4263
        min := bounds top.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4264
        max := bounds bottom.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4265
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4266
        items keysAndValuesDo:[:anIndex :anItem|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4267
            anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4268
                layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4269
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4270
                (layout top < max and:[layout bottom > min]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4271
                    ^ anIndex
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4272
                ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4273
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4274
        ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4275
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4276
        min := bounds left.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4277
        max := bounds right.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4278
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4279
        items keysAndValuesDo:[:anIndex :anItem|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4280
            anItem isVisible ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4281
                layout := anItem layout.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4282
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4283
                (layout left < max and:[layout right > min]) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4284
                    ^ anIndex
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4285
                ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4286
            ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4287
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4288
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4289
    ^ 0
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4290
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4291
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4292
makeItemVisible:anItem
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4293
    "make an item visible"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4294
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4295
    |boundsPREV boundsNEXT delta layout index scr0 scr1 windowSz scrSz doScroll
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4296
     isVertical boundsMin layoutMin boundsMax layoutMax dltOrg
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4297
     inv1 inv2|
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4298
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4299
    (     anItem notNil
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4300
     and:[self hasScrollers
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4301
     and:[(layout := anItem layout) notNil]]
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4302
    ) ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4303
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4304
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4305
    index      := self indexOfItem:anItem.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4306
    boundsPREV := self scrollerBoundsAt:#PREV.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4307
    boundsNEXT := self scrollerBoundsAt:#NEXT.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4308
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4309
    isVertical := self verticalLayout.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4310
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4311
    isVertical ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4312
        boundsMin := boundsPREV bottom.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4313
        boundsMax := boundsNEXT top.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4314
        layoutMin := layout top.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4315
        layoutMax := layout bottom.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4316
        windowSz  := height.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4317
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4318
        boundsMin := boundsPREV right.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4319
        boundsMax := boundsNEXT left.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4320
        layoutMin := layout left.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4321
        layoutMax := layout right.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4322
        windowSz  := width.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4323
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4324
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4325
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4326
    layoutMin < boundsMin ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4327
        layoutMin >= 0 ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4328
            ^ self
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4329
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4330
        "/ test whether is first visible item
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4331
        index := items findLast:[:el| el isVisible] startingAt:(index - 1).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4332
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4333
        index == 0 ifTrue:[ scr0 := margin ]
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4334
                  ifFalse:[ scr0 := boundsMin ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4335
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4336
        delta := layoutMin negated + scr0.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4337
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4338
        layoutMax > boundsMax ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4339
            ^ self
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4340
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4341
        "/ test whether is last visible item
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4342
        index  := items findFirst:[:el| el isVisible ] startingAt:(index + 1).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4343
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4344
        index == 0 ifTrue:[ scr0 := windowSz - margin ]
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4345
                  ifFalse:[ scr0 := boundsMax ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4346
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4347
        delta := scr0 - layoutMax.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4348
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4349
    delta == 0 ifTrue:[ ^ self ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4350
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4351
    doScroll := false.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4352
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4353
    shown ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4354
        delta abs < (windowSz / 2) ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4355
            doScroll := true.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4356
            self repairDamage
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4357
        ]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4358
    ].
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4359
    isVertical ifTrue:[ dltOrg := 0@delta ] ifFalse:[dltOrg := delta@0].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4360
    items do:[:el| el moveBy:dltOrg ].
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4361
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4362
    doScroll ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4363
        self invalidate.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4364
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4365
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4366
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4367
    windowSz  := windowSz - margin - margin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4368
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4369
    scr0  := boundsMin.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4370
    scr1  := scr0 + delta abs.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4371
    scrSz := boundsMax - scr1.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4372
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  4373
    delta < 0 ifTrue:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4374
        isVertical ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4375
            self copyFrom:self x:margin y:scr1 toX:margin y:scr0
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4376
                           width:windowSz height:scrSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4377
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4378
            scr1 := scr0 + scrSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4379
            inv2 := (margin @ scr1) extent:(windowSz @ (height - scr1 - margin)).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4380
            "/ self invalidateX:margin y:scr1 width:windowSz height:(height - scr1 - margin).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4381
        ] ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4382
            self copyFrom:self x:scr1 y:margin toX:scr0 y:margin
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4383
                           width:scrSz height:windowSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4384
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4385
            scr1 := scr0 + scrSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4386
            inv2 := (scr1 @ margin) extent:((width - scr1 - margin) @ windowSz).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4387
            "/ self invalidateX:scr1 y:margin width:(width - scr1 - margin) height:windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4388
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4389
        inv1 := boundsPREV.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4390
    ] ifFalse:[
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4391
        isVertical ifTrue:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4392
            self copyFrom:self x:margin y:scr0 toX:margin y:scr1
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4393
                           width:windowSz height:scrSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4394
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4395
            inv2 := (margin @ margin) extent:(windowSz @ (scr1 - margin)).
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4396
            "/ self invalidateX:margin y:margin width:windowSz height:scr1 - margin.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4397
        ] ifFalse:[
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4398
            self copyFrom:self x:scr0 y:margin toX:scr1 y:margin
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4399
                           width:scrSz height:windowSz async:false.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4400
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4401
            inv2 := (margin @ margin) extent:(scr1 - margin) @ windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4402
            "/ self invalidateX:margin y:margin width:scr1 - margin height:windowSz.
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4403
        ].
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
  4404
        inv1 := boundsNEXT.
2042
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4405
    ].
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4406
    self invalidate:inv1.
cc2141b4117f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2041
diff changeset
  4407
    self invalidate:inv2.
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4408
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4409
    "Modified: / 13.11.2001 / 20:26:42 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4410
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4411
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4412
scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4413
    "returns the one and only scrollActivity - data holder
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4414
     for a menu and all contained submenus"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4415
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4416
    superMenu notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4417
        ^ superMenu scrollActivity
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4418
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4419
    scrollActivity isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4420
        scrollActivity := ScrollActivity new.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4421
    ].
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4422
    ^ scrollActivity
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4423
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4424
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4425
scrollerBoundsAt:aDirection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4426
    "returns the bounds of the scroller at a direction or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4427
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4428
    |y x w h inset|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4429
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4430
    self hasScrollers ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4431
        ^ nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4432
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4433
    inset := 0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4434
    x := y := inset.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4435
    w := h := 15.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4436
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4437
    self verticalLayout ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4438
        aDirection == #NEXT ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4439
            y := height - h - inset.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4440
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4441
        w := width - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4442
    ] ifFalse:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4443
        aDirection == #NEXT ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4444
            x := width - w - inset.       
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4445
        ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4446
        h := height - inset - inset.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4447
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4448
    ^ Rectangle left:x top:y width:w height:h
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4449
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4450
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4451
scrollerDirectionAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4452
    "returns the scroller-direction at aPoint, or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4453
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4454
    self hasScrollers ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4455
        #( PREV NEXT ) do:[:aDirection| |bounds|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4456
            (    (bounds := self scrollerBoundsAt:aDirection) notNil
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4457
             and:[bounds containsPoint:aPoint]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4458
            ) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4459
                ^ (self hasScrollerAt:aDirection) ifTrue:[aDirection] ifFalse:[nil]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4460
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4461
        ]
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4462
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4463
    ^ nil
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4464
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4465
    "Created: / 13.11.2001 / 14:13:16 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4466
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4467
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4468
!MenuPanel methodsFor:'private-searching'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4469
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4470
detectGrabMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4471
    "returns the menu which is responsible for the grap; the last opened menu"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4472
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4473
    |subMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4474
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4475
    selection notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4476
        (subMenu := selection visibleSubmenu) notNil ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4477
            ^ subMenu detectGrabMenu
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4478
        ]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4479
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4480
    ^ self
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4481
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4482
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4483
detectMenuAtGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4484
    "returns the menu which contains the grab-point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4485
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4486
    |dstMenu dstPoint firstMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4487
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4488
    dstPoint := self translateGrabPoint:aGrabPoint.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4489
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4490
    ((dstPoint x between:0 and:width) and:[dstPoint y between:0 and:height]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4491
        firstMenu := self.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4492
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4493
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  4494
    (selection isNil or:[(dstMenu := selection visibleSubmenu) isNil]) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4495
        ^ firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4496
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4497
    dstMenu := dstMenu detectMenuAtGrabPoint:aGrabPoint.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  4498
    ^ dstMenu ? firstMenu
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4499
!
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4500
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4501
detectViewAtX:x y:y in:aTopView
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4502
    "detect view at x@y"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4503
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4504
    ^ aTopView detectViewAt:(x@y).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4505
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4506
"/ cg: old code was (refactored to use common code)
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4507
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4508
"/    |p subViews|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4509
"/
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4510
"/    (subViews := aTopView subViews) notNil ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4511
"/        subViews do:[:v| |p|
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4512
"/            v shown ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4513
"/                (    (x between:(v left) and:(v right))
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4514
"/                 and:[y between:(v top)  and:(v bottom)]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4515
"/                ) ifTrue:[
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4516
"/                    p := device translatePoint:(x@y) from:(aTopView id) to:(v id).
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4517
"/                  ^ self detectViewAtX:p x y:p y in:v.
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4518
"/                ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4519
"/            ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4520
"/        ]
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4521
"/    ].
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4522
"/    ^ aTopView
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4523
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4524
    "Modified: / 10.10.2001 / 13:45:56 / cg"
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4525
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  4526
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4527
itemAt:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4528
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4529
     If no item match nil is returned."
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4530
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4531
    |idx|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4532
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4533
    stringOrNumberOrPoint isPoint ifTrue:[
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4534
        ^ self itemAtPoint:stringOrNumberOrPoint
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4535
    ].
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4536
    idx := self indexOf:stringOrNumberOrPoint.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4537
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  4538
    ^ nil
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4539
!
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4540
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4541
itemAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4542
    "returns the item at aPoint or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4543
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4544
    |x y|
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4545
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4546
    items notNil ifTrue:[
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4547
        x := aPoint x.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4548
        y := aPoint y.
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4549
        ^ items detect:[:el| el containsPointX:x y:y] ifNone:nil
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
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4552
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4553
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4554
superMenuAtPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4555
    "returns the superMenu which contains aPoint, or nil if none detected"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4556
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4557
    |grabPoint superMenu|
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4558
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4559
    (self containsPoint:aPoint) ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4560
        ^ self
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4561
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4562
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4563
    grabPoint := aPoint - (self translateGrabPoint:0).
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4564
    superMenu := self.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4565
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4566
    [ (superMenu := superMenu superMenu) notNil ] whileTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4567
        (superMenu containsPoint:(superMenu translateGrabPoint:grabPoint)) ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4568
            ^ superMenu
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4569
        ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4570
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4571
    ^ nil
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4572
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  4573
    "Created: / 13.11.2001 / 20:22:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4574
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4575
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4576
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4577
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4578
container:aView
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4579
    super container:aView.
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4580
    aView notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4581
	"/ I am no longer a popUpView
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4582
	self updateLevelAndBorder
2003
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4583
    ].
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4584
!
732fbaf5864f avoid changing the level after realization (to avoid confusing the shadow)
Claus Gittinger <cg@exept.de>
parents: 2000
diff changeset
  4585
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4586
containsPoint:aPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4587
    "returns true if the argument, aPoint is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4588
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4589
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4590
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4591
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4592
containsPointX:x y:y
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4593
    "returns true if point is contained by the view"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4594
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  4595
    ^ (x between:0 and:width) and:[y between:0 and:height]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4596
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4597
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4598
hasGroupDividerAt:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4599
    "returns true if a divider is defined at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4600
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4601
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4602
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4603
    groupSizes size ~~ 0 ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4604
        i := 0.
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4605
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4606
        groupSizes do:[:t|
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4607
            (i := i + t) == anIndex ifTrue:[
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4608
                ^ true
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4609
            ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4610
        ]
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4611
    ].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4612
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4613
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4614
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4615
hasGroupDividers
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4616
    "returns true if any group divider exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4617
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4618
    ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4619
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4620
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4621
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4622
    "returns true if the panel is the first in the menu hierarchy in must
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4623
     be fit to the extent of its superView;
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4624
     NOT SUPPORTED"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4625
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4626
    ^ false
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4627
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4628
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4629
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4630
    "return true if view is a popup view; without decoration
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4631
     and popUp to top immediately"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4632
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4633
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4634
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4635
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4636
isVerticalLayout
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4637
    "returns true if vertical layout otherwise false( horizontal layout )"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4638
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4639
    ^ self verticalLayout
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4640
!
c05874084d4c implement
ca
parents: 407
diff changeset
  4641
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4642
isViewWrapper
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  4643
    ^ items size == 0 and:[subViews size ~~ 0]
1793
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4644
!
f76529768dd6 keyPress:... check for wrapped view
ca
parents: 1791
diff changeset
  4645
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4646
type
428
ca
parents: 427
diff changeset
  4647
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  4648
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4649
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4650
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4651
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4652
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4653
hasSelection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4654
    "returns true if a selection exists"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4655
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4656
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4657
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4658
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4659
openDelayed:anItem
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4660
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4661
    superMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  4662
        superMenu openDelayed:anItem.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4663
        ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4664
    ].
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4665
    openDelayedMenuBlock notNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4666
        Processor removeTimedBlock:openDelayedMenuBlock.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4667
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4668
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4669
    anItem isNil ifTrue:[
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4670
        openDelayedMenuBlock := nil.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4671
        ^ self
2253
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4672
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4673
    openDelayedMenuBlock := [
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4674
        openDelayedMenuBlock := nil.
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4675
        anItem openDelayedSubmenu
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4676
    ].
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4677
2f6fa29b1f99 starting removing #menuAdornmentAt:
ca
parents: 2251
diff changeset
  4678
    Processor addTimedBlock:openDelayedMenuBlock afterSeconds:0.5.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4679
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4680
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4681
selection
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4682
    "returns current selected item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4683
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4684
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4685
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4686
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4687
selection:anItemOrNil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4688
    "change selection to an item or nil
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4689
     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
  4690
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4691
    |openMenu openOnSelect submenu item|
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4692
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4693
    selection == anItemOrNil ifTrue:[^ self].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4694
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4695
    (anItemOrNil isNil or:[anItemOrNil hasSubmenu not]) ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4696
        self selection:anItemOrNil openMenu:false.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4697
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4698
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4699
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4700
    openMenu     := self isPopUpView not.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4701
    openOnSelect := styleSheet at:#'menu.openOnSelect' default:false.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4702
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4703
    openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4704
        openMenu := openOnSelect.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4705
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4706
    self selection:anItemOrNil openMenu:openMenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4707
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4708
    openOnSelect ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4709
        "/ select first item in submenu
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4710
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4711
        submenu := anItemOrNil currentSubmenu.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4712
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4713
        submenu notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4714
            item := submenu itemAt:1.
2347
9c22beda83cd hideOnRelease now from styleSheet;
Claus Gittinger <cg@exept.de>
parents: 2345
diff changeset
  4715
            (item notNil and:[item hasSubmenu not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4716
                submenu selection:item openMenu:false
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4717
            ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4718
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4719
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4720
!
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4721
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4722
selection:anItemOrNil openMenu:openMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4723
    "change selection to an item or nil"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4724
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4725
    |helpListener oldSelect|
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4726
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4727
    anItemOrNil == selection ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4728
        ^ self
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4729
    ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4730
    self openDelayed:nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4731
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4732
    oldSelect := selection.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4733
    selection := nil.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4734
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4735
    anItemOrNil notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4736
        self makeItemVisible:anItemOrNil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4737
        anItemOrNil canSelect ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4738
            selection := anItemOrNil
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4739
        ] ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4740
            oldSelect isNil ifTrue:[^ self].
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4741
        ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4742
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4743
    oldSelect notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4744
        "/ clear current selection
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4745
        oldSelect isSelected:false.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4746
    ].
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  4747
    selection isNil ifTrue:[^ self].
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4748
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4749
    selection == enteredItem ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4750
        enteredItem := nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4751
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4752
        self pointerEntersItem:nil
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4753
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  4754
    ActiveHelp isActive ifTrue:[
2251
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4755
        helpListener := ActiveHelp currentHelpListener.
30490c3f2173 bug fixes with focus handling
ca
parents: 2249
diff changeset
  4756
        helpListener initiateHelpFor:self at:nil now:true.
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4757
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4758
    shown ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4759
        self rearrangeItems.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4760
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4761
        openMenu ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4762
            selection invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4763
        ]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4764
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4765
    openMenu ifTrue:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4766
        selection isSelected:true.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  4767
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4768
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4769
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4770
selectionIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4771
    "returns index of current selection or 0"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4772
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4773
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4774
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4775
    (item := self selection) notNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4776
        ^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4777
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4778
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4779
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4780
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4781
selectionIndex:anIndex
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4782
    "set selection at an index"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4783
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4784
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4785
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4786
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4787
!MenuPanel methodsFor:'translation'!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4788
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4789
translateGrabPoint:aGrabPoint
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4790
    "translate the grab point into self"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4791
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4792
    superMenu isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4793
        "I am the grapView"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4794
        aGrabPoint isNumber ifTrue:[^ aGrabPoint @ aGrabPoint].
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4795
        ^ aGrabPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4796
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4797
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4798
    relativeGrabOrigin isNil ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4799
        relativeGrabOrigin := self topMenu translatePoint:0 to:self.
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4800
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4801
    ^ relativeGrabOrigin + aGrabPoint
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4802
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4803
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4804
translateMenuPoint:aPoint toMenu:aMenu
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4805
    "translate a point into another menu its point"
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4806
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4807
    |grapPoint|
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4808
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4809
    aMenu == self ifTrue:[
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4810
        ^ aPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4811
    ].
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4812
    grapPoint := aPoint - (self translateGrabPoint:0).
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4813
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4814
    ^ aMenu translateGrabPoint:grapPoint
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4815
!
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4816
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4817
translatePoint:aPoint to:anotherWindowOrNilForScreen
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4818
    "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
  4819
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4820
    ^ device 
2715
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4821
        translatePoint:aPoint asPoint 
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4822
        fromView:self 
11d4f65d42d2 categories
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  4823
        toView:anotherWindowOrNilForScreen
2020
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4824
1f1868eba475 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2018
diff changeset
  4825
    "Modified: / 10.10.2001 / 14:11:47 / cg"
1791
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4826
! !
bd26612c387a optimization: no longer use #translatePoint:from:to:
ca
parents: 1790
diff changeset
  4827
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4828
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4829
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4830
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4831
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4832
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4833
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4834
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4835
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4836
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4837
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4838
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  4839
    ^ VerticalInset
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4840
!
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4841
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4842
verticalPopUpInset
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4843
    ^ VerticalPopUpInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4844
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4845
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4846
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4847
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4848
halfSeparatorSize
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4849
    "returns size of a space-separator
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4850
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4851
    ^ 5
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4852
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  4853
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4854
separatorSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4855
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4856
    "
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4857
    ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4858
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4859
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4860
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4861
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4862
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4863
    "
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4864
    <resource: #style (#'menuPanel.verticalInset')>
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4865
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  4866
    HorizontalInset       := 2.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4867
    VerticalInset         := MenuPanel styleSheet at:#'menuPanel.verticalInset' default:2.
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4868
    VerticalPopUpInset    := 2.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4869
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4870
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4871
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4872
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  4873
    LabelRightOffset      := 15.
1765
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4874
a003f417d6ad fix for vertical spacing
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  4875
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4876
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4877
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4878
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4879
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4880
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4881
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4882
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4883
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4884
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4885
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4886
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4887
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4888
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4889
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4890
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4891
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4892
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4893
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4894
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4895
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4896
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4897
  ^ item.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4898
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4899
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4900
new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4901
    ^ self basicNew initialize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4902
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4903
1808
e8628b502a49 methodCategory change
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  4904
!MenuPanel::Item methodsFor:'accepting'!
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4905
420
ca
parents: 417
diff changeset
  4906
canAccept
ca
parents: 417
diff changeset
  4907
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  4908
    "
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4909
    self enabled    ifFalse:[ ^ false].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4910
    self hasSubmenu ifFalse:[ ^ true ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4911
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4912
    self hasDelayedMenu ifFalse:[^ false ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  4913
  ^ subMenu isNil or:[subMenu shown not]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4914
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4915
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4916
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4917
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4918
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4919
    |arg|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4920
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4921
    indication notNil ifTrue:[    
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4922
        arg := self indicationValue not.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4923
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4924
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4925
        choice notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4926
            choice value:(menuItem choiceValue).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4927
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4928
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4929
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4930
    ^ arg
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4931
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4932
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4933
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4934
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4935
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4936
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4937
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4938
    ^ accessCharacter
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4939
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4940
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4941
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4942
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4943
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4944
    ^ menuItem accessCharacterPosition
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4945
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4946
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  4947
accessCharacterPosition:anIndex 
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4948
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4949
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4950
    menuItem accessCharacterPosition:anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4951
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4952
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4953
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4954
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4955
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4956
    ^ menuItem argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4957
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4958
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4959
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4960
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4961
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  4962
    menuItem argument:anArgument.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4963
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4964
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4965
displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4966
    "returns my printable Label
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4967
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4968
    ^ displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4969
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  4970
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4971
displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4972
    "returns the labelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4973
    "
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4974
    |prevFont w h|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4975
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4976
    displayLabelExtent notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4977
        ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4978
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4979
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4980
    displayLabel isNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4981
        displayLabelExtent := 0@0.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4982
        ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4983
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4984
    prevFont := menuPanel setFont:(self font).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4985
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4986
    displayLabel isArray ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4987
        w := h := 0.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4988
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4989
        displayLabel do:[:aSubLabel|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4990
            aSubLabel notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4991
                w := w max:(aSubLabel widthOn:menuPanel).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4992
                h := h + 1 + (aSubLabel heightOn:menuPanel).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4993
            ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4994
                h := h + (self spaceBetweenEmptyLines)
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4995
            ]
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4996
        ]
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4997
    ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4998
        w := displayLabel  widthOn:menuPanel.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  4999
        h := displayLabel heightOn:menuPanel.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5000
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5001
    "/ care for italic fonts - give a few more pixels at the end
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5002
    menuPanel font italic ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5003
        w := w + 2.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5004
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5005
    displayLabelExtent := w@h.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5006
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5007
    prevFont notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5008
        menuPanel setFont:prevFont.     "/ restore previous font
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5009
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5010
    ^ displayLabelExtent
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5011
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5012
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5013
font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5014
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5015
    "
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5016
    |font|
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5017
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5018
    menuPanel isNil ifTrue:[^ nil].
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5019
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5020
    font := menuItem font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5021
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5022
    font notNil ifTrue:[
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5023
        font := font onDevice:(menuPanel device).
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5024
        menuItem font:font.
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5025
    ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5026
    ^ font
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5027
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5028
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5029
font:aFont
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5030
    "returns the user configured font or nil (default menu font)
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5031
    "
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  5032
    menuItem font:aFont.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5033
!
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  5034
2604
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5035
ignoreMnemonicKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5036
    "if true, mnemonic (access character) in the submenus under the item are ignored
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5037
    "
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5038
    ^ menuItem ignoreMnemonicKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5039
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5040
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5041
ignoreMnemonicKeys:aBoolean
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5042
    "if true, mnemonic (access character) in the submenus under the item are ignored
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5043
    "
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5044
    menuItem ignoreMnemonicKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5045
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5046
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5047
ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5048
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5049
    "
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5050
    ^ menuItem ignoreShortcutKeys
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5051
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5052
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5053
ignoreShortcutKeys:aBoolean
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5054
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5055
    "
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5056
    menuItem ignoreShortcutKeys:aBoolean.
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5057
!
34401b14b068 support of ignoreMnemonicKeys and ignoreShortcutKeys during processing
ca
parents: 2603
diff changeset
  5058
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5059
itemValue
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5060
    "gets value
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5061
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5062
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5063
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5064
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5065
itemValue:aValue
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5066
    "argument could be a value holder, an action or selector
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5067
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5068
    menuItem itemValue:aValue.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5069
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5070
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5071
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5072
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5073
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5074
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5075
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5076
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5077
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5078
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5079
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5080
    "
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5081
    |size char oldExtent|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5082
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5083
    oldExtent          := displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5084
    displayLabelExtent := nil. "/ force a recomputation
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5085
    accessCharacter    := disabledDisplayLabel := nil.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5086
    label              := aLabel value.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5087
    displayLabel       := label value ? ''.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5088
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5089
    displayLabel isString ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5090
        "CHECK FOR SEPARATOR"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5091
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5092
        (menuItem isButton not and:[indication isNil and:[choice isNil]]) ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5093
            size := displayLabel size.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5094
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5095
            size == 0 ifTrue:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5096
                displayLabel := nil.            "blank separator"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5097
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5098
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5099
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5100
            size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5101
                char := displayLabel first.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5102
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5103
                (char == $- or:[char == $=]) ifTrue:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5104
                    label := displayLabel.      "line separator"
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5105
                    displayLabel := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5106
                    ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5107
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5108
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5109
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5110
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5111
        displayLabel isCollection ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5112
            displayLabel := displayLabel asArray.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5113
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5114
    ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5115
    displayLabel notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5116
        displayLabel isArray ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5117
            displayLabel keysAndValuesDo:[:i :el|
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5118
                el notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5119
                    displayLabel at:i put:(self updateAccessCharacterFor:el).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5120
                ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5121
            ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5122
        ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5123
            displayLabel := self updateAccessCharacterFor:displayLabel.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5124
        ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5125
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5126
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5127
    menuPanel shown ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5128
        self fetchImages.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5129
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5130
        oldExtent = self displayLabelExtent ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5131
            self invalidate
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5132
        ] ifFalse:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5133
            menuPanel mustRearrange
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5134
        ]
1978
a53447b8cbe2 set label; reange menu if extent changed otherwise redraw only the item
martin
parents: 1955
diff changeset
  5135
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5136
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5137
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5138
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5139
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5140
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  5141
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5142
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5143
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5144
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5145
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5146
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5147
    ^ menuItem nameKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5148
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5149
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5150
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5151
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5152
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5153
    menuItem nameKey:aNameKey.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5154
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5155
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5156
rawLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5157
    "returns my raw, unprocessed label
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5158
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5159
    ^ menuItem rawLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5160
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5161
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5162
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5163
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5164
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5165
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5166
    ^ menuItem shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5167
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5168
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5169
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5170
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5171
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5172
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5173
    menuItem shortcutKey ~= aKey ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5174
        menuItem shortcutKey:aKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5175
        self invalidate.
1889
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5176
    ].
43516e4588ce give warning messages for unimplemented menu-aspects
Claus Gittinger <cg@exept.de>
parents: 1878
diff changeset
  5177
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5178
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5179
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5180
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5181
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5182
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5183
    ^ menuItem startGroup
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5184
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5185
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5186
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5187
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5188
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5189
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5190
    menuItem startGroup:aSymbol.
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5191
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  5192
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5193
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5194
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5195
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5196
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5197
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5198
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5199
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5200
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5201
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5202
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5203
    "
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5204
    |widget|
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5205
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5206
    aSubMenu isNil ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5207
        subMenu notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5208
            subMenu destroy.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5209
            subMenu := nil.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5210
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5211
        ^ self
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5212
    ].
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5213
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  5214
    (aSubMenu isKindOf:Menu) ifTrue:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5215
        subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5216
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5217
        menuPanel notNil ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5218
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5219
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5220
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5221
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5222
        menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5223
            subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5224
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5225
        subMenu menu:aSubMenu.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5226
    ] ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5227
        aSubMenu isView ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5228
            (aSubMenu isKindOf:ApplicationModel) ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5229
                "/ ... mhhhh ....
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5230
                ^ menuItem submenuChannel:aSubMenu
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5231
            ].            
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5232
            widget := SimpleView new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5233
            widget client:aSubMenu.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5234
        ] ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5235
            widget := aSubMenu
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5236
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5237
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5238
        (widget isKindOf:MenuPanel) ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5239
            subMenu := widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5240
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5241
            menuItem horizontalLayout == true ifTrue:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5242
                subMenu verticalLayout:false
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5243
            ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5244
        ] ifFalse:[
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5245
            subMenu := MenuPanel new.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5246
            subMenu receiver:menuPanel receiver.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5247
            subMenu addSubView:widget.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5248
            subMenu extent:(widget preferredExtent).
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5249
            widget origin:0.0@0.0 corner:1.0@1.0.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5250
        ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5251
        subMenu superMenu:menuPanel.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5252
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5253
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5254
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5255
textLabel
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5256
    "returns my textLabel or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5257
     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
  5258
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5259
    |txt|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5260
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5261
    displayLabel notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5262
        displayLabel isArray ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5263
            ^ displayLabel perform:#string ifNotUnderstood:nil
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5264
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5265
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5266
        displayLabel do:[:el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5267
            (txt := el perform:#string ifNotUnderstood:nil) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5268
                ^ txt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5269
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5270
        ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5271
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5272
    ^ nil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5273
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5274
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5275
triggerOnDown
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5276
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5277
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5278
    menuItem triggerOnDown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5279
        self hasSubmenu ifFalse:[^ true].
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5280
    ].
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5281
    ^ false
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5282
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5283
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5284
triggerOnDown:aBool
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5285
    "trigger the action if pressed
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5286
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5287
    menuItem triggerOnDown:aBool.
1841
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5288
!
5d01716cc37c implement: triggerOnDown
ca
parents: 1836
diff changeset
  5289
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5290
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5291
    "gets value
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5292
     Left here for ST80 compatibility - value is a bad name
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5293
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5294
    ^ menuItem itemValue
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5295
!
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5296
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5297
value:aValue
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5298
    "could be a value holder, an action or selector
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5299
     Left here for ST80 compatibility - value: is a bad name
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5300
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5301
    menuItem itemValue:aValue.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5302
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5303
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5304
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5305
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  5306
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5307
    menuItem itemValue:aValue.
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5308
    menuItem  argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5309
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5310
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5311
!MenuPanel::Item methodsFor:'accessing-behavior'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5312
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5313
choice
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5314
    "implements a radio group; the field
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5315
    "
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5316
    ^ choice
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5317
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5318
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5319
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5320
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5321
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5322
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5323
    choice == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5324
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5325
    choice isValueModel ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5326
	choice removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5327
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5328
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5329
    (choice := something) notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5330
	choice isSymbol ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5331
	    (choice := self aspectAt:choice) isNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5332
		choice := something
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5333
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5334
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5335
	choice isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5336
	    choice addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5337
	]
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5338
    ].
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5339
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5340
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5341
choiceValue
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5342
    "implements a radio group; the value writen to the choice if selected
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5343
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5344
    ^ menuItem choiceValue
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5345
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5346
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5347
choiceValue:something
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5348
    "implements a radio group; the value writen to the choice if selected
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5349
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5350
    menuItem choiceValue ~= something ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5351
        menuItem choiceValue:something.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5352
        choice notNil ifTrue:[ self invalidate ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5353
    ].
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5354
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5355
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5356
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5357
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5358
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5359
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5360
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5361
    menuPanel enabled ifFalse:[^ false].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5362
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5363
    enableChannel isSymbol ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5364
        state := self aspectAt:enableChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5365
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5366
        state isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5367
            self ifNotInUIBuilderInfoPrintCR:
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5368
                ('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')').
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5369
            ^ true
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5370
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5371
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5372
        state isValueModel ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5373
            enableChannel := state.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5374
            enableChannel addDependent:self.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5375
            state := enableChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5376
        ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5377
            state := state value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5378
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5379
    ] ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5380
        state := enableChannel value
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5381
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5382
    ^ state ~~ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5383
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5384
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  5385
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5386
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5387
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5388
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5389
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5390
    enableChannel isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5391
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5392
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5393
	oldState := enableChannel value.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5394
	enableChannel isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5395
	    enableChannel removeDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5396
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5397
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5398
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5399
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5400
    enableChannel isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5401
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5402
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5403
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5404
	enableChannel isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5405
	    enableChannel addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5406
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5407
	    enableChannel isSymbol ifTrue:[^ self]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5408
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5409
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5410
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5411
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5412
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5413
    newState ~~ oldState ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5414
	self invalidate
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  5415
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5416
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5417
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5418
hideMenuOnActivated
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5419
    "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5420
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5421
    ^ menuItem hideMenuOnActivated
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5422
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5423
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5424
hideMenuOnActivated:aBool
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5425
   "hide the menu when the item was activated; the default is true
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5426
   "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5427
   menuItem hideMenuOnActivated:aBool.
1670
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5428
!
dbc8a05605e0 add new behavior: hideMenuOnActivated
ca
parents: 1666
diff changeset
  5429
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5430
ifNotInUIBuilderInfoPrintCR:aMessage
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5431
    "/ q&d hack to suppress info-messages in UIBuilder
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5432
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5433
    (menuPanel receiver isNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5434
    and:[ menuPanel application notNil
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5435
    and:[ menuPanel application askFor:#isUIPainter]])
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5436
    ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5437
	^ self "/ suppressed
2216
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5438
    ].
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5439
    aMessage infoPrintCR
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5440
!
9cbeda150dae no info for toolbarmenu enable channel
penk
parents: 2214
diff changeset
  5441
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5442
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5443
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5444
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5445
    ^ indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5446
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5447
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5448
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5449
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5450
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5451
    indication == something ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5452
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5453
    indication isValueModel ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5454
	indication removeDependent:self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5455
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5456
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5457
    (indication := something) notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5458
	indication isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5459
	    indication addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5460
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5461
	    "/ to force an update of the value
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5462
	    self indicationValue
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5463
	]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5464
    ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5465
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5466
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5467
keepLinkedMenu
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5468
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5469
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5470
    ^ menuItem keepLinkedMenu
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5471
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5472
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5473
keepLinkedMenu:aBool
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5474
    "get the keepLinkedMenu flag
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5475
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5476
    menuItem keepLinkedMenu:aBool.
1767
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5477
!
e6325bfd4fad allow views in subMenus
ca
parents: 1766
diff changeset
  5478
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5479
sendToOriginator
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5480
    "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
  5481
     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
  5482
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5483
    ^ menuItem sendToOriginator
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5484
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5485
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5486
sendToOriginator:aBoolean
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5487
    "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
  5488
     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
  5489
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5490
    menuItem sendToOriginator:aBoolean.
2331
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5491
!
ebd240410703 can now specify if menu action is to be performed by
ca
parents: 2326
diff changeset
  5492
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5493
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5494
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5495
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5496
    ^ menuItem submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5497
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5498
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5499
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5500
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5501
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5502
    menuItem submenuChannel:aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5503
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5504
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5505
!MenuPanel::Item methodsFor:'accessing-dimension'!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5506
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5507
moveBy:aPoint
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5508
    "move layout origin
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5509
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5510
    layout moveBy:aPoint.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5511
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5512
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5513
preferredExtent
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5514
    "compute my preferred extent excluding the shortCutKey and the menu identifier
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5515
    "
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5516
    |isVertical icon wIcon isButton labelExtent
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5517
     x "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5518
     y "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5519
     s "{ Class:SmallInteger }"
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5520
    |
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5521
    self isVisible ifFalse:[^ 0@0 ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5522
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5523
    isButton := menuItem isButton.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5524
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5525
    isButton ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5526
        s := menuPanel maxAbsoluteButtonLevel.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5527
        x := s + HorizontalButtonInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5528
        y := s + VerticalButtonInset.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5529
    ] ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5530
        x  := HorizontalInset.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5531
        y  := (menuPanel isPopUpView ifTrue:[VerticalPopUpInset] ifFalse:[VerticalInset]) ? 2.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5532
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5533
    x := x * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5534
    y := y * 2.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5535
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5536
    isVertical := menuPanel verticalLayout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5537
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  5538
    self isSeparator ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5539
        "SEPARATOR"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5540
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5541
        s := self class separatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5542
        label = '' ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5543
            s := self class halfSeparatorSize.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5544
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5545
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5546
        "width of doubleSeparator is 5 !!!!"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5547
        isVertical ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5548
            x := x max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5549
            y := y + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5550
        ] ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5551
            y := y max:s.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5552
            x := x + 5.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5553
        ].
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5554
    ] ifFalse:[
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5555
        labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5556
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5557
        x := x + labelExtent x.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5558
        y := y + labelExtent y.
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5559
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5560
        isButton ifFalse:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5561
            menuPanel showSeparatingLines ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5562
                "width of separator is 2 plus right offset 1 := 3"
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5563
                isVertical ifFalse:[x := x + 3] ifTrue:[y := y + 3].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5564
            ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5565
            (indication notNil or:[choice notNil]) ifTrue:[
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5566
                x := x + 2 + menuPanel iconIndicationOff width.
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5567
            ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5568
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5569
        wIcon := 0.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5570
        self hasMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5571
            icon := MenuPanel menuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5572
            wIcon := MenuPanel menuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5573
        ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5574
            self hasDelayedMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5575
                icon := MenuPanel delayedMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5576
                wIcon := MenuPanel delayedMenuIndicatorOffset + icon width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5577
            ]
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  5578
        ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  5579
        x := x + wIcon.
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5580
    ].
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  5581
    ^ x@y
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5582
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5583
1679
af40842718f6 when accepting, and the application does not respond to that
Claus Gittinger <cg@exept.de>
parents: 1670
diff changeset
  5584
!MenuPanel::Item methodsFor:'accessing-help'!
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5585
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5586
activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5587
    "get the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5588
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5589
    ^ menuItem activeHelpKey
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5590
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5591
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5592
activeHelpKey:aHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5593
    "set the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5594
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5595
    menuItem activeHelpKey:aHelpKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5596
    activeHelpText := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5597
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5598
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5599
activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5600
    "get the active helpText or nil if not yet resolved
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5601
    "
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5602
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5603
    |app key|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5604
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5605
    activeHelpText notNil ifTrue:[^ activeHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5606
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5607
    ((key := self activeHelpKey) notNil 
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5608
    and:[(app := menuPanel application) notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5609
        ^ app helpTextForKey:key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5610
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5611
    ^ nil
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5612
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5614
activeHelpText:aText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5615
    "set the active helpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5616
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5617
    activeHelpText := aText.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5618
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5619
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5620
flyByHelpText
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5621
    "get the flyBy helpText or nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5622
    "
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5623
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5624
    |text key app|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5625
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5626
    flyByHelpText notNil ifTrue:[^ flyByHelpText].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5627
2574
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  5628
    self isSeparator ifTrue:[^ nil].
366e5807711f separators have no flyByHelp
Claus Gittinger <cg@exept.de>
parents: 2569
diff changeset
  5629
2471
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5630
    "/ its NOT the button-attribute, which controls flyByHelp suppression...
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5631
    "/ (if you have an argument for that let us know..)
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5632
    "/    self isButton ifFalse:[^ nil].
e6e52dc428a2 it is not the isButton behavior,
martin
parents: 2460
diff changeset
  5633
    (menuPanel isNil or:[menuPanel isPopUpView]) ifTrue:[^ nil].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5634
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  5635
    "/ if an activeHelpKey was explicitely given, use that one
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5636
    key := self activeHelpKey. 
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5637
    (key notNil and:[(app := menuPanel application) notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5638
        text := app flyByHelpTextForKey:key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5639
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5640
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  5641
    "/ 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
  5642
    text isNil ifTrue:[
2676
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  5643
        self hasSubmenu ifTrue:[
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  5644
            ^ key
01dc236c3dcd flyByHelp: shown for items with menu IFF there is an activeHelp key
ca
parents: 2675
diff changeset
  5645
        ].
2652
686c0f0acb90 do not show help for items which have a menu (launchers about-item)
Claus Gittinger <cg@exept.de>
parents: 2617
diff changeset
  5646
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5647
        text := key.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5648
        text isNil ifTrue:[
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5649
            displayLabel isString ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5650
                text := displayLabel string.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5651
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5652
        ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5653
        text isNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5654
            text := self rawLabel.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5655
            text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5656
                text := menuItem rawLabel.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5657
                text isString ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5658
                    text := nil.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5659
                ]
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5660
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5661
            text notNil ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5662
                (text includes:$&) ifTrue:[ 
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5663
                    text := (self updateAccessCharacterFor:text) string.
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5664
                ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5665
            ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5666
        ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5667
    ].
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5668
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5669
    text = displayLabel ifTrue:[
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5670
        "for text menus: it does not make sense to show the labels string again
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5671
         (i.e. in a pull down menu)"
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5672
        ^ nil
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  5673
    ].
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5674
    ^ text
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5675
!
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5676
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5677
flyByHelpText:aText
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  5678
    "exlicitly set the flyBy helpText. For example, to dynamically change it.
2345
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5679
    "
8b7b3e384002 fallBack to activeHelpKey and label, if no flyByHelp is
Claus Gittinger <cg@exept.de>
parents: 2344
diff changeset
  5680
    flyByHelpText := aText.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5681
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  5682
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5683
!MenuPanel::Item methodsFor:'accessing-look'!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5684
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5685
horizontalLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5686
    "on default submenus has a vertical layout;
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5687
     true, the submenu has a horizontal layout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5688
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5689
    ^ menuItem horizontalLayout ? false
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5690
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5691
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5692
horizontalLayout:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5693
    "on default submenus has a vertical layout;
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5694
     true, the submenu has a horizontal layout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5695
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  5696
    menuItem horizontalLayout:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5697
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5698
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5699
isButton
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5700
    "returns whether item looks like a Button
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5701
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5702
    ^ menuItem isButton
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5703
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5704
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5705
isButton:aBool
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5706
    "sets whether item looks like a Button
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5707
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5708
    menuItem isButton ~~ aBool ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5709
        menuItem isButton:aBool.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5710
        self invalidate.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5711
    ]
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5712
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5713
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5714
layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5715
    "returns my layout ( Rectangle )
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5716
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5717
    ^ layout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5718
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5719
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5720
layout:aLayout
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5721
    "set a new layout ( Rectangle )
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5722
    "
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5723
    layout := aLayout.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5724
    self invalidate.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5725
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5726
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5727
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5728
showBusyCursorWhilePerforming
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5729
    "get the flag which controls if a busy cursor is to be shown
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5730
     while performing the menu action. Defaults to false.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5731
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5732
    ^ menuItem showBusyCursorWhilePerforming
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5733
!
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5734
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5735
showBusyCursorWhilePerforming:aBoolean
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5736
    "set/clear the flag which controls if a busy cursor is to be shown
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5737
     while performing the menu action. Defaults to false.
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5738
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5739
    menuItem showBusyCursorWhilePerforming:aBoolean.
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5740
! !
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  5741
2504
0ce78a73aacf method category rename
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  5742
!MenuPanel::Item methodsFor:'activation & deactivation'!
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5743
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5744
currentSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5745
    "returns the current submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5746
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5747
    ^ subMenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5748
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5749
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5750
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5751
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5752
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5753
hideSubmenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5754
    "hide submenu
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5755
    "
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5756
    self hideSubmenu:subMenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5757
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5758
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5759
hideSubmenu:aSubmenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5760
    "hide submenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5761
    "
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5762
    |id|
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5763
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5764
    aSubmenu isNil ifTrue:[^ self].
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  5765
    aSubmenu removeDependencies.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5766
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5767
    aSubmenu realized ifFalse:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5768
        id := aSubmenu id.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5769
        id notNil ifTrue:[ menuPanel device unmapWindow:id ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5770
    ] ifTrue:[
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5771
        aSubmenu hide
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5772
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5773
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5774
    aSubmenu  windowGroup:nil.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5775
    menuPanel windowGroup removeView:aSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5776
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5777
    "/ release menu if derived from channel
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5778
    (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5779
        menuItem keepLinkedMenu ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5780
            subMenu := nil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  5781
        ]
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5782
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5783
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5784
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5785
openDelayedSubmenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5786
    "called to open now my delayed submenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5787
    "
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5788
    |subm|
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5789
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5790
    (self isSelected and:[menuPanel shown]) ifFalse:[^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5791
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5792
    subMenu notNil ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5793
        subMenu realized ifTrue:[
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5794
            "/ already open
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5795
            ^ self
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5796
        ].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5797
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5798
    subm := self setupSubmenu.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5799
    subm isNil ifTrue:[^ self].
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5800
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5801
    self openSubmenu.
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5802
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5803
    (subm == subMenu and:[self isSelected]) ifFalse:[
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5804
        "/ closed during building or opening the submenu
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5805
        self hideSubmenu:subm.
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  5806
    ].
1705
201f9ce1b2d2 checkin from browser
ca
parents: 1704
diff changeset
  5807
!
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5808
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5809
openSubmenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5810
    "opens the submenu; make sure, that the submenu and the menPanel
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5811
     is fully visible by shifting it into the visible screen area if
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5812
     nescessary.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5813
    "
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5814
    |p o device isVertical topMenu windGrp prefExtent
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5815
     devBot   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5816
     devRight "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5817
     width    "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5818
     height   "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5819
     top      "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5820
     left     "{ Class:SmallInteger }"
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5821
    |
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5822
1737
c18896a7cb50 replace shown by realized; when opening a submenue-submenue by shortcut key
ca
parents: 1735
diff changeset
  5823
    (subMenu notNil and:[subMenu shown not and:[self isSelected and:[menuPanel realized]]]) ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5824
        ^ self
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5825
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5826
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5827
    topMenu := menuPanel topMenu.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5828
    (subMenu device notNil and:[topMenu device ~~ subMenu device]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5829
        subMenu releaseDeviceResources.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5830
        subMenu setDevice:topMenu device id:nil gcId:nil.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5831
        subMenu recreate.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5832
    ].
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  5833
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5834
    windGrp := topMenu windowGroup.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5835
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5836
    subMenu superMenu:menuPanel.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5837
    subMenu becomesActiveMenu.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5838
    subMenu cursor:Cursor hand.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5839
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5840
    windGrp notNil ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5841
        subMenu windowGroup:windGrp.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5842
        windGrp addTopView:subMenu.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5843
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5844
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5845
    "Q&D kludge - test whether the layout is nil;
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5846
                  if true recompute the layouts
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5847
    "
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  5848
    layout isNil ifTrue:[menuPanel rearrangeItems].
2111
f3d67f7c0f92 bug fix when opening a menu by mnemonic
ca
parents: 2100
diff changeset
  5849
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5850
    " Q&D kludge - if any visibility attributes are blocks;
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5851
      TODO: only invoke mustRearrange if any are blocks
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5852
            (since I react correctly on valueHolder changes)
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5853
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5854
    subMenu rearrangeItemsIfItemVisibilityChanged.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5855
    subMenu fixSize.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5856
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5857
    "compute origin of subMenu
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5858
    "
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5859
    isVertical := menuPanel verticalLayout.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5860
    device     := menuPanel device.
1714
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5861
    prefExtent := subMenu preferredExtent.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5862
    height     := prefExtent y.
b4c05977e9d5 get heigth and width from preferredExtent when open a submenu
ca
parents: 1710
diff changeset
  5863
    width      := prefExtent x.
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5864
    devBot     := device  usableHeight.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5865
    devRight   := device  usableWidth.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5866
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5867
    p := isVertical ifTrue:[layout topRight - 2] ifFalse:[layout bottomLeft].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5868
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5869
    menuPanel isPopUpView ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5870
        o := menuPanel origin + p
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5871
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5872
        o := menuPanel translatePoint:p to:nil.   "/ translate to root window
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  5873
    ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5874
    left := o x.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5875
    top  := o y.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5876
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5877
    top + height > devBot ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5878
        top := isVertical ifTrue:[devBot - height]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5879
                         ifFalse:[top - layout height - height + 2]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5880
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5881
    top := top max:0.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5882
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5883
"/    (isVertical not and:[subMenu isVerticalLayout]) ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5884
"/        top < menuPanel bottom ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5885
"/            left := left + layout width.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5886
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5887
"/        left + width > devRight ifTrue:[
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5888
"/            left := o x - width - 2
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5889
"/        ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5890
"/    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  5891
        
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5892
    left + width > devRight ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5893
        left := isVertical ifTrue:[left - layout width - width + 2]
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5894
                          ifFalse:[devRight - width]
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5895
    ].
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5896
    left := left max:0.
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5897
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5898
    subMenu origin:(left@top).
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5899
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5900
    subMenu realized ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5901
        subMenu realize. 
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5902
    ] ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  5903
        topMenu device mapWindow:(subMenu id).
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5904
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5905
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5906
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5907
toggleSubmenuVisibility
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5908
    "toggle the visibility of the submenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5909
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5910
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5911
	subMenu shown ifTrue:[^ self hideSubmenu]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5912
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5913
	(subMenu := self setupSubmenu) isNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5914
	    "/ cannot open a submenu
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5915
	    ^ self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5916
	]
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5917
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5918
    self openSubmenu.
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5919
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5920
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5921
!
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5922
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5923
visibleSubmenu
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5924
    "returns the current visible submenu or nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5925
    "
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5926
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  5927
	subMenu shown ifTrue:[^ subMenu].
1786
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5928
    ].
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5929
    ^ nil
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5930
f27f48940f48 change behaviour of cursor/key control and menu actication
ca
parents: 1785
diff changeset
  5931
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5932
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5933
! !
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  5934
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5935
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5936
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5937
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5938
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5939
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5940
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5941
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5942
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5943
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  5944
    (appl isValueModel) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5945
        ^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5946
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5947
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5948
    appl isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5949
        appl := menuPanel application.
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5950
    ].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5951
    appl isNil ifTrue:[ ^ nil].
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5952
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5953
    MessageNotUnderstood handle:[:ex|
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5954
        ex selector == aKey ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5955
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5956
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5957
        self ifNotInUIBuilderInfoPrintCR:
2545
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  5958
            ('MenuPanel::Item [info]: application (class %1) does not provide aspect: %2' 
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  5959
             bindWith:appl className with:aKey).
2123
091268558e93 *** empty log message ***
ca
parents: 2118
diff changeset
  5960
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5961
        aKey numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5962
            value := appl perform:aKey with:(menuItem argument ? self).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5963
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5964
            (appl respondsTo:#aspectFor:) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5965
                value := appl aspectFor:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5966
            ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5967
                value := appl perform:aKey
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5968
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5969
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5970
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5971
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5972
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  5973
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5974
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5975
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5976
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5977
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5978
fontChanged
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5979
    "called whenever the font changed
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5980
    "
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5981
    displayLabel notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5982
        displayLabelExtent := nil.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5983
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5984
        subMenu notNil ifTrue:[
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5985
            subMenu font:(menuPanel font).
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5986
        ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5987
    ].
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5988
!
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  5989
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5990
update:something with:aParameter from:changedObject
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5991
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5992
    |form rect|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5993
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5994
    (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
  5995
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  5996
    self isSeparator ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5997
        "/ NOT A SEPARATOR
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5998
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  5999
        menuPanel shown ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6000
            changedObject == enableChannel ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6001
                (enableChannel value == false and:[self isSelected]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6002
                    ^ menuPanel selection:nil.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6003
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6004
                ^ self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6005
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6006
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6007
            (changedObject == indication or:[changedObject == choice]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6008
                menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6009
                    self invalidate
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6010
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6011
                    "/ invalidate the interactor only
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6012
                    "/ take any interactor; interactors has the same extent
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6013
                    form := menuPanel iconIndicationOff.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6014
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6015
                    rect := Rectangle left:(layout left + HorizontalInset)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6016
                                       top:(layout top)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6017
                                     width:(form width)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6018
                                    height:(layout height).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6019
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6020
                    menuPanel invalidate:rect repairNow:false
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6021
                ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6022
                ^ self
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6023
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6024
        ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  6025
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6026
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6027
    changedObject == isVisible ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6028
        menuPanel mustRearrange.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6029
        menuPanel rearrangeItems.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6030
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6031
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  6032
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  6033
    super update:something with:aParameter from:changedObject
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6034
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6035
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6036
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6037
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6038
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6039
    (indication notNil and:[indication isSymbol]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6040
	" indication is a selector otherwise a change notification
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6041
	  is raised from the model !!!!
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6042
	"
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6043
	self update:nil with:nil from:indication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6044
    ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6045
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6046
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6047
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6048
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6049
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6050
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6051
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6052
    ^ menuItem
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6053
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6054
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6055
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6056
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6057
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6058
    |lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  6059
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6060
    menuPanel disabledRedrawDo:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6061
        menuItem := aMenuItem.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6062
        menuItem isNil ifTrue:[ menuItem := MenuItem new].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6063
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6064
        label := displayLabel := activeHelpText := nil.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6065
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6066
        self    enabled:(menuItem enabled).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6067
        self indication:(menuItem indication).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6068
        self     choice:(menuItem choice).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6069
        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
  6070
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6071
"/ we should call here resourceRetriever insteat of labelImage
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6072
"/ but ... ??
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6073
        (lbl := menuItem labelImage value) isNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6074
            lbl := menuItem rawLabel. "/ avoid translating &'s twice
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6075
        ].
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6076
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6077
        self submenu:(menuItem submenu).
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  6078
        self label:lbl.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6079
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  6080
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  6081
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6082
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6083
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6084
!MenuPanel::Item methodsFor:'dependents access'!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6085
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6086
addDependencies
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6087
    "add all dependencies
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6088
    "
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6089
    enableChannel isValueModel ifTrue:[enableChannel addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6090
    isVisible     isValueModel ifTrue:[isVisible     addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6091
    indication    isValueModel ifTrue:[indication    addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6092
    choice        isValueModel ifTrue:[choice        addDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6093
!
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6094
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6095
removeDependencies
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6096
    "remove all dependencies
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6097
    "
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6098
    enableChannel isValueModel ifTrue:[enableChannel removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6099
    isVisible     isValueModel ifTrue:[isVisible     removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6100
    indication    isValueModel ifTrue:[indication    removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6101
    choice        isValueModel ifTrue:[choice        removeDependent:self].
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6102
! !
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6103
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6104
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6105
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6106
draw
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6107
    "redraw item
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6108
    "
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6109
    |isSelected ownBgCol paint bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6110
     x  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6111
     y  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6112
     w  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6113
     h  "{ Class:SmallInteger }"
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6114
    |
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6115
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6116
    self isVisible ifFalse:[^ self].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6117
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6118
    self isSeparator ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6119
        self drawSeparator.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6120
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6121
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6122
    menuItem isButton ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6123
        self drawButton.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6124
        ^ self
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6125
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6126
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6127
    "/ DRAW A LABELED ENTRY; no button, no separator
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6128
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6129
    isSelected := self isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6130
    bgColor    := menuPanel backgroundColor.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6131
    paint      := isSelected 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6132
                    ifTrue:[self activeBackgroundColor] 
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6133
                    ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6134
                        (self isEnabled and:[ self isEntered ]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6135
                            menuPanel enteredBackgroundColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6136
                        ] ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6137
                            bgColor
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6138
                        ]].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6139
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6140
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6141
        paint := ownBgCol
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6142
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6143
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6144
    paint ~= bgColor ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6145
        menuPanel paint:paint.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6146
        menuPanel fillRectangle:layout.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6147
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6148
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6149
    menuPanel showSeparatingLines ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6150
        self drawSeparatingLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6151
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6152
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6153
    self drawLabel.  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6154
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6155
    (ownBgCol notNil and:[isSelected]) ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6156
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6157
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6158
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6159
        x := layout left.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6160
        y := layout top.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6161
        w := layout width.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6162
        h := layout height.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6163
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6164
        menuPanel displayRectangleX:(x + 1) y:(y + 1) width:(w - 2) height:(h - 2).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6165
        menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).  
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6166
    ].
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6167
    menuPanel drawLabelEdgeFor:self selected:isSelected.
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6168
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6169
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6170
drawButton
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6171
    "draw as button
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6172
    "
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6173
    |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
  6174
     x "{ Class:SmallInteger }"
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6175
     y "{ Class:SmallInteger }"
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6176
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6177
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6178
    isEnabled  := self enabled.
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  6179
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6180
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6181
    isSelected ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6182
        "/ test whether button has pressed toggle behaviour
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6183
        showSelected := (self isToggle and:[self indicationValue]).
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6184
    ] ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6185
        showSelected := isSelected
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6186
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6187
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6188
    showSelected ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6189
        bg := self activeBackgroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6190
        fg := self activeForegroundColor.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6191
    ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6192
        self isEntered ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6193
            bg := self buttonEnteredBackgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6194
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6195
            bg := self backgroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6196
        ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6197
        isEnabled ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6198
            fg := menuPanel foregroundColor
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6199
        ] ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6200
            fg := menuPanel disabledForegroundColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6201
            etchFg := menuPanel disabledEtchedForegroundColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6202
            drawObject := self disabledRawLabel
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6203
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6204
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6205
1708
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6206
    (ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6207
        bg := ownBgCol
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6208
    ].
cfaf55b9043d bug fix in background color of button when derives from label(text)
ca
parents: 1707
diff changeset
  6209
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6210
    "DRAW BACKGROUND"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6211
    bg ~= menuPanel backgroundColor ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6212
        menuPanel paint:bg.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6213
        menuPanel fillRectangle:layout.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6214
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6215
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6216
    x := layout left + menuPanel buttonPassiveLevel + HorizontalButtonInset.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6217
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6218
    (drawObject isImage and:[menuPanel centerItems]) ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6219
        x := x + (layout width - menuPanel buttonPassiveLevel - HorizontalButtonInset - 1 - drawObject width // 2).
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6220
    ].
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6221
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6222
    isSelected ifFalse:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6223
        "check whether button should be drawn selected; indicator or radio button"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6224
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6225
        indication notNil ifTrue:[
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6226
            "button is indicator and set"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6227
            isSelected := self indicationValue
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6228
        ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6229
            isSelected := (choice notNil and:[choice value = menuItem choiceValue]).
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6230
        ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6231
    ].
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6232
    y := 0.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6233
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6234
    isSelected ifTrue:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6235
        level := menuPanel buttonActiveLevel.
2142
ea2a32738005 pressed button label only shifted by one pixel
penk
parents: 2141
diff changeset
  6236
        x     := x + 1 "level abs".
2143
7b99a7348c97 draw label shifted right-down when pressed
penk
parents: 2142
diff changeset
  6237
        y     := y + 1 "level abs".
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6238
    ] ifFalse:[   
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6239
        level := self isEntered ifTrue:[menuPanel buttonEnteredLevel]
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6240
                               ifFalse:[menuPanel buttonPassiveLevel].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6241
    ].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6242
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6243
    drawObject isEmptyOrNil ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6244
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6245
            self drawRawLabel:drawObject atX:x+1 yOffset:y+1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6246
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6247
        self drawRawLabel:drawObject atX:x yOffset:y+0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6248
    ].
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6249
    self drawMenuIndicator.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6250
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6251
    level ~~ 0 ifTrue:[
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6252
        menuPanel drawButtonEdgesFor:self level:level
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6253
    ].
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6254
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6255
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6256
drawLabel
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6257
    "draw a labeled entry; no button, no separator.
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6258
    "
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6259
    |scKey cLb cLa drawObject fg etchFg arrow 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6260
     isSelected isEnabled form
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6261
     h "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6262
     y "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6263
     x "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6264
     t "{ Class:SmallInteger }"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6265
    |
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6266
    drawObject := displayLabel.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6267
    isEnabled  := self enabled.
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6268
    isSelected := self isSelected.
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6269
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6270
    isSelected ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6271
        fg := self activeForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6272
    ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6273
        isEnabled ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6274
            self isEntered ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6275
                fg := menuPanel enteredForegroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6276
            ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6277
                fg := menuPanel foregroundColor
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6278
            ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6279
        ] ifFalse:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6280
            fg          := menuPanel disabledForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6281
            etchFg      := menuPanel disabledEtchedForegroundColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6282
            drawObject  := self disabledRawLabel
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6283
        ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6284
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6285
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6286
    h := layout height.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6287
    x := layout left + HorizontalInset.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6288
    t := layout top.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6289
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6290
    ((form := self indicatorForm) notNil or:[(form := self choiceForm) notNil]) ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6291
        y := t + ((h - form height) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6292
        
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6293
        form displayOn:menuPanel x:x y:y.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6294
        x := x + 2 + form width.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6295
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6296
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6297
    drawObject isEmptyOrNil ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6298
        etchFg notNil ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6299
            self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6300
        ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6301
        self drawRawLabel:drawObject atX:x yOffset:0 paint:fg.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6302
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6303
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6304
    self drawMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6305
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6306
    "/ DRAW SHORTCUT KEY
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6307
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6308
    (     menuItem shortcutKey notNil
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6309
     and:[(x := menuPanel shortKeyInset) ~~ 0
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6310
     and:[(scKey:= self shortcutKeyAsString) notNil]]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6311
    ) ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6312
        x := layout left + x.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6313
        y := t + ((h - (scKey heightOn:menuPanel)) // 2).
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6314
        y := y + menuPanel font ascent.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6315
        scKey displayOn:menuPanel x:x y:y. 
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6316
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6317
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6318
    "/ DRAW SUBMENU INDICATION
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6319
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6320
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6321
        ^ self
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6322
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6323
    arrow := menuPanel rightArrow.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6324
    x := layout right - arrow width - HorizontalInset.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6325
    y := t + (h - arrow height // 2).
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6326
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6327
    (menuPanel styleSheet is3D not
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6328
    or:[(drawObject := menuPanel rightArrowShadow) isNil]) ifTrue:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6329
        ^ menuPanel displayForm:arrow x:x y:y
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6330
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6331
    cLa := menuPanel shadowColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6332
    cLb := menuPanel lightColor.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6333
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6334
    isSelected ifFalse:[
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6335
        fg  := cLa.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6336
        cLa := cLb.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6337
        cLb := fg
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6338
    ].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6339
    menuPanel paint:cLa.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6340
    menuPanel displayForm:arrow x:x y:y.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6341
    menuPanel paint:cLb.
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6342
    menuPanel displayForm:drawObject x:x y:y. 
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6343
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6344
    "Modified: / 6.9.1998 / 21:48:53 / cg"
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6345
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6346
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6347
drawMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6348
    "draw a menu indicator if the item has a menu or delayed menu.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6349
    "
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6350
    |x y icon bAbsLevel|
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6351
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6352
    self hasDelayedMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6353
        icon := MenuPanel delayedMenuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6354
    ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6355
        self hasMenuIndicator ifTrue:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6356
            icon := MenuPanel menuIndicator.
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6357
        ] ifFalse:[
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6358
            ^ self
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6359
        ]
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6360
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6361
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6362
    x := layout right  - icon width.
2460
9afb27f470a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2433
diff changeset
  6363
    false "delayedMenuIndicatorVerticalPosition == #center" ifTrue:[
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6364
        y := layout height - icon height // 2 + layout top.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6365
    ] ifFalse:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6366
        y := layout bottom - icon height - 2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6367
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6368
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6369
    bAbsLevel := 0.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6370
    menuItem isButton ifTrue:[
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6371
        self isSelected ifTrue:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6372
            x := x + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6373
            y := y + 1.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6374
        ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6375
        bAbsLevel := menuPanel maxAbsoluteButtonLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6376
        x := x - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6377
        y := y - bAbsLevel.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6378
    ].
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6379
    x := x - 1 "- HorizontalInset".
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6380
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6381
    (self isEnabled "and:[self delayedMenuIsEnabled]") ifFalse:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6382
        icon := menuPanel lightenedImageOnDevice:icon
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6383
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6384
    icon displayOn:menuPanel x:x y:y.
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6385
2234
29eba50f76eb drawColSep beautified;
Claus Gittinger <cg@exept.de>
parents: 2232
diff changeset
  6386
    (false "drawDelayedMenuIndicatorSeparator" and:[ menuPanel buttonPassiveLevel ~~ 0 ])
2220
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6387
    ifTrue:[
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6388
        menuPanel paint:menuPanel buttonShadowColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6389
        menuPanel displayLineFromX:x-2 y:layout top+bAbsLevel+1 toX:x-2 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6390
        menuPanel paint:menuPanel buttonLightColor.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6391
        menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2.
5ea0ceb20354 delayed submenu indicator
Claus Gittinger <cg@exept.de>
parents: 2219
diff changeset
  6392
    ].
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6393
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  6394
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6395
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6396
    "draw a labeled entry; no button, no separator.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6397
    "
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6398
    |mfont labelExtent
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6399
     y  "{ Class:SmallInteger }"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6400
     y0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6401
     x0 "{ Class:SmallInteger }"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6402
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6403
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6404
    mfont := menuPanel setFont:(self font).
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6405
    "/ fontAscent := menuPanel font ascent.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6406
    menuPanel paint:fg.
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6407
    labelExtent := self displayLabelExtent.
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6408
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6409
    y := layout top + (layout height - labelExtent y // 2) + yOffset.
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6410
"/  menuPanel centerItems ifTrue:[self halt].
2675
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6411
    aLabel isArray ifFalse:[ |printLabel|
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6412
        aLabel isText ifTrue:[
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6413
            "/background of label already drawn
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6414
            printLabel := aLabel withoutEmphasis:#backgroundColor.
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6415
        ] ifFalse:[
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6416
            printLabel := aLabel.
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6417
        ].
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6418
        y := y + (printLabel ascentOn:menuPanel).
7a090a030736 bugfix when drawing Text with #backgroundColor (see ColorMenu)
ca
parents: 2659
diff changeset
  6419
        printLabel displayOn:menuPanel x:x y:y.
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6420
    ] ifTrue:[
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6421
        aLabel do:[:el|
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6422
            el notNil ifTrue:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6423
                y0 := y + (el ascentOn:menuPanel).
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6424
"/                el isImageOrForm ifFalse:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6425
"/                    y0 := y + fontAscent
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6426
"/                ] ifTrue:[
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6427
"/                    y0 := y
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6428
"/                ].
2614
86086fc6a99c bugfix: adapt extents if font changed
ca
parents: 2611
diff changeset
  6429
                x0 := x + (labelExtent x - (el widthOn:menuPanel) // 2).
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6430
                el displayOn:menuPanel x:x0 y:y0.
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6431
                y := y + 1 + (el heightOn:menuPanel)
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6432
            ] ifFalse:[
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  6433
                y := y + (self spaceBetweenEmptyLines) 
2337
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6434
            ]
7f384db88273 centerItems attribute
Claus Gittinger <cg@exept.de>
parents: 2332
diff changeset
  6435
        ].
1727
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6436
    ].
a6365337be59 support setting font in MenuPanel and Editor
ca
parents: 1726
diff changeset
  6437
    menuPanel setFont:mfont
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6438
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6439
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6440
drawSeparatingLines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6441
    "draw separating lines
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6442
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6443
    |myIndex lfSep rtSep items prevItem nextItem
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6444
     lightColor shadowColor
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6445
     l "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6446
     t "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6447
     r "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6448
     b "{ Class:SmallInteger }"
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  6449
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6450
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6451
    items := menuPanel items.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6452
    myIndex := items identityIndexOf:self.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6453
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6454
    prevItem  := items at:(myIndex - 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6455
    lfSep := prevItem notNil and:[prevItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6456
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6457
    nextItem  := items at:(myIndex + 1) ifAbsent:nil.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6458
    rtSep := nextItem notNil and:[nextItem isButton not].
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6459
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6460
    (lfSep or:[rtSep]) ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6461
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6462
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6463
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6464
    lightColor := menuPanel lightColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6465
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6466
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6467
    menuPanel paint:lightColor.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6468
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6469
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6470
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6471
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  6472
    b := layout bottom.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6473
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6474
    menuPanel verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6475
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-1 toX:r y:t-1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6476
	rtSep ifTrue:[menuPanel displayLineFromX:l y:b-1 toX:r y:b-1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6477
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6478
	menuPanel paint:shadowColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6479
	lfSep ifTrue:[menuPanel displayLineFromX:l y:t-2 toX:r y:t-2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6480
	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
  6481
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6482
	lfSep ifTrue:[menuPanel displayLineFromX:l-1 y:t toX:l-1 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6483
	rtSep ifTrue:[menuPanel displayLineFromX:r-1 y:t toX:r-1 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6484
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6485
	menuPanel paint:shadowColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6486
	lfSep ifTrue:[menuPanel displayLineFromX:l-2 y:t toX:l-2 y:b].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6487
	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
  6488
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6489
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6490
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6491
drawSeparator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6492
    "draw as separator
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6493
    "
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6494
    |type lightColor shadowColor isDouble
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6495
     left top
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6496
     x0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6497
     x1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6498
     y0  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6499
     y1  "{ Class:SmallInteger }"
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6500
    |
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6501
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6502
    type := self separatorType.
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6503
    (type isNil or:[type == #blankLine]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6504
	^ self
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6505
    ].
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6506
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6507
    isDouble := type == #doubleLine.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6508
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6509
    lightColor := menuPanel lightColor.
2059
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6510
    shadowColor := menuPanel shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6511
    menuPanel paint:shadowColor.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6512
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6513
    left := layout left.
c760cfb7d689 code cleanup;
Claus Gittinger <cg@exept.de>
parents: 2058
diff changeset
  6514
    top := layout top.
1707
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6515
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6516
    menuPanel verticalLayout ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6517
	x0 := left  + HorizontalInset.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6518
	x1 := layout right - HorizontalInset.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6519
	y0 := top   - 1 + (layout height // 2).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6520
	isDouble ifTrue:[y0 := y0 - 2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6521
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6522
	menuPanel displayLineFromX:x0 y:y0   toX:x1 y:y0.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6523
	isDouble ifTrue:[menuPanel displayLineFromX:x0 y:y0+4 toX:x1 y:y0+4].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6524
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6525
	menuPanel paint:lightColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6526
	menuPanel displayLineFromX:x0 y:y0+1 toX:x1 y:y0+1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6527
	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
  6528
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6529
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6530
	y1 := layout bottom.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6531
	x0 := left - 1 + (layout width // 2).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6532
	y0 := top.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6533
	isDouble ifTrue:[x0 := x0 - 2].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6534
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6535
	menuPanel displayLineFromX:x0   y:y0 toX:x0   y:y1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6536
	isDouble ifTrue:[menuPanel displayLineFromX:x0+4 y:y0 toX:x0+4 y:y1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6537
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6538
	menuPanel paint:lightColor.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6539
	menuPanel displayLineFromX:x0+1 y:y0 toX:x0+1 y:y1.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6540
	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
  6541
    ]
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6542
!
4354f516e937 add some comment to methods; split draw routines for buttons labels ..
ca
parents: 1705
diff changeset
  6543
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6544
invalidate
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6545
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6546
    layout isNil ifTrue:[^ self].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6547
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6548
    (displayLabel notNil and:[menuPanel notNil]) ifTrue:[
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  6549
        menuPanel invalidateItem:self repairNow:false
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6550
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6551
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6552
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6553
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6554
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6555
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6556
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6557
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6558
    self submenu:nil.
2681
2d928e2d12af removeDependents on hide;
ca
parents: 2679
diff changeset
  6559
    self removeDependencies.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6560
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6561
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6562
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6563
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6564
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6565
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6566
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6567
    menuPanel := aPanel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6568
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6569
    menuItem isNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6570
        self halt.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6571
        menuItem := MenuItem new
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6572
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6573
!
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6574
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6575
initialize
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6576
    menuItem := MenuItem new.
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6577
!
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6578
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6579
reinitStyle
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6580
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6581
    subMenu notNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6582
	subMenu reinitStyle
1811
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6583
    ].
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6584
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6585
    "Created: / 17.8.2000 / 17:57:07 / cg"
df4f5e5b3396 restart under windows
Claus Gittinger <cg@exept.de>
parents: 1810
diff changeset
  6586
    "Modified: / 17.8.2000 / 18:00:08 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6587
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6588
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6589
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6590
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6591
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6592
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6593
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6594
    |block form image|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6595
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6596
    disabledDisplayLabel notNil ifTrue:[^ disabledDisplayLabel].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6597
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6598
    disabledDisplayLabel := displayLabel ? ''.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6599
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6600
    disabledDisplayLabel isString ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6601
        ^ disabledDisplayLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6602
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6603
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6604
    block := [:el| |rslt|
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6605
        (rslt := el) notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6606
            el isImageOrForm ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6607
                el colorMap notNil ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6608
                    rslt := menuPanel lightenedImageOnDevice:el
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6609
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6610
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6611
                (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6612
                    ((form := el icon) notNil and:[form colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6613
                        form := menuPanel lightenedImageOnDevice:form
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6614
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6615
                    ((image := el image) notNil and:[image colorMap notNil]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6616
                        image := menuPanel lightenedImageOnDevice:image
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6617
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6618
                    rslt := LabelAndIcon form:form image:image string:(el string).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6619
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6620
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6621
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6622
        rslt
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6623
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6624
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6625
    displayLabel isArray ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6626
        disabledDisplayLabel := Array new:(displayLabel size).
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6627
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6628
        displayLabel keysAndValuesDo:[:anIndex :aLabel|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6629
            disabledDisplayLabel at:anIndex put:(block value:aLabel)
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6630
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6631
    ] ifFalse:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6632
        disabledDisplayLabel := block value:displayLabel
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6633
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6634
    ^ disabledDisplayLabel
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6635
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  6636
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6637
fetchDeviceResources
2373
8dbf026f0bd1 bug fix: specific font used by item
ca
parents: 2372
diff changeset
  6638
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6639
    disabledDisplayLabel := nil.
1829
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6640
    self fetchImages.
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6641
!
bd8b95c5bb89 migration fixes
Claus Gittinger <cg@exept.de>
parents: 1825
diff changeset
  6642
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6643
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6644
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  6645
    "
2118
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  6646
    |icon|
89d02ebc5b65 optimize #labels: and #fetchImages in Item. discard block
ca
parents: 2113
diff changeset
  6647
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6648
    (displayLabel isNil or:[displayLabel isString]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6649
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6650
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6651
    displayLabel isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6652
        displayLabel := menuPanel imageOnMyDevice:displayLabel.
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6653
        ^ self.  
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6654
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6655
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6656
    (displayLabel isKindOf:LabelAndIcon) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6657
        (icon := displayLabel image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6658
            displayLabel image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6659
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6660
        (icon := displayLabel icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6661
            displayLabel icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6662
        ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6663
        ^ self
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6664
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6665
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6666
    displayLabel isArray ifFalse:[^ self].            
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6667
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6668
    displayLabel keysAndValuesDo:[:i :el|
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6669
        (el notNil and:[el isString not]) ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6670
            el isImageOrForm ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6671
                displayLabel at:i put:(menuPanel imageOnMyDevice:el).
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6672
            ] ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6673
                el class == LabelAndIcon ifTrue:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6674
                    (icon := el image) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6675
                        el image:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6676
                    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6677
                    (icon := el icon) notNil ifTrue:[
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2485
diff changeset
  6678
                        el icon:(menuPanel imageOnMyDevice:icon)
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6679
                    ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6680
                ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6681
            ]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6682
        ]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  6683
    ].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6684
!
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6685
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6686
updateAccessCharacterFor:aLabel
2550
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6687
    "replace the & by the short-key attribute (i.e. underline it)"
1dc3745fc313 do not show the menus label again as fly by help
Claus Gittinger <cg@exept.de>
parents: 2545
diff changeset
  6688
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6689
    |s i rest label pos|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6690
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6691
    (accessCharacter notNil or:[aLabel isNil]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6692
        ^ aLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6693
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6694
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6695
    aLabel isString ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6696
        aLabel class == LabelAndIcon ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6697
            aLabel string:(self updateAccessCharacterFor:(aLabel string))
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6698
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6699
        ^ aLabel
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6700
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6701
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6702
    s := aLabel size.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6703
    i := 1.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6704
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6705
    label := aLabel.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6706
    pos := menuItem accessCharacterPosition.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6707
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6708
    [((i := label indexOf:$& startingAt:i) ~~ 0 and:[i < s])] whileTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6709
        rest := label copyFrom:(i+1).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6710
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6711
        i == 1 ifTrue:[label := rest]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6712
              ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6713
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6714
        (label at:i) == $& ifTrue:[i := i + 1] ifFalse:[pos := i].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6715
        s := s - 1.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6716
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6717
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6718
    (pos isNil or:[(accessCharacter := label at:pos ifAbsent:nil) isNil]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6719
        ^ label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6720
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6721
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6722
    label isText ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6723
        label := Text string:label
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6724
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6725
    label emphasisAt:pos add:#underline.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6726
    ^ label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6727
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6728
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6729
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6730
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6731
displayString
1690
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6732
    ^ self class name, '[', label printString, ']'
38b23fb1a931 add DefaultEnteredLevel and DefaultSelectionFollowsMouse
ca
parents: 1688
diff changeset
  6733
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6734
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  6735
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6736
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6737
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6738
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6739
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6740
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6741
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6742
        ^ menuPanel buttonActiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6743
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6744
    ^ menuPanel activeBackgroundColor
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6745
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6746
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6747
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6748
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6749
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6750
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6751
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6752
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  6753
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6754
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6755
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6756
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6757
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6758
        ^ menuPanel buttonPassiveBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6759
    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6760
    ^ menuPanel backgroundColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6761
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  6762
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6763
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6764
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6765
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6766
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6767
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6768
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6769
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6770
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6771
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6772
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6773
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6774
    run size == 0 ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6775
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6776
	    ^ run value
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6777
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6778
    ] ifFalse:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6779
	run do:[:r|
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6780
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6781
		^ r value
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6782
	    ]
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  6783
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6784
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6785
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6786
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6787
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6788
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6789
    "returns the background color to use when thhe mouse has entered 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6790
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6791
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6792
    menuItem isButton ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6793
        ^ menuPanel buttonEnteredBackgroundColor
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6794
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6795
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6796
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6797
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6798
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6799
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6800
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6801
    |isOn|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6802
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6803
    choice isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6804
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6805
    isOn := (choice value = menuItem choiceValue).
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6806
    self enabled ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6807
        ^ isOn ifTrue:[menuPanel iconRadioGroupDisabledOn]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6808
               ifFalse:[menuPanel iconRadioGroupDisabledOff]
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6809
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6810
    ^ isOn ifTrue:[menuPanel iconRadioGroupOn]
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6811
           ifFalse:[menuPanel iconRadioGroupOff]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6812
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6813
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6814
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6815
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6816
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6817
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6818
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  6819
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6820
    |subm sel numArgs|
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6821
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6822
    aRecv isNil ifTrue:[^ nil].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6823
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6824
    sel := menuItem submenuChannel.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6825
    sel isString ifFalse:[^ nil].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6826
    sel := sel asSymbol.
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6827
    numArgs := sel numArgs.
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6828
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6829
    numArgs == 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6830
        MessageNotUnderstood handle:[:ex |
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6831
            |selector|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6832
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6833
            ((selector := ex message selector) == sel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6834
            or:[selector == #aspectFor:]) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6835
                ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6836
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6837
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6838
            subm := aRecv aspectFor:sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6839
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6840
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6841
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6842
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6843
    (Array with:(aRecv) with:(aRecv class))
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6844
    do:[:aPossibleReceiver |
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6845
        MessageNotUnderstood handle:[:ex|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6846
            ex message selector == sel ifFalse:[ ex reject ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6847
        ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6848
            numArgs == 0 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6849
                subm := aPossibleReceiver perform:sel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6850
            ] ifFalse:[ 
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6851
                numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6852
                    subm := aPossibleReceiver perform:sel with:(menuItem argument ? menuPanel)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6853
                ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6854
                    subm := aPossibleReceiver perform:sel with:(menuItem argument) with:menuPanel
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6855
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6856
            ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6857
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6858
        subm notNil ifTrue:[^ subm].
1795
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6859
    ].
6afd0e768267 submenuChannel selector: allow upto two arguments, the arg and the menu
ca
parents: 1793
diff changeset
  6860
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6861
    ^ subm
2043
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6862
133a9674bcdf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  6863
    "Modified: / 30.10.2001 / 13:28:25 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6864
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  6865
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6866
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6867
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6868
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6869
    |numArgs sel recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6870
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6871
    indication isNil ifTrue:[^ nil].                                    "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6872
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6873
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6874
        ^ indication value == true                                      "block or model"
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6875
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6876
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6877
    (numArgs := indication numArgs) == 2 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6878
        recv := menuPanel receiver.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6879
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6880
        (recv isValueModel) ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6881
            (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6882
                sel := indication copyFrom:1 to:(indication indexOf:$:).
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6883
                sel := sel asSymbol.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6884
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6885
                MessageNotUnderstood handle:[:ex| 
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6886
                    ex message selector == sel ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6887
                        ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6888
                    ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6889
                ] do:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6890
                    sel := recv perform:sel with:(menuItem argument)
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6891
                ]
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6892
            ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6893
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6894
        ^ sel value == true
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6895
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6896
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6897
    numArgs ~~ 0 ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6898
        sel := (indication copyWithoutLast:1) asSymbol
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6899
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6900
        sel := indication
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6901
    ].    
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6902
    sel := self aspectAt:sel.
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6903
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6904
    sel isValueModel ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6905
        indication := sel.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6906
        indication addDependent:self.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6907
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6908
    ^ sel value == true
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6909
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6910
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6911
indicationValue:aValue
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6912
    "set the indication value
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6913
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6914
    |numArgs recv|
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6915
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6916
    indication isNil ifTrue:[^ self].                                   "no indication specified"
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6917
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6918
    indication isSymbol ifFalse:[                                       
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6919
        indication perform:#value: with:aValue ifNotUnderstood:nil.     "block or model"
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6920
        ^ self
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6921
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6922
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6923
    (numArgs := indication numArgs) == 0 ifTrue:[                       "no arguments to selector; cannot set"
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6924
        ^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6925
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6926
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  6927
    recv := menuPanel receiver.
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6928
    recv isValueModel ifTrue:[^ self].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6929
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  6930
    recv isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6931
        recv := menuPanel application.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6932
        recv isNil ifTrue:[^ self].
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6933
    ].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6934
2069
7891c7d3af69 use new #perform:withOptionalArgument:
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
  6935
    MessageNotUnderstood handle:[:ex| 
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6936
        (ex message selector ~~ indication) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6937
            ex reject
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6938
        ].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6939
        self ifNotInUIBuilderInfoPrintCR:
2545
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  6940
            ('MenuPanel::Item [info]: application (class %1) does not respond to: %2' 
e838be7f2c83 Tell application name in info message about no-existing aspects.
Stefan Vogel <sv@exept.de>
parents: 2505
diff changeset
  6941
             bindWith:recv className with:indication).
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6942
    ] do:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6943
        numArgs == 1 ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6944
            recv perform:indication with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6945
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6946
            recv perform:indication with:(menuItem argument ? self) with:aValue
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  6947
        ]
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6948
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6949
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6950
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  6951
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6952
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6953
    "
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6954
    |val|
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6955
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6956
    indication isNil ifTrue:[^ nil].
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  6957
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6958
    val := self indicationValue.
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6959
    self enabled ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6960
	^ val == true 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6961
	    ifTrue:[menuPanel iconIndicationDisabledOn]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6962
	    ifFalse:[menuPanel iconIndicationDisabledOff]
1798
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6963
    ].
08ae92e6fdf3 extra disabled icons for checkBoxes and radioButtons
Claus Gittinger <cg@exept.de>
parents: 1797
diff changeset
  6964
    ^ val == true 
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6965
	ifTrue:[menuPanel iconIndicationOn]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  6966
	ifFalse:[menuPanel iconIndicationOff]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6967
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  6968
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6969
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6970
    "returns true if the mouse pointer is over the item
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6971
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6972
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6973
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6974
    "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
  6975
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  6976
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6977
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  6978
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6979
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6980
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6981
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6982
    self isSeparator ifFalse:[
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6983
        ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6984
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6985
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6986
    (lbl := label value) isNil ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6987
        ^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6988
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  6989
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  6990
    lbl size == 1 ifTrue:[
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6991
        c := lbl first.
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6992
        c == $- ifTrue:[^ #singleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6993
        c == $= ifTrue:[^ #doubleLine].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6994
    ].
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  6995
    ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6996
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6997
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  6998
setupSubmenu
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  6999
    |appl master recv submenuHolder submenu submenuEncoding channel|
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7000
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7001
    channel := menuItem submenuChannel value.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7002
    channel isNil ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7003
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7004
    subMenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7005
        menuItem keepLinkedMenu ifTrue:[ ^ subMenu ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7006
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7007
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7008
    channel isSymbol ifFalse:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7009
        submenuHolder := channel
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7010
    ] ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7011
        appl := menuPanel application.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7012
        appl isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7013
            appl := menuPanel receiver.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7014
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7015
                (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7016
                    [submenuHolder isNil 
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7017
                     and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7018
                          and:[master ~~ appl]]] whileTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7019
                        appl := master.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7020
                        submenuHolder := self findSubMenuIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7021
                    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7022
                ]
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7023
            ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7024
        ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7025
        submenuHolder isNil ifTrue:[    
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7026
            (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7027
                (recv := menuPanel receiver) ~~ appl ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7028
                    appl := recv.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7029
                    submenuHolder := self findSubMenuIn:appl
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7030
                ]
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7031
            ]
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7032
        ]
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7033
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7034
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7035
    (submenu := submenuHolder value) isArray ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7036
        submenuEncoding := submenu.    
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7037
        submenu := Menu new fromLiteralArrayEncoding:submenuEncoding.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7038
        "/ cg: linked menus also may contain translations ...
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7039
        submenu notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7040
            appl notNil ifTrue:[
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7041
                submenu findGuiResourcesIn:appl.
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7042
            ]                
2232
5784671fb497 when searching for a sumbenus application, do NOT
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  7043
        ].
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7044
    ].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7045
    "/ appl notNil ifTrue:[submenu application:appl].
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7046
    self submenu:submenu.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7047
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7048
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  7049
    "Modified: / 19.5.1998 / 19:36:56 / cg"
2485
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7050
!
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7051
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7052
spaceBetweenEmptyLines
b3d92f4a5f7b correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 2482
diff changeset
  7053
        ^ 3
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7054
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7055
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7056
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7057
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7058
canChangeVisibility
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7059
    "return true if I am not always visible; can only be changed by a selector
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7060
     otherwise there is a change notification raised if the model changed
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7061
    "
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7062
    ^ isVisible isSymbol
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7063
"/  ^ isVisible notNil and:[isVisible ~~ true]
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7064
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  7065
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7066
canSelect
1699
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7067
    "returns true if item is selectable; no separator, visible and enabled.
d7b522c4b332 grabing and recomputation of items
ca
parents: 1698
diff changeset
  7068
     in case of a choice (RadioButton) i have to check for the choiceValue
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7069
    "
2362
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7070
    self isSeparator ifTrue:[^ false].
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7071
7a0f2e986289 rawLabel visa isSeparator
ca
parents: 2360
diff changeset
  7072
    (self isVisible and:[self enabled]) ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7073
        (choice isNil or:[choice value ~= menuItem choiceValue]) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7074
            ^ true
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7075
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7076
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  7077
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7078
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7079
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7080
containsPoint:aPoint
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7081
    "returns true if aPoint is contained in my layout
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7082
    "
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7083
    (self isVisible and:[layout notNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7084
	^ layout containsPoint:aPoint
2046
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7085
    ].
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7086
    ^ false
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7087
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7088
    "Created: / 13.11.2001 / 13:55:31 / cg"
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7089
!
012798480de6 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  7090
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7091
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7092
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7093
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7094
    (self isVisible and:[layout notNil]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7095
	^ layout containsPointX:x y:y
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  7096
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  7097
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7098
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7099
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7100
hasDelayedMenu
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7101
    "returns true if a delayed menu exists
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7102
    "
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7103
    self hasSubmenu ifFalse:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7104
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7105
    ].
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7106
    menuItem itemValue notNil ifTrue:[ ^ true ].
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7107
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7108
    (indication isNil and:[choice isNil]) ifTrue:[
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7109
        ^ false
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7110
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7111
    ^ true
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7112
!
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7113
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7114
hasDelayedMenuIndicator
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7115
    "returns true if the item has a delayed menu
2326
a8447d6449eb show submenu indicator (for button) even for normal menus
Claus Gittinger <cg@exept.de>
parents: 2269
diff changeset
  7116
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7117
    "
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7118
    menuPanel isPopUpView ifFalse:[
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7119
        ^ self hasDelayedMenu
2214
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7120
    ].
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7121
    ^ false
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7122
!
8eefad87cf62 drawing delayed menu indicators... first try not yet finished
ca
parents: 2199
diff changeset
  7123
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7124
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7125
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7126
    "
1726
a4733a8b51e1 support labeled arrays; printing vertical (font not yet supported)
ca
parents: 1723
diff changeset
  7127
    ^ indication notNil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7128
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  7129
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7130
hasMenuIndicator
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7131
    "returns true if the item has a delayed menu
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7132
     and is in the topMenuPanel (because submenuIndicator is already drawn in popUpViews)
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7133
    "
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7134
    menuPanel isPopUpView ifFalse:[
2360
aa745970fcb9 *** empty log message ***
ca
parents: 2359
diff changeset
  7135
        ^ self hasSubmenu and:[menuItem isButton]
2344
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7136
    ].
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7137
    ^ false
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7138
!
d8a5d00c004e different icons for delayed and non-delayed menus
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  7139
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7140
hasSubmenu
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7141
    "returns true if the item is configured as an subMenu entry
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7142
    "
2364
c72f35819bda remove attribute submenuChannel - derives from menuItem
ca
parents: 2362
diff changeset
  7143
    ^ subMenu notNil or:[menuItem submenuChannel notNil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7144
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7145
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7146
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7147
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7148
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7149
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7150
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7151
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7152
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7153
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7154
    "
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7155
    ^ displayLabel isNil
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7156
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7157
2159
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7158
isToggle
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7159
    "returns true if on/off indication exists
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7160
    "
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7161
    ^ self hasIndication and:[ self isButton ]
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7162
!
1eac041aeb3d toggle button draw & behavior
Claus Gittinger <cg@exept.de>
parents: 2145
diff changeset
  7163
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7164
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7165
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7166
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7167
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7168
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7169
    isVisible isSymbol ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7170
	state := self aspectAt:isVisible.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7171
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7172
	state isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7173
	    isVisible := state.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7174
	    isVisible addDependent:self.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7175
	    state := isVisible.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7176
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7177
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7178
	state := isVisible
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7179
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7180
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7181
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7182
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7183
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7184
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7185
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7186
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7187
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7188
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7189
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7190
    isVisible isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7191
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7192
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7193
	oldState := isVisible value.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7194
	isVisible isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7195
	    isVisible removeDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7196
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7197
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7198
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7199
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7200
    isVisible isNil ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7201
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7202
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7203
	isVisible isValueModel ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7204
	    isVisible addDependent:self
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7205
	] ifFalse:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7206
	    isVisible isSymbol ifTrue:[^ self]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7207
	].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7208
	menuPanel shown ifFalse:[^ self].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7209
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7210
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7211
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7212
    newState ~~ oldState ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7213
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7214
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7215
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  7216
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7217
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  7218
2433
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7219
needsItemSpaceWhenDrawing
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7220
    ^ self isSeparator not and:[menuItem isButton not]
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7221
!
49341ed11830 rawLabel/label/textLabel confusion cleaned up
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  7222
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7223
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7224
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7225
    "
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7226
    |nm prefix shortcutKey|
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7227
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7228
    shortcutKey := menuItem shortcutKey.
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7229
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7230
    shortcutKey isNil ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7231
        ^ nil
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7232
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7233
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  7234
    shortcutKey isCharacter ifTrue:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7235
        nm := shortcutKey asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7236
    ] ifFalse:[
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7237
        "/ this is somewhat complicated: we have the symbolic key at hand,
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7238
        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7239
        "/ Ask the devices keyboardMap for the backtranslation.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7240
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7241
        nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7242
        "/
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7243
        "/ some modifier-key combination ?
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7244
        "/
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7245
        (nm startsWith:#Cmd) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7246
            prefix := #Cmd.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7247
        ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7248
            prefix := #Alt.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7249
        ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7250
            prefix := #Meta.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7251
        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7252
            prefix := #Ctrl.
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7253
        ]]]].
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7254
        prefix notNil ifTrue:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7255
            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7256
        ] ifFalse:[
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7257
            nm := nm asString
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7258
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7259
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  7260
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7261
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7262
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7263
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7264
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7265
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7266
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7267
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7268
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7270
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7271
    m notNil ifTrue:[
2145
aa6c81509521 prep to separate vertical from horizontal space
penk
parents: 2143
diff changeset
  7272
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7273
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7274
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7275
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  7276
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7277
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7279
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7280
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7281
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7282
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7283
    "
1998
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7284
5059b7c9cd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1997
diff changeset
  7285
    ^ menuPanel notNil and:[menuPanel selection == self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7286
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7287
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7288
isSelected:isSelected
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7289
    "change selection to a state. Dependant on the state open or hide an existing
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7290
     submenu and perform a redraw
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  7291
    "
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7292
    (isSelected and:[menuPanel notNil]) ifFalse:[
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7293
        self invalidate.
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7294
        self hideSubmenu.
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7295
        ^ self
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7296
    ].
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7297
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7298
    menuPanel realized ifFalse:[ ^ self ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7299
2359
de4236cc8e7b *** empty log message ***
ca
parents: 2355
diff changeset
  7300
    (indication isNil or:[menuItem isButton not]) ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7301
        self invalidate
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7302
    ].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7303
    self hasSubmenu ifFalse:[ ^ self].
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7304
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7305
    self hasDelayedMenu ifTrue:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7306
        menuPanel openDelayed:self
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7307
    ] ifFalse:[
2249
cb1073891ea8 add: #selection:openMenu:
ca
parents: 2238
diff changeset
  7308
        subMenu := self setupSubmenu.
2374
975fa3542e82 replace ifNil and ifNotNil
ca
parents: 2373
diff changeset
  7309
        subMenu notNil ifTrue:[ self openSubmenu ].
1701
026ece539435 prepare delayed open of submenus
ca
parents: 1699
diff changeset
  7310
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7311
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7312
2692
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7313
!MenuPanel::Item::Adornment methodsFor:'accessing'!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7314
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7315
argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7316
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7317
  ^ argument2
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7318
!
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7319
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7320
argument2:anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7321
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7322
    argument2 := anArgumentOrNil
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7323
! !
93566e299318 +actionValue2
werner
parents: 2681
diff changeset
  7324
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7325
!MenuPanel::ScrollActivity class methodsFor:'default icons'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7326
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7327
icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7328
    "This resource specification was automatically generated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7329
     by the ImageEditor of ST/X."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7330
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7331
    "Do not manually edit this!! If it is corrupted,
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7332
     the ImageEditor may not be able to read the specification."
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7333
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7334
    "
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7335
     self icon inspect
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7336
     ImageEditor openOnClass:self andSelector:#icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7337
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7338
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7339
    <resource: #image>
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7340
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7341
    ^Icon
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7342
	constantNamed:#'MenuPanel::Scrolling class icon'
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7343
	ifAbsentPut:[(Depth1Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?>@@@@@@ @C@@N@@<@C8@O<@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@_<@? A<@C @D@@@@@@@@@@@a') ; yourself); yourself]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7344
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7345
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7346
!MenuPanel::ScrollActivity class methodsFor:'instance creation'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7347
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7348
new
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7349
    ^ self basicNew initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7350
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7351
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7352
!MenuPanel::ScrollActivity methodsFor:'accessing'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7353
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7354
activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7355
    "returns the active menu the scrolling is activated on; nil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7356
     is returned if scrolling is deactivated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7357
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7358
    ^ activeMenu
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7359
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7360
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7361
direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7362
    "returns the scroll-direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7363
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7364
    ^ direction
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7365
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7366
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7367
iconAt:aDirection on:aMenu
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7368
    |icon device index|
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7369
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7370
    device := aMenu device.
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7371
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7372
    aDirection == #PREV ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7373
	aMenu verticalLayout ifTrue:[index := 3]    "/ 3 - 1 * 90  180
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7374
			    ifFalse:[index := 2]    "/ 2 - 1 * 90  90   
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7375
    ] ifFalse:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7376
	aMenu verticalLayout ifTrue:[index := 1]    "/ 1 - 1 * 90  0
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7377
			    ifFalse:[index := 4]    "/ 4 - 1 * 90  270
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7378
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7379
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7380
    icon := icons at:index.
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7381
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7382
    (icon isNil or:[icon device ~~ device]) ifTrue:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7383
	icon := self class icon.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7384
	index > 1 ifTrue:[ icon := icon rotated:(index - 1 * 90) ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7385
		 ifFalse:[ icon := icon copy ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7386
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7387
	icon := icon onDevice:device.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7388
	icon clearMaskedPixels.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7389
	icons at:index put:icon
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7390
    ].
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7391
    ^ icon
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7392
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7393
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7394
!MenuPanel::ScrollActivity methodsFor:'initialization'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7395
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7396
initialize
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7397
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7398
    semaLock := RecursionLock new.
2018
2130a45b7dfe checkin from browser
ca
parents: 2016
diff changeset
  7399
    icons    := Array new:4.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7400
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7401
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7402
!MenuPanel::ScrollActivity methodsFor:'queries'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7403
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7404
isActive
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7405
    "returns true if scrolling is activated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7406
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7407
    ^ activeMenu notNil
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7408
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7409
2137
0aaeeab0811d renamed Scrolling to ScrollActivity.
Claus Gittinger <cg@exept.de>
parents: 2133
diff changeset
  7410
!MenuPanel::ScrollActivity methodsFor:'user operations'!
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7411
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  7412
startIfRequiredAt:aDirection on:aMenu
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7413
    "start scrolling; returns true if scrolling is activated
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7414
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7415
    |bounds index|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7416
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7417
    semaLock critical:[
2219
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7418
	self stop.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7419
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7420
	(     aDirection notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7421
	 and:[aMenu notNil
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7422
	 and:[(bounds := aMenu scrollerBoundsAt:aDirection) notNil]]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7423
	) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7424
	    activeMenu := aMenu.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7425
	    direction  := aDirection.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7426
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7427
	    index := aMenu indexOfItemAtScroller:aDirection.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7428
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7429
	    index ~~ 0 ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7430
		scrollTask := 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7431
		    [ 
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7432
			|item step|
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7433
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7434
			[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7435
			    step := (aDirection == #PREV) ifTrue:[-1] ifFalse:[1].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7436
			    ( aMenu shown and:[(item := aMenu itemAt:index) notNil] ) ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7437
				aMenu makeItemVisible:item.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7438
				index := index + step.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7439
			    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7440
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7441
			    Delay waitForSeconds:(ButtonController defaultInitialDelay).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7442
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7443
			    [ aMenu shown and:[(item := aMenu itemAt:index) notNil] ] whileTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7444
				aMenu makeItemVisible:item.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7445
				Delay waitForSeconds:(ButtonController defaultRepeatDelay).
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7446
				index := index + step.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7447
			    ].
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7448
			    item := nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7449
			] ensure:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7450
			    scrollTask := nil.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7451
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7452
			    item notNil ifTrue:[
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7453
				"/ process was killed
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7454
				aMenu invalidate:bounds
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7455
			    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7456
			]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7457
		    ] forkAt:8.
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7458
	    ]
93426020ceed *** empty log message ***
ca
parents: 2216
diff changeset
  7459
	]
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7460
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7461
    ^ bounds notNil
2047
62de65e3a61b initial delay; autoRepeat delay
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  7462
2048
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7463
    "Created: ca"
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7464
ba472f3f46c7 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2047
diff changeset
  7465
    "Modified: / 13.11.2001 / 20:15:52 / cg"
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7466
!
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7467
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7468
stop
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7469
    "stop scrolling; returns true if the scrolling was activated otherwise false
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7470
    "
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7471
    |task resp|
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7472
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7473
    activeMenu isNil ifTrue:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7474
        ^ false
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7475
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7476
    semaLock critical:[
2231
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7477
        resp := activeMenu notNil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7478
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7479
        (task := scrollTask) notNil ifTrue:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7480
            scrollTask := nil.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7481
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7482
            Error handle:[:ex|
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7483
            ] do:[
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7484
                task terminateWithAllSubprocessesInGroup.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7485
                task waitUntilTerminated.
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7486
            ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7487
        ].
65cec3d10fb1 Change sends to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2220
diff changeset
  7488
        activeMenu := direction := nil.
2016
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7489
    ].
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7490
    ^ resp
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7491
! !
f1ba765d4fa7 add scrolling - first
ca
parents: 2012
diff changeset
  7492
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7493
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7494
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7495
version
2731
7382424af8d9 Don't carsh when typing SPACE in PopUpList
Stefan Vogel <sv@exept.de>
parents: 2729
diff changeset
  7496
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.395 2004-07-13 08:46:33 stefan Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7497
! !
2199
61ef4fe363e7 *** empty log message ***
ca
parents: 2187
diff changeset
  7498
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  7499
MenuPanel initialize!