MenuPanel.st
author ca
Sat, 29 Aug 1998 18:40:41 +0200
changeset 1101 22eb87115477
parent 1097 8a2f6c5ad1a9
child 1107 0ace8de67a4e
permissions -rw-r--r--
level on default 1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     1
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     4
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    11
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    12
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    13
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
    14
SimpleView subclass:#MenuPanel
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    15
	instanceVariableNames:'adornment shadowView mapTime mustRearrange superMenu
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    16
		shortKeyInset selection items groupSizes receiver enableChannel
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    17
		menuHolder enabled onLevel offLevel fgColor activeFgColor
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    18
		lastActiveMenu activeBgColor disabledFgColor groupDividerSize
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
    19
		itemSpace fitFirstPanel rightArrow rightArrowShadow
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
    20
		selectionFrameBrightColor selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
    21
		buttonLightColor buttonShadowColor buttonHalfLightColor
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
    22
		buttonHalfShadowColor lastButtonSelected enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
    23
		buttonEnteredBgColor'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    24
	classVariableNames:'InitialSelectionQuerySignal DefaultAdornment
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    25
		DefaultGroupDividerSize DefaultHilightLevel DefaultLevel
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    26
		DefaultItemSpace DefaultButtonItemSpace DefaultForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    27
		DefaultBackgroundColor DefaultHilightForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    28
		DefaultHilightBackgroundColor DefaultDisabledForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    29
		DefaultFitFirstPanel RightArrowForm RightArrowShadowForm
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    30
		SelectionFrameBrightColor SelectionFrameDarkColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    31
		ButtonActiveLevel ButtonPassiveLevel ButtonActiveBackgroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    32
		ButtonPassiveBackgroundColor ButtonLightColor ButtonShadowColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    33
		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle Images
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    34
		LigthenedImages ButtonEnteredBackgroundColor ButtonEnteredLevel'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    35
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    36
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    37
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    38
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    39
Object subclass:#Item
729
18395718ec8e lighten the icon & image of a disabled LabelAndIcon if the
ca
parents: 728
diff changeset
    40
	instanceVariableNames:'layout menuPanel subMenu adornment rawLabel disabledRawLabel
18395718ec8e lighten the icon & image of a disabled LabelAndIcon if the
ca
parents: 728
diff changeset
    41
		enableChannel nameKey accessCharacterPosition value label
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
    42
		rawImage activeHelpKey submenuChannel startGroup isButton
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
    43
		isVisible'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    44
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    45
		VerticalButtonInset LabelRightOffset ShortcutKeyOffset
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
    46
		IndicatorOn IndicatorOff'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    47
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    48
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    49
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    50
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    51
Object subclass:#Adornment
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
    52
	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
    53
		choiceValue'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    54
	classVariableNames:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    55
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    56
	privateIn:MenuPanel::Item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    57
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    58
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    59
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    60
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    61
copyright
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    62
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    63
 COPYRIGHT (c) 1997 by eXept Software AG
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    64
              All Rights Reserved
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    65
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    66
 This software is furnished under a license and may be used
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    67
 only in accordance with the terms of that license and with the
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    68
 inclusion of the above copyright notice.   This software may not
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    69
 be provided or otherwise made available to, or used by, any
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    70
 other person.  No title to or ownership of the software is
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    71
 hereby transferred.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    72
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    73
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    74
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    75
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    76
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    77
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
    not yet finished MenuPanel class - this will eventually replace
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    most of the MenuView and PopUpMenu stuff.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    83
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    84
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    85
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    86
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    87
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    88
    [author:]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    89
        Claus Atzkern
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    90
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    91
    [see also:]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    92
        Menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    93
        MenuItem
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    94
        MenuEditor
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    95
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    96
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    97
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    98
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    99
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
    start as PullDownMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
                                                                                [exBegin]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   104
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   108
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   109
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   110
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   111
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   114
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   115
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   121
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   122
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   123
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   126
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   127
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   128
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   130
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   131
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   132
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   133
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   134
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   136
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   137
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   140
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   141
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   142
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   143
    top open.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
                                                                                [exEnd]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   145
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   146
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
    start as PopUpMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   148
                                                                                [exBegin]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   149
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   151
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   152
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   153
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   154
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   155
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   156
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   157
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   158
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   159
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   160
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   161
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   162
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   163
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   164
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   165
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   166
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   167
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   168
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   169
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   170
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   171
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   173
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   174
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   175
    mview startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   176
                                                                                [exEnd]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   177
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   178
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   179
    start from menu spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   180
                                                                                [exBegin]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   181
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   182
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   183
    menu := MenuPanel menu:
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   184
        #(#Menu #( #(#MenuItem 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   185
                    #label: 'File' 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   186
                    #submenu:
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   187
                      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   188
                                 (#MenuItem 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   189
                                    #label: 'edit' 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   190
                                    #submenu:
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   191
                                      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   192
                                                 #(#MenuItem #label: 'close' #value:#close)     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   193
                                               )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   194
                                               nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   195
                                               nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   196
                                       )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   197
                                  )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   198
                                 #(#MenuItem #label: 'help' #value:#help )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   199
                               )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   200
                               nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   201
                               nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   202
                       )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   203
                 ) 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   204
                #(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   205
                #(#MenuItem #label: 'Bar' 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   206
                            #submenu:
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   207
                               #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   208
                                          #(#MenuItem #label: 'bar 2' #value:#bar2 )     
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   209
                                        )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   210
                                        nil
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   211
                                        nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   212
                                )     
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   213
                 ) 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   214
              ) 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   215
              #( 2 )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   216
              nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   217
         ) decodeAsLiteralArray.  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   218
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   219
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   220
    Transcript showCR:(menu startUp).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   221
                                                                                [exEnd]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   222
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   223
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   224
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   225
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   226
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   227
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   228
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   229
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   230
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   231
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   232
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   233
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   234
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   235
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   236
    aSpec notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   237
        menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   238
        menu fromLiteralArrayEncoding:aSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   239
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   240
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   241
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   242
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   243
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   244
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   245
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   247
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   248
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   249
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   250
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   251
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   255
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   256
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   257
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   261
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   262
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   263
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   264
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   265
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
    mview := self new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
    aReceiver notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
        mview receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   280
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
initialize
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   288
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   289
    DefaultAdornment := nil.
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   290
    self initialize
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   291
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   292
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   293
    InitialSelectionQuerySignal isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
        InitialSelectionQuerySignal := QuerySignal new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   295
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   296
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   297
    DefaultAdornment isNil ifTrue:[
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   298
        DefaultAdornment := IdentityDictionary new
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   299
            at:#showSeparatingLines put:false;
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   300
            at:#showGroupDivider    put:true;
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   301
            at:#verticalLayout      put:true;
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   302
            at:#item                put:nil;
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   303
            at:#value               put:nil;
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   304
            yourself
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   305
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   307
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   308
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   309
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   310
preSnapshot
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   311
    "remove all resources
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   312
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   313
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   314
    LigthenedImages := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   315
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   316
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   317
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   318
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   319
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   320
updateStyleCache
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   321
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   322
    |menuStyle style font|
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   323
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   324
    menuStyle := MenuView styleSheet.
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   325
    menuStyle isNil ifTrue:[
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   326
        "make sure that style sheet is present"
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   327
        MenuView updateStyleCache.        
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   328
        menuStyle := MenuView styleSheet.
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   329
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   330
    style := menuStyle name.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   331
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   332
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   333
    DefaultForegroundColor := menuStyle colorAt:'pullDownMenu.foregroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   334
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   335
    DefaultForegroundColor isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   336
        DefaultForegroundColor := menuStyle colorAt:'menu.foregroundColor'
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   337
                                            default:Color black.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   338
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   339
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   340
    (style == #motif or:[style == #iris]) ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   341
        DefaultBackgroundColor        := DefaultViewBackgroundColor.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   342
        DefaultHilightForegroundColor := DefaultForegroundColor.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   343
        DefaultHilightLevel     := 2.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   344
        DefaultLevel            := 0.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   345
    ] ifFalse:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   346
        (DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   347
            DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   348
        ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   349
        DefaultLevel           := menuStyle at:'pullDownMenu.level' default:1.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   350
        DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   351
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   352
        DefaultBackgroundColor isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   353
            DefaultBackgroundColor := menuStyle colorAt:'menu.backgroundColor'
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   354
                                                default:DefaultViewBackgroundColor.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   355
        ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   356
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   357
        DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   358
        DefaultHilightForegroundColor isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   359
            DefaultHilightForegroundColor := menuStyle colorAt:'menu.hilightForegroundColor'
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   360
                                                       default:DefaultBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   361
        ].
601
b0c2644b5982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   362
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   363
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   364
    DefaultDisabledForegroundColor := menuStyle colorAt:'menu.disabledForegroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   365
    DefaultDisabledForegroundColor isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   366
        DefaultDisabledForegroundColor := menuStyle colorAt:'button.disabledForegroundColor'
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   367
                                                    default:Color darkGray.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   368
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   369
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   370
    style == #motif ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   371
        DefaultHilightBackgroundColor := DefaultBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   372
    ] ifFalse:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   373
        DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   374
        DefaultHilightBackgroundColor isNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   375
            DefaultHilightBackgroundColor := menuStyle colorAt:'menu.hilightBackgroundColor'
1032
d1c9f5f9693c fixed os2 style.
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   376
                                                       default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   377
        ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   378
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   379
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   380
    DefaultGroupDividerSize := menuStyle at:'menu.groupDividerSize' default:6.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   381
    DefaultItemSpace        := menuStyle at:'menu.itemSpace' default:0.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   382
    DefaultButtonItemSpace  := menuStyle at:'menu.buttonItemSpace' default:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   383
    DefaultFitFirstPanel    := menuStyle at:'menu.fitFirstPanel' default:true.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   384
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   385
    MenuView updateStyleCache.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   386
    DefaultFont := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   387
"/    font := menuStyle fontAt:'pullDownMenu.font'.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   388
"/    font isNil ifTrue:[font := menuStyle fontAt:'menu.font'].
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   389
"/    DefaultFont := font.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   390
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   391
    RightArrowForm := SelectionInListView rightArrowFormOn:Display.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   392
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
   393
    (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   394
        RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   395
    ] ifFalse:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   396
        RightArrowShadowForm := nil
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   397
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   398
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   399
    SelectionFrameBrightColor    := Color white.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   400
    SelectionFrameDarkColor      := Color black.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   401
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   402
    ButtonActiveLevel            :=  menuStyle at:'menu.buttonActiveLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   403
    ButtonActiveLevel isNil ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   404
        ButtonActiveLevel        :=  menuStyle at:'button.activeLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   405
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   406
    ButtonPassiveLevel           :=  menuStyle at:'menu.buttonPassiveLevel'.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   407
    ButtonPassiveLevel isNil ifTrue:[
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   408
        ButtonPassiveLevel       :=  menuStyle at:'button.passiveLevel' default:(menuStyle is3D ifTrue:[2] ifFalse:[0]).
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   409
    ].
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   410
    ButtonActiveBackgroundColor  :=  menuStyle at:'button.activeBackgroundColor' default: DefaultBackgroundColor.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
   411
    ButtonPassiveBackgroundColor := (menuStyle at:'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor.
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   412
    ButtonLightColor             := (menuStyle at:'button.lightColor') ? Color white.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   413
    ButtonShadowColor            := menuStyle at:'button.shadowColor' default:(style == #next ifTrue:[Color black] ifFalse:[Color gray]).
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   414
    ButtonHalfLightColor         :=  menuStyle at:'button.halfLightColor'.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   415
    ButtonHalfShadowColor        :=  menuStyle at:'button.halfShadowColor'.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   416
    ButtonEdgeStyle              :=  menuStyle at:'button.edgeStyle'.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
   417
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   418
    ButtonEnteredBackgroundColor := menuStyle colorAt:'menu.buttonEnteredBackgroundColor'.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   419
    ButtonEnteredBackgroundColor isNil ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   420
        ButtonEnteredBackgroundColor := menuStyle colorAt:'button.enteredBackgroundColor'
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   421
                                                  default:ButtonPassiveBackgroundColor.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   422
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   423
    ButtonEnteredLevel := menuStyle at:'menu.buttonEnteredLevel' default:ButtonPassiveLevel.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   424
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   425
    Item updateStyleCache
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   426
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   427
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   428
     self updateStyleCache
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   429
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   430
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
   431
    "Modified: / 20.8.1998 / 19:18:56 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   432
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   433
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   434
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   435
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   436
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   437
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   438
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   439
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   440
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   441
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   442
    Images isNil ifTrue:[ Images := IdentityDictionary new ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   443
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   444
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   445
        Images at:aDevice put:(deviceImages := Dictionary new)
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   446
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   447
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   448
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   449
        ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   450
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   451
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   452
    image := anImage copy onDevice:aDevice.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   453
    image clearMaskedPixels.
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   454
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   455
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   456
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   457
    "Modified: / 27.2.1998 / 17:41:37 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   458
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   459
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   460
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   461
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   462
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   463
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   464
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   465
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   466
    LigthenedImages isNil ifTrue:[ LigthenedImages := IdentityDictionary new ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   467
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   468
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   469
        LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   470
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   471
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   472
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   473
        ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   474
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   475
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   476
    ((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   477
        image := anImage copy lightened onDevice:aDevice.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   478
        image clearMaskedPixels.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   479
    ] ifFalse:[
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   480
        image := self image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   481
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   482
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   483
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   484
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   485
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   486
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   487
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   488
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   489
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   490
subMenu:aSubMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   491
    "create a submenu; can be redifined in derived classes
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   492
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   493
  ^ (self new) menu:aSubMenu.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   494
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   495
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   496
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   497
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   498
!MenuPanel class methodsFor:'resources'!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   499
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   500
checkedImage
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   501
    "This resource specification was automatically generated
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   502
     by the ImageEditor of ST/X."
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   503
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   504
    "Do not manually edit this!! If it is corrupted,
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   505
     the ImageEditor may not be able to read the specification."
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   506
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   507
    "
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   508
     self checkedImage inspect
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   509
     ImageEditor openOnClass:self andSelector:#checkedImage
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   510
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   511
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   512
    <resource: #image>
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   513
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   514
    ^Icon
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   515
        constantNamed:#'MenuPanel checkedImage'
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   516
        ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?????>****''%UUU]9AUUC^PEU@7%@U@]9TA@W^UP@U7%U@U]9U@AW^U@PE7%@U@]9@UTC^PUUP7/???=5UUUUP@a') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; yourself]
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   517
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   518
    "Modified: / 18.8.1998 / 15:43:49 / cg"
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   519
!
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   520
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   521
uncheckedImage
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   522
    "This resource specification was automatically generated
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   523
     by the ImageEditor of ST/X."
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   524
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   525
    "Do not manually edit this!! If it is corrupted,
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   526
     the ImageEditor may not be able to read the specification."
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   527
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   528
    "
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   529
     self uncheckedImage inspect
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   530
     ImageEditor openOnClass:self andSelector:#uncheckedImage
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   531
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   532
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   533
    <resource: #image>
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   534
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   535
    ^Icon
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   536
        constantNamed:#'MenuPanel uncheckedImage'
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   537
        ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'*****)UUUURP@@@H$@@@BI@@@@"P@@@H$@@@BI@@@@"P@@@H$@@@BI@@@@"P@@@H$@@@BI@@@@"Z***( @@@@@@a') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; yourself]
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   538
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   539
    "Modified: / 18.8.1998 / 15:41:42 / cg"
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
   540
! !
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
   541
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   542
!MenuPanel methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   543
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   544
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   545
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   546
    "
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   547
    ^ self accept:(self selection)
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   548
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   549
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   550
accept:anItem
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   551
    "this is the topMenu: accept item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   552
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   553
    |value item tgState itemIdx recv|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   554
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   555
    self superMenu notNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   556
        ^ self topMenu accept:anItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   557
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
   558
    lastButtonSelected := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   559
    self selection:nil.
420
ca
parents: 417
diff changeset
   560
    self forceUngrabMouseAndKeyboard.
ca
parents: 417
diff changeset
   561
ca
parents: 417
diff changeset
   562
    (anItem notNil and:[anItem canAccept]) ifTrue:[
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   563
        tgState := anItem toggleIndication.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   564
        itemIdx := anItem menuPanel findFirst:[:el| el == anItem ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   565
        item    := anItem.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   566
        recv    := anItem menuPanel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   567
    ].
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   568
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   569
    self isPopUpView ifFalse:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   570
        self do:[:el| el updateIndicators].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   571
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   572
    ] ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   573
        self destroy
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   574
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   575
    value := self accept:item index:itemIdx toggle:tgState receiver:recv.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   576
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   577
    self isPopUpView ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   578
        self menuAdornmentAt:#value put:value.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   579
        self menuAdornmentAt:#item  put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   580
    ].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   581
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   582
  ^ item.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   583
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
   584
    "Modified: / 14.8.1998 / 16:10:02 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   585
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   586
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   587
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   588
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   589
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   590
    |value argument numArgs isKindOfValueModel|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   591
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   592
    anItem isNil ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   593
        self menuAdornmentAt:#hasPerformed put:true.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   594
      ^ nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   595
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   596
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   597
    self menuAdornmentAt:#hasPerformed put:(aReceiver isKindOf:ValueModel).
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   598
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   599
    (value := anItem value) isNil ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   600
        ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   601
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   602
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   603
    (argument := anItem argument) isNil ifTrue:[
738
8249ba64daf7 if the first argument to the selector or block is nil
ca
parents: 736
diff changeset
   604
        argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   605
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   606
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   607
    value isSymbol ifFalse:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   608
        (value respondsTo:#numArgs) ifTrue:[numArgs := value numArgs]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   609
                                   ifFalse:[numArgs := 0].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   610
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   611
        numArgs == 0 ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   612
            value value
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   613
        ] ifFalse:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   614
            numArgs == 1 ifTrue:[value value:argument]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   615
                        ifFalse:[value value:argument value:self]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   616
        ].
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   617
        self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   618
      ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   619
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   620
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   621
    aReceiver isNil ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   622
        ^ value
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   623
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   624
    isKindOfValueModel := aReceiver isKindOf:ValueModel.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   625
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   626
    (numArgs := value numArgs) == 0 ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   627
        isKindOfValueModel ifFalse:[aReceiver perform:value]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   628
                            ifTrue:[aReceiver value:value]
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   629
    ] ifFalse:[
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   630
        numArgs == 1 ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   631
            isKindOfValueModel ifFalse:[aReceiver perform:value with:argument]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   632
                                ifTrue:[aReceiver value:value value:argument]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   633
        ] ifFalse:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   634
            isKindOfValueModel ifFalse:[aReceiver perform:value with:argument with:self]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   635
                                ifTrue:[aReceiver value:value value:argument value:self]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   636
        ]
420
ca
parents: 417
diff changeset
   637
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   638
    self menuAdornmentAt:#hasPerformed put:true.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   639
  ^ value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   640
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   641
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   642
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   643
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   644
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   645
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   646
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   647
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   648
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   649
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   650
    "
971
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   651
    ^ (self lastItemAccepted) value
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   652
"/    |top|
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   653
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   654
"/    top := self topMenu.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   655
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   656
"/    (top menuAdornmentAt:#hasPerformed) == true ifTrue:[
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   657
"/        ^ self topMenu menuAdornmentAt:#value.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   658
"/    ].
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   659
"/  ^ nil
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   660
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   661
    "Modified: / 18.6.1998 / 23:37:09 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   662
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   663
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   664
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   665
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   666
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   667
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   668
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   669
  ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   670
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   671
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   672
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   673
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   674
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   675
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   676
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   677
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   678
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   679
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   680
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   681
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   682
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   683
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   684
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   685
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   686
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   687
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   688
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   689
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   690
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   691
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   692
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   693
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   694
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   695
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   696
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   697
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   698
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   699
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   700
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   701
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   702
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   703
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   704
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   705
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   706
  ^ self itemAt:stringOrNumber do:[:el| el argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   707
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   708
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   709
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   710
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   711
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   712
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   713
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   714
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   715
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   716
    "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
   717
     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
   718
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   719
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   720
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   721
    "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
   722
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   723
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   724
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   725
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   726
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   727
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   728
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   729
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   730
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   731
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   732
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   733
    aGroupSizes = groupSizes ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   734
        groupSizes := aGroupSizes copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   735
        self mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   736
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   737
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   738
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   739
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   740
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   741
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   742
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   743
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   744
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   745
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   746
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   747
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   748
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   749
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   750
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   751
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   752
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   753
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   754
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   755
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   756
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   757
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   758
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   759
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   760
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   761
    self disabledRedrawDo:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   762
        self removeAll.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   763
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   764
        labels notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   765
            labels do:[:aLabel|(self createAtIndex:nil) label:aLabel]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   766
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   767
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   768
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   769
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   770
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   771
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   772
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   773
  ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   774
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   775
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   776
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   777
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   778
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   779
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   780
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   781
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   782
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   783
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   784
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   785
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   786
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   787
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   788
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   789
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   790
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   791
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   792
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   793
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   794
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   795
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   796
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   797
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   798
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   799
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   800
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   801
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   802
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   803
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   804
    (receiver isNil and:[superMenu notNil]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   805
        ^ superMenu receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   806
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   807
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   808
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   810
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   811
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   812
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   813
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   814
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   815
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   816
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   817
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   818
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   819
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   820
  ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   821
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   822
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   823
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   824
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   825
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   826
    self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   827
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   828
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   829
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   830
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   831
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   832
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   833
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   834
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   835
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   836
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   837
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   838
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   839
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   840
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   841
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   842
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   843
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   844
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   845
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   846
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   847
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   848
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   849
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   850
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   851
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   852
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   853
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   854
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   855
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   856
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   857
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   858
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   859
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   860
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   861
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   862
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   863
!MenuPanel methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   864
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   865
disable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   866
    "disable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   867
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   868
    self enabled:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   869
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   870
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   871
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   872
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   873
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   874
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   875
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   876
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   877
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   878
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   879
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   880
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   881
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   882
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   883
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   884
enable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   885
    "enable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   886
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   887
    self enabled:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   888
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   889
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   890
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   891
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   892
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   893
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   894
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   895
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   896
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   897
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   898
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   899
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   900
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   901
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   902
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   903
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   904
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   905
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   906
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   907
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   908
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   909
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   910
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   911
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   912
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   913
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   914
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   915
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   916
    self enabled == state ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   917
        ^ self
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   918
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   919
    enabled := state.
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   920
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   921
    self canDrawItem ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   922
        self do:[:anItem| anItem enabledStateOfMenuChangedTo:enabled]
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   923
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   924
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   925
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   926
enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   927
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   928
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   929
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   930
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   931
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   932
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   933
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   934
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   935
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   936
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   937
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   938
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   939
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   940
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   941
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   942
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   943
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   944
!MenuPanel methodsFor:'accessing channels'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   945
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   946
enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   947
    "gets a enable channel or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   948
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   949
    ^ enableChannel
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   950
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   951
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   952
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   953
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   954
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   955
    enableChannel notNil ifTrue:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   956
        enableChannel removeDependent:self
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   957
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   958
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   959
    (enableChannel := aValueHolder) notNil ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   960
        enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   961
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   962
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   963
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   964
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   965
menuHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   966
    "gets a menu holder or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   967
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   968
    ^ menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   969
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   970
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   971
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   972
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   973
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   974
    menuHolder notNil ifTrue:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   975
        menuHolder removeDependent:self
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   976
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   977
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   978
    (menuHolder := aValueHolder) notNil ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   979
        menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   980
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   981
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   982
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   983
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   984
!MenuPanel methodsFor:'accessing color & font'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   985
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   986
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   987
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   988
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   989
    ^ activeBgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   990
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   991
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   992
activeBackgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   993
    "set the background drawing color used to highlight selection. You should not 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   994
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   995
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   996
    activeBgColor ~~ aColor ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   997
        activeBgColor := aColor on:device.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   998
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   999
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1000
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1001
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1002
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1003
    "Modified: / 6.6.1998 / 19:49:46 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1004
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1005
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1006
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1007
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1008
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1009
    ^ activeFgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1010
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1011
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1012
activeForegroundColor:aColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1013
    "set the foreground color used to highlight selections; You should not
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1014
     use this method; instead leave the value as defined in the styleSheet.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1015
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1016
    activeFgColor ~~ aColor ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1017
        activeFgColor := aColor on:device.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1018
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1019
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1020
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1021
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1022
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1023
    "Modified: / 6.6.1998 / 19:50:01 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1024
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1025
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1026
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1027
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1028
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1029
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1030
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1031
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1032
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1033
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1034
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1035
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1036
    super viewBackground ~~ aColor ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1037
        super viewBackground:aColor.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1038
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1039
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1040
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1041
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1042
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1043
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1044
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1045
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1046
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1047
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1048
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1049
    ^ButtonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1050
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1051
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1052
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1053
    "get the button edge style
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1054
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1055
    ^ButtonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1056
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1057
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1058
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1059
    "get the background drawing color used to highlight entered button items
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1060
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1061
    ^ buttonEnteredBgColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1062
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1063
    "Created: / 20.8.1998 / 13:53:37 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1064
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1065
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1066
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1067
    "get the 3D-level used to highlight entered button items
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1068
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1069
    ^ ButtonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1070
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1071
    "Created: / 20.8.1998 / 13:53:46 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1072
    "Modified: / 20.8.1998 / 15:49:32 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1073
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1074
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1075
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1076
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1077
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1078
    ^buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1079
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1080
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1081
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1082
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1083
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1084
    ^buttonHalfShadowColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1085
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1086
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1087
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1088
    "get the background drawing color used to light button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1089
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1090
    ^buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1091
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1092
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1093
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1094
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1095
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1096
    ^ButtonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1097
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1098
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1099
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1100
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1101
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1102
    ^buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1103
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1104
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1105
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1106
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1107
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1108
  ^ disabledFgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1109
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1110
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1111
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1112
disabledForegroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1113
    "set the foregroundColor drawing color used by disabled items. You should not
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1114
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1115
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1116
    disabledFgColor ~~ aColor ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1117
        disabledFgColor := aColor on:device.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1118
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1119
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1120
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1121
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1122
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1123
    "Modified: / 6.6.1998 / 19:50:17 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1124
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1125
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1126
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1127
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1128
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1129
    (aFont notNil and:[aFont ~= font]) ifTrue:[
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1130
        super font:(aFont on:device).
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1131
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1132
        superMenu notNil ifTrue:[
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1133
            self extent:(self preferredExtent)
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1134
        ].
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1135
        self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1136
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1137
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1138
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1139
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1140
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1141
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1142
  ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1143
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1144
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1145
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1146
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1147
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1148
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1149
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1150
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1151
    fgColor ~~ aColor ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1152
        fgColor := aColor on:device.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1153
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1154
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1155
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1156
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1157
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1158
    "Modified: / 6.6.1998 / 19:50:46 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1159
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1160
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1161
lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1162
    "get the lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1163
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1164
    ^ lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1165
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1166
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1167
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1168
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1169
lightColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1170
    "set the light drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1171
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1172
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1173
    lightColor ~~ aColor ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1174
        super lightColor:aColor.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1175
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1176
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1177
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1178
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1179
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1180
    "Modified: / 6.6.1998 / 19:50:39 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1181
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1182
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1183
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1184
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1185
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1186
    ^selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1187
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1188
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1189
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1190
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1191
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1192
    ^selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1193
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1194
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1195
shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1196
    "get the shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1197
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1198
    ^ shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1199
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1200
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1201
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1202
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1203
shadowColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1204
    "set the shadow drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1205
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1206
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1207
    shadowColor ~~ aColor ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1208
        super shadowColor:aColor.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1209
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1210
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1211
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1212
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1213
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1214
    "Modified: / 6.6.1998 / 19:50:32 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1215
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1216
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1217
!MenuPanel methodsFor:'accessing dimensions'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1218
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1219
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1220
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1221
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1222
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1223
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
    (explicitExtent ~~ true) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1225
        (item := self itemAt:1) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1226
            self rearrangeItems.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1227
          ^ item height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1228
        ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1229
        ^ 4 + (font height + (font descent * 2)).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1230
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1231
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1232
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1233
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1234
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1235
    "compute and returns my preferred extent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1236
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1237
    |x y hasMenu shCtKey space hrzInset|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1238
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1239
    self numberOfItems == 0 ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1240
        ^ 32 @ 32
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1241
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1242
    space := (items size + 1) * itemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1243
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1244
    self isFitPanel ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1245
        x := 0
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1246
    ] ifFalse:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1247
        x := groupSizes size * groupDividerSize.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1248
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1249
    hrzInset := items first horizontalInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1250
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1251
    self verticalLayout ifFalse:[
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1252
        "/ horizontal - add x-extents; take max of y-extents
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1253
        y := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1254
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1255
        self do:[:el| |elY elPref|
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1256
            el isVisible ifTrue:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1257
                elPref := el preferredExtent.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1258
                x := x + elPref x.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1259
                elY := elPref y.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1260
                el isButton ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1261
                    elY := elY + (2 * DefaultButtonItemSpace).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1262
                    x := x + (2 * DefaultButtonItemSpace).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1263
                ].
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1264
                y := y max:elY.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1265
            ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1266
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1267
        x := x + space.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1268
    ] ifTrue:[
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1269
        "/ vertical - add y-extents
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1270
        hasMenu := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1271
        shCtKey := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1272
        y := x.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1273
        x := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1274
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
        self do:[:el| |l e|
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1276
            el isVisible ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1277
                (l := el rawLabel) notNil ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1278
                    (e := l widthOn:self) > x ifTrue:[x := e].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1279
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1280
                    (el hasSubmenu or:[el submenuChannel notNil]) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1281
                        hasMenu := true
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1282
                    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1283
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1284
                    (     (l := el shortcutKeyAsString) notNil
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1285
                     and:[(e := l widthOn:self) > shCtKey]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1286
                    ) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1287
                        shCtKey := e
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1288
                    ].
638
2e9b19837590 bug fixes
ca
parents: 630
diff changeset
  1289
                ].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1290
                y := y + el preferredExtent y
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1291
            ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1292
        ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1293
        x := x + hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1294
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1295
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
594
72d2c4ced8f5 set inset of shortKey's
ca
parents: 590
diff changeset
  1296
            shortKeyInset := x + Item labelRightOffset.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1297
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1299
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1300
                x := x + (Item shortcutKeyOffset) 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1301
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
        ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1303
        y := y + space.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1304
        x := x + hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1306
    ^ (x @ y) + (margin + margin)
1095
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1307
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1308
    "Modified: / 24.8.1998 / 19:16:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1309
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1312
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1313
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1315
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1316
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1317
subMenuIndicationWidth
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1318
    ^ RightArrowForm width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1319
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1320
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1321
!MenuPanel methodsFor:'accessing items'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1322
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1323
itemAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1324
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1325
     If no item match nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1326
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1327
    |idx|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1328
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1329
    idx := self indexOf:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1330
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1331
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1332
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1333
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1334
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1335
itemAt:stringOrNumber do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1336
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1337
     the item not exists nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1338
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1339
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1340
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1341
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1342
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1343
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1344
     the item not exists the result of the exception block is returned (no arguments).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1345
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1346
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1347
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1349
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
  ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1351
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1352
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1353
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1354
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1355
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1356
    ^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1357
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1359
!MenuPanel methodsFor:'accessing look'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1360
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1361
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1362
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1363
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1364
    ^ButtonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1365
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1366
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1367
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1368
buttonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1369
    "get the button passive level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1370
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1371
    ^ButtonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1372
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1373
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1374
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1375
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1376
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1377
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1378
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1379
    ^ fitFirstPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1380
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1381
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1382
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1383
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1384
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1385
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1386
    (fitFirstPanel == aState or:[self isPopUpView]) ifFalse:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1387
        fitFirstPanel := aState.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1388
        self mustRearrange
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1389
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1390
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1391
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1392
groupDividerSize
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1393
    "get the size of the group dividers
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1394
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1395
  ^ groupDividerSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1396
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1397
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1398
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1399
groupDividerSize:aSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1400
    "set the size of the group dividers. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1401
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1402
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1403
    aSize ~~ groupDividerSize ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1404
        groupDividerSize := aSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1405
        self mustRearrange.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1406
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1407
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1408
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1410
itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1411
    "get the space space between to items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1412
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1413
  ^ itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1414
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1415
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1416
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1417
itemSpace:aSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1418
    "set the horizontal space between to items. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1419
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1420
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1421
    aSize ~~ itemSpace ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1422
        itemSpace := aSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1423
        self mustRearrange
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1424
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1425
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1426
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1427
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1428
level:anInt
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1429
    super level:anInt.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1430
    mustRearrange := true
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1431
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1432
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1433
rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1434
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1435
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1436
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1437
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1438
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1440
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1441
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1442
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1443
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1444
  ^ self menuAdornmentAt:#showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1445
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1446
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1447
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1448
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1450
    (self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1451
        self mustRearrange.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1452
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1457
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1458
  ^ self menuAdornmentAt:#showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1459
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1460
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1461
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1464
    (self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1465
        self mustRearrange
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1466
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1467
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1470
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1471
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1472
  ^ self menuAdornmentAt:#verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1473
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1474
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1477
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1478
    (self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[        
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1479
        self mustRearrange
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1480
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1482
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1483
!MenuPanel methodsFor:'accessing submenu'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1484
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1488
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1489
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1494
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1495
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1496
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1497
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1500
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1501
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1502
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
    (item := self selection) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
        ^ item submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1506
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1507
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1508
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1509
!MenuPanel methodsFor:'activation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1510
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1511
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1512
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1513
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1514
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1515
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1516
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1521
show
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1522
    "realize the view at its last position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1523
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1525
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1526
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1527
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1528
showAt:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
    "realize the view at aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1530
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1531
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1532
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1533
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1537
    "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
  1538
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1539
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1540
     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
  1541
     menu (i.e. the view or controller), which will perform the action
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1542
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1543
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1544
    self rearrangeItems.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1545
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1546
    aBoolean ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1547
        self fixSize.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1548
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1549
    self origin:aPoint.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1550
    self makeFullyVisible.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1551
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1552
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1553
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1554
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1555
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1556
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1557
        ^ nil
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1558
    ].
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1559
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1560
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1561
    "Modified: / 8.7.1998 / 20:06:35 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1562
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1563
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1564
showAtPointer
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1565
    "realize the view at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1566
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1567
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1568
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1569
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1570
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1571
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1572
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1573
    "make myself visible at the screen center.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1574
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1575
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1576
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1577
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1578
    top raise.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1579
  ^ self showAt:(top origin + (aView originRelativeTo:top) + (aView extent // 2) - (self extent // 2))
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1580
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1581
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1582
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1583
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1584
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1585
    "realize the menu at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1586
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1587
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1588
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1589
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1590
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1591
    "realize the menu at aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1592
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1593
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1594
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1595
    "Created: / 21.5.1998 / 14:15:57 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1596
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1597
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1598
!MenuPanel methodsFor:'active help'!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1599
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1600
helpText
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1601
    |appl item key|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1602
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1603
    (item := self selection) notNil ifTrue:[
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1604
        (key := item activeHelpKey) notNil ifTrue:[
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1605
            (appl := self application) notNil ifTrue:[
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1606
                ^ appl helpTextForKey:key.
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1607
            ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1608
        ]
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1609
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1610
    ^ nil.
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1611
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1612
    "Modified: / 31.7.1998 / 03:15:17 / cg"
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1613
!
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1614
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1615
helpTextAt:aPoint
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1616
    |menu point item key appl|
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1617
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1618
    menu := self superMenuAtX:aPoint x y:aPoint y.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1619
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1620
    menu isNil ifTrue:[
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1621
"/        'nil menu' printCR.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1622
        ^ ''
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1623
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1624
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1625
    point := self translatePoint:aPoint to:menu.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1626
    item  := menu itemAtX:(point x) y:(point y).
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1627
    item  notNil ifTrue:[
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1628
        (key := item activeHelpKey) notNil ifTrue:[
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1629
            (appl := self application) notNil ifTrue:[
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1630
                ^ appl helpTextForKey:key.
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1631
            ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1632
        ]
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1633
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1634
"/    'nil item' printCR.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1635
    ^ nil.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1636
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1637
    "Modified: / 31.7.1998 / 03:15:07 / cg"
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1638
! !
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1639
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1640
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
createAtIndex:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1643
    "create an item and add this item to the index. In case of nil the item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1644
     is added to the end. If the index is not valid nil is returned otherwise
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1645
     the new created item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1646
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1647
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1648
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1649
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1650
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1651
    anIndexOrNil notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1652
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1653
            ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1654
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1655
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1656
    items isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1657
        items := OrderedCollection new
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1658
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1659
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1660
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1661
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1662
        items add:item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1663
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1664
        items add:item beforeIndex:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1665
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1666
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1667
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1668
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1669
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1670
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1671
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1672
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1673
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1674
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1675
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1676
        items remove:item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1677
        item  destroy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1678
        items isEmpty ifTrue:[items := nil].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1679
        self mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1680
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1681
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1682
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1683
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1684
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1685
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1686
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1687
    self disabledRedrawDo:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1688
        self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1689
        groupSizes := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1690
        self do:[:el| el destroy ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1691
        items := nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1692
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1693
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1694
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1695
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1696
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1697
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1698
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1699
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1700
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1701
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1702
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1703
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1704
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1705
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1706
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1707
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1708
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1709
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1710
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1711
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1712
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1713
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1714
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1715
  ^ menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1716
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1717
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1718
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1719
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1720
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1721
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1722
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1723
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1724
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1725
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1726
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1727
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1728
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1729
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1730
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1731
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1732
    self disabledRedrawDo:[
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1733
        |menu newItems|
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1734
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1735
        self removeAll.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1736
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1737
        (menu := aMenu) notNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1738
            (aMenu isCollection) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1739
                menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1740
                menu fromLiteralArrayEncoding:aMenu.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1741
            ] ifFalse:[
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  1742
                menu receiver notNil ifTrue:[receiver := menu receiver]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1743
            ].
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1744
            (newItems := menu menuItems) notNil ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1745
                items := newItems collect:[:ni | 
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1746
                                |i|
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1747
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1748
                                i:= Item in:self.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1749
                                i menuItem:ni.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1750
                                i.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1751
                            ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1752
            ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1753
            self groupSizes:(menu groupSizes).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1754
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1755
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1756
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1757
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1758
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1759
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1760
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1761
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1762
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1763
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1764
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1765
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1766
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1767
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1768
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1769
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1770
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1771
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1772
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1773
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1774
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1775
drawButtonEdgesInLayout: layout withLevel: aLevel selected:isSelected
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1776
    |shadow|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1777
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1778
    styleSheet is3D ifFalse:[
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1779
        ^ self displayRectangle:layout.
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1780
    ].
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1781
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1782
    shadow := buttonShadowColor.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1783
    isSelected ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1784
        buttonShadowColor == self buttonActiveBackgroundColor ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1785
            shadow := self buttonActiveBackgroundColor darkened
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1786
        ].
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1787
    ].
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1788
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1789
    self drawEdgesForX: layout left y: layout top width: layout width height: layout height level: aLevel 
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1790
        shadow:      shadow 
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1791
        light:       buttonLightColor
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1792
        halfShadow:  buttonHalfShadowColor 
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1793
        halfLight:   buttonHalfLightColor
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1794
        style:       ButtonEdgeStyle
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1795
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1796
    "Created: / 20.8.1998 / 15:43:38 / cg"
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1797
    "Modified: / 20.8.1998 / 19:09:05 / cg"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1798
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1799
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1800
drawEdgesForX:x y:y width:w height:height isSelected:selectedBool isEntered:enteredBool
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1801
    |level|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1802
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1803
    level := selectedBool 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1804
                ifTrue:[onLevel] 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1805
                ifFalse:[offLevel].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1806
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1807
    level ~~ 0 ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1808
        self drawEdgesForX:x y:y width:w height:height level:level
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1809
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1810
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1811
    "Modified: / 20.8.1998 / 15:43:11 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1812
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1813
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1814
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1815
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1816
    "
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1817
    mustRearrange == true ifFalse:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1818
        mustRearrange := true.
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1819
        shown ifTrue:[
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1820
            self invalidate "/ RepairNow:true
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1821
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1822
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1823
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1824
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1825
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1826
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1827
rearrangeGroups
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1828
    |layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1829
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1830
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1831
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1832
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1833
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1834
        ^ self
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1835
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1836
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1837
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1838
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1839
    (dltX := width - margin "- 2" - layout right) <= 0 ifTrue:[
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1840
        ^ self  "/ no free space
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1841
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1842
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1843
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1844
    start == 0 ifTrue:[
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1845
        ^ self  "/ no item detected
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1846
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1847
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1848
    "/ change layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1849
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1850
    items from:start do:[:anItem|
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1851
        anItem isVisible ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1852
            layout := anItem layout.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1853
            layout  left:(layout  left + dltX).
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1854
            layout right:(layout right + dltX).
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1855
        ]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1856
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1857
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1858
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1859
rearrangeItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1860
    "recompute layout of my items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1861
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1862
    |expLast e grpDivSz layout isVert
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1863
     x  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1864
     y  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1865
     noItems "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1866
    |
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1867
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1868
    mustRearrange ifFalse:[ ^ self ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1869
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1870
"/  fetch font from superMenu
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1871
    (superMenu notNil and:[superMenu font ~~ font]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1872
        super font:(superMenu font on:device)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1873
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1874
    (noItems := items size) == 0 ifTrue:[
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1875
        mustRearrange := false.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1876
      ^ self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1877
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1878
    expLast  := false.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1879
    isVert   := self verticalLayout.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1880
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1881
    self hasGroupDividers ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1882
        self isFitPanel ifFalse:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1883
            grpDivSz := groupDividerSize
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1884
        ] ifTrue:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1885
            expLast := true.
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1886
            x := margin.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1887
            e := self computeExtent.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1888
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1889
            isVert ifTrue:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1890
                items do:[:el | x := x + el preferredExtent y].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1891
                y := e y.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1892
            ] ifFalse:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1893
                items do:[:el|x := x + el preferredExtent x].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1894
                y := e x.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1895
            ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1896
            x := x + (noItems + 1 * itemSpace).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1897
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1898
            (grpDivSz := (y - x) // (groupSizes size)) <= 0 ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1899
                grpDivSz := nil
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1900
            ].
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1901
            x > (width-margin) ifTrue:[
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1902
                grpDivSz := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1903
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1904
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1905
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1906
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1907
    (self isPopUpView or:[explicitExtent ~~ true]) ifTrue:[
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1908
        e := self preferredExtent copy.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1909
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1910
        self isPopUpView ifFalse:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1911
            isVert ifTrue:[e y:1.0]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1912
                  ifFalse:[e x:1.0]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1913
        ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1914
        self extent:e
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1915
    ] ifFalse:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1916
        e := self computeExtent
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1917
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1918
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1919
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1920
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1921
    isVert ifTrue:[y := y + itemSpace]
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1922
          ifFalse:[x := x + itemSpace].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1923
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1924
    self keysAndValuesDo:[:anIndex :el| |org corn elPref|
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1925
        el isVisible ifTrue:[
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1926
            el isButton ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1927
                org := Point x:(x+DefaultButtonItemSpace) y:(y+DefaultButtonItemSpace).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1928
            ] ifFalse:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1929
                org := Point x:x y:y.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1930
            ].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1931
            elPref := el preferredExtent.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1932
            isVert ifTrue:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1933
                y := y + elPref y.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1934
                corn := (e x - margin @ y).
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1935
                el isButton ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1936
                    corn := corn - (DefaultButtonItemSpace @ 0).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1937
                    el layout:(Rectangle origin:org corner:corn).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1938
                    y := y + (2 * DefaultButtonItemSpace).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1939
                ] ifFalse:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1940
                    el layout:(Rectangle origin:org corner:corn).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1941
                ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1942
                y := y + itemSpace.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1943
            ] ifFalse:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1944
                x := x + elPref x.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1945
                el isButton ifTrue:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1946
                    x := x + DefaultButtonItemSpace.
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1947
                    corn := (x @ (e y - margin)).
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1948
                    corn := corn - (0 @ DefaultButtonItemSpace).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1949
                    el layout:(Rectangle origin:org corner:corn).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1950
                    x := x + DefaultButtonItemSpace.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1951
                ] ifFalse:[
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1952
                    corn := (x @ e y).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1953
                    el layout:(Rectangle origin:org corner:corn).
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1954
                ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1955
                x := x + itemSpace.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1956
            ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1957
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1958
            (grpDivSz notNil and:[self hasGroupDividerAt:anIndex]) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1959
                isVert ifTrue:[y := y + grpDivSz]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1960
                      ifFalse:[x := x + grpDivSz]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1961
            ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1962
        ] ifFalse:[
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1963
            org := Point x:x y:y.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1964
            el layout:(Rectangle origin:org corner:org)
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1965
        ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1966
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1967
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1968
    expLast ifTrue:[
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1969
        e := items last.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1970
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1971
        e isVisible ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1972
            layout := items last layout.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1973
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1974
            isVert ifTrue:[layout bottom:((self extent y) + 1)]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1975
                  ifFalse:[layout  right:((self extent x) + 1)].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  1976
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1977
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1978
    self rearrangeGroups.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1979
    mustRearrange := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1980
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1981
    "Modified: / 20.8.1998 / 19:34:41 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1982
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1983
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1984
redrawX:x y:y width:w height:h
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1985
    "redraw a rectangle
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1986
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1987
    |start end isVrt x1 x2 y1 y2 item layout lnSz hrzInset prevClipArea|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1988
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1989
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1990
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1991
    self  paint:(self backgroundColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1992
    self  clearRectangleX:x y:y width:w height:h.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1993
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1994
    isVrt := self verticalLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1995
    end   := items size.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1996
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1997
    mustRearrange ifTrue:[
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1998
        self isPopUpView not ifTrue:[
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  1999
            explicitExtent := true
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2000
        ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2001
        self rearrangeItems.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2002
        start := 1
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2003
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2004
        end == 0 ifTrue:[ ^ self ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2005
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2006
        isVrt ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2007
            start := self findFirst:[:el| (el layout bottom) >= y ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2008
            start == 0 ifTrue:[ ^ self ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2009
            end := y + h.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2010
            end := self findLast:[:el| (el layout top) < end ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2011
        ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2012
            start := self findFirst:[:el| (el layout right) >= x ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2013
            start == 0 ifTrue:[ ^ self ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2014
            end := x + w.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2015
            end := self findLast:[:el| (el layout left) < end ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2016
        ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2017
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2018
        (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2019
            start := start - 1
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2020
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2021
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2022
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2023
    (     self hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2024
     and:[self showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2025
     and:[self isFitPanel not]]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2026
    ) ifTrue:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2027
        lnSz := groupDividerSize // 2
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2028
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2029
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2030
    end == 0 ifTrue:[^ self ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2031
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2032
    hrzInset := items first horizontalInset.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2033
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2034
    prevClipArea   := clipRect.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2035
    clipRect       := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2036
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2037
    device setClipX:x y:y width:w height:h in:drawableId gc:gcId.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2038
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2039
    start to:end do:[:i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2040
        item := items at:i.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2041
        item redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2042
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2043
        (lnSz notNil and:[self hasGroupDividerAt:i]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2044
            layout := item layout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2045
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
            isVrt ifTrue:[
433
ff676b8dd717 add inset to seperator line
ca
parents: 428
diff changeset
  2047
                x1 := layout left  + hrzInset.
ff676b8dd717 add inset to seperator line
ca
parents: 428
diff changeset
  2048
                x2 := layout right - hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2049
                y1 := (layout bottom) + lnSz.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2050
                y2 := y1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2051
            ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2052
                x1 := (layout right) + lnSz.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2053
                x2 := x1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2054
                y1 := layout top.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2055
                y2 := layout bottom.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2056
            ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2057
            self paint:(self shadowColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2058
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2059
            self paint:(self lightColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2060
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
            isVrt ifTrue:[y1 := y1 + 1. y2 := y1 ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
                 ifFalse:[x1 := x1 + 1. x2 := x1 ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2063
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2064
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2065
        ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2066
    ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2067
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2068
    clipRect := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2069
    prevClipArea isNil ifTrue:[device noClipIn:drawableId  gc:gcId]
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2070
                      ifFalse:[self clippingRectangle:prevClipArea].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2071
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2072
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2073
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2074
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2076
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2077
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2078
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2079
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2080
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2081
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2082
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2083
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2085
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2086
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2087
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2088
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2089
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2090
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2091
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2092
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2093
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2094
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2095
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2096
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2097
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2098
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2099
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2100
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2101
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2102
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2103
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2104
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2105
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2106
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2107
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2108
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2109
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2110
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2111
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2112
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2113
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2114
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2115
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2116
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2117
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2118
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2119
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2120
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2121
    i := self findFirst:[:el|(el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2122
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2123
    i ~~ 0 ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2124
        ^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2125
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2126
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2127
    something isSymbol ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2128
        i := self findFirst:[:el|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2129
            v := el value.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2130
            v isSymbol and:[v == something]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2131
        ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2132
        i ~~ 0 ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2133
            ^ i
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2134
        ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2135
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2136
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2137
    (something respondsTo:#string) ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2138
        v := something string.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2139
      ^ self findFirst:[:el|el textLabel = v].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2140
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2141
  ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2142
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2143
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2144
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2145
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2146
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2147
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2148
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2149
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2150
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2151
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2153
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2154
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2155
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2156
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2157
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2158
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2159
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2160
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2161
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2162
    |menu point sensor sel|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2163
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2164
    (    (sensor := self sensor) notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2165
     and:[sensor hasButtonMotionEventFor:nil]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2166
    ) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2167
        ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2168
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2169
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2170
    sensor anyButtonPressed ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2171
        "/ TODO: remember item over which pointer is
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2172
        "/ (for enteredFG/enteredBG/enteredLevel handling)
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2173
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2174
        
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2175
        (buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2176
        or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2177
            (self containsPointX:x y:y) ifTrue:[
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2178
                ((sel := self itemAtX:x y:y) notNil 
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2179
                and:[sel isButton 
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2180
                and:[superMenu isNil
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2181
                and:[sel canSelect]]]) ifTrue:[
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2182
                    self itemEntered:sel.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2183
                ] ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2184
                    self itemEntered:nil
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2185
                ]
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2186
            ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2187
        ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2188
        ^ self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2189
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2190
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2191
    "/ ok, a button is pressed.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2192
    (buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2193
    or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2194
        self itemEntered:nil.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2195
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2196
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2197
    lastButtonSelected notNil ifTrue:[
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2198
        ^ self
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2199
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2200
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2201
    (self containsPointX:x y:y) ifTrue:[
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2202
        ((sel := self itemAtX:x y:y) notNil and:[sel isButton and:[superMenu isNil]]) ifTrue:[
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2203
            sel canSelect ifTrue:[
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2204
                lastButtonSelected := sel
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2205
            ]
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2206
        ].
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2207
        ^ self selection:sel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2208
    ].
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2209
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2210
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2211
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2212
    menu isNil ifTrue:[
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2213
       ^ self selection:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2214
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2215
    point := self translatePoint:(x@y) to:menu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2216
    menu selection:(menu itemAtX:(point x) y:(point y))
1022
4519009d5f9c ignore motion events when no button is down.
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  2217
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2218
    "Modified: / 22.8.1998 / 12:51:17 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2219
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2220
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2221
buttonPress:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2222
    "any button pressed; open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2223
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2224
    |menu point item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2225
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2226
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2227
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2228
    menu isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2229
        menu := self topMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2230
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2231
        point := self translatePoint:(x@y) to:menu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2232
        item  := menu itemAtX:(point x) y:(point y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2233
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2234
    menu selection:item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2235
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2236
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2237
buttonRelease:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2238
    "button release action; accept selection and close all views
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2239
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2240
    |menu item|
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2241
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2242
    menu := self topMenu activeMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2243
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2244
    (    menu hasSelection
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2245
     or:[menu isPopUpView not
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2246
     or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue)
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2247
                                and:(menu mapTime)) > 200]]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2248
    ) ifTrue:[
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2249
        item := nil.
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2250
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2251
        (     (menu := self superMenuAtX:x y:y) notNil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2252
         and:[(item := menu selection) notNil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2253
         and:[item submenu notNil]]
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2254
        ) ifTrue:[
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2255
            menu selection:nil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2256
        ] ifFalse:[
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2257
            (    lastButtonSelected isNil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2258
             or:[item isNil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2259
             or:[(menu itemAtX:x y:y) == lastButtonSelected]]
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2260
            ) ifFalse:[
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2261
                item := nil
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2262
            ].
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2263
            self topMenu accept:item
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2264
        ]
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2265
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2266
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2267
    "Modified: / 27.2.1998 / 17:41:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2268
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2270
cursorPressed:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2271
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2272
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2273
    |next submenu item
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2274
     n     "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2275
     idx   "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2276
     first "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2277
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2278
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2279
        ^ superMenu cursorPressed:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2280
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2282
    self verticalLayout ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2283
        aKey == #CursorLeft  ifTrue:[^ self selection:nil].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2284
        aKey ~~ #CursorRight ifTrue:[next := aKey == #CursorDown].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2286
        aKey == #CursorUp ifTrue:[^ self selection:nil].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2287
        aKey ~~ #CursorDown ifTrue:[next := aKey == #CursorRight].        
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2288
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2289
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2290
    next isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2291
        (item := self selection) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2292
            (submenu := item submenu) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2293
                idx := submenu findFirst:[:el| el canSelect ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2294
              ^ submenu selectionIndex:idx
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2295
            ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2296
          ^ self selection:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2297
        ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2298
      ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2299
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2300
    first := self findFirst:[:el| el canSelect ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2301
    first == 0 ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2303
    idx := self selectionIndex.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2304
    n   := 1 + (self sensor compressKeyPressEventsWithKey:aKey).
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2305
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2306
    n timesRepeat:[
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2307
        next ifTrue:[
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2308
            [((idx := idx + 1) <= items size and:[(items at:idx) canSelect not])
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2309
            ] whileTrue.
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2310
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2311
            idx > items size ifTrue:[
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2312
                idx := first
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2313
            ].
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2314
        ] ifFalse:[    
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2315
            [((idx := idx - 1) > 0  and:[(items at:idx) canSelect not])
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2316
            ] whileTrue.
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2317
            
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2318
            idx < 1 ifTrue:[ idx := self findLast:[:el| el canSelect ] ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2319
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2320
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2321
    self selectionIndex:idx
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2322
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2323
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2324
itemEntered:anItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2325
    |prevEnteredItem|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2326
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2327
    anItem == enteredItem ifTrue:[^ self].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2328
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2329
    prevEnteredItem := enteredItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2330
    enteredItem := anItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2331
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2332
    prevEnteredItem notNil ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2333
        prevEnteredItem redraw
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2334
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2335
    enteredItem notNil ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2336
        enteredItem redraw
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2337
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2338
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2339
    "Created: / 20.8.1998 / 13:18:23 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2340
    "Modified: / 20.8.1998 / 14:03:55 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2341
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2342
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2343
keyPress:key x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2344
    "any key is pressed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2345
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2346
    |listOfItems item menu idx cIdx upperKey lowerKey rawKey|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2347
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2348
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2349
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2350
    [ menu shown ] whileFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2351
        (menu := superMenu) isNil ifTrue:[^ self]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2352
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2354
    key == #Return ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2355
        ^ menu accept
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2356
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2357
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2358
    (     key == #CursorDown or:[key == #CursorUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2359
      or:[key == #CursorLeft or:[key == #CursorRight]]]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2360
    ) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2361
        ^ menu cursorPressed:key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2362
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2363
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2364
    rawKey := device keyboardMap keyAtValue:key ifAbsent:key.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2365
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2366
    listOfItems := self selectItemsForShortcutKey:rawKey.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2367
    listOfItems isNil ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2368
        listOfItems := self selectItemsForShortcutKey:key.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2369
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2370
    listOfItems notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2371
        item := listOfItems first.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2372
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2373
        item hasSubmenu ifFalse:[
441
91230b4c4844 bug fix
ca
parents: 436
diff changeset
  2374
            ^ menu accept:item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2375
        ].
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2376
        ^ self openMenusFromItems:listOfItems
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2377
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2378
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2379
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2380
        (superMenu containsPoint:(self translatePoint:(x@y) to:superMenu)) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2381
            menu := superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2382
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2383
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2384
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2385
    cIdx := menu selectionIndex.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2386
    cIdx isNil ifTrue:[cIdx := 0].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2387
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2388
    upperKey := key asUppercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2389
    lowerKey := key asLowercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2390
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2391
    menu keysAndValuesDo:[:anIndex :el| |c l|
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2392
        (el canSelect and:[(l := el textLabel) notNil]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2393
            l size ~~ 0 ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2394
                (c := el accessCharacter) notNil ifTrue:[
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2395
                    (c == upperKey or:[c == lowerKey]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2396
                        ^ menu selection:el
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2397
                    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2398
                ] ifFalse:[
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2399
                    ((c := l first) == upperKey or:[c == lowerKey]) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
                        anIndex > cIdx ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2401
                            ^ menu selection:el
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2402
                        ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2403
                            idx isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2404
                                idx := anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2405
                            ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2406
                                anIndex > idx ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2407
                                    anIndex ~~ cIdx ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2408
                                        idx := anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2409
                                    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2410
                                ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2411
                            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2412
                        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2413
                        
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2414
                    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2415
                ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2416
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2417
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2418
    ].
417
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2419
    (item := menu itemAt:idx) isNil ifTrue:[
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2420
        menu hasSelection ifFalse:[
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2421
            (menu := menu superMenu) isNil ifTrue:[
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2422
                ^ super keyPress:key x:x y:y
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2423
            ]
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2424
        ]
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2425
    ].
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2426
    menu selection:item.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2427
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2428
    "Modified: / 8.8.1998 / 13:38:36 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2429
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2430
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2431
pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2432
    self itemEntered:nil.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2433
    super pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2434
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2435
    "Created: / 20.8.1998 / 14:04:29 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2436
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2437
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2438
sizeChanged:how
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2439
    self isFitPanel ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2440
        self mustRearrange.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2441
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2442
    super sizeChanged:how
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2443
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2444
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2445
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2446
420
ca
parents: 417
diff changeset
  2447
forceUngrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2448
    "ungrab resources (mouse and keyboard)
420
ca
parents: 417
diff changeset
  2449
    "
ca
parents: 417
diff changeset
  2450
    |sensor|
ca
parents: 417
diff changeset
  2451
ca
parents: 417
diff changeset
  2452
    device ungrabPointer.
ca
parents: 417
diff changeset
  2453
ca
parents: 417
diff changeset
  2454
    (sensor := self sensor) notNil ifTrue:[
ca
parents: 417
diff changeset
  2455
        "/ make certain all X events have been received
ca
parents: 417
diff changeset
  2456
        device sync.
ca
parents: 417
diff changeset
  2457
        "/ now all events have been received.
ca
parents: 417
diff changeset
  2458
        "/ now, flush all pointer events
ca
parents: 417
diff changeset
  2459
        sensor flushKeyboardFor:nil
ca
parents: 417
diff changeset
  2460
    ].
ca
parents: 417
diff changeset
  2461
    device ungrabKeyboard.
ca
parents: 417
diff changeset
  2462
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2463
    "Modified: / 2.2.1998 / 09:24:48 / stefan"
420
ca
parents: 417
diff changeset
  2464
!
ca
parents: 417
diff changeset
  2465
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2466
grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2467
    "get exclusive access to pointer and keyboard.
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2468
     Only used for popUp menus."
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2469
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2470
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2471
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2472
    realized ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2473
        sensor := self sensor.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2474
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2475
        device activePointerGrab ~~ self ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2476
            sensor notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2477
                sensor flushMotionEventsFor:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2478
            ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2479
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2480
            (device grabPointerInView:self) ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2481
                Delay waitForSeconds:0.1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2482
                (device grabPointerInView:self) ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2483
                    "give up"
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2484
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2485
                    self unmap
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2486
                ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2487
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2488
        ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2489
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2490
        device activeKeyboardGrab ~~ self ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2491
            sensor notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2492
                device sync.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2493
                sensor flushKeyboardFor:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2494
            ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2495
            device grabKeyboardInView:self.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2496
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2497
            superMenu notNil ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2498
                self getKeyboardFocus
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2499
            ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2500
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2501
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2502
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2503
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2504
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2505
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2506
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2507
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2508
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2509
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2510
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2511
    device activePointerGrab == self ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2512
        device ungrabPointer.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2513
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2514
    device activeKeyboardGrab == self ifTrue:[
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2515
        sensor := self sensor.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2516
        sensor notNil ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2517
            "/ make certain all X events have been received
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2518
            device sync.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2519
            "/ now all events have been received.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2520
            "/ now, flush all pointer events
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2521
            sensor flushKeyboardFor:self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2522
        ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2523
        device ungrabKeyboard.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2524
    ].
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2525
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2526
    "Modified: / 2.2.1998 / 10:27:12 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2527
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2529
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2530
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2531
imageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2532
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2533
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2534
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2535
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2536
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2537
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2538
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2539
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2540
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2541
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2542
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2543
!MenuPanel methodsFor:'initialize / release'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2544
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2545
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2546
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2547
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2548
    ^self
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2549
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2550
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2551
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2552
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2553
    "
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2554
    |style|
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2555
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2556
    self isPopUpView ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2557
        style := styleSheet name.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2558
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2559
        (style ~~ #normal and:[style ~~ #mswindows]) ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2560
            self borderWidth:1.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2561
        ]
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2562
    ].
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
  2563
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2564
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2565
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2566
    self isPopUpView ifTrue:[
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2567
        (PopUpView styleSheet at:'popup.shadow' default:false) ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2568
            shadowView isNil ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2569
                shadowView := (ShadowView onDevice:device) for:self
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2570
            ] ifFalse:[
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2571
                self saveUnder:true.
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2572
            ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2573
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2574
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2575
        explicitExtent == true ifTrue:[
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2576
            (self width) == (superView width) ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2577
                self verticalLayout:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2578
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2579
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2580
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2581
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2582
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2583
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2584
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2585
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2586
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2587
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2588
    self clearLastActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2589
    self do:[:el|el destroy].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2590
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2591
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2592
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2593
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2594
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2595
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2596
    items     := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2597
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2598
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2599
    "Modified: / 27.2.1998 / 17:41:25 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2600
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2601
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2602
fetchDeviceResources
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2603
    "fetch device colors, to avoid reallocation at redraw time"
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2604
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2605
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2606
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2607
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2608
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2609
    style := styleSheet name.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2610
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2611
    "/ 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
  2612
    "/ (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
  2613
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2614
    self isPopUpView ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2615
        (style == #motif or:[style == #iris]) ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2616
            self topView == self superView ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2617
                self level:2
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2618
            ]
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2619
        ]
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2620
    ] ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2621
        (style == #next or:[style == #normal]) ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2622
            onLevel := offLevel := 0
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2623
        ] ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2624
            style == #openwin ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2625
                offLevel := 0.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2626
            ]
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2627
        ]
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2628
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2629
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2630
    superMenu isNil ifTrue:[
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2631
        fgColor                   := DefaultForegroundColor         onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2632
        activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2633
        activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2634
        disabledFgColor           := DefaultDisabledForegroundColor onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2635
        rightArrow                := RightArrowForm                 onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2636
        selectionFrameBrightColor := SelectionFrameBrightColor      onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2637
        selectionFrameDarkColor   := SelectionFrameDarkColor        onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2638
        buttonLightColor          := ButtonLightColor               onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2639
        buttonShadowColor         := ButtonShadowColor              onDevice:device.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2640
        ButtonHalfLightColor notNil ifTrue: [
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2641
            buttonHalfLightColor      := ButtonHalfLightColor           onDevice:device].
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2642
        ButtonHalfShadowColor notNil ifTrue: [
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2643
            buttonHalfShadowColor     := ButtonHalfShadowColor          onDevice:device].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2644
        buttonEnteredBgColor      := ButtonEnteredBackgroundColor   onDevice:device.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2645
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2646
        (rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2647
            rightArrowShadow := rightArrowShadow onDevice:device
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2648
        ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2649
    ] ifFalse:[
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2650
        fgColor                   := superMenu foregroundColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2651
        activeBgColor             := superMenu activeBackgroundColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2652
        activeFgColor             := superMenu activeForegroundColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2653
        disabledFgColor           := superMenu disabledForegroundColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2654
        rightArrow                := superMenu rightArrow.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2655
        rightArrowShadow          := superMenu rightArrowShadow.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2656
        selectionFrameBrightColor := superMenu selectionFrameBrightColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2657
        selectionFrameDarkColor   := superMenu selectionFrameDarkColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2658
        buttonLightColor          := superMenu buttonLightColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2659
        buttonShadowColor         := superMenu buttonShadowColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2660
        buttonHalfLightColor      := superMenu buttonHalfLightColor.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  2661
        buttonHalfShadowColor     := superMenu buttonHalfShadowColor.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2662
        buttonEnteredBgColor      := superMenu buttonEnteredBackgroundColor.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2663
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2664
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2665
    "Modified: / 20.8.1998 / 15:51:17 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2666
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2667
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2668
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2669
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2670
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2671
    |style|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2672
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2673
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2674
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2675
    onLevel   := DefaultHilightLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2676
    offLevel  := DefaultLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2677
    itemSpace := DefaultItemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2678
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2679
    groupDividerSize := DefaultGroupDividerSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2680
    fitFirstPanel := DefaultFitFirstPanel.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2681
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2682
    style := styleSheet name.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2683
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2684
"/    style == #st80 ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2685
"/        self level:0
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2686
"/    ] ifFalse:[
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2687
        self level:1.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2688
"/    ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2689
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2690
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2691
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2692
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2693
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2694
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2695
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2696
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2697
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2698
    enabled := true.
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2699
"/    self origin:0.0@0.0.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2700
    originChanged  := extentChanged := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2701
    explicitExtent := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2702
    shortKeyInset  := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2703
    mustRearrange  := false.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2704
    self borderWidth:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2705
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2706
    font := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2707
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2708
    "Modified: / 20.8.1998 / 20:09:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2709
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2710
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2711
mapped
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2712
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2713
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2714
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2715
    |anItemList|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2716
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2717
    self enableMotionEvents.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2718
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2719
    lastButtonSelected := nil.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2720
    self becomesActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2721
    super mapped.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  2722
    self do:[:anItem| anItem fetchImages ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2723
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2724
    anItemList := InitialSelectionQuerySignal raise.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2725
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2726
    self isPopUpView ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2727
        self grabMouseAndKeyboard
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2728
    ] ifFalse:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2729
"/        styleSheet is3D ifTrue:[self borderWidth:0].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2730
        super viewBackground:(self backgroundColor).
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2731
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2732
    self do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2733
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2734
    anItemList size > 0 ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2735
        self redrawX:0 y:0 width:10000 height:10000.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2736
        self openMenusFromItems:anItemList.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2737
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2738
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2739
    "Modified: / 2.2.1998 / 09:27:21 / stefan"
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2740
    "Modified: / 20.8.1998 / 19:17:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2741
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2742
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2743
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2744
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2745
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2746
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2747
    self isPopUpView ifTrue:[
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2748
        "Because of #saveUnder of ShadowView the order of realize is significant:
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2749
         shadowView must be realized before self"
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2750
        self hiddenOnRealize:true.
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2751
        super realize.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
  2752
        self resize.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2753
        shadowView notNil ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2754
            shadowView realize.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2755
        ].
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2756
        super map.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  2757
        self raise.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2758
    ] ifFalse:[
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2759
        super realize.
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2760
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2761
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2762
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2763
recreate
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2764
    "this is called after a snapin. If the image was saved with an active menu,
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2765
     hide the menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2766
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2767
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2768
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2769
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2770
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2771
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2772
unmap
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2773
    "unmap view. If we have a popup supermenu, it will get all keyboard and
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2774
     mouse events.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2775
    "
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2776
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2777
    self clearLastActiveMenu.
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  2778
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2779
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2780
    "/ Kludge for X11: after grabbing and ungrabbing other views may get buttonMotionEvents
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2781
    "/ when a mouse button is still pressed. To avoid this we grab the mouse for the superview.
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2782
    "/ (Move from upperMenuPanel of NewLauncher to lowerMenuPanel)
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2783
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2784
    (superMenu notNil and:[superMenu shown and:[superMenu isPopUpView 
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2785
     or:[superMenu sensor anyButtonPressed]]]) ifTrue:[
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2786
        superMenu grabMouseAndKeyboard
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2787
    ] ifFalse:[
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2788
        self ungrabMouseAndKeyboard.
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2789
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2790
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2791
    shadowView notNil ifTrue:[shadowView unmap].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2792
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2793
    "Modified: / 2.2.1998 / 10:27:06 / stefan"
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2794
    "Modified: / 27.2.1998 / 17:41:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2795
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2796
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2797
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2798
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2799
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2800
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2801
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2802
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2803
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2804
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2805
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2806
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2807
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2808
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2810
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2811
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2812
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2813
superMenu:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2814
    "set the supermenu starting from
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2815
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2816
    superMenu := aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2817
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2818
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2819
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2820
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2821
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2822
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2823
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2824
    top := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2825
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2826
    [ top superMenu notNil ] whileTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2827
        top := top superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2828
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2829
  ^ top
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2830
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2831
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2832
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2833
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2834
!MenuPanel methodsFor:'printing'!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2835
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2836
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2837
    "return a printed representation of the menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2838
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2839
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2840
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2841
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2842
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2843
    self do:[:anItem|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2844
        label  := anItem label ? ''.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2845
        string := string ,' ', label printString.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2846
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2847
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2848
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2849
    "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
  2850
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2851
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2852
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2853
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2854
application
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2855
    |appl|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2856
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2857
    superMenu notNil ifTrue:[
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2858
        ^ superMenu application
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2859
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2860
    (appl := super application) isNil ifTrue:[
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  2861
        windowGroup notNil ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  2862
            appl := windowGroup mainGroup topViews first application
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  2863
        ]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2864
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2865
  ^ appl
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2866
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2867
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2868
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2869
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2870
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2871
    |adm|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2872
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2873
    adm := adornment ? DefaultAdornment.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2874
  ^ adm at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2875
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2876
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2877
menuAdornmentAt:aSymbol put:something
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2878
    "sets a value for the specific menu; if the value differs to the
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2879
     current stored value, true is returned otherwise false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2880
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2881
    (self menuAdornmentAt:aSymbol) == something ifTrue:[
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2882
        ^ false
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2883
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2884
    adornment isNil ifTrue:[
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2885
        adornment := DefaultAdornment copy
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2886
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2887
    adornment at:aSymbol put:something.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2888
  ^ true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2889
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2890
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2891
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2892
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2893
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2894
    aList isCollection ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2895
        items size >= aList size ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2896
            aList keysAndValuesDo:[:anIndex :anArg|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2897
                (items at:anIndex) perform:aSelector with:anArg
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2898
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2899
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2900
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2901
        self do:[:anItem| anItem perform:aSelector with:aList ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2902
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2903
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2904
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2905
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2906
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2907
openMenusFromItems:anItemList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2908
    "open all menus derived from sequence of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2909
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2910
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2911
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2912
    (anItemList isNil or:[anItemList isEmpty]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2913
        ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2914
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2915
    item := anItemList removeLast.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2916
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2917
    item enabled ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2918
        ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2919
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2920
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2921
    InitialSelectionQuerySignal answer:anItemList do:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2922
        self selection:item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2923
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2924
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2925
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2926
selectItemsForShortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2927
    "get sequence of items up to the item providing the key (inclusive). The
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2928
     first entry into the collection is the item providing the key, the last
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2929
     entry is the item in the topMenu( reverse )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2930
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2931
    |seq|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2932
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2933
    self do:[:anItem|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2934
        anItem isEnabled ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2935
            anItem shortcutKey = aKey ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2936
                seq := OrderedCollection new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2937
            ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2938
                anItem hasSubmenu ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2939
                    seq := anItem submenu selectItemsForShortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2940
                ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2941
            ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2942
            seq notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2943
                seq add:anItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2944
              ^ seq
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2945
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2946
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2947
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2948
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2949
        
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2950
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2951
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2952
translatePoint:aPoint to:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2953
    "translate a point into a views point; in case of no view nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2954
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2955
    aView notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2956
        aView == self ifTrue:[^ aPoint].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2957
      ^ device translatePoint:aPoint from:(self id) to:(aView id)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2958
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2959
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2960
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2961
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2962
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2963
!MenuPanel methodsFor:'private activation'!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2964
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2965
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2966
    "returns the current active menu or self (the top menu)
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2967
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2968
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2969
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2970
    "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
  2971
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2972
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2973
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2974
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2975
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2976
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2977
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2978
    "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
  2979
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2980
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2981
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2982
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2983
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2984
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2985
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2986
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2987
    "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
  2988
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2989
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2990
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2991
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2992
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2993
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2994
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2995
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2996
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2997
    top activeMenu == self ifTrue:[
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2998
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2999
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3000
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3001
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3002
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3003
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3004
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3005
    "returns the time when the menu becomes active
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3006
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3007
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3008
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3009
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3010
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3011
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3012
!MenuPanel methodsFor:'private searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3013
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3014
itemAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3015
    "returns item at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3016
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3017
    self do:[:el| (el containsPointX:x y:y) ifTrue:[^el] ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3018
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3019
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3020
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3021
superMenuAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3022
    "returns supermenu at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3023
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3024
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3025
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3026
    (self containsPointX:x y:y) ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3027
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3028
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3029
    [ (menu := menu superMenu) notNil ] whileTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3030
        (menu containsPoint:(self translatePoint:(x@y) to:menu)) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3031
            ^ menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3032
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3033
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3034
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3035
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3036
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3037
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3038
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3039
canDrawItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3040
    "returns true if an item could be drawn otherwise false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3041
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3042
    ^ (mustRearrange not and:[shown])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3043
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3044
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3045
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3046
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3047
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3048
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3049
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3050
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3051
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3052
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3053
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3054
    ^ (x between:0 and:width) and:[y between:0 and:height]
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3055
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3056
"/    |ext|
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3057
"/
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3058
"/    (x >= 0 and:[y >= 0]) ifTrue:[
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3059
"/        ext := self computeExtent.
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3060
"/      ^ (x < ext x and:[y < ext y])
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3061
"/    ].
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3062
"/    ^ false
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3063
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3064
    "Modified: / 29.1.1998 / 16:46:10 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3065
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3066
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3067
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3068
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3069
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3070
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3071
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3072
    groupSizes size ~~ 0 ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3073
        i := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3074
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3075
        groupSizes do:[:t|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3076
            (i := i + t) == anIndex ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3077
                ^ true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3078
            ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3079
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3080
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3081
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3082
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3083
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3084
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3085
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3086
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3087
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3088
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3089
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3090
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3092
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3093
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3094
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3095
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3096
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3097
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3098
    "returns true if the panel is the first in the menu hierarchy in must
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3099
     be fit to the extent of its superView
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3100
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3101
    ^ self isPopUpView ifTrue:[false] ifFalse:[fitFirstPanel]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3102
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3103
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3104
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3105
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3106
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3107
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3108
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3109
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3110
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3111
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3113
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3114
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3115
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3116
  ^ self verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3117
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3118
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3119
!
c05874084d4c implement
ca
parents: 407
diff changeset
  3120
c05874084d4c implement
ca
parents: 407
diff changeset
  3121
type
428
ca
parents: 427
diff changeset
  3122
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3123
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3124
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3125
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3126
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3127
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3128
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3129
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3130
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3131
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3132
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3133
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3134
isValidSelection:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3135
    "returns true if something could be selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3136
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3137
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3138
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3139
    enabled ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3140
        (item := self itemAt:something) notNil ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3141
            ^ item canSelect
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3142
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3143
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3144
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3145
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3146
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3147
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3148
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3149
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3150
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3151
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3152
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3153
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3154
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3155
selection:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3156
    "change selection to an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3157
    "
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3158
    |item newSel hlp|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3159
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3160
    selection isNumber ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3161
        newSel := self itemAt:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3162
    ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3163
        (anItemOrNil notNil and:[anItemOrNil canSelect]) ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3164
            newSel := anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3165
        ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3166
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3167
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3168
    selection == newSel ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3169
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3170
    (item := selection) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3171
        selection := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3172
        item selected:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3173
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3174
    newSel notNil ifTrue:[
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3175
        selection := newSel.
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3176
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3177
"/ cg: thats rubbish - it will show help for my first item,
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3178
"/ but not the selected one ...
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3179
"/        ActiveHelp isActive ifTrue:[
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3180
"/            hlp := ActiveHelp currentHelpListener.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3181
"/            hlp initiateHelpFor:self atX:1 y:1 now:true.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3182
"/        ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3183
        selection selected:true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3184
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3185
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3186
    "Modified: / 2.2.1998 / 10:13:46 / stefan"
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3187
    "Modified: / 31.7.1998 / 03:14:18 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3188
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3189
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3190
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3191
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3192
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3193
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3195
    (item := self selection) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3196
        ^ self findFirst:[:el| el == item ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3197
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3198
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3199
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3200
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3201
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3202
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3203
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3204
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3205
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3206
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3207
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3208
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3209
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3210
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3211
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3212
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3213
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3214
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3215
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3216
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3217
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3218
shortcutKeyOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3219
    ^ ShortcutKeyOffset
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3220
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3221
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3222
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3223
    ^ VerticalInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3224
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3225
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3226
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3227
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3228
separatorSize:aType
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3229
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3230
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3231
    aType == #doubleLine ifTrue:[^ 10 ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3232
    aType == #singleLine ifTrue:[^ 10 ].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3233
  ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3234
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3235
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3236
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3237
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3238
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3239
    "
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3240
    HorizontalInset       := 4.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3241
    VerticalInset         := 3.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3242
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3243
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3244
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3245
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3246
    LabelRightOffset      := 15.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3247
    ShortcutKeyOffset     := 5.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3248
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
  3249
    IndicatorOn  := MenuPanel checkedImage.
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
  3250
    IndicatorOff := MenuPanel uncheckedImage.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3251
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3252
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3253
!MenuPanel::Item class methodsFor:'image specs'!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3254
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3255
checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3256
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3257
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3258
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3259
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3260
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3261
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3262
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3263
     self checkOffIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3264
     ImageEditor openOnClass:self andSelector:#checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3265
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3266
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3267
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3268
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3269
    ^Icon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3270
        constantNamed:#'MenuPanel::Item checkOffIcon'
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3271
        ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@IUP@@E@AP@DJ*)@DZ**(IJ***AJ***,R***+D****1J***,R***+AZ**+@Z***0A***0@K*+0@@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:'C<@_<C?8_?3??O?>??;??/?>??9??G?<O? _<@_@') ; yourself); yourself]
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3272
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3273
    "Modified: / 18.8.1998 / 15:46:56 / cg"
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3274
!
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3275
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3276
checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3277
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3278
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3279
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3280
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3281
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3282
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3283
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3284
     self checkOnIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3285
     ImageEditor openOnClass:self andSelector:#checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3286
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3287
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3288
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3289
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3290
    ^Icon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3291
        constantNamed:#'MenuPanel::Item checkOnIcon'
1080
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3292
        ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DJ*Y@DZ?:(AK??:AJ??>,R???;D/??>1K???,R???;A[??;@Z??>0A*?:0@C*+0@@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?>??;??/?>??9??G?<O? O<@_@') ; yourself); yourself]
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3293
fcccfd32eb4a images beautified
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3294
    "Modified: / 18.8.1998 / 15:46:51 / cg"
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3295
! !
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3296
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3297
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3298
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3299
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3300
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3301
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3303
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3304
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3305
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3306
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3307
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3308
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3309
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3310
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3311
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3312
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3313
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3314
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3315
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3316
  ^ item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3317
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3318
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3319
!MenuPanel::Item methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3320
420
ca
parents: 417
diff changeset
  3321
canAccept
ca
parents: 417
diff changeset
  3322
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  3323
    "
ca
parents: 417
diff changeset
  3324
  ^ (self enabled and:[self hasSubmenu not])
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3325
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3326
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3327
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3328
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3329
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3330
    |arg|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3331
723
4f05cbdcaede once again some corrections for button press indication
tz
parents: 720
diff changeset
  3332
    self hasIndication ifTrue:[    
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3333
        arg := self indicationValue not.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3334
        self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3335
    ] ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3336
        self hasChoice ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3337
            arg := self choiceValue.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3338
            self choice value:arg.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3339
            arg := true.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3340
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3341
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3342
    ^ arg
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3343
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3344
    "Modified: / 14.8.1998 / 16:13:37 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3345
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3346
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3347
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3348
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3349
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3350
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3351
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3352
    accessCharacterPosition isNil ifTrue:[
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3353
        ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3354
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3355
  ^ (rawLabel string) at:accessCharacterPosition ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3356
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3357
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3358
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3359
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3360
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3361
  ^ accessCharacterPosition
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3362
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3363
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3364
accessCharacterPosition:anIndex
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3365
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3366
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3367
    accessCharacterPosition ~~ anIndex ifTrue:[
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3368
        accessCharacterPosition := anIndex.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3369
        self updateRawLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3370
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3371
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3372
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3373
activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3374
    ^ activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3375
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3376
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3377
activeHelpKey:aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3378
    activeHelpKey := aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3379
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3380
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3381
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3382
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3383
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3384
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3385
  ^ adornment argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3386
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3387
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3388
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3389
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3390
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3391
    self argument ~~ anArgument ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3392
        self adornment argument:anArgument.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3393
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3394
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3395
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3396
compareAccessCharacterWith:aKey
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3397
    "returns true if key is my access character
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3398
    "
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3399
    ^ self accessCharacter == aKey
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3400
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3401
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3402
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3403
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3404
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3405
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3406
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3407
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3408
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3409
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3410
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3411
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3412
    "
475
b604babd1f4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  3413
    |i rest s|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3414
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3415
    accessCharacterPosition := nil.
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3416
    label := aLabel value.
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3417
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3418
    (label isString and:[(s := label size) > 1]) ifTrue:[
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3419
        i := 1.
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3420
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3421
        [((i := label indexOf:$& startingAt:i) ~~ 0 
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3422
        and:[i < s])] whileTrue:[
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3423
            rest := label copyFrom:(i+1).
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3424
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3425
            i == 1 ifTrue:[label := rest]
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3426
                  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3427
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3428
            (label at:i) == $& ifTrue:[i := i + 1]
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3429
                              ifFalse:[accessCharacterPosition := i].
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3430
            s := s - 1.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3431
        ]
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3432
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3433
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3434
    self updateRawLabel
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3435
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3436
    "Modified: / 31.7.1998 / 00:52:26 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3437
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3438
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3439
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3440
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3441
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3442
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3443
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3444
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3445
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3446
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3447
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3448
    ^ nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3449
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3450
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3451
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3452
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3453
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3454
    nameKey := aNameKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3455
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3457
rawLabel
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3458
    "returns my printable Label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3459
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3460
    ^ rawLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3461
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3462
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3463
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3464
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3465
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3466
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3467
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3468
  ^ adornment shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3469
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3470
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3471
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3472
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3473
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3474
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3475
    self shortcutKey ~~ aKey ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3476
        self adornment shortcutKey:aKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3477
        self redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3478
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3479
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3480
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3481
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3482
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3483
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3484
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3485
    ^ startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3486
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3487
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3488
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3489
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3490
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3491
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3492
    (startGroup isNil or:[startGroup == #right]) ifTrue:[
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3493
        startGroup := aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3494
    ] ifFalse:[
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3495
        self warn:('not supported group: ', aSymbol printString ).
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3496
    ]
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3497
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3498
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3499
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3500
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3501
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3502
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3503
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3504
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3505
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3506
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3507
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3508
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3509
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3510
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3511
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3512
    (aSubMenu notNil 
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3513
     and:[(aSubMenu isView or:[aSubMenu isKindOf:Menu]) not]) ifTrue:[
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3514
        ^ self submenuChannel:aSubMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3515
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3516
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3517
    (subMenu := aSubMenu) notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3518
        aSubMenu class == Menu ifTrue:[
1068
155168a813ad oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  3519
            subMenu := MenuPanel new.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  3520
            menuPanel notNil ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  3521
                subMenu receiver:menuPanel receiver.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  3522
            ].
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  3523
            subMenu menu:aSubMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3524
        ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3525
        (subMenu notNil and:[subMenu isView]) ifTrue:[
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3526
            subMenu superMenu:menuPanel
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3527
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3528
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3529
1068
155168a813ad oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  3530
    "Modified: / 10.8.1998 / 13:26:28 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3531
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3532
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3533
textLabel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3534
    "returns my textLabel or nil if none text
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3535
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3536
    (rawLabel respondsTo:#string) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3537
        ^ rawLabel string
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3538
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3539
  ^ nil
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3540
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3541
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3542
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3543
    "gets value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3544
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3545
    ^ value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3546
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3547
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3548
value:something
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3549
    "could be a value holder, an action or selector
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3550
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3551
    value := something.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3552
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3553
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3554
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3555
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3556
    "
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3557
    self value:aValue.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3558
    self argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3559
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3560
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3561
!MenuPanel::Item methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3562
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3563
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3564
    "get choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3565
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3566
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3567
  ^ adornment choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3568
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3569
    "Created: / 14.8.1998 / 14:38:52 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3570
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3571
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3572
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3573
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3574
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3575
    |old new|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3576
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3577
    old := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3578
    old == something ifTrue:[^ self].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3579
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3580
    (self isKindOfValueHolder:old) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3581
        old removeDependent:self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3582
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3583
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3584
    new := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3585
    new isSymbol ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3586
        new := self aspectAt:new.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3587
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3588
    (self isKindOfValueHolder:new) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3589
        new addDependent:self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3590
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3591
    self adornment choice:new.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3592
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3593
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3594
    "Created: / 14.8.1998 / 14:39:11 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3595
    "Modified: / 14.8.1998 / 16:13:19 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3596
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3597
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3598
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3599
    "get choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3600
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3601
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3602
  ^ adornment choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3603
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3604
    "Created: / 14.8.1998 / 15:46:33 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3605
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3606
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3607
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3608
    "set choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3609
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3610
    |old|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3611
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3612
    self adornment choiceValue:something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3613
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3614
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3615
    "Created: / 14.8.1998 / 15:46:59 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3616
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3617
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3618
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3619
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3620
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3621
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3622
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3623
    menuPanel enabled ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3624
        enableChannel isSymbol ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3625
            state := self aspectAt:enableChannel.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3626
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3627
            (self isKindOfValueHolder:state) ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3628
                enableChannel := state.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3629
                enableChannel addDependent:self.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3630
                state := enableChannel value.
1010
908145ffe38a allow use of blocks as enable-holder.
Claus Gittinger <cg@exept.de>
parents: 987
diff changeset
  3631
            ] ifFalse:[
908145ffe38a allow use of blocks as enable-holder.
Claus Gittinger <cg@exept.de>
parents: 987
diff changeset
  3632
                state := state value
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3633
            ]
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  3634
        ] ifFalse:[
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3635
            state := enableChannel value
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
  3636
        ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3637
      ^ state ~~ false
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3638
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3639
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3640
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3641
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3642
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3643
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3644
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3645
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3646
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3647
    enableChannel isNil ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3648
        oldState := true
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3649
    ] ifFalse:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3650
        oldState := enableChannel value.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3651
        (self isKindOfValueHolder:enableChannel) ifTrue:[
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3652
            enableChannel removeDependent:self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3653
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3654
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3655
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3656
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3657
    enableChannel isNil ifTrue:[
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3658
        menuPanel shown ifFalse:[^ self].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3659
        newState := true
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3660
    ] ifFalse:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3661
        (self isKindOfValueHolder:enableChannel) ifTrue:[
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3662
            enableChannel addDependent:self
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3663
        ] ifFalse:[
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3664
            enableChannel isSymbol ifTrue:[^ self]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3665
        ].
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3666
        menuPanel shown ifFalse:[^ self].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3667
        newState := enableChannel value.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3668
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3669
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3670
    newState ~~ oldState ifTrue:[
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3671
        (rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3672
            self drawLabel
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3673
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3674
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3675
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3676
    "Modified: / 27.10.1997 / 16:13:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3677
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3678
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3679
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3680
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3681
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3682
    adornment isNil ifTrue:[^ nil].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3683
  ^ adornment indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3684
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3685
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3686
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3687
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3688
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3689
    |old|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3690
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3691
    old := self indication.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3692
    old == something ifTrue:[^ self].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3693
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3694
    (self isKindOfValueHolder:old) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3695
        old removeDependent:self
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3696
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3697
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3698
    (self isKindOfValueHolder:something) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3699
        something addDependent:self
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3700
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3701
    self adornment indication:something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3702
    self updateRawLabel.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3703
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3704
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3705
isButton
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3706
    "returns whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3707
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3708
    ^ isButton
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3709
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3710
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3711
isButton:anBoolean
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3712
    "sets whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3713
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3714
    isButton := anBoolean.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3715
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3716
    layout notNil ifTrue:[
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3717
        self redrawAsButton
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3718
    ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3719
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3720
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3721
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3722
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3723
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3724
setupSubmenu
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3725
    |appl recv subm|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3726
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3727
    submenuChannel notNil ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3728
        submenuChannel isSymbol ifFalse:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3729
            subm := submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3730
        ] ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3731
            appl := menuPanel application.
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3732
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3733
            (subm := self findSubMenuIn:appl) isNil ifTrue:[
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3734
                (recv := menuPanel receiver) ~~ appl ifTrue:[
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3735
                    subm := self findSubMenuIn:recv
658
88e3122f071f check whether subdirectory is provided
ca
parents: 657
diff changeset
  3736
                ]
661
8c937a50be8f dynamic subMenus:
ca
parents: 660
diff changeset
  3737
            ]
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3738
        ].
661
8c937a50be8f dynamic subMenus:
ca
parents: 660
diff changeset
  3739
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3740
        (subm := subm value) isArray ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3741
            subm := Menu new fromLiteralArrayEncoding:subm.
709
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3742
            "/ cg: linked menus also may contain translations ...
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3743
            subm notNil ifTrue:[
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3744
                appl notNil ifTrue:[
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3745
                    subm findGuiResourcesIn:appl.
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3746
                ]                
4fbc1048fe05 linked menus may also contain label translations ...
Claus Gittinger <cg@exept.de>
parents: 708
diff changeset
  3747
            ].
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3748
        ].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3749
        self submenu:subm.
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3750
    ].
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  3751
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3752
    ^ subMenu
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3753
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3754
    "Modified: / 19.5.1998 / 19:36:56 / cg"
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3755
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3756
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3757
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3758
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3759
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3760
  ^ submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3761
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3762
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3763
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3764
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3765
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3766
    submenuChannel := aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3767
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3768
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3769
!MenuPanel::Item methodsFor:'accessing dimension'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3770
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3771
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3772
    "gets height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3773
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3774
    layout isNil ifTrue:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3775
        ^ self preferredExtent y
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3776
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3777
    ^ layout height
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3778
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3779
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3780
horizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3781
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3782
    isButton ifTrue: [^menuPanel buttonPassiveLevel + HorizontalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3783
    ^HorizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3784
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3785
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3786
layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3787
    "returns my layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3788
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3789
    ^ layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3790
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3791
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3792
layout:aLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3793
    "set a new layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3794
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3795
    layout := aLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3796
    self redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3797
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3798
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3799
verticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3800
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3801
    isButton ifTrue: [^menuPanel buttonPassiveLevel + VerticalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3802
    ^VerticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3803
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3804
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3805
width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3806
    "gets width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3807
    "
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3808
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3809
    layout isNil ifTrue:[
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3810
        ^ self preferredExtent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3811
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3812
    ^ layout width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3813
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3814
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3815
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3816
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3817
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3818
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3819
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3820
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3821
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3822
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3823
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3824
    (appl isKindOf:ValueModel) ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3825
        ^ appl value:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3826
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3827
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3828
    (appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3829
        Object messageNotUnderstoodSignal handle:[:ex|
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3830
            ex parameter selector == aKey ifFalse:[
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3831
                ex reject
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3832
            ].
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3833
        ] do:[
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3834
            (appl isKindOf:ApplicationModel) 
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3835
                ifTrue:[value := appl aspectFor:aKey]
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3836
                ifFalse:[value := appl perform:aKey]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3837
        ]
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3838
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3839
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3840
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3841
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3842
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3843
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3844
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3845
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3846
choiceChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3847
    "called when the choice changed
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3848
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3849
    |indicator|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3850
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3851
    isButton ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3852
        indicator := self choiceForm.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3853
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3854
        indicator = rawLabel icon ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3855
            ^ self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3856
        ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3857
        rawLabel icon:indicator.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3858
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3859
        disabledRawLabel notNil ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3860
            disabledRawLabel icon:indicator
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3861
        ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3862
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3863
    self redraw
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3864
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3865
    "Created: / 14.8.1998 / 16:14:59 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3866
    "Modified: / 14.8.1998 / 17:19:32 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3867
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3868
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3869
enabledStateOfMenuChangedTo:aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3870
    "enabled state of menu changed to aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3871
    "
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3872
    rawLabel notNil ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3873
        self drawLabel
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3874
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3875
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3876
!
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3877
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3878
indicationChanged
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3879
    "called when the indication changed
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3880
    "
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3881
    |indicator|
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3882
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3883
    isButton ifFalse:[
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3884
        indicator := self indicatorForm.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3885
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3886
        indicator = rawLabel icon ifTrue:[
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3887
            ^ self
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3888
        ].
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3889
        rawLabel icon:indicator.
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3890
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3891
        disabledRawLabel notNil ifTrue:[
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3892
            disabledRawLabel icon:indicator
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3893
        ]
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3894
    ].
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3895
    self redraw
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3896
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3897
    "Modified: / 14.8.1998 / 17:19:38 / cg"
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3898
!
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3899
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3900
update:something with:aParameter from:changedObject
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3901
    |indicator|
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3902
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3903
    changedObject == self indication ifTrue:[
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3904
        ^ self indicationChanged
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3905
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3906
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3907
    changedObject == self choice ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3908
        ^ self choiceChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3909
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3910
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3911
    changedObject == enableChannel ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3912
        (rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3913
            self drawLabel
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3914
        ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3915
        ^ self
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3916
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3917
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3918
    changedObject == isVisible ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3919
        ^ menuPanel mustRearrange
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3920
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3921
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3922
    super update:something with:aParameter from:changedObject
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3923
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3924
    "Modified: / 14.8.1998 / 16:13:41 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3925
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3926
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3927
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3928
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3929
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3930
    |indicator| 
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3931
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3932
    (indicator := self indication) notNil ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3933
"/        (isButton and:[menuPanel isPopUpView]) ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3934
"/            (self isKindOfValueHolder:indicator) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3935
"/                ^ self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3936
"/            ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3937
"/        ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3938
        self indicationChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3939
    ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3940
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3941
    "Modified: / 14.8.1998 / 15:19:38 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3942
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3943
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3944
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3945
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3946
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3947
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3948
    "
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3949
    |item label rcv|
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3950
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3951
    label := self label.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3952
    item  := MenuItem labeled:(label printString).
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3953
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3954
    label isImage ifTrue:[
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3955
        rcv := ResourceRetriever new.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3956
        rcv className:#MenuEditor.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3957
        rcv selector:#iconUnknown.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3958
        item labelImage:rcv.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3959
    ].
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3960
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3961
    item activeHelpKey:activeHelpKey.
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3962
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3963
    enableChannel notNil ifTrue:[
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3964
        item enabled:(enableChannel value)
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3965
    ].
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3966
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3967
    item accessCharacterPosition:(self accessCharacterPosition).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3968
    item startGroup:(self startGroup).
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3969
    item argument:(self argument).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3970
    item nameKey:(self nameKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3971
    item shortcutKeyCharacter:(self shortcutKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3972
    item value:(value value).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3973
    item indication:(self indication value).
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3974
    item choice:(self choice value).
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3975
    item choiceValue:(self choiceValue).
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3976
    item isVisible:(self isVisible).
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3977
    item isButton:isButton.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3978
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3979
    submenuChannel isSymbol ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3980
        item submenuChannel:submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3981
    ] ifFalse:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3982
        self submenu notNil ifTrue:[
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3983
            item submenu:(self submenu asMenu)
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3984
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3985
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3986
  ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3987
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3988
    "Modified: / 14.8.1998 / 15:47:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3989
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3990
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3991
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3992
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3993
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3994
    |var lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3995
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3996
    menuPanel disabledRedrawDo:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3997
        label := nil.
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3998
        activeHelpKey := aMenuItem activeHelpKey.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3999
        self enabled:(aMenuItem enabled).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4000
        self nameKey:(aMenuItem nameKey).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4001
        self indication:(aMenuItem indication).
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4002
        self choice:(aMenuItem choice).
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4003
        self choiceValue:(aMenuItem choiceValue).
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4004
        self isButton:(aMenuItem isButton).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4005
        self startGroup:(aMenuItem startGroup).
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4006
        self isVisible:(aMenuItem isVisible).
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4007
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4008
        (var := aMenuItem accessCharacterPosition) notNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4009
            self accessCharacterPosition:var.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4010
        ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4011
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4012
        (lbl := aMenuItem labelImage value) isNil ifTrue:[
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  4013
            lbl := aMenuItem rawLabel. "/ avoid translating &'s twice
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4014
        ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4015
        self label:lbl.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4016
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4017
        self shortcutKey:(aMenuItem shortcutKeyCharacter).
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4018
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4019
        (var := aMenuItem argument) notNil ifTrue:[
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4020
            self argument:var.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4021
        ].
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4022
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4023
        submenuChannel := aMenuItem submenuChannel.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4024
        self submenu:(aMenuItem submenu).
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4025
        self value:(aMenuItem value).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4026
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  4027
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4028
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4029
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4030
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4031
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4032
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4033
drawLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4034
    "draw label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4035
    "
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4036
    |y x h l t scKey cLb cLa img fg asc arrow hrzInset 
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4037
     buttonLevel isSelected clr|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4038
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4039
    self isVisible ifFalse:[^ self].
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4040
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4041
    img := rawLabel.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4042
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4043
    asc := menuPanel font ascent.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4044
    h   := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4045
    l   := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4046
    t   := layout top.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4047
    hrzInset := self horizontalInset.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4048
    isSelected := self drawSelected.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4049
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4050
    self enabled ifTrue:[
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4051
        fg := isSelected ifTrue:[self activeForegroundColor]
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4052
                        ifFalse:[menuPanel foregroundColor].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4053
    ] ifFalse:[
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4054
        fg := menuPanel disabledForegroundColor.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4055
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4056
        (img := disabledRawLabel) isNil ifTrue:[
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4057
            img := self disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4058
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4059
    ].
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4060
    menuPanel paint:fg.
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4061
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4062
    "/ t := t + menuPanel level.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4063
    y := t + ((h - (img heightOn:menuPanel)) // 2).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4064
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4065
    (self textLabel) notNil ifTrue:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4066
        y := y + asc.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4067
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4068
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4069
    isButton ifTrue:[   
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4070
        (isSelected or:[self indicationValue == true]) ifTrue:
720
7187e69c300b some corrections for button press indication
tz
parents: 718
diff changeset
  4071
        [   
7187e69c300b some corrections for button press indication
tz
parents: 718
diff changeset
  4072
            img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1.
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4073
            buttonLevel := menuPanel buttonActiveLevel.
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4074
        ] ifFalse:[   
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4075
            img displayOn:menuPanel x:(l + hrzInset) y:y.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4076
            self isEntered ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4077
                buttonLevel := menuPanel buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4078
            ] ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4079
                buttonLevel := menuPanel buttonPassiveLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4080
            ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4081
        ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4082
        menuPanel 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4083
            drawButtonEdgesInLayout:layout 
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4084
            withLevel:buttonLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4085
            selected:isSelected.
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4086
        ^ self
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4087
    ].
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4088
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4089
"/ label = 'Sort By Name' ifTrue:[self halt.].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4090
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4091
    img displayOn:menuPanel x:(l + hrzInset) y:y.
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4092
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4093
    "/ DRAW SHORTCUT KEY
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4094
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4095
    MenuView showAcceleratorKeys == true ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4096
        menuPanel isVerticalLayout ifTrue:[ "/ only for vertical menus ...
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4097
            (scKey:= self shortcutKeyAsString) notNil ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4098
                (x := menuPanel shortKeyInset) == 0 ifTrue:[
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4099
                    x := hrzInset + LabelRightOffset + (img widthOn:menuPanel)
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4100
                ].
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4101
                x := l + x.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4102
                y := t + ((h - (scKey heightOn:menuPanel)) // 2).
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4103
                y := y + asc.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4104
                scKey displayOn:menuPanel x:x y:y. 
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  4105
            ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4106
        ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4107
    ].
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  4108
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4109
    "/ DRAW SUBMENU INDICATION
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4110
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4111
    (menuPanel isVerticalLayout and:[self submenu notNil]) ifTrue:[
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4112
        arrow := menuPanel rightArrow.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4113
        x := layout right - arrow width - hrzInset.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4114
        y := t + (h - arrow height // 2).
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4115
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  4116
        (menuPanel styleSheet is3D not
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  4117
        or:[(img := menuPanel rightArrowShadow) isNil]) ifTrue:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4118
            ^ menuPanel displayForm:arrow x:x y:y
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4119
        ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4120
        cLa := menuPanel shadowColor.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4121
        cLb := menuPanel lightColor.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4122
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4123
        isSelected ifFalse:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4124
            fg  := cLa.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4125
            cLa := cLb.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4126
            cLb := fg
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4127
        ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4128
        menuPanel paint:cLa.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4129
        menuPanel displayForm:arrow x:x y:y.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4130
        menuPanel paint:cLb.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4131
        menuPanel displayForm:img x:x y:y. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4132
    ]
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  4133
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4134
    "Modified: / 22.8.1998 / 18:32:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4135
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4136
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4137
drawSelected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4138
    "return true if item is selected or if item implements
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4139
     a toggle in a radio group which is selected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4140
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4141
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4142
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4143
    self isSelected ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4144
        ^ true
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4145
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4146
    isButton ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4147
        ^ ((holder := self choice) notNil and:[holder value == self choiceValue])
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4148
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4149
    ^ false
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4150
!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4151
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4152
redraw
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4153
    "redraw item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4154
    "
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4155
    |isSelected ownBgCol showItemSep type paint lgCol shCol
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4156
     h  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4157
     w  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4158
     l  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4159
     t  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4160
     r  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4161
     b  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4162
     x  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4163
     y  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4164
     hrzInset "{ Class:SmallInteger }"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4165
     isEntered
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4166
    |
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4167
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4168
    (self isVisible and:[menuPanel canDrawItem]) ifFalse:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4169
        ^ self
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4170
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4171
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4172
    isSelected := self drawSelected.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4173
    isEntered := self isEntered.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4174
    hrzInset   := self horizontalInset.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4175
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4176
    isSelected ifFalse:[
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4177
        (isButton and:[isEntered]) ifTrue:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4178
            paint := self buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4179
        ] ifFalse:[
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4180
            paint := self backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4181
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4182
    ] ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4183
        paint := self activeBackgroundColor
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4184
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4185
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4186
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4187
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4188
    b := layout bottom.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4189
    h := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4190
    w := layout width.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4191
    (ownBgCol := self backgroundColorFromLabel) isNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4192
        menuPanel paint:paint.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4193
        menuPanel fillRectangle:layout.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4194
    ] ifFalse:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4195
        self hasIndication ifFalse:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4196
            menuPanel paint:ownBgCol.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4197
            menuPanel fillRectangle:layout.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4198
        ] ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4199
            menuPanel paint:paint.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4200
            x := (rawLabel icon width) + hrzInset + 4.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4201
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4202
            menuPanel fillRectangleX:l y:t width:x height:h.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4203
            menuPanel paint:ownBgCol.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4204
            menuPanel fillRectangleX:(l + x) y:t width:(w - x) height:h.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4205
            ownBgCol := nil.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4206
       ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4207
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4208
    lgCol       := menuPanel lightColor.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4209
    shCol       := menuPanel shadowColor.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4210
    showItemSep := menuPanel showSeparatingLines.
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4211
    type        := self separatorType.
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4212
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4213
    type notNil ifTrue:[
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4214
        type == #blankLine ifTrue:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4215
            ^ self
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4216
        ].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4217
        "/ draw separator
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4218
        menuPanel paint:shCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4219
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4220
        menuPanel verticalLayout ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4221
            l := l + hrzInset.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4222
            r := r - hrzInset.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4223
            y := t - 1 + (h // 2).
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4224
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4225
            type == #doubleLine ifTrue:[y := y - 2].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4226
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4227
            menuPanel displayLineFromX:l y:y toX:r y:y.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4228
            menuPanel paint:lgCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4229
            y := y + 1.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4230
            menuPanel displayLineFromX:l y:y toX:r y:y.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4231
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4232
            type == #doubleLine ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4233
                y := y + 3.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4234
                menuPanel paint:shCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4235
                menuPanel displayLineFromX:l y:y toX:r y:y.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4236
                menuPanel paint:lgCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4237
                y := y + 1.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4238
                menuPanel displayLineFromX:l y:y toX:r y:y.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4239
            ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4240
        ] ifFalse:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4241
            x := l - 1 + (w // 2).
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4242
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4243
            type == #doubleLine ifTrue:[x := x - 2].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4244
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4245
            menuPanel displayLineFromX:x y:t toX:x y:b.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4246
            menuPanel paint:lgCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4247
            x := x + 1.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4248
            menuPanel displayLineFromX:x y:t toX:x y:b.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4249
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4250
            type == #doubleLine ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4251
                x := x + 3.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4252
                menuPanel paint:shCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4253
                menuPanel displayLineFromX:x y:t toX:x y:b.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4254
                menuPanel paint:lgCol.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4255
                x := x + 1.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4256
                menuPanel displayLineFromX:x y:t toX:x y:b.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4257
            ]
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4258
        ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4259
        ^ self
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4260
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4261
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4262
    isButton ifTrue:[
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4263
        ^ self drawLabel
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4264
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4265
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4266
    showItemSep ifTrue:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4267
        |col index item lfSep rtSep|
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4268
        col := menuPanel paint.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4269
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4270
        index := menuPanel indexOfItem:self.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4271
        item  := menuPanel itemAtIndex:(index - 1).
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4272
        lfSep := item notNil and:[item isButton not].
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4273
        item  := menuPanel itemAtIndex:(index + 1).
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4274
        rtSep := item notNil and:[item isButton not].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4275
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4276
        menuPanel paint:lgCol.
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4277
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4278
        menuPanel verticalLayout ifTrue:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4279
            lfSep ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4280
                menuPanel displayLineFromX:l y:t - 1 toX:r y:t - 1.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4281
            ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4282
            rtSep ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4283
                menuPanel displayLineFromX:l y:b - 1 toX:r y:b - 1.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4284
            ].
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4285
            menuPanel paint:shCol.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4286
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4287
            lfSep ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4288
                menuPanel displayLineFromX:l y:t - 2 toX:r y:t - 2.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4289
            ].
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4290
            rtSep ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4291
                menuPanel displayLineFromX:l y:b - 2 toX:r y:b - 2.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4292
            ]
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4293
        ] ifFalse:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4294
            lfSep ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4295
                menuPanel displayLineFromX:l - 1 y:t toX:l - 1 y:b
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4296
            ].
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4297
            rtSep ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4298
                menuPanel displayLineFromX:r - 1 y:t toX:r - 1 y:b.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4299
            ]. 
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4300
            menuPanel paint:shCol.
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4301
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4302
            lfSep ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4303
                menuPanel displayLineFromX:l - 2 y:t toX:l - 2 y:b
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4304
            ].
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  4305
            rtSep ifTrue:[
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4306
                menuPanel displayLineFromX:r - 2 y:t toX:r - 2 y:b.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4307
            ] 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4308
        ]
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4309
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4310
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4311
    self drawLabel.  
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4312
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4313
    (ownBgCol notNil and:[isSelected]) ifTrue:[
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  4314
        ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  4315
                                 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4316
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4317
        menuPanel displayRectangleX:(l + 1) y:(t + 1) width:(w - 2) height:(h - 2).
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  4318
        menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).  
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4319
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4320
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4321
    menuPanel drawEdgesForX:l y:t width:w height:h isSelected:isSelected isEntered:isEntered.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4322
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4323
    "Modified: / 20.8.1998 / 15:11:33 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4324
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4325
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4326
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4327
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4328
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4329
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4330
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4331
    |channel|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4332
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4333
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4334
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4335
    (enableChannel notNil and:[self isKindOfValueHolder:enableChannel]) ifTrue:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4336
        enableChannel removeDependent:self
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4337
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4338
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4339
    (isVisible notNil and:[self isKindOfValueHolder:isVisible]) ifTrue:[
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4340
        isVisible removeDependent:self
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4341
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4342
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4343
    channel := self indication.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4344
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4345
        channel removeDependent:self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4346
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4347
    channel := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4348
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4349
        channel removeDependent:self
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4350
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4351
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4352
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4353
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4354
    "Modified: / 14.8.1998 / 14:37:57 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4355
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4356
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4357
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4358
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4359
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4360
    menuPanel := aPanel.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4361
    isButton  := false.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4362
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4363
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4364
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4365
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4366
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4367
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4368
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4369
    disabledRawLabel isNil ifTrue:[
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4370
        (     rawImage notNil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4371
         and:[(rawImage respondsTo:#colorMap)
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4372
         and:[rawImage colorMap notNil]]
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4373
        ) ifFalse:[
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4374
            disabledRawLabel := rawLabel.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4375
        ] ifTrue:[
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4376
            disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4377
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4378
            rawLabel class == LabelAndIcon ifTrue:[
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4379
                (isButton
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4380
                  or:[((self indication notNil or:[self choice notNil])
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4381
                 and:[label class == LabelAndIcon])]
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4382
                ) ifTrue:[
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4383
                    disabledRawLabel := LabelAndIcon form:(rawLabel icon)
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4384
                                                    image:disabledRawLabel
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4385
                                                   string:(rawLabel string)
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4386
                ] ifFalse:[
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4387
                    disabledRawLabel := LabelAndIcon form:disabledRawLabel
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4388
                                                    image:(rawLabel image)
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4389
                                                   string:(rawLabel string)
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4390
                ]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4391
            ]
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4392
        ]
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4393
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4394
    ^ disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4395
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4396
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4397
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4398
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4399
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4400
    |icon|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4401
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4402
    rawImage notNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4403
        rawLabel isImage ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4404
            rawLabel := menuPanel imageOnDevice:rawImage
735
268ea1a83942 images on device
ca
parents: 730
diff changeset
  4405
        ] ifFalse:[
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4406
            rawLabel class == LabelAndIcon ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4407
                (icon := rawLabel image) notNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4408
                    rawLabel image:(menuPanel imageOnDevice:icon)
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4409
                ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4410
                (icon := rawLabel icon) notNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4411
                    (self indication isNil and:[self choice isNil]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4412
                        rawLabel icon:(menuPanel imageOnDevice:icon)
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4413
                    ]
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4414
                ]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4415
            ]
735
268ea1a83942 images on device
ca
parents: 730
diff changeset
  4416
        ]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4417
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4418
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4419
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4420
updateRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4421
    "recreate rawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4422
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4423
    |char size form|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4424
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4425
    label isNil ifTrue:[        "/ not yet initialized
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4426
        ^ self
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4427
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4428
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4429
    (form := self indicatorForm) isNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4430
        form := self choiceForm
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4431
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4432
    rawImage         := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4433
    disabledRawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4434
    rawLabel         := label value.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4435
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4436
    rawLabel isString ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4437
        rawLabel isText ifFalse:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4438
            rawLabel := rawLabel withoutSeparators
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4439
        ].        
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4440
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4441
        form isNil ifTrue:[                             "/ check for separator
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4442
            rawLabel isEmpty ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4443
                  rawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4444
                ^ self
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4445
            ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4446
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4447
            rawLabel size == 1 ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4448
                char := rawLabel first.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4449
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4450
                (char == $- or:[char == $=]) ifTrue:[   "/ other line separators
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4451
                    label := String new:1.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4452
                    label at:1 put:char.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4453
                    rawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4454
                  ^ self
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4455
                ]
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4456
            ]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4457
        ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4458
        rawLabel isEmpty ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4459
            rawLabel := label value
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4460
        ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4461
        size := self accessCharacterPosition.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4462
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4463
        (size notNil and:[size <= rawLabel size]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4464
            rawLabel isText ifFalse:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4465
                rawLabel := Text string:rawLabel
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4466
            ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4467
            rawLabel emphasisAt:size add:#underline
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4468
        ]
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4469
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4470
    rawLabel isImage ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4471
        rawImage := rawLabel.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4472
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4473
        form notNil ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4474
            isButton ifTrue:[form := nil].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4475
            rawLabel := LabelAndIcon form:form image:rawImage.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4476
        ]
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4477
    ] ifFalse:[
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4478
        rawLabel class == LabelAndIcon ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4479
            rawImage := rawLabel icon.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4480
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4481
            (form notNil and:[isButton not]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4482
                rawLabel image:rawImage.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4483
                rawLabel icon:form
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4484
            ]                
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4485
        ] ifFalse:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4486
            rawImage := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4487
            rawLabel isNil ifTrue:[rawLabel := ''].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4488
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4489
            (form notNil and:[isButton not]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4490
                rawLabel := LabelAndIcon icon:form string:rawLabel.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4491
            ] ifFalse:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4492
                disabledRawLabel := rawLabel.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4493
            ]
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4494
        ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4495
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4496
    menuPanel shown ifTrue:[ self fetchImages ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4497
    menuPanel mustRearrange
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4498
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4499
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4500
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4501
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4502
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4503
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4504
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4505
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4506
    isButton ifTrue: [^menuPanel buttonActiveBackgroundColor].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4507
    ^menuPanel activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4508
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4509
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4510
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4511
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4512
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4513
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4514
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4515
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4516
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4517
adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4518
    "returns adornment; if not existing yet a new instance
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4519
     is created
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4520
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4521
    adornment isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4522
        adornment := Adornment new
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4523
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4524
  ^ adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4525
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4526
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4527
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4528
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4529
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4530
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4531
    isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor].
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4532
    ^menuPanel backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4533
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4534
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4535
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4536
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4537
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4538
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4539
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4540
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4541
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4542
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4543
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4544
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4545
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4546
    run size == 0 ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4547
        (run value isColor and:[run key == #backgroundColor]) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4548
            ^ run value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4549
        ]
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4550
    ] ifFalse:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4551
        run do:[:r|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4552
            (r value isColor and:[r key == #backgroundColor]) ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4553
                ^ r value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4554
            ]
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4555
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4556
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4557
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4558
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4559
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4560
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4561
    "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
  4562
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4563
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4564
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4565
    isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4566
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4567
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4568
    "Created: / 20.8.1998 / 13:56:10 / cg"
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4569
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4570
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4571
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4572
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4573
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4574
    |holder|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4575
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4576
    (holder := self choice) isNil ifTrue:[^ nil].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4577
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4578
    holder value == self choiceValue ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4579
        ^ self class checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4580
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4581
    ^ self class checkOffIcon
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4582
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4583
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4584
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4585
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4586
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4587
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4588
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4589
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4590
    |subm argument sel|
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4591
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4592
    subm := nil.
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4593
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4594
    aRecv notNil ifTrue:[
711
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4595
        submenuChannel last ~~ $: ifTrue:[
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4596
            Object messageNotUnderstoodSignal handle:[:ex|
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4597
                |selector|
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4598
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4599
                ((selector := ex parameter selector) == submenuChannel
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4600
                or:[selector == #aspectFor:]) ifFalse:[
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4601
                    ex reject
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4602
                ].
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4603
            ] do:[
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4604
                subm := aRecv aspectFor:submenuChannel
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4605
            ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4606
            subm isNil ifTrue:[
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4607
                Object messageNotUnderstoodSignal handle:[:ex| 
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4608
                    ex parameter selector == submenuChannel ifFalse:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4609
                        ex reject
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4610
                    ].
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4611
            ] do:[
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4612
                    subm := aRecv perform:submenuChannel
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4613
                ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4614
            ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4615
            subm isNil ifTrue:[
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4616
                Object messageNotUnderstoodSignal handle:[:ex| 
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4617
                    ex parameter selector == submenuChannel ifFalse:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4618
                        ex reject
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4619
                    ].
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4620
                ] do:[
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4621
                    subm := aRecv class perform:submenuChannel
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4622
                ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4623
            ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4624
        ] ifFalse:[
711
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4625
            (argument := self argument) notNil ifTrue:[
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4626
                sel := submenuChannel asSymbol.
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4627
                Object messageNotUnderstoodSignal handle:[:ex| 
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4628
                    ex parameter selector == sel ifFalse:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4629
                        ex reject
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4630
                    ].
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4631
                ] do:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4632
                    subm := aRecv perform:sel with:argument
711
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4633
                ].
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4634
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4635
                subm isNil ifTrue:[
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4636
                    Object messageNotUnderstoodSignal handle:[:ex| 
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4637
                        ex parameter selector == sel ifFalse:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4638
                            ex reject
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4639
                        ].
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4640
                    ] do:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4641
                        subm := aRecv class perform:sel with:argument
711
08be3e0f494e support argument in linked menu
ca
parents: 710
diff changeset
  4642
                    ]
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4643
                ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4644
            ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4645
        ]
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4646
    ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4647
    ^ subm
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4648
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4649
    "Modified: / 4.8.1998 / 17:40:09 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4650
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4651
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4652
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4653
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4654
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4655
    |indication numArgs sel recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4656
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4657
    (indication := self indication) isNil ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4658
        ^ nil                                           "/ has no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4659
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4660
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4661
    indication isSymbol ifTrue:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4662
        (numArgs := indication numArgs) ~~ 0 ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4663
            numArgs == 2 ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4664
                recv := menuPanel receiver.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4665
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4666
                (recv isKindOf:ValueModel) ifFalse:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4667
                    (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4668
                        sel := indication copyFrom:1 to:(indication indexOf:$:).
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4669
                        indication := nil.
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4670
                        sel := sel asSymbol.
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4671
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4672
                        Object messageNotUnderstoodSignal handle:[:ex| 
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4673
                            ex parameter selector == sel ifFalse:[
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4674
"/                                Transcript showCR:'no indication for: ' , sel.
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4675
                                ex reject
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4676
                            ].
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4677
                        ] do:[
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4678
                            indication := recv perform:sel with:self argument
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4679
                        ]
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4680
                    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4681
                ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4682
                ^ indication value == true
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4683
            ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4684
            indication := (indication copyWithoutLast:1) asSymbol
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4685
        ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4686
        indication := self aspectAt:indication.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4687
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4688
        (self isKindOfValueHolder:indication) ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4689
            self adornment indication:indication.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4690
            indication addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4691
        ]
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4692
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4693
    ^ indication value == true
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4694
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4695
    "Modified: / 8.8.1998 / 02:15:15 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4696
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4697
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4698
indicationValue:aValue
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4699
    "returns indication value or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4700
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4701
    |numArgs indication recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4702
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4703
    (indication := self indication) isNil ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4704
        ^ self                                          "/ has no indication
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4705
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4706
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4707
    indication isSymbol ifFalse:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4708
        (self isKindOfValueHolder:indication) ifTrue:[  "/ is value holder
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4709
            indication value:aValue
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4710
        ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4711
        ^ self
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4712
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4713
    recv := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4714
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4715
    (recv isKindOf:ValueModel) ifTrue:[
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4716
        recv value:indication value:aValue.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4717
    ] ifFalse:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4718
        (      (numArgs := indication numArgs) ~~ 0
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4719
          and:[recv notNil or:[(recv := menuPanel application) notNil]]
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4720
        ) ifTrue:[
1026
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4721
            Object messageNotUnderstoodSignal handle:[:ex| 
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4722
                (ex parameter selector ~~ indication) ifTrue:[
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4723
                    ex reject
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4724
                ]
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4725
            ] do:[
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4726
                numArgs == 1 ifTrue:[
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4727
                    recv perform:indication with:aValue
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4728
                ] ifFalse:[
739
61916e42d6e3 if the first argument to the selector or block is nil
ca
parents: 738
diff changeset
  4729
                    recv perform:indication with:(self argument ? self) with:aValue
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4730
                ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4731
            ]
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4732
        ]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4733
    ].
1026
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4734
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4735
    "Modified: / 28.7.1998 / 20:47:08 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4736
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4737
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4738
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4739
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4740
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4741
    |value|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4742
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4743
    (value := self indicationValue) isNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4744
        ^ nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4745
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4746
  ^ value ifTrue:[IndicatorOn] ifFalse:[IndicatorOff]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4747
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4748
    "Created: / 14.8.1998 / 15:53:53 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4749
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4750
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4751
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4752
    "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
  4753
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4754
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4755
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4756
    "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
  4757
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4758
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4759
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4760
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4761
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4762
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4763
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4764
    rawLabel isNil ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4765
        ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4766
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4767
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4768
    (lbl := label value) isNil ifTrue:[
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4769
        ^ #singleLine
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4770
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4771
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4772
    lbl size == 1 ifTrue:[
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4773
        c := lbl first.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4774
        c == $- ifTrue:[^ #singleLine].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4775
        c == $= ifTrue:[^ #doubleLine].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4776
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4777
  ^ #blankLine
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4778
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4779
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4780
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4781
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4782
canSelect
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4783
    "returns true if item is selectable
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4784
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4785
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4786
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4787
    (self isVisible and:[self enabled and:[rawLabel notNil]]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4788
        ((holder := self choice) isNil or:[holder value ~~ self choiceValue]) ifTrue:[
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4789
            ^ true
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4790
        ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4791
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4792
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4793
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4794
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4795
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4796
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4797
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4798
    (self isVisible and:[layout notNil]) ifTrue:[
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4799
        ^ (     (x >= layout left)
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4800
            and:[x <  layout right
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4801
            and:[y >  layout top
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4802
            and:[y <= layout bottom]]]
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4803
          )
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4804
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4805
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4806
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4807
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4808
hasChoice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4809
    "returns true if a choice indication (RadioButton) exists
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4810
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4811
  ^ self choice notNil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4812
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4813
    "Created: / 14.8.1998 / 14:38:20 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4814
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4815
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4816
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4817
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4818
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4819
  ^ self indication notNil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4820
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4821
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4822
hasSubmenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4823
    "returns true if a submenu exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4824
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4825
    ^ self submenu notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4826
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4827
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4828
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4829
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4830
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4831
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4832
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4833
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4834
isKindOfValueHolder:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4835
    "returns true if something is kind of vlaue holder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4836
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4837
    ^ ((something respondsTo:#value:) and:[something isBlock not])
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4838
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4839
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4840
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4841
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4842
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4843
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4844
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4845
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4846
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4847
    "
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4848
    ^ rawLabel isNil
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4849
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4850
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4851
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4852
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4853
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4854
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4855
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4856
    isVisible isSymbol ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4857
        state := self aspectAt:isVisible.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4858
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4859
        (self isKindOfValueHolder:state) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4860
            isVisible := state.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4861
            isVisible addDependent:self.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4862
            state := isVisible value.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4863
        ]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4864
    ] ifFalse:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4865
        state := isVisible value
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4866
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4867
  ^ state ~~ false
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4868
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4869
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4870
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4871
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4872
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4873
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4874
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4875
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4876
    isVisible isNil ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4877
        oldState := true
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4878
    ] ifFalse:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4879
        oldState := isVisible value.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4880
        (self isKindOfValueHolder:isVisible) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4881
            isVisible removeDependent:self
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4882
        ]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4883
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4884
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4885
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4886
    isVisible isNil ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4887
        newState := true
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4888
    ] ifFalse:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4889
        (self isKindOfValueHolder:isVisible) ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4890
            isVisible addDependent:self
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4891
        ] ifFalse:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4892
            isVisible isSymbol ifTrue:[^ self]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4893
        ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4894
        menuPanel shown ifFalse:[^ self].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4895
        newState := isVisible value.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4896
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4897
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4898
    newState ~~ oldState ifTrue:[
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4899
        menuPanel mustRearrange
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4900
    ]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4901
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4902
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4903
preferredExtent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4904
    "compute my preferred extent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4905
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4906
    |x y s isVertical sepSize|
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4907
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4908
    self isVisible ifFalse:[^ (0 @ 0) ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4909
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4910
    x := self horizontalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4911
    y := self verticalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4912
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4913
    isVertical := menuPanel verticalLayout.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4914
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4915
    self isSeparator ifFalse:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4916
        x := x + (rawLabel widthOn:menuPanel).
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4917
        y := y + (rawLabel heightOn:menuPanel).
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4918
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4919
        MenuView showAcceleratorKeys == true ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4920
            isVertical ifTrue:[ "/ only for vertical menus ...
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4921
                (s := self shortcutKeyAsString) notNil ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4922
                    x := x + LabelRightOffset + (s widthOn:menuPanel)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4923
                ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4924
            ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4925
        ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4926
        (isVertical and:[self hasSubmenu or:[submenuChannel notNil]]) ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4927
            x := x + menuPanel subMenuIndicationWidth.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4928
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4929
            s notNil ifTrue:[x := x + ShortcutKeyOffset]
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4930
                    ifFalse:[x := x + LabelRightOffset]
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4931
        ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4932
    ] ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4933
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4934
        sepSize := (self class separatorSize:(self separatorType)).
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4935
        isVertical ifFalse:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4936
            x := x max:sepSize.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4937
            y := y + (menuPanel font height)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4938
        ] ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4939
            y := y max:sepSize
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4940
        ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4941
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4942
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4943
    ^ (x @ y)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4944
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4945
    "Modified: / 8.8.1998 / 01:38:26 / cg"
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4946
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4947
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4948
preferredExtentX
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4949
    "compute my preferred extent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4950
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4951
    ^ self preferredExtent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4952
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4953
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4954
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4955
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4956
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4957
    "
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4958
    |nm key prefix|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4959
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4960
    (key := self shortcutKey) isNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4961
        ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4962
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4963
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4964
    key isCharacter ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4965
        nm := key asString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4966
    ] ifFalse:[
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4967
        "/ this is somewhat complicated: we have the symbolic key at hand,
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4968
        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4969
        "/ Ask the devices keyboardMap for the backtranslation.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4970
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4971
        nm := menuPanel device keyboardMap keyAtValue:key ifAbsent:key.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4972
        "/
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4973
        "/ some modifier-key combination ?
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4974
        "/
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4975
        (nm startsWith:#Cmd) ifTrue:[
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4976
            prefix := #Cmd.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4977
        ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4978
            prefix := #Alt.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4979
        ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4980
            prefix := #Meta.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4981
        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4982
            prefix := #Ctrl.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4983
        ]]]].
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4984
        prefix notNil ifTrue:[
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4985
            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4986
        ] ifFalse:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4987
            nm := nm asString
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4988
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4989
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4990
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4991
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4992
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4993
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4994
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4995
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4996
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4997
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4998
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4999
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5000
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5001
    m notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5002
        ^ m , '-'
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5003
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5004
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5005
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5006
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5007
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5008
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5009
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5010
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5011
hideSubmenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5012
    "hide submenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5013
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5014
    |subMenu id|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5015
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5016
    subMenu := self submenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5017
    subMenu realized ifFalse:[
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5018
        (id := subMenu id) notNil ifTrue:[
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5019
            menuPanel device unmapWindow:id
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5020
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5021
    ] ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5022
       subMenu hide
1076
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5023
    ].
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5024
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5025
    subMenu windowGroup:nil.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5026
    menuPanel windowGroup removeView:subMenu.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5027
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5028
    "Modified: / 14.8.1998 / 17:36:01 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5029
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5030
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5031
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5032
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5033
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5034
    ^ menuPanel selection == self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5035
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5036
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5037
openSubmenuAt:aPoint
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5038
    "open submenu at a point
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5039
    "
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5040
    |top windowGrp subMenu|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5041
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5042
    windowGrp := menuPanel topMenu windowGroup.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5043
    subMenu   := self setupSubmenu.
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5044
    subMenu isNil ifTrue:[
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5045
        ^ self
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5046
    ].
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  5047
    subMenu font:(menuPanel topMenu font).
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5048
    subMenu becomesActiveMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5049
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5050
    windowGrp notNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5051
        subMenu windowGroup:windowGrp.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5052
        windowGrp addTopView:subMenu.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5053
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5054
    subMenu fixSize.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5055
    subMenu origin:aPoint.
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5056
"/    subMenu makeFullyVisible.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5057
    top := menuPanel topMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5058
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5059
    subMenu realized ifFalse:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5060
        subMenu realize. 
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5061
    ] ifTrue:[
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5062
        top device mapWindow:subMenu id.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5063
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5064
    subMenu makeFullyVisible.
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5065
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5066
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5067
"/    (top styleSheet at:'menu.autoSelectFirst') ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5068
"/        subMenu selectionIndex:1
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5069
"/    ]
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5070
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5071
    "Modified: / 19.5.1998 / 19:37:37 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5072
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5073
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5074
selected:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5075
    "change selection to a state. Dependant on the state open or hide an existing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5076
     submenu and perform a redraw
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5077
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5078
    |p d subMenu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5079
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5080
    subMenu := self submenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5081
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5082
    aState ifFalse:[
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5083
        self redraw.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5084
        subMenu notNil ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5085
            self hideSubmenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5086
        ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5087
      ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5088
    ].
720
7187e69c300b some corrections for button press indication
tz
parents: 718
diff changeset
  5089
    menuPanel shown ifFalse:[^ self].  
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5090
    (self hasIndication not or: [isButton not]) ifTrue: [self redraw].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5091
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5092
    subMenu isNil ifTrue:[
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5093
        menuPanel isPopUpView ifTrue:[
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5094
            menuPanel grabMouseAndKeyboard.
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5095
        ].
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5096
        ^ self.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5097
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5098
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  5099
    menuPanel verticalLayout ifTrue:[p := (layout right - 4) @ (layout top)]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5100
                            ifFalse:[p := (layout left)  @ (layout bottom)].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5102
    d := menuPanel device.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5103
    p := d translatePoint:p from:(menuPanel id) to:(d rootWindowId).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5104
    self openSubmenuAt:p.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5105
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5106
    "Modified: / 2.2.1998 / 10:17:41 / stefan"
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  5107
    "Modified: / 5.8.1998 / 00:15:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5108
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5109
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5110
!MenuPanel::Item::Adornment methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5111
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5112
accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5113
    "get the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5114
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5115
    ^ accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5116
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5117
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5118
accessCharacterPosition:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5119
    "set the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5120
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5121
    accessCharacterPosition := anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5122
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5124
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5125
    "ST/X goody; get argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5126
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5127
  ^ argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5128
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5130
argument:anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5131
    "ST/X goody; set argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5132
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5133
    argument := anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5134
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5135
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5136
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5137
    "get has choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5138
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5139
  ^ choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5140
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5141
    "Created: / 14.8.1998 / 14:41:31 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5142
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5143
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5144
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5145
    "set choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5146
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5147
    choice := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5148
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5149
    "Created: / 14.8.1998 / 14:41:39 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5150
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5151
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5152
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5153
    "return the value of the instance variable 'choiceValue' (automatically generated)"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5154
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5155
    ^ choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5156
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5157
    "Created: / 14.8.1998 / 15:47:52 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5158
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5159
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5160
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5161
    "set the value of the instance variable 'choiceValue' (automatically generated)"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5162
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5163
    choiceValue := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5164
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5165
    "Created: / 14.8.1998 / 15:47:52 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5166
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5167
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5168
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5169
    "get has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5170
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5171
  ^ indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5172
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5173
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5174
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5175
    "set has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5176
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5177
    indication := something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5178
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5179
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5180
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5181
    "get the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5182
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5183
  ^ shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5184
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5185
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5186
shortcutKey:aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5187
    "set the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5188
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5189
    shortcutKey := aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5190
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5191
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5192
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5193
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5194
version
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  5195
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.121 1998-08-29 16:40:41 ca Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5196
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5197
MenuPanel initialize!