MenuPanel.st
author Claus Gittinger <cg@exept.de>
Tue, 08 Sep 1998 12:17:48 +0200
changeset 1117 3181b8002e05
parent 1110 eac7291cc4bb
child 1124 4a7fec62a572
permissions -rw-r--r--
background color setting
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
     3
	      All Rights Reserved
388
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    64
	      All Rights Reserved
388
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:]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    89
	Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    90
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    91
    [see also:]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    92
	Menu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    93
	MenuItem
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   103
										[exBegin]
388
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.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   144
										[exEnd]
388
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   148
										[exBegin]
388
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   176
										[exEnd]
388
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
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   180
										[exBegin]
388
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:
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   184
	#(#Menu #( #(#MenuItem 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   185
		    #label: 'File' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   186
		    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   187
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   188
				 (#MenuItem 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   189
				    #label: 'edit' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   190
				    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   191
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   192
						 #(#MenuItem #label: 'close' #value:#close)     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   193
					       )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   194
					       nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   195
					       nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   196
				       )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   197
				  )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   198
				 #(#MenuItem #label: 'help' #value:#help )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   199
			       )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   200
			       nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   201
			       nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   202
		       )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   203
		 ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   204
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   205
		#(#MenuItem #label: 'Bar' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   206
			    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   207
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   208
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   209
					)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   210
					nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   211
					nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   212
				)     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   213
		 ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   214
	      ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   215
	      #( 2 )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   216
	      nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   217
	 ) decodeAsLiteralArray.  
388
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).
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   221
										[exEnd]
388
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   237
	menu := Menu new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   238
	menu fromLiteralArrayEncoding:aSpec.
388
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   279
	mview receiver:aReceiver
388
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   294
	InitialSelectionQuerySignal := QuerySignal new.
388
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   298
	DefaultAdornment := IdentityDictionary new
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   299
	    at:#showSeparatingLines put:false;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   300
	    at:#showGroupDivider    put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   301
	    at:#verticalLayout      put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   302
	    at:#item                put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   303
	    at:#value               put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   326
	"make sure that style sheet is present"
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   327
	MenuView updateStyleCache.        
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   328
	menuStyle := MenuView styleSheet.
660
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   336
	DefaultForegroundColor := menuStyle colorAt:'menu.foregroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   337
					    default:Color black.
616
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   341
	DefaultBackgroundColor        := DefaultViewBackgroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   342
	DefaultHilightForegroundColor := DefaultForegroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   343
	DefaultHilightLevel     := 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   344
	DefaultLevel            := 0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   345
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   346
	(DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   347
	    DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   348
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   349
	DefaultLevel           := menuStyle at:'pullDownMenu.level' default:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   350
	DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   351
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   352
	DefaultBackgroundColor isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   353
	    DefaultBackgroundColor := menuStyle colorAt:'menu.backgroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   354
						default:DefaultViewBackgroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   355
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   356
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   357
	DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   358
	DefaultHilightForegroundColor isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   359
	    DefaultHilightForegroundColor := menuStyle colorAt:'menu.hilightForegroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   360
						       default:DefaultBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   366
	DefaultDisabledForegroundColor := menuStyle colorAt:'button.disabledForegroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   367
						    default:Color darkGray.
616
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   371
	DefaultHilightBackgroundColor := DefaultBackgroundColor
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   372
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   373
	DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   374
	DefaultHilightBackgroundColor isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   375
	    DefaultHilightBackgroundColor := menuStyle colorAt:'menu.hilightBackgroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   376
						       default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   377
	]
616
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   394
	RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   395
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   396
	RightArrowShadowForm := nil
616
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   404
	ButtonActiveLevel        :=  menuStyle at:'button.activeLevel' 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
   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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   420
	ButtonEnteredBackgroundColor := menuStyle colorAt:'button.enteredBackgroundColor'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   421
						  default:ButtonPassiveBackgroundColor.
1081
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   445
	Images at:aDevice put:(deviceImages := Dictionary new)
1097
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   449
	^ image
794
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   469
	LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   473
	^ image
794
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:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   477
	image := anImage copy lightened onDevice:aDevice.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   478
	image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   479
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   480
	image := self image:anImage onDevice:aDevice
794
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
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   498
!MenuPanel methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   499
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   500
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   501
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   502
    "
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   503
    ^ self accept:(self selection)
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   504
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   505
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   506
accept:anItem
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   507
    "this is the topMenu: accept item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   508
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   509
    |value item tgState itemIdx recv|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   510
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   511
    self superMenu notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   512
	^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   513
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
   514
    lastButtonSelected := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   515
    self selection:nil.
420
ca
parents: 417
diff changeset
   516
    self forceUngrabMouseAndKeyboard.
ca
parents: 417
diff changeset
   517
ca
parents: 417
diff changeset
   518
    (anItem notNil and:[anItem canAccept]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   519
	tgState := anItem toggleIndication.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   520
	itemIdx := anItem menuPanel findFirst:[:el| el == anItem ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   521
	item    := anItem.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   522
	recv    := anItem menuPanel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   523
    ].
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   524
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   525
    self isPopUpView ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   526
	self do:[:el| el updateIndicators].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   527
	self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   528
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   529
	self destroy
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   530
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   531
    value := self accept:item index:itemIdx toggle:tgState receiver:recv.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   532
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   533
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   534
	self menuAdornmentAt:#value put:value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   535
	self menuAdornmentAt:#item  put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   536
    ].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   537
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   538
  ^ item.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   539
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
   540
    "Modified: / 14.8.1998 / 16:10:02 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   541
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   542
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   543
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   544
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   545
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   546
    |value argument numArgs isKindOfValueModel|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   547
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   548
    anItem isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   549
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   550
      ^ nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   551
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   552
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   553
    self menuAdornmentAt:#hasPerformed put:(aReceiver isKindOf:ValueModel).
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   554
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   555
    (value := anItem value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   556
	^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   557
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   558
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   559
    (argument := anItem argument) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   560
	argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   561
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   562
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   563
    value isSymbol ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   564
	(value respondsTo:#numArgs) ifTrue:[numArgs := value numArgs]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   565
				   ifFalse:[numArgs := 0].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   566
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   567
	numArgs == 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   568
	    value value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   569
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   570
	    numArgs == 1 ifTrue:[value value:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   571
			ifFalse:[value value:argument value:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   572
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   573
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   574
      ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   575
    ].
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
    aReceiver isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   578
	^ value
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   579
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   580
    isKindOfValueModel := aReceiver isKindOf:ValueModel.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   581
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   582
    (numArgs := value numArgs) == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   583
	isKindOfValueModel ifFalse:[aReceiver perform:value]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   584
			    ifTrue:[aReceiver value:value]
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   585
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   586
	numArgs == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   587
	    isKindOfValueModel ifFalse:[aReceiver perform:value with:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   588
				ifTrue:[aReceiver value:value value:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   589
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   590
	    isKindOfValueModel ifFalse:[aReceiver perform:value with:argument with:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   591
				ifTrue:[aReceiver value:value value:argument value:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   592
	]
420
ca
parents: 417
diff changeset
   593
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   594
    self menuAdornmentAt:#hasPerformed put:true.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   595
  ^ value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   596
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   597
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   598
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   599
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   600
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   601
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   602
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   603
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   604
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   605
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   606
    "
971
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   607
    ^ (self lastItemAccepted) value
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   608
"/    |top|
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   609
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   610
"/    top := self topMenu.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   611
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   612
"/    (top menuAdornmentAt:#hasPerformed) == true ifTrue:[
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   613
"/        ^ self topMenu menuAdornmentAt:#value.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   614
"/    ].
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   615
"/  ^ nil
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   616
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   617
    "Modified: / 18.6.1998 / 23:37:09 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   618
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   619
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   620
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   621
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   622
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   623
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   624
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   625
  ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   626
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   627
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   628
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   629
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   630
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   631
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   632
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   633
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   634
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   635
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   636
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   637
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   638
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   639
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   640
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   641
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   642
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   643
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   644
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   645
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   646
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   647
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   648
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   649
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   650
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   651
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   652
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   653
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   654
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   655
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   656
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   657
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   658
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   659
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   660
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   661
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   662
  ^ self itemAt:stringOrNumber do:[:el| el argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   663
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   664
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   665
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   666
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   667
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   668
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   669
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   670
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   671
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   672
    "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
   673
     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
   674
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   675
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   676
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   677
    "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
   678
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   679
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   680
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   681
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   682
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   683
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   684
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   685
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   686
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   687
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   688
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   689
    aGroupSizes = groupSizes ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   690
	groupSizes := aGroupSizes copy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   691
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   692
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   693
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   694
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   695
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   696
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   697
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   698
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   699
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   700
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   701
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   702
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   703
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   704
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   705
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   706
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   707
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   708
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   709
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   710
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   711
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   712
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   713
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   714
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   715
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   716
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   717
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   718
	self removeAll.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   719
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   720
	labels notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   721
	    labels do:[:aLabel|(self createAtIndex:nil) label:aLabel]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   722
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   723
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   724
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   725
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   726
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   727
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   728
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   729
  ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   730
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   731
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   732
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   733
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   734
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   735
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   736
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   737
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   738
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   739
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   740
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   741
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   742
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   743
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   744
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   745
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   746
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   747
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   748
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   749
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   750
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   751
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   752
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   753
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   754
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   755
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   756
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   757
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   758
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   759
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   760
    (receiver isNil and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   761
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   762
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   763
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   764
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   765
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   766
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   767
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   768
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   769
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   770
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   771
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   772
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   773
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   774
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   775
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   776
  ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   777
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   778
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   779
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   780
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   781
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   782
    self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   783
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   784
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   785
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   786
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   787
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   788
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   789
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   790
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   791
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   792
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   793
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   794
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   795
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   796
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   797
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   798
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   799
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   800
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   801
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   802
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   803
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   804
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   805
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   806
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   807
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   808
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   810
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   811
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   812
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   813
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   814
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   815
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   816
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   817
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   818
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   819
!MenuPanel methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   820
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   821
disable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   822
    "disable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   823
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   824
    self enabled:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   825
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   826
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   827
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   828
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   829
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   830
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   831
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   832
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   833
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   834
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   835
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   836
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   837
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   838
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   839
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   840
enable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   841
    "enable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   842
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   843
    self enabled:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   844
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   845
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   846
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   847
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   848
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   849
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   850
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   851
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   852
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   853
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   854
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   855
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   856
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   857
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   858
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   859
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   860
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   861
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   862
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   863
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   864
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   865
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   866
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   867
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   868
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   869
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   870
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   871
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   872
    self enabled == state ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   873
	^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   874
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   875
    enabled := state.
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   876
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   877
    self canDrawItem ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   878
	self do:[:anItem| anItem enabledStateOfMenuChangedTo:enabled]
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   879
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   880
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   881
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   882
enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   883
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   884
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   885
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   886
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   887
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   888
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   889
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   890
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   891
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   892
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   893
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   894
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   895
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   896
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   897
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   898
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   899
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   900
!MenuPanel methodsFor:'accessing channels'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   901
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   902
enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   903
    "gets a enable channel or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   904
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   905
    ^ enableChannel
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   906
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   907
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   908
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   909
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   910
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   911
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   912
	enableChannel removeDependent:self
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
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   915
    (enableChannel := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   916
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   917
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   918
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   919
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   920
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   921
menuHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   922
    "gets a menu holder or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   923
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   924
    ^ menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   925
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   926
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   927
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   928
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   929
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   930
    menuHolder notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   931
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   932
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   933
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   934
    (menuHolder := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   935
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   936
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   937
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   938
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   939
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   940
!MenuPanel methodsFor:'accessing color & font'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   941
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   942
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   943
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   944
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   945
    ^ activeBgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   946
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   947
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   948
activeBackgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   949
    "set the background drawing color used to highlight selection. You should not 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   950
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   951
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   952
    activeBgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   953
	activeBgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   954
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   955
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   956
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   957
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   958
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   959
    "Modified: / 6.6.1998 / 19:49:46 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   960
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   961
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   962
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   963
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   964
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   965
    ^ activeFgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   966
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   967
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   968
activeForegroundColor:aColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   969
    "set the foreground color used to highlight selections; You should not
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   970
     use this method; instead leave the value as defined in the styleSheet.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   971
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   972
    activeFgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   973
	activeFgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   974
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   975
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   976
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   977
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   978
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   979
    "Modified: / 6.6.1998 / 19:50:01 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   980
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   981
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   982
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   983
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   984
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   985
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   986
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   987
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   988
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   989
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   990
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   991
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   992
    super viewBackground ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   993
	super viewBackground:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   994
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   995
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   996
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   997
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   998
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   999
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1000
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1001
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1002
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1003
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1004
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1005
    ^ButtonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1006
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1007
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1008
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1009
    "get the button edge style
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1010
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1011
    ^ButtonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1012
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1013
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1014
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1015
    "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
  1016
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1017
    ^ buttonEnteredBgColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1018
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1019
    "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
  1020
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1021
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1022
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1023
    "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
  1024
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1025
    ^ ButtonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1026
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1027
    "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
  1028
    "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
  1029
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1030
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1031
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1032
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1033
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1034
    ^buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1035
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1036
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1037
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1038
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1039
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1040
    ^buttonHalfShadowColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1041
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1042
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1043
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1044
    "get the background drawing color used to light button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1045
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1046
    ^buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1047
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1048
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1049
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1050
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1051
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1052
    ^ButtonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1053
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1054
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1055
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1056
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1057
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1058
    ^buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1059
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1060
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1061
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1062
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1063
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1064
  ^ disabledFgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1065
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1066
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1067
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1068
disabledForegroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1069
    "set the foregroundColor drawing color used by disabled items. You should not
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1070
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1071
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1072
    disabledFgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1073
	disabledFgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1074
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1075
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1076
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1077
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1078
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1079
    "Modified: / 6.6.1998 / 19:50:17 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1080
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1081
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1082
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1083
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1084
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1085
    (aFont notNil and:[aFont ~= font]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1086
	super font:(aFont on:device).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1087
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1088
	superMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1089
	    self extent:(self preferredExtent)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1090
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1091
	self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1092
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1093
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1094
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1095
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1096
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1097
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1098
  ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1099
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1100
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1101
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1102
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1103
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1104
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1105
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1106
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1107
    fgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1108
	fgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1109
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1110
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1111
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1112
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1113
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1114
    "Modified: / 6.6.1998 / 19:50:46 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1115
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1116
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1117
lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1118
    "get the lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1119
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1120
    ^ lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1121
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1122
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1123
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1124
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1125
lightColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1126
    "set the light drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1127
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1128
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1129
    lightColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1130
	super lightColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1131
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1132
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1133
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1134
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1135
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1136
    "Modified: / 6.6.1998 / 19:50:39 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1137
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1138
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1139
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1140
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1141
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1142
    ^selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1143
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1144
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1145
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1146
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1147
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1148
    ^selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1149
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1150
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1151
shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1152
    "get the shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1153
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1154
    ^ shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1155
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1156
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1157
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1158
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1159
shadowColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1160
    "set the shadow drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1161
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1162
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1163
    shadowColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1164
	super shadowColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1165
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1166
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1167
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1168
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1169
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1170
    "Modified: / 6.6.1998 / 19:50:32 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1171
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1172
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1173
!MenuPanel methodsFor:'accessing dimensions'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1174
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1175
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1176
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1177
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1178
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1179
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1180
    (explicitExtent ~~ true) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1181
	(item := self itemAt:1) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1182
	    self rearrangeItems.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1183
	  ^ item height
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1184
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1185
	^ 4 + (font height + (font descent * 2)).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1186
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1187
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1188
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1189
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1190
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1191
    "compute and returns my preferred extent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1192
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1193
    |x y hasMenu shCtKey space hrzInset|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1194
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1195
    self numberOfItems == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1196
	^ 32 @ 32
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1197
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1198
    space := (items size + 1) * itemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1199
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1200
    self isFitPanel ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1201
	x := 0
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1202
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1203
	x := groupSizes size * groupDividerSize.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1204
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1205
    hrzInset := items first horizontalInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1206
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1207
    self verticalLayout ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1208
	"/ horizontal - add x-extents; take max of y-extents
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1209
	y := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1210
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1211
	self do:[:el| |elY elPref|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1212
	    el isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1213
		elPref := el preferredExtent.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1214
		x := x + elPref x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1215
		elY := elPref y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1216
		el isButton ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1217
		    elY := elY + (2 * DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1218
		    x := x + (2 * DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1219
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1220
		y := y max:elY.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1221
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1222
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1223
	x := x + space.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1225
	"/ vertical - add y-extents
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1226
	hasMenu := false.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1227
	shCtKey := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1228
	y := x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1229
	x := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1230
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1231
	self do:[:el| |l e|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1232
	    el isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1233
		(l := el rawLabel) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1234
		    (e := l widthOn:self) > x ifTrue:[x := e].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1235
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1236
		    (el hasSubmenu or:[el submenuChannel notNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1237
			hasMenu := true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1238
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1239
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1240
		    (     (l := el shortcutKeyAsString) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1241
		     and:[(e := l widthOn:self) > shCtKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1242
		    ) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1243
			shCtKey := e
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1244
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1245
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1246
		y := y + el preferredExtent y
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1247
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1248
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1249
	x := x + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1250
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1251
	(hasMenu or:[shCtKey ~~ 0]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1252
	    shortKeyInset := x + Item labelRightOffset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1253
	    x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1254
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1255
	    (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1256
		x := x + (Item shortcutKeyOffset) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1257
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1258
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1259
	y := y + space.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1260
	x := x + hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1261
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1262
    ^ (x @ y) + (margin + margin)
1095
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1263
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1264
    "Modified: / 24.8.1998 / 19:16:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1265
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1266
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1267
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1268
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1269
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1270
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1271
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1272
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1273
subMenuIndicationWidth
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1274
    ^ RightArrowForm width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1275
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1276
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1277
!MenuPanel methodsFor:'accessing items'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1279
itemAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1280
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1281
     If no item match nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1282
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1283
    |idx|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1284
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1285
    idx := self indexOf:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1286
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1287
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1289
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1291
itemAt:stringOrNumber do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1292
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1293
     the item not exists nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1294
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1295
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1296
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1297
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1299
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1300
     the item not exists the result of the exception block is returned (no arguments).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1301
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1306
  ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1307
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1308
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1309
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1310
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1311
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1312
    ^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1313
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
!MenuPanel methodsFor:'accessing look'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1317
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1318
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1319
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1320
    ^ButtonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1321
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1322
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1323
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1324
buttonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1325
    "get the button passive level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1326
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1327
    ^ButtonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1328
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1329
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1330
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1331
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1332
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1333
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1334
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1335
    ^ fitFirstPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1336
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1337
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1338
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1339
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1340
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1341
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1342
    (fitFirstPanel == aState or:[self isPopUpView]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1343
	fitFirstPanel := aState.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1344
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1345
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1346
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1347
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1348
groupDividerSize
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1349
    "get the size of the group dividers
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1351
  ^ groupDividerSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1352
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1353
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1354
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1355
groupDividerSize:aSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1356
    "set the size of the group dividers. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1357
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1359
    aSize ~~ groupDividerSize ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1360
	groupDividerSize := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1361
	self mustRearrange.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1362
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1363
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1364
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1365
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1366
itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1367
    "get the space space between to items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1368
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1369
  ^ itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1370
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1372
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1373
itemSpace:aSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1374
    "set the horizontal space between to items. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1375
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1376
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1377
    aSize ~~ itemSpace ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1378
	itemSpace := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1379
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1380
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1381
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1382
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1383
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1384
level:anInt
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1385
    super level:anInt.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1386
    mustRearrange := true
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1387
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1388
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1389
rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1390
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1391
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1392
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1393
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1394
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1395
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1396
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1397
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1398
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1399
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1400
  ^ self menuAdornmentAt:#showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1401
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1402
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1403
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1404
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1405
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1406
    (self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1407
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1408
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1410
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1411
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1412
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1413
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1414
  ^ self menuAdornmentAt:#showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1415
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1416
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1417
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1418
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1419
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1420
    (self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1421
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1422
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1423
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1425
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1426
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1427
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1428
  ^ self menuAdornmentAt:#verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1429
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1430
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1431
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1432
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1433
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1434
    (self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1435
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1436
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1437
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1438
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
!MenuPanel methodsFor:'accessing submenu'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1440
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1441
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1442
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1443
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1444
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1445
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1446
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1447
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1448
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1450
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1451
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1452
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1457
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1459
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1460
	^ item submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1464
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1465
!MenuPanel methodsFor:'activation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1466
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1467
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1470
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1471
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1472
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1473
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1474
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1477
show
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1478
    "realize the view at its last position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1479
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1482
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1483
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1484
showAt:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
    "realize the view at aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1488
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1489
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1493
    "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
  1494
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1495
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1496
     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
  1497
     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
  1498
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1500
    self rearrangeItems.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1501
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1502
    aBoolean ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1503
	self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
    self origin:aPoint.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1506
    self makeFullyVisible.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1507
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1508
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1509
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1510
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1511
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1512
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1513
	^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1514
    ].
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1515
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1516
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1517
    "Modified: / 8.7.1998 / 20:06:35 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
showAtPointer
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1521
    "realize the view at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1522
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1523
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
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
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
    "make myself visible at the screen center.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1530
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1531
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1532
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1533
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
    top raise.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
  ^ self showAt:(top origin + (aView originRelativeTo:top) + (aView extent // 2) - (self extent // 2))
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1537
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1538
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1539
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1540
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1541
    "realize the menu at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1542
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1543
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1544
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1545
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1546
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1547
    "realize the menu at aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1548
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1549
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1550
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1551
    "Created: / 21.5.1998 / 14:15:57 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1552
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1553
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1554
!MenuPanel methodsFor:'active help'!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1555
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1556
helpText
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1557
    |appl item key|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1558
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1559
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1560
	(key := item activeHelpKey) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1561
	    (appl := self application) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1562
		^ appl helpTextForKey:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1563
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1564
	]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1565
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1566
    ^ nil.
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1567
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1568
    "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
  1569
!
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1570
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1571
helpTextAt:aPoint
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1572
    |menu point item key appl|
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1573
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1574
    menu := self superMenuAtX:aPoint x y:aPoint y.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1575
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1576
    menu isNil ifTrue:[
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1577
"/        'nil menu' printCR.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1578
	^ ''
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1579
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1580
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1581
    point := self translatePoint:aPoint to:menu.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1582
    item  := menu itemAtX:(point x) y:(point y).
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1583
    item  notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1584
	(key := item activeHelpKey) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1585
	    (appl := self application) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1586
		^ appl helpTextForKey:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1587
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1588
	]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1589
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1590
"/    'nil item' printCR.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1591
    ^ nil.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1592
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1593
    "Modified: / 31.7.1998 / 03:15:07 / cg"
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1594
! !
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1595
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1596
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1597
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1598
createAtIndex:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1599
    "create an item and add this item to the index. In case of nil the item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1600
     is added to the end. If the index is not valid nil is returned otherwise
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1601
     the new created item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1602
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1603
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1604
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1605
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1606
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1607
    anIndexOrNil notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1608
	(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1609
	    ^ nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1610
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1611
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1612
    items isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1613
	items := OrderedCollection new
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1614
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1615
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1616
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1617
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1618
	items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1619
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1620
	items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1621
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1622
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1623
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1624
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1625
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1626
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1627
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1628
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1629
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1630
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1631
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1632
	items remove:item.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1633
	item  destroy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1634
	items isEmpty ifTrue:[items := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1635
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1636
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1637
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1638
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1639
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1640
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1643
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1644
	self selection:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1645
	groupSizes := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1646
	self do:[:el| el destroy ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1647
	items := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1648
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1649
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1650
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1651
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1652
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1653
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1654
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1655
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1656
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1657
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1658
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1659
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1660
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1661
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1662
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1663
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1664
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1665
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1666
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1667
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1668
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1669
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1670
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1671
  ^ menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1672
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1673
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1674
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1675
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1676
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1677
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1678
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1679
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1680
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1681
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1682
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1683
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1684
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1685
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1686
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1687
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1688
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1689
	|menu newItems|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1690
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1691
	self removeAll.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1692
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1693
	(menu := aMenu) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1694
	    (aMenu isCollection) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1695
		menu := Menu new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1696
		menu fromLiteralArrayEncoding:aMenu.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1697
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1698
		menu receiver notNil ifTrue:[receiver := menu receiver]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1699
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1700
	    (newItems := menu menuItems) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1701
		items := newItems collect:[:ni | 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1702
				|i|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1703
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1704
				i:= Item in:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1705
				i menuItem:ni.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1706
				i.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1707
			    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1708
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1709
	    self groupSizes:(menu groupSizes).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1710
	]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1711
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1712
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1713
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1714
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1715
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1716
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1717
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1718
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1719
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1720
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1721
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1722
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1723
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1724
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1725
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1726
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1727
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1728
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1729
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1730
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1731
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
  1732
    |shadow|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1733
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1734
    styleSheet is3D ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1735
	^ self displayRectangle:layout.
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1736
    ].
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1737
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1738
    shadow := buttonShadowColor.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1739
    isSelected ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1740
	buttonShadowColor == self buttonActiveBackgroundColor ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1741
	    shadow := self buttonActiveBackgroundColor darkened
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1742
	].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1743
    ].
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1744
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1745
    self drawEdgesForX: layout left y: layout top width: layout width height: layout height level: aLevel 
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1746
	shadow:      shadow 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1747
	light:       buttonLightColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1748
	halfShadow:  buttonHalfShadowColor 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1749
	halfLight:   buttonHalfLightColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1750
	style:       ButtonEdgeStyle
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1751
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1752
    "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
  1753
    "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
  1754
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1755
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1756
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
  1757
    |level|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1758
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1759
    level := selectedBool 
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1760
		ifTrue:[onLevel] 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1761
		ifFalse:[offLevel].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1762
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1763
    level ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1764
	self drawEdgesForX:x y:y width:w height:height level:level
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1765
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1766
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1767
    "Modified: / 20.8.1998 / 15:43:11 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1768
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1769
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1770
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1771
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1772
    "
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1773
    mustRearrange == true ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1774
	mustRearrange := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1775
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1776
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1777
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1778
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1779
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1780
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1781
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1782
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1783
rearrangeGroups
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1784
    |layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1785
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1786
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1787
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1788
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1789
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1790
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1791
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1792
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1793
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1794
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1795
    (dltX := width - margin "- 2" - layout right) <= 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1796
	^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1797
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1798
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1799
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1800
    start == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1801
	^ self  "/ no item detected
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1802
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1803
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1804
    "/ change layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1805
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1806
    items from:start do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1807
	anItem isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1808
	    layout := anItem layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1809
	    layout  left:(layout  left + dltX).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1810
	    layout right:(layout right + dltX).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1811
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1812
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1813
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1814
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1815
rearrangeItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1816
    "recompute layout of my items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1817
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1818
    |expLast e grpDivSz layout isVert
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1819
     x  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1820
     y  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1821
     noItems "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1822
    |
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1823
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1824
    mustRearrange ifFalse:[ ^ self ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1825
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1826
"/  fetch font from superMenu
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1827
    (superMenu notNil and:[superMenu font ~~ font]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1828
	super font:(superMenu font on:device)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1829
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1830
    (noItems := items size) == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1831
	mustRearrange := false.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1832
      ^ self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1833
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1834
    expLast  := false.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1835
    isVert   := self verticalLayout.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1836
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1837
    self hasGroupDividers ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1838
	self isFitPanel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1839
	    grpDivSz := groupDividerSize
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1840
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1841
	    expLast := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1842
	    x := margin.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1843
	    e := self computeExtent.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1844
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1845
	    isVert ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1846
		items do:[:el | x := x + el preferredExtent y].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1847
		y := e y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1848
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1849
		items do:[:el|x := x + el preferredExtent x].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1850
		y := e x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1851
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1852
	    x := x + (noItems + 1 * itemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1853
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1854
	    (grpDivSz := (y - x) // (groupSizes size)) <= 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1855
		grpDivSz := nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1856
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1857
	    x > (width-margin) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1858
		grpDivSz := nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1859
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1860
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1861
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1862
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1863
    (self isPopUpView or:[explicitExtent ~~ true]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1864
	e := self preferredExtent copy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1865
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1866
	self isPopUpView ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1867
	    isVert ifTrue:[e y:1.0]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1868
		  ifFalse:[e x:1.0]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1869
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1870
	self extent:e
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1871
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1872
	e := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1873
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1874
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1875
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1876
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1877
    isVert ifTrue:[y := y + itemSpace]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1878
	  ifFalse:[x := x + itemSpace].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1879
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1880
    self keysAndValuesDo:[:anIndex :el| |org corn elPref|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1881
	el isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1882
	    el isButton ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1883
		org := Point x:(x+DefaultButtonItemSpace) y:(y+DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1884
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1885
		org := Point x:x y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1886
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1887
	    elPref := el preferredExtent.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1888
	    isVert ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1889
		y := y + elPref y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1890
		corn := (e x - margin @ y).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1891
		el isButton ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1892
		    corn := corn - (DefaultButtonItemSpace @ 0).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1893
		    el layout:(Rectangle origin:org corner:corn).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1894
		    y := y + (2 * DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1895
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1896
		    el layout:(Rectangle origin:org corner:corn).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1897
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1898
		y := y + itemSpace.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1899
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1900
		x := x + elPref x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1901
		el isButton ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1902
		    x := x + DefaultButtonItemSpace.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1903
		    corn := (x @ (e y - margin)).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1904
		    corn := corn - (0 @ DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1905
		    el layout:(Rectangle origin:org corner:corn).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1906
		    x := x + DefaultButtonItemSpace.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1907
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1908
		    corn := (x @ e y).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1909
		    el layout:(Rectangle origin:org corner:corn).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1910
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1911
		x := x + itemSpace.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1912
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1913
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1914
	    (grpDivSz notNil and:[self hasGroupDividerAt:anIndex]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1915
		isVert ifTrue:[y := y + grpDivSz]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1916
		      ifFalse:[x := x + grpDivSz]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1917
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1918
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1919
	    org := Point x:x y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1920
	    el layout:(Rectangle origin:org corner:org)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1921
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1922
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1923
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1924
    expLast ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1925
	e := items last.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1926
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1927
	e isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1928
	    layout := items last layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1929
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1930
	    isVert ifTrue:[layout bottom:((self extent y) + 1)]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1931
		  ifFalse:[layout  right:((self extent x) + 1)].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1932
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1933
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1934
    self rearrangeGroups.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1935
    mustRearrange := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1936
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1937
    "Modified: / 20.8.1998 / 19:34:41 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1938
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1939
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1940
redrawX:x y:y width:w height:h
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1941
    "redraw a rectangle
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1942
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1943
    |start end isVrt x1 x2 y1 y2 item layout lnSz hrzInset prevClipArea|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1944
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1945
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1946
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1947
    self  paint:(self backgroundColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1948
    self  clearRectangleX:x y:y width:w height:h.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1949
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1950
    isVrt := self verticalLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1951
    end   := items size.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1952
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1953
    mustRearrange ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1954
	self isPopUpView not ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1955
	    explicitExtent := true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1956
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1957
	self rearrangeItems.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1958
	start := 1
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1959
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1960
	end == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1961
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1962
	isVrt ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1963
	    start := self findFirst:[:el| (el layout bottom) >= y ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1964
	    start == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1965
	    end := y + h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1966
	    end := self findLast:[:el| (el layout top) < end ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1967
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1968
	    start := self findFirst:[:el| (el layout right) >= x ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1969
	    start == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1970
	    end := x + w.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1971
	    end := self findLast:[:el| (el layout left) < end ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1972
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1973
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1974
	(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1975
	    start := start - 1
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1976
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1977
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1978
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1979
    (     self hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1980
     and:[self showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1981
     and:[self isFitPanel not]]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1982
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1983
	lnSz := groupDividerSize // 2
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1984
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1985
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1986
    end == 0 ifTrue:[^ self ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1987
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1988
    hrzInset := items first horizontalInset.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1989
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1990
    prevClipArea   := clipRect.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1991
    clipRect       := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1992
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1993
    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
  1994
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1995
    start to:end do:[:i|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1996
	item := items at:i.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1997
	item redraw.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1998
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1999
	(lnSz notNil and:[self hasGroupDividerAt:i]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2000
	    layout := item layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2001
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2002
	    isVrt ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2003
		x1 := layout left  + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2004
		x2 := layout right - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2005
		y1 := (layout bottom) + lnSz.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2006
		y2 := y1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2007
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2008
		x1 := (layout right) + lnSz.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2009
		x2 := x1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2010
		y1 := layout top.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2011
		y2 := layout bottom.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2012
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2013
	    self paint:(self shadowColor).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2014
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2015
	    self paint:(self lightColor).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2016
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2017
	    isVrt ifTrue:[y1 := y1 + 1. y2 := y1 ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2018
		 ifFalse:[x1 := x1 + 1. x2 := x1 ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2019
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2020
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2021
	]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2022
    ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2023
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2024
    clipRect := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2025
    prevClipArea isNil ifTrue:[device noClipIn:drawableId  gc:gcId]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2026
		      ifFalse:[self clippingRectangle:prevClipArea].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2027
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2028
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2029
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2030
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2031
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2032
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2033
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2034
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2035
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2036
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2037
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2038
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2039
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2040
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2041
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2042
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2043
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2044
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2045
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2046
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2047
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2048
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2049
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2050
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2051
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2052
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2053
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2054
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2055
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2056
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2057
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2058
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2059
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2060
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2063
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2064
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2065
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2066
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2067
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2068
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2069
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2070
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2071
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2072
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2073
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2074
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2075
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2076
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2077
    i := self findFirst:[:el|(el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2078
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2079
    i ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2080
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2081
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2082
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2083
    something isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2084
	i := self findFirst:[:el|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2085
	    v := el value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2086
	    v isSymbol and:[v == something]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2087
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2088
	i ~~ 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2089
	    ^ i
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2090
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2091
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2092
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2093
    (something respondsTo:#string) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2094
	v := something string.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2095
      ^ self findFirst:[:el|el textLabel = v].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2096
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2097
  ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2098
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2099
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2100
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2101
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2102
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2103
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2104
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2105
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2106
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2107
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2108
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2109
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2110
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2111
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2113
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2114
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2115
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2116
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2117
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2118
    |menu point sensor sel|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2119
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2120
    (    (sensor := self sensor) notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2121
     and:[sensor hasButtonMotionEventFor:nil]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2122
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2123
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2124
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2125
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2126
    sensor anyButtonPressed ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2127
	"/ TODO: remember item over which pointer is
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2128
	"/ (for enteredFG/enteredBG/enteredLevel handling)
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2129
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2130
        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2131
	(buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2132
	or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2133
	    (self containsPointX:x y:y) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2134
		((sel := self itemAtX:x y:y) notNil 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2135
		and:[sel isButton 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2136
		and:[superMenu isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2137
		and:[sel canSelect]]]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2138
		    self itemEntered:sel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2139
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2140
		    self itemEntered:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2141
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2142
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2143
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2144
	^ self
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2145
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2146
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2147
    "/ ok, a button is pressed.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2148
    (buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2149
    or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2150
	self itemEntered:nil.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2151
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2153
    lastButtonSelected notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2154
	^ self
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2155
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2156
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2157
    (self containsPointX:x y:y) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2158
	((sel := self itemAtX:x y:y) notNil and:[sel isButton and:[superMenu isNil]]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2159
	    sel canSelect ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2160
		lastButtonSelected := sel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2161
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2162
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2163
	^ self selection:sel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2164
    ].
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2165
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2166
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2167
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2168
    menu isNil ifTrue:[
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2169
       ^ self selection:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2170
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2171
    point := self translatePoint:(x@y) to:menu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2172
    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
  2173
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2174
    "Modified: / 22.8.1998 / 12:51:17 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2175
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2176
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2177
buttonPress:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2178
    "any button pressed; open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2179
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2180
    |menu point item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2181
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2182
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2183
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2184
    menu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2185
	menu := self topMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2186
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2187
	point := self translatePoint:(x@y) to:menu.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2188
	item  := menu itemAtX:(point x) y:(point y)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2189
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2190
    menu selection:item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2191
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2192
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2193
buttonRelease:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2194
    "button release action; accept selection and close all views
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2195
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2196
    |menu item|
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2197
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2198
    menu := self topMenu activeMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2199
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2200
    (    menu hasSelection
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2201
     or:[menu isPopUpView not
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2202
     or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue)
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2203
				and:(menu mapTime)) > 200]]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2204
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2205
	item := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2206
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2207
	(     (menu := self superMenuAtX:x y:y) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2208
	 and:[(item := menu selection) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2209
	 and:[item submenu notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2210
	) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2211
	    menu selection:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2212
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2213
	    (    lastButtonSelected isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2214
	     or:[item isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2215
	     or:[(menu itemAtX:x y:y) == lastButtonSelected]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2216
	    ) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2217
		item := nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2218
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2219
	    self topMenu accept:item
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2220
	]
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2221
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2222
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2223
    "Modified: / 27.2.1998 / 17:41:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2224
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2225
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2226
cursorPressed:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2227
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2228
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2229
    |next submenu item
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2230
     n     "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2231
     idx   "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2232
     first "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2233
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2234
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2235
	^ superMenu cursorPressed:aKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2236
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2237
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2238
    self verticalLayout ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2239
	aKey == #CursorLeft  ifTrue:[^ self selection:nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2240
	aKey ~~ #CursorRight ifTrue:[next := aKey == #CursorDown].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2241
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2242
	aKey == #CursorUp ifTrue:[^ self selection:nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2243
	aKey ~~ #CursorDown ifTrue:[next := aKey == #CursorRight].        
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2244
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2245
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2246
    next isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2247
	(item := self selection) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2248
	    (submenu := item submenu) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2249
		idx := submenu findFirst:[:el| el canSelect ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2250
	      ^ submenu selectionIndex:idx
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2251
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2252
	  ^ self selection:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2253
	].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2254
      ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2255
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2256
    first := self findFirst:[:el| el canSelect ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2257
    first == 0 ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2258
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2259
    idx := self selectionIndex.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2260
    n   := 1 + (self sensor compressKeyPressEventsWithKey:aKey).
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2261
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2262
    n timesRepeat:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2263
	next ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2264
	    [((idx := idx + 1) <= items size and:[(items at:idx) canSelect not])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2265
	    ] whileTrue.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2266
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2267
	    idx > items size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2268
		idx := first
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2269
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2270
	] ifFalse:[    
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2271
	    [((idx := idx - 1) > 0  and:[(items at:idx) canSelect not])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2272
	    ] whileTrue.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2273
            
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2274
	    idx < 1 ifTrue:[ idx := self findLast:[:el| el canSelect ] ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2275
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2276
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2277
    self selectionIndex:idx
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2278
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2279
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2280
itemEntered:anItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2281
    |prevEnteredItem|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2282
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2283
    anItem == enteredItem ifTrue:[^ self].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2284
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2285
    prevEnteredItem := enteredItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2286
    enteredItem := anItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2287
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2288
    prevEnteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2289
	prevEnteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2290
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2291
    enteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2292
	enteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2293
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2294
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2295
    "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
  2296
    "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
  2297
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2298
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2299
keyPress:key x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2300
    "any key is pressed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2301
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2302
    |listOfItems item menu idx cIdx upperKey lowerKey rawKey|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2304
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2305
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2306
    [ menu shown ] whileFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2307
	(menu := superMenu) isNil ifTrue:[^ self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2308
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2309
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2310
    key == #Return ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2311
	^ menu accept
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2312
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2313
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2314
    (     key == #CursorDown or:[key == #CursorUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2315
      or:[key == #CursorLeft or:[key == #CursorRight]]]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2316
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2317
	^ menu cursorPressed:key
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2318
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2319
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2320
    rawKey := device keyboardMap keyAtValue:key ifAbsent:key.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2321
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2322
    listOfItems := self selectItemsForShortcutKey:rawKey.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2323
    listOfItems isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2324
	listOfItems := self selectItemsForShortcutKey:key.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2325
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2326
    listOfItems notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2327
	item := listOfItems first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2328
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2329
	item hasSubmenu ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2330
	    ^ menu accept:item
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2331
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2332
	^ self openMenusFromItems:listOfItems
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2333
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2334
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2335
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2336
	(superMenu containsPoint:(self translatePoint:(x@y) to:superMenu)) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2337
	    menu := superMenu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2338
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2339
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2340
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2341
    cIdx := menu selectionIndex.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2342
    cIdx isNil ifTrue:[cIdx := 0].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2343
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2344
    upperKey := key asUppercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2345
    lowerKey := key asLowercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2346
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2347
    menu keysAndValuesDo:[:anIndex :el| |c l|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2348
	(el canSelect and:[(l := el textLabel) notNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2349
	    l size ~~ 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2350
		(c := el accessCharacter) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2351
		    (c == upperKey or:[c == lowerKey]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2352
			^ menu selection:el
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2353
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2354
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2355
		    ((c := l first) == upperKey or:[c == lowerKey]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2356
			anIndex > cIdx ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2357
			    ^ menu selection:el
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2358
			] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2359
			    idx isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2360
				idx := anIndex
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2361
			    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2362
				anIndex > idx ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2363
				    anIndex ~~ cIdx ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2364
					idx := anIndex
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2365
				    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2366
				]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2367
			    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2368
			]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2369
                        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2370
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2371
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2372
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2373
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2374
    ].
417
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2375
    (item := menu itemAt:idx) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2376
	menu hasSelection ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2377
	    (menu := menu superMenu) isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2378
		^ super keyPress:key x:x y:y
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2379
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2380
	]
417
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2381
    ].
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2382
    menu selection:item.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2383
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2384
    "Modified: / 8.8.1998 / 13:38:36 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2385
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2386
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2387
pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2388
    self itemEntered:nil.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2389
    super pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2390
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2391
    "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
  2392
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2393
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2394
sizeChanged:how
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2395
    self isFitPanel ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2396
	self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2397
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2398
    super sizeChanged:how
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2399
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2401
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2402
420
ca
parents: 417
diff changeset
  2403
forceUngrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2404
    "ungrab resources (mouse and keyboard)
420
ca
parents: 417
diff changeset
  2405
    "
ca
parents: 417
diff changeset
  2406
    |sensor|
ca
parents: 417
diff changeset
  2407
ca
parents: 417
diff changeset
  2408
    device ungrabPointer.
ca
parents: 417
diff changeset
  2409
ca
parents: 417
diff changeset
  2410
    (sensor := self sensor) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2411
	"/ make certain all X events have been received
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2412
	device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2413
	"/ now all events have been received.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2414
	"/ now, flush all pointer events
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2415
	sensor flushKeyboardFor:nil
420
ca
parents: 417
diff changeset
  2416
    ].
ca
parents: 417
diff changeset
  2417
    device ungrabKeyboard.
ca
parents: 417
diff changeset
  2418
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2419
    "Modified: / 2.2.1998 / 09:24:48 / stefan"
420
ca
parents: 417
diff changeset
  2420
!
ca
parents: 417
diff changeset
  2421
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2422
grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2423
    "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
  2424
     Only used for popUp menus."
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2425
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2426
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2427
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2428
    realized ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2429
	sensor := self sensor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2430
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2431
	device activePointerGrab ~~ self ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2432
	    sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2433
		sensor flushMotionEventsFor:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2434
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2435
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2436
	    (device grabPointerInView:self) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2437
		Delay waitForSeconds:0.1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2438
		(device grabPointerInView:self) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2439
		    "give up"
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2440
		    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2441
		    self unmap
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2442
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2443
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2444
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2445
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2446
	device activeKeyboardGrab ~~ self ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2447
	    sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2448
		device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2449
		sensor flushKeyboardFor:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2450
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2451
	    device grabKeyboardInView:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2452
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2453
	    superMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2454
		self getKeyboardFocus
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2455
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2456
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2457
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2458
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2459
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2460
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2461
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2462
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2463
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2464
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2465
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2466
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2467
    device activePointerGrab == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2468
	device ungrabPointer.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2469
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2470
    device activeKeyboardGrab == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2471
	sensor := self sensor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2472
	sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2473
	    "/ make certain all X events have been received
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2474
	    device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2475
	    "/ now all events have been received.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2476
	    "/ now, flush all pointer events
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2477
	    sensor flushKeyboardFor:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2478
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2479
	device ungrabKeyboard.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2480
    ].
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2481
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2482
    "Modified: / 2.2.1998 / 10:27:12 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2483
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2484
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2485
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2486
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2487
imageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2488
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2489
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2490
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2491
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2492
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2493
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2494
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2495
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2496
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2497
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2498
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2499
!MenuPanel methodsFor:'initialize / release'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2500
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2501
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2502
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2503
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2504
    ^self
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2505
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2506
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2507
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2508
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2509
    "
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2510
    |style|
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2511
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2512
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2513
	style := styleSheet name.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2514
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2515
	(style ~~ #normal and:[style ~~ #mswindows]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2516
	    self borderWidth:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2517
	]
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2518
    ].
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
  2519
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2520
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2521
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2522
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2523
	(PopUpView styleSheet at:'popup.shadow' default:false) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2524
	    shadowView isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2525
		shadowView := (ShadowView onDevice:device) for:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2526
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2527
		self saveUnder:true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2528
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2529
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2530
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2531
	explicitExtent == true ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2532
	    (self width) == (superView width) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2533
		self verticalLayout:false
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2534
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2535
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2536
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2537
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2538
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2539
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2540
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2541
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2542
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2543
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2544
    self clearLastActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2545
    self do:[:el|el destroy].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2546
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2547
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2548
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2549
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2550
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2551
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2552
    items     := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2553
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2554
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2555
    "Modified: / 27.2.1998 / 17:41:25 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2556
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2557
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2558
fetchDeviceResources
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2559
    "fetch device colors, to avoid reallocation at redraw time"
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2560
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2561
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2562
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2563
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2564
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2565
    style := styleSheet name.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2566
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2567
    "/ 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
  2568
    "/ (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
  2569
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2570
    self isPopUpView ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2571
	(style == #motif or:[style == #iris]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2572
	    self topView == self superView ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2573
		self level:2
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2574
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2575
	]
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2576
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2577
	(style == #next or:[style == #normal]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2578
	    onLevel := offLevel := 0
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2579
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2580
	    style == #openwin ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2581
		offLevel := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2582
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2583
	]
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2584
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2585
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2586
    superMenu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2587
	fgColor                   := DefaultForegroundColor         onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2588
	activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2589
	activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2590
	disabledFgColor           := DefaultDisabledForegroundColor onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2591
	rightArrow                := RightArrowForm                 onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2592
	selectionFrameBrightColor := SelectionFrameBrightColor      onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2593
	selectionFrameDarkColor   := SelectionFrameDarkColor        onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2594
	buttonLightColor          := ButtonLightColor               onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2595
	buttonShadowColor         := ButtonShadowColor              onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2596
	ButtonHalfLightColor notNil ifTrue: [
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2597
	    buttonHalfLightColor      := ButtonHalfLightColor           onDevice:device].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2598
	ButtonHalfShadowColor notNil ifTrue: [
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2599
	    buttonHalfShadowColor     := ButtonHalfShadowColor          onDevice:device].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2600
	buttonEnteredBgColor      := ButtonEnteredBackgroundColor   onDevice:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2601
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2602
	(rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2603
	    rightArrowShadow := rightArrowShadow onDevice:device
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2604
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2605
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2606
	fgColor                   := superMenu foregroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2607
	activeBgColor             := superMenu activeBackgroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2608
	activeFgColor             := superMenu activeForegroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2609
	disabledFgColor           := superMenu disabledForegroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2610
	rightArrow                := superMenu rightArrow.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2611
	rightArrowShadow          := superMenu rightArrowShadow.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2612
	selectionFrameBrightColor := superMenu selectionFrameBrightColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2613
	selectionFrameDarkColor   := superMenu selectionFrameDarkColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2614
	buttonLightColor          := superMenu buttonLightColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2615
	buttonShadowColor         := superMenu buttonShadowColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2616
	buttonHalfLightColor      := superMenu buttonHalfLightColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2617
	buttonHalfShadowColor     := superMenu buttonHalfShadowColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2618
	buttonEnteredBgColor      := superMenu buttonEnteredBackgroundColor.
1081
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
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2621
    "Modified: / 20.8.1998 / 15:51:17 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2622
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2623
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2624
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2625
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2626
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2627
    |style|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2628
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2629
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2630
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2631
    self viewBackground:DefaultBackgroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2632
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2633
    onLevel   := DefaultHilightLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2634
    offLevel  := DefaultLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2635
    itemSpace := DefaultItemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2636
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2637
    groupDividerSize := DefaultGroupDividerSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2638
    fitFirstPanel := DefaultFitFirstPanel.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2639
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2640
    style := styleSheet name.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2641
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2642
"/    style == #st80 ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2643
"/        self level:0
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2644
"/    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2645
	self level:1.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2646
"/    ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2647
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2648
    "Modified: / 5.9.1998 / 18:16:57 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2649
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2650
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2651
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2652
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2653
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2654
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2655
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2656
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2657
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2658
    enabled := true.
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2659
"/    self origin:0.0@0.0.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2660
    originChanged  := extentChanged := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2661
    explicitExtent := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2662
    shortKeyInset  := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2663
    mustRearrange  := false.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2664
    self borderWidth:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2665
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2666
    font := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2667
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2668
    "Modified: / 20.8.1998 / 20:09:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2669
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2670
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2671
mapped
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2672
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2673
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2674
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2675
    |anItemList|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2676
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2677
    self enableMotionEvents.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2678
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2679
    lastButtonSelected := nil.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2680
    self becomesActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2681
    super mapped.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  2682
    self do:[:anItem| anItem fetchImages ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2683
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2684
    anItemList := InitialSelectionQuerySignal raise.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2685
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2686
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2687
	self grabMouseAndKeyboard
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2688
    ] ifFalse:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2689
"/        styleSheet is3D ifTrue:[self borderWidth:0].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2690
	super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2691
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2692
    self do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2693
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2694
    anItemList size > 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2695
	self redrawX:0 y:0 width:10000 height:10000.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2696
	self openMenusFromItems:anItemList.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2697
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2698
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2699
    "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
  2700
    "Modified: / 20.8.1998 / 19:17:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2701
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2702
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2703
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2704
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2705
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2706
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2707
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2708
	"Because of #saveUnder of ShadowView the order of realize is significant:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2709
	 shadowView must be realized before self"
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2710
	self hiddenOnRealize:true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2711
	super realize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2712
	self resize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2713
	shadowView notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2714
	    shadowView realize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2715
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2716
	super map.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2717
	self raise.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2718
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2719
	super realize.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2720
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2721
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2722
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2723
recreate
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2724
    "this is called after a snapin. If the image was saved with an active menu,
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2725
     hide the menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2726
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2727
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2728
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2729
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2730
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2731
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2732
unmap
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2733
    "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
  2734
     mouse events.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2735
    "
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2736
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2737
    self clearLastActiveMenu.
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  2738
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2739
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2740
    "/ Kludge for X11: after grabbing and ungrabbing other views may get buttonMotionEvents
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2741
    "/ 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
  2742
    "/ (Move from upperMenuPanel of NewLauncher to lowerMenuPanel)
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2743
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2744
    (superMenu notNil and:[superMenu shown and:[superMenu isPopUpView 
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2745
     or:[superMenu sensor anyButtonPressed]]]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2746
	superMenu grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2747
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2748
	self ungrabMouseAndKeyboard.
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2749
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2750
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2751
    shadowView notNil ifTrue:[shadowView unmap].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2752
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2753
    "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
  2754
    "Modified: / 27.2.1998 / 17:41:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2755
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2756
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2757
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2758
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2759
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2760
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2761
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2762
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2763
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2764
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2765
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2766
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2767
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2768
    ^ superMenu
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2773
superMenu:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2774
    "set the supermenu starting from
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2775
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2776
    superMenu := aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2777
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2778
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2779
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2780
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2781
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2782
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2783
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2784
    top := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2785
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2786
    [ top superMenu notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2787
	top := top superMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2788
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2789
  ^ top
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2790
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2791
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2792
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2793
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2794
!MenuPanel methodsFor:'printing'!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2795
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2796
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2797
    "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
  2798
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2799
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2800
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2801
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2802
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2803
    self do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2804
	label  := anItem label ? ''.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2805
	string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2806
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2807
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2808
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2809
    "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
  2810
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2811
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2812
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2813
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2814
application
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2815
    |appl|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2816
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2817
    superMenu notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2818
	^ superMenu application
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2819
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2820
    (appl := super application) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2821
	windowGroup notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2822
	    appl := windowGroup mainGroup topViews first application
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2823
	]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2824
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2825
  ^ appl
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2826
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2827
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2828
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2829
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2830
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2831
    |adm|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2832
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2833
    adm := adornment ? DefaultAdornment.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2834
  ^ adm at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2835
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2836
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2837
menuAdornmentAt:aSymbol put:something
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2838
    "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
  2839
     current stored value, true is returned otherwise false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2840
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2841
    (self menuAdornmentAt:aSymbol) == something ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2842
	^ false
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2843
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2844
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2845
	adornment := DefaultAdornment copy
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2846
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2847
    adornment at:aSymbol put:something.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2848
  ^ true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2849
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2850
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2851
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2852
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2853
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2854
    aList isCollection ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2855
	items size >= aList size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2856
	    aList keysAndValuesDo:[:anIndex :anArg|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2857
		(items at:anIndex) perform:aSelector with:anArg
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2858
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2859
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2860
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2861
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2862
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2863
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2864
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2865
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2866
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2867
openMenusFromItems:anItemList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2868
    "open all menus derived from sequence of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2869
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2870
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2871
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2872
    (anItemList isNil or:[anItemList isEmpty]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2873
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2874
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2875
    item := anItemList removeLast.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2876
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2877
    item enabled ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2878
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2879
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2880
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2881
    InitialSelectionQuerySignal answer:anItemList do:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2882
	self selection:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2883
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2884
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2885
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2886
selectItemsForShortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2887
    "get sequence of items up to the item providing the key (inclusive). The
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2888
     first entry into the collection is the item providing the key, the last
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2889
     entry is the item in the topMenu( reverse )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2890
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2891
    |seq|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2892
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2893
    self do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2894
	anItem isEnabled ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2895
	    anItem shortcutKey = aKey ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2896
		seq := OrderedCollection new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2897
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2898
		anItem hasSubmenu ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2899
		    seq := anItem submenu selectItemsForShortcutKey:aKey
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2900
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2901
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2902
	    seq notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2903
		seq add:anItem.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2904
	      ^ seq
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2905
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2906
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2907
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2908
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2909
        
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2910
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2911
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2912
translatePoint:aPoint to:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2913
    "translate a point into a views point; in case of no view nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2914
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2915
    aView notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2916
	aView == self ifTrue:[^ aPoint].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2917
      ^ device translatePoint:aPoint from:(self id) to:(aView id)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2918
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2919
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2920
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2921
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2922
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2923
!MenuPanel methodsFor:'private activation'!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2924
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2925
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2926
    "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
  2927
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2928
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2929
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2930
    "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
  2931
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2932
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2933
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2934
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2935
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2936
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2937
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2938
    "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
  2939
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2940
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2941
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2942
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2943
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2944
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2945
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2946
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2947
    "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
  2948
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2949
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2950
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2951
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2952
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2953
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2954
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2955
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2956
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2957
    top activeMenu == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2958
	top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2959
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2960
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2961
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2962
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2963
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2964
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2965
    "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
  2966
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2967
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2968
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2969
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2970
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2971
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2972
!MenuPanel methodsFor:'private searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2973
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2974
itemAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2975
    "returns item at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2976
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2977
    self do:[:el| (el containsPointX:x y:y) ifTrue:[^el] ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2978
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2979
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2980
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2981
superMenuAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2982
    "returns supermenu at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2983
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2984
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2985
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2986
    (self containsPointX:x y:y) ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2987
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2988
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2989
    [ (menu := menu superMenu) notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2990
	(menu containsPoint:(self translatePoint:(x@y) to:menu)) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2991
	    ^ menu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2992
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2993
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2994
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2995
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2996
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2997
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2998
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2999
canDrawItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3000
    "returns true if an item could be drawn otherwise false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3001
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3002
    ^ (mustRearrange not and:[shown])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3003
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3004
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3005
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3006
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3007
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3008
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3009
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3010
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3011
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3012
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3013
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3014
    ^ (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
  3015
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3016
"/    |ext|
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3017
"/
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3018
"/    (x >= 0 and:[y >= 0]) ifTrue:[
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3019
"/        ext := self computeExtent.
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3020
"/      ^ (x < ext x and:[y < ext y])
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3021
"/    ].
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3022
"/    ^ false
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3023
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3024
    "Modified: / 29.1.1998 / 16:46:10 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3025
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3026
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3027
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3028
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3029
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3030
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3031
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3032
    groupSizes size ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3033
	i := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3034
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3035
	groupSizes do:[:t|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3036
	    (i := i + t) == anIndex ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3037
		^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3038
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3039
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3040
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3041
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3042
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3043
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3044
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3045
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3046
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3047
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3048
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3049
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3050
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3051
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3052
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3053
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3054
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3055
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3056
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3057
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3058
    "returns true if the panel is the first in the menu hierarchy in must
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3059
     be fit to the extent of its superView
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3060
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3061
    ^ self isPopUpView ifTrue:[false] ifFalse:[fitFirstPanel]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3062
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3063
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3064
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3065
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3066
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3067
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3068
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3069
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3070
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3071
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3072
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3073
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3074
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3075
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3076
  ^ self verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3077
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3078
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3079
!
c05874084d4c implement
ca
parents: 407
diff changeset
  3080
c05874084d4c implement
ca
parents: 407
diff changeset
  3081
type
428
ca
parents: 427
diff changeset
  3082
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3083
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3084
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3085
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3086
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3087
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3088
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3089
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3090
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3092
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3093
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3094
isValidSelection:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3095
    "returns true if something could be selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3096
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3097
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3098
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3099
    enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3100
	(item := self itemAt:something) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3101
	    ^ item canSelect
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3102
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3103
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3104
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3105
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3107
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3108
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3109
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3110
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3111
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3112
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3113
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3114
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3115
selection:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3116
    "change selection to an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3117
    "
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3118
    |item newSel hlp|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3119
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3120
    selection isNumber ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3121
	newSel := self itemAt:anItemOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3122
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3123
	(anItemOrNil notNil and:[anItemOrNil canSelect]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3124
	    newSel := anItemOrNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3125
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3126
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3127
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3128
    selection == newSel ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3130
    (item := selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3131
	selection := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3132
	item selected:false.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3133
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3134
    newSel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3135
	selection := newSel.
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3136
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3137
"/ 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
  3138
"/ but not the selected one ...
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3139
"/        ActiveHelp isActive ifTrue:[
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3140
"/            hlp := ActiveHelp currentHelpListener.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3141
"/            hlp initiateHelpFor:self atX:1 y:1 now:true.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3142
"/        ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3143
	selection selected:true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3144
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3145
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3146
    "Modified: / 2.2.1998 / 10:13:46 / stefan"
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3147
    "Modified: / 31.7.1998 / 03:14:18 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3148
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3149
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3150
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3151
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3152
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3153
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3154
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3155
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3156
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3157
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3158
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3159
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3160
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3161
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3162
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3163
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3164
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3165
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3166
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3167
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3168
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3169
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3170
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3171
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3172
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3173
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3174
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3175
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3176
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3177
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3178
shortcutKeyOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3179
    ^ ShortcutKeyOffset
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3180
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3181
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3182
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3183
    ^ VerticalInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3184
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3185
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3186
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3187
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3188
separatorSize:aType
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3189
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3190
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3191
    aType == #doubleLine ifTrue:[^ 10 ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3192
    aType == #singleLine ifTrue:[^ 10 ].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3193
  ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3194
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3195
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3196
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3197
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3198
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3199
    "
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3200
    HorizontalInset       := 4.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3201
    VerticalInset         := 3.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3202
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3203
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3204
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3205
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3206
    LabelRightOffset      := 15.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3207
    ShortcutKeyOffset     := 5.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3208
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3209
    IndicatorOn  := self checkedImage.
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3210
    IndicatorOff := self uncheckedImage.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3211
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3212
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3213
!MenuPanel::Item class methodsFor:'image specs'!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3214
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3215
checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3216
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3217
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3218
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3219
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3220
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3221
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3222
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3223
     self checkOffIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3224
     ImageEditor openOnClass:self andSelector:#checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3225
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3226
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3227
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3228
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3229
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3230
	constantNamed:#'MenuPanel::Item checkOffIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3231
	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D_?>(AO??;AO???LS???3D???<1O???LS???3A_??3@Z??<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]!
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3232
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3233
checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3234
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3235
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3236
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3237
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3238
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3239
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3240
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3241
     self checkOnIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3242
     ImageEditor openOnClass:self andSelector:#checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3243
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3244
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3245
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3246
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3247
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3248
	constantNamed:#'MenuPanel::Item checkOnIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3249
	ifAbsentPut:[(Depth2Image new) width: 15; height: 15; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@AUP@@E@AP@DO?Y@D]@^(AL@@;AM@@GLS@@@3D0@@L1L@@CLSP@A3A\@@3@Z4A<0A+?00@C@C0@@O?@@') ; colorMapFromArray:#[0 0 0 85 85 85 170 170 170 255 255 255]; mask:((Depth1Image new) width: 15; height: 15; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'A<@_<C?8_?1??O?:??+?>/?:??)?=G?4O< HL@_@') ; yourself); yourself]!
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3250
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3251
checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3252
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3253
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3254
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3255
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3256
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3257
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3258
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3259
     self checkedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3260
     ImageEditor openOnClass:self andSelector:#checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3261
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3262
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3263
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3264
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3265
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3266
	constantNamed:#'MenuPanel::Item checkedImage'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3267
	ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'*****X@@@@FEUUUQ!!UUTDXUUVAFEUUBQ!!UU TXPUP%FDAXEQ!!0DITXW@AUFE\BUQ!!U0UTXUUUUF@@@@AUUUUUP@a') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?????_?=??7??_?=??7??_?=??7??_?=??7??X@A??<b') ; yourself); yourself]!
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3268
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3269
uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3270
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3271
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3272
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3273
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3274
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3275
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3276
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3277
     self uncheckedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3278
     ImageEditor openOnClass:self andSelector:#uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3279
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3280
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3281
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3282
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3283
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3284
	constantNamed:#'MenuPanel::Item uncheckedImage'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3285
	ifAbsentPut:[(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUG????10@@@L\@@@CG@@@@10@@@L\@@@CG@@@@10@@@L\@@@CG@@@@10@@@L\@@@CG@@@@1????<@@@@@@@a') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'?????_?=??7??_?=??7??_?=??7??_?=??7??X@A??<b') ; yourself); yourself]! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3286
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3287
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3289
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3290
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3291
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3292
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3293
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3294
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3295
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3296
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3297
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3298
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3299
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3300
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3301
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3302
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3304
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3305
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3306
  ^ item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3307
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3308
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3309
!MenuPanel::Item methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3310
420
ca
parents: 417
diff changeset
  3311
canAccept
ca
parents: 417
diff changeset
  3312
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  3313
    "
ca
parents: 417
diff changeset
  3314
  ^ (self enabled and:[self hasSubmenu not])
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3315
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3316
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3317
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3318
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3319
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3320
    |arg|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3321
723
4f05cbdcaede once again some corrections for button press indication
tz
parents: 720
diff changeset
  3322
    self hasIndication ifTrue:[    
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3323
	arg := self indicationValue not.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3324
	self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3325
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3326
	self hasChoice ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3327
	    arg := self choiceValue.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3328
	    self choice value:arg.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3329
	    arg := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3330
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3331
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3332
    ^ arg
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3333
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3334
    "Modified: / 14.8.1998 / 16:13:37 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3335
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3336
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3337
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3338
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3339
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3340
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3341
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3342
    accessCharacterPosition isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3343
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3344
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3345
  ^ (rawLabel string) at:accessCharacterPosition ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3346
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3347
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3348
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3349
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3350
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3351
  ^ accessCharacterPosition
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3352
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3354
accessCharacterPosition:anIndex
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3355
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3356
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3357
    accessCharacterPosition ~~ anIndex ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3358
	accessCharacterPosition := anIndex.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3359
	self updateRawLabel.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3360
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3361
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3362
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3363
activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3364
    ^ activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3365
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3366
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3367
activeHelpKey:aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3368
    activeHelpKey := aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3369
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3370
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3371
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3372
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3373
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3374
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3375
  ^ adornment argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3376
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3377
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3378
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3379
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3380
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3381
    self argument ~~ anArgument ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3382
	self adornment argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3383
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3384
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3385
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3386
compareAccessCharacterWith:aKey
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3387
    "returns true if key is my access character
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3388
    "
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3389
    ^ self accessCharacter == aKey
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3390
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3391
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3392
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3393
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3394
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3395
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3396
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3397
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3398
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3399
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3400
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3401
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3402
    "
475
b604babd1f4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  3403
    |i rest s|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3404
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3405
    accessCharacterPosition := nil.
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3406
    label := aLabel value.
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3407
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3408
    (label isString and:[(s := label size) > 1]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3409
	i := 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3410
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3411
	[((i := label indexOf:$& startingAt:i) ~~ 0 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3412
	and:[i < s])] whileTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3413
	    rest := label copyFrom:(i+1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3414
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3415
	    i == 1 ifTrue:[label := rest]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3416
		  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3417
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3418
	    (label at:i) == $& ifTrue:[i := i + 1]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3419
			      ifFalse:[accessCharacterPosition := i].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3420
	    s := s - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3421
	]
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3422
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3423
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3424
    self updateRawLabel
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3425
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3426
    "Modified: / 31.7.1998 / 00:52:26 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3427
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3428
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3429
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3430
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3431
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3432
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3433
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3434
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3435
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3436
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3437
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3438
    ^ nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3439
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3440
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3441
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3442
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3443
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3444
    nameKey := aNameKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3445
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3446
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3447
rawLabel
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3448
    "returns my printable Label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3449
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3450
    ^ rawLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3451
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3452
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3453
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3454
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3455
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3457
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3458
  ^ adornment shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3459
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3460
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3461
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3462
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3463
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3464
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3465
    self shortcutKey ~~ aKey ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3466
	self adornment shortcutKey:aKey.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3467
	self redraw.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3468
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3469
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3470
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3471
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3472
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3473
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3474
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3475
    ^ startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3476
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3477
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3478
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3479
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3480
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3481
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3482
    (startGroup isNil or:[startGroup == #right]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3483
	startGroup := aSymbol
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3484
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3485
	self warn:('not supported group: ', aSymbol printString ).
710
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
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3489
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3490
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3491
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3492
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3493
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3494
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3495
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3496
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3497
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3498
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3499
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3500
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3501
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3502
    (aSubMenu notNil 
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3503
     and:[(aSubMenu isView or:[aSubMenu isKindOf:Menu]) not]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3504
	^ self submenuChannel:aSubMenu
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) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3508
	aSubMenu class == Menu ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3509
	    subMenu := MenuPanel new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3510
	    menuPanel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3511
		subMenu receiver:menuPanel receiver.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3512
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3513
	    subMenu menu:aSubMenu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3514
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3515
	(subMenu notNil and:[subMenu isView]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3516
	    subMenu superMenu:menuPanel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3517
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3518
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3519
1068
155168a813ad oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  3520
    "Modified: / 10.8.1998 / 13:26:28 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3521
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3522
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3523
textLabel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3524
    "returns my textLabel or nil if none text
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3525
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3526
    (rawLabel respondsTo:#string) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3527
	^ rawLabel string
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3528
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3529
  ^ nil
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3530
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3531
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3532
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3533
    "gets value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3534
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3535
    ^ value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3536
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3537
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3538
value:something
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3539
    "could be a value holder, an action or selector
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3540
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3541
    value := something.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3542
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3543
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3544
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3545
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3546
    "
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3547
    self value:aValue.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3548
    self argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3549
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3550
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3551
!MenuPanel::Item methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3552
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3553
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3554
    "get choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3555
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3556
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3557
  ^ adornment choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3558
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3559
    "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
  3560
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3561
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3562
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3563
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3564
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3565
    |old new|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3566
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3567
    old := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3568
    old == something ifTrue:[^ self].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3569
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3570
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3571
	old removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3572
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3573
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3574
    new := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3575
    new isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3576
	new := self aspectAt:new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3577
	new isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3578
	    new := something
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3579
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3580
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3581
    (self isKindOfValueHolder:new) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3582
	new addDependent:self
1074
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
    self adornment choice:new.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3585
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3586
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3587
    "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
  3588
    "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
  3589
!
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
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3592
    "get choice value
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
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3595
  ^ adornment choiceValue
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
    "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
  3598
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3599
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3600
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3601
    "set choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3602
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3603
    |old|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3604
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3605
    self adornment choiceValue:something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3606
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3607
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3608
    "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
  3609
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3610
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3611
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3612
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3613
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3614
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3615
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3616
    menuPanel enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3617
	enableChannel isSymbol ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3618
	    state := self aspectAt:enableChannel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3619
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3620
	    (self isKindOfValueHolder:state) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3621
		enableChannel := state.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3622
		enableChannel addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3623
		state := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3624
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3625
		state := state value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3626
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3627
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3628
	    state := enableChannel value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3629
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3630
      ^ state ~~ false
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3631
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3632
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3633
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3634
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3635
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3636
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3637
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3638
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3639
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3640
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3641
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3642
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3643
	oldState := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3644
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3645
	    enableChannel removeDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3646
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3647
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3648
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3649
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3650
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3651
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3652
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3653
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3654
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3655
	    enableChannel addDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3656
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3657
	    enableChannel isSymbol ifTrue:[^ self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3658
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3659
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3660
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3661
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3662
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3663
    newState ~~ oldState ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3664
	(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3665
	    self drawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3666
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3667
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3668
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3669
    "Modified: / 27.10.1997 / 16:13:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3670
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3671
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3672
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3673
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3674
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3675
    adornment isNil ifTrue:[^ nil].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3676
  ^ adornment indication
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:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3680
    "set 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
    |old|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3683
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3684
    old := self indication.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3685
    old == something ifTrue:[^ self].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3686
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3687
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3688
	old removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3689
    ].
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
    (self isKindOfValueHolder:something) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3692
	something addDependent:self
407
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 adornment indication:something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3695
    self updateRawLabel.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3696
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3697
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3698
isButton
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3699
    "returns whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3700
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3701
    ^ isButton
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3702
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3703
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3704
isButton:anBoolean
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3705
    "sets whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3706
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3707
    isButton := anBoolean.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3708
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3709
    layout notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3710
	self redrawAsButton
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3711
    ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3712
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
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3715
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3716
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3717
setupSubmenu
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  3718
    |appl recv subm|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3719
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3720
    submenuChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3721
	submenuChannel isSymbol ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3722
	    subm := submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3723
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3724
	    appl := menuPanel application.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3725
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3726
	    (subm := self findSubMenuIn:appl) isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3727
		(recv := menuPanel receiver) ~~ appl ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3728
		    subm := self findSubMenuIn:recv
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3729
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3730
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3731
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3732
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3733
	(subm := subm value) isArray ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3734
	    subm := Menu new fromLiteralArrayEncoding:subm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3735
	    "/ cg: linked menus also may contain translations ...
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3736
	    subm notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3737
		appl notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3738
		    subm findGuiResourcesIn:appl.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3739
		]                
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3740
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3741
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3742
	self submenu:subm.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3743
    ].
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  3744
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3745
    ^ subMenu
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3746
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  3747
    "Modified: / 19.5.1998 / 19:36:56 / cg"
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3748
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3749
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3750
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3751
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3752
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3753
  ^ submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3754
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3755
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3756
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3757
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3758
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3759
    submenuChannel := aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3760
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3761
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3762
!MenuPanel::Item methodsFor:'accessing dimension'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3763
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3764
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3765
    "gets height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3766
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3767
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3768
	^ self preferredExtent y
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3769
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3770
    ^ layout height
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3771
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3772
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3773
horizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3774
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3775
    isButton ifTrue: [^menuPanel buttonPassiveLevel + HorizontalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3776
    ^HorizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3777
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3778
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3779
layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3780
    "returns my layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3781
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3782
    ^ layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3783
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3784
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3785
layout:aLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3786
    "set a new layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3787
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3788
    layout := aLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3789
    self redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3790
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3791
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3792
verticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3793
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3794
    isButton ifTrue: [^menuPanel buttonPassiveLevel + VerticalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3795
    ^VerticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3796
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3797
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3798
width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3799
    "gets width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3800
    "
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3801
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3802
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3803
	^ self preferredExtent x
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3804
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3805
    ^ layout width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3806
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3807
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3808
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3809
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3810
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3811
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3812
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3813
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3814
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3815
    appl := menuPanel receiver.
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
    (appl isKindOf:ValueModel) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3818
	^ appl value:aKey
524
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
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3821
    (appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3822
	Object messageNotUnderstoodSignal handle:[:ex|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3823
	    ex parameter selector == aKey ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3824
		ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3825
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3826
	] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3827
	    (appl isKindOf:ApplicationModel) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3828
		ifTrue:[value := appl aspectFor:aKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3829
		ifFalse:[value := appl perform:aKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3830
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3831
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3832
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3833
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3834
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3835
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3836
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3837
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3838
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3839
choiceChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3840
    "called when the choice changed
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3841
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3842
    |indicator|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3843
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3844
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3845
	indicator := self choiceForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3846
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3847
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3848
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3849
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3850
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3851
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3852
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3853
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3854
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3855
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3856
    self redraw
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3857
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3858
    "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
  3859
    "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
  3860
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3861
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3862
enabledStateOfMenuChangedTo:aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3863
    "enabled state of menu changed to aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3864
    "
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3865
    rawLabel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3866
	self drawLabel
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3867
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3868
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3869
!
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3870
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3871
indicationChanged
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3872
    "called when the indication changed
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3873
    "
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3874
    |indicator|
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3875
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3876
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3877
	indicator := self indicatorForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3878
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3879
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3880
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3881
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3882
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3883
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3884
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3885
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3886
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3887
    ].
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3888
    self redraw
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3889
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3890
    "Modified: / 14.8.1998 / 17:19:38 / cg"
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3891
!
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3892
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3893
update:something with:aParameter from:changedObject
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3894
    |indicator|
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3895
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3896
    changedObject == self indication ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3897
	^ self indicationChanged
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3898
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3899
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3900
    changedObject == self choice ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3901
	^ self choiceChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3902
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3903
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3904
    changedObject == enableChannel ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3905
	(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3906
	    self drawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3907
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3908
	^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3909
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3910
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3911
    changedObject == isVisible ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3912
	^ menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3913
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3914
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3915
    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
  3916
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3917
    "Modified: / 14.8.1998 / 16:13:41 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3918
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3919
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3920
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3921
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3922
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3923
    |indicator| 
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3924
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3925
    (indicator := self indication) notNil ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3926
"/        (isButton and:[menuPanel isPopUpView]) ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3927
"/            (self isKindOfValueHolder:indicator) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3928
"/                ^ self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3929
"/            ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3930
"/        ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3931
	self indicationChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3932
    ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3933
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3934
    "Modified: / 14.8.1998 / 15:19:38 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3935
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3936
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3937
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3938
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3939
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3940
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3941
    "
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3942
    |item label rcv|
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3943
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3944
    label := self label.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3945
    item  := MenuItem labeled:(label printString).
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3946
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3947
    label isImage ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3948
	rcv := ResourceRetriever new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3949
	rcv className:#MenuEditor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3950
	rcv selector:#iconUnknown.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3951
	item labelImage:rcv.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3952
    ].
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  3953
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3954
    item activeHelpKey:activeHelpKey.
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3955
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3956
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3957
	item enabled:(enableChannel value)
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3958
    ].
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3959
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3960
    item accessCharacterPosition:(self accessCharacterPosition).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3961
    item startGroup:(self startGroup).
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3962
    item argument:(self argument).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3963
    item nameKey:(self nameKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3964
    item shortcutKeyCharacter:(self shortcutKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3965
    item value:(value value).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3966
    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
  3967
    item choice:(self choice value).
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3968
    item choiceValue:(self choiceValue).
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3969
    item isVisible:(self isVisible).
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3970
    item isButton:isButton.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3971
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3972
    submenuChannel isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3973
	item submenuChannel:submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3974
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3975
	self submenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3976
	    item submenu:(self submenu asMenu)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3977
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3978
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3979
  ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3980
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3981
    "Modified: / 14.8.1998 / 15:47:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3982
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3983
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3984
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3985
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3986
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3987
    |var lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3988
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3989
    menuPanel disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3990
	label := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3991
	activeHelpKey := aMenuItem activeHelpKey.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3992
	self enabled:(aMenuItem enabled).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3993
	self nameKey:(aMenuItem nameKey).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3994
	self indication:(aMenuItem indication).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3995
	self choice:(aMenuItem choice).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3996
	self choiceValue:(aMenuItem choiceValue).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3997
	self isButton:(aMenuItem isButton).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3998
	self startGroup:(aMenuItem startGroup).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3999
	self isVisible:(aMenuItem isVisible).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4000
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4001
	(var := aMenuItem accessCharacterPosition) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4002
	    self accessCharacterPosition:var.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4003
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4004
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4005
	(lbl := aMenuItem labelImage value) isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4006
	    lbl := aMenuItem rawLabel. "/ avoid translating &'s twice
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4007
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4008
	self label:lbl.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4009
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4010
	self shortcutKey:(aMenuItem shortcutKeyCharacter).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4011
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4012
	(var := aMenuItem argument) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4013
	    self argument:var.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4014
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4015
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4016
	submenuChannel := aMenuItem submenuChannel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4017
	self submenu:(aMenuItem submenu).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4018
	self value:(aMenuItem value).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4019
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  4020
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4021
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4022
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4023
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4024
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4025
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4026
drawLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4027
    "draw label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4028
    "
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4029
    |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
  4030
     buttonLevel isSelected clr|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4031
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4032
    self isVisible ifFalse:[^ self].
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4033
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4034
    img := rawLabel.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4035
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4036
    asc := menuPanel font ascent.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4037
    h   := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4038
    l   := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4039
    t   := layout top.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4040
    hrzInset := self horizontalInset.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4041
    isSelected := self drawSelected.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4042
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4043
    self enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4044
	fg := isSelected ifTrue:[self activeForegroundColor]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4045
			ifFalse:[menuPanel foregroundColor].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4046
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4047
	fg := menuPanel disabledForegroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4048
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4049
	(img := disabledRawLabel) isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4050
	    img := self disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4051
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4052
    ].
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4053
    menuPanel paint:fg.
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4054
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4055
    "/ t := t + menuPanel level.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4056
    y := t + ((h - (img heightOn:menuPanel)) // 2).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4057
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4058
    (self textLabel) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4059
	y := y + asc.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4060
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4061
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4062
    isButton ifTrue:[   
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4063
	(isSelected or:[self indicationValue == true]) ifTrue:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4064
	[   
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4065
	    img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4066
	    buttonLevel := menuPanel buttonActiveLevel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4067
	] ifFalse:[   
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4068
	    img displayOn:menuPanel x:(l + hrzInset) y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4069
	    self isEntered ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4070
		buttonLevel := menuPanel buttonEnteredLevel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4071
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4072
		buttonLevel := menuPanel buttonPassiveLevel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4073
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4074
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4075
	menuPanel 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4076
	    drawButtonEdgesInLayout:layout 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4077
	    withLevel:buttonLevel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4078
	    selected:isSelected.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4079
	^ self
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4080
    ].
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4081
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4082
"/ 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
  4083
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4084
    img displayOn:menuPanel x:(l + hrzInset) y:y.
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4085
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4086
    "/ DRAW SHORTCUT KEY
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4087
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4088
    MenuView showAcceleratorKeys == true ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4089
	menuPanel isVerticalLayout ifTrue:[ "/ only for vertical menus ...
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4090
	    (scKey:= self shortcutKeyAsString) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4091
		(x := menuPanel shortKeyInset) == 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4092
		    x := hrzInset + LabelRightOffset + (img widthOn:menuPanel)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4093
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4094
		x := l + x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4095
		y := t + ((h - (scKey heightOn:menuPanel)) // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4096
		y := y + asc.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4097
		scKey displayOn:menuPanel x:x y:y. 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4098
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4099
	].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4100
    ].
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  4101
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4102
    "/ DRAW SUBMENU INDICATION
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4103
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4104
    (menuPanel isVerticalLayout and:[self submenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4105
	arrow := menuPanel rightArrow.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4106
	x := layout right - arrow width - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4107
	y := t + (h - arrow height // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4108
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4109
	(menuPanel styleSheet is3D not
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4110
	or:[(img := menuPanel rightArrowShadow) isNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4111
	    ^ menuPanel displayForm:arrow x:x y:y
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4112
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4113
	cLa := menuPanel shadowColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4114
	cLb := menuPanel lightColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4115
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4116
	isSelected ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4117
	    fg  := cLa.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4118
	    cLa := cLb.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4119
	    cLb := fg
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4120
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4121
	menuPanel paint:cLa.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4122
	menuPanel displayForm:arrow x:x y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4123
	menuPanel paint:cLb.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4124
	menuPanel displayForm:img x:x y:y. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4125
    ]
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  4126
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4127
    "Modified: / 22.8.1998 / 18:32:28 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4128
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4129
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4130
drawSelected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4131
    "return true if item is selected or if item implements
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4132
     a toggle in a radio group which is selected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4133
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4134
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4135
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4136
    self isSelected ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4137
	^ true
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4138
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4139
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4140
	^ ((holder := self choice) notNil and:[holder value = self choiceValue])
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4141
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4142
    ^ false
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4143
!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4144
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4145
redraw
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4146
    "redraw item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4147
    "
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4148
    |isSelected ownBgCol showItemSep type paint lgCol shCol
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4149
     h  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4150
     w  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4151
     l  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4152
     t  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4153
     r  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4154
     b  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4155
     x  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4156
     y  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4157
     hrzInset "{ Class:SmallInteger }"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4158
     isEntered
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4159
    |
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4160
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4161
    (self isVisible and:[menuPanel canDrawItem]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4162
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4163
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4164
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4165
    isSelected := self drawSelected.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4166
    isEntered := self isEntered.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4167
    hrzInset   := self horizontalInset.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4168
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4169
    isSelected ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4170
	(isButton and:[isEntered]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4171
	    paint := self buttonEnteredBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4172
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4173
	    paint := self backgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4174
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4175
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4176
	paint := self activeBackgroundColor
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4177
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4178
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4179
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4180
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4181
    b := layout bottom.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4182
    h := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4183
    w := layout width.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4184
    (ownBgCol := self backgroundColorFromLabel) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4185
	menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4186
	menuPanel fillRectangle:layout.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4187
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4188
	self hasIndication ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4189
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4190
	    menuPanel fillRectangle:layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4191
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4192
	    menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4193
	    x := (rawLabel icon width) + hrzInset + 4.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4194
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4195
	    menuPanel fillRectangleX:l y:t width:x height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4196
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4197
	    menuPanel fillRectangleX:(l + x) y:t width:(w - x) height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4198
	    ownBgCol := nil.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4199
       ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4200
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4201
    lgCol       := menuPanel lightColor.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4202
    shCol       := menuPanel shadowColor.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4203
    showItemSep := menuPanel showSeparatingLines.
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4204
    type        := self separatorType.
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4205
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4206
    type notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4207
	type == #blankLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4208
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4209
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4210
	"/ draw separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4211
	menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4212
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4213
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4214
	    l := l + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4215
	    r := r - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4216
	    y := t - 1 + (h // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4217
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4218
	    type == #doubleLine ifTrue:[y := y - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4219
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4220
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4221
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4222
	    y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4223
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4224
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4225
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4226
		y := y + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4227
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4228
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4229
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4230
		y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4231
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4232
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4233
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4234
	    x := l - 1 + (w // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4235
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4236
	    type == #doubleLine ifTrue:[x := x - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4237
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4238
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4239
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4240
	    x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4241
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4242
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4243
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4244
		x := x + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4245
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4246
		menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4247
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4248
		x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4249
		menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4250
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4251
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4252
	^ self
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4253
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4254
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4255
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4256
	^ self drawLabel
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4257
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4258
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4259
    showItemSep ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4260
	|col index item lfSep rtSep|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4261
	col := menuPanel paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4262
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4263
	index := menuPanel indexOfItem:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4264
	item  := menuPanel itemAtIndex:(index - 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4265
	lfSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4266
	item  := menuPanel itemAtIndex:(index + 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4267
	rtSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4268
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4269
	menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4270
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4271
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4272
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4273
		menuPanel displayLineFromX:l y:t - 1 toX:r y:t - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4274
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4275
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4276
		menuPanel displayLineFromX:l y:b - 1 toX:r y:b - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4277
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4278
	    menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4279
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4280
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4281
		menuPanel displayLineFromX:l y:t - 2 toX:r y:t - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4282
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4283
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4284
		menuPanel displayLineFromX:l y:b - 2 toX:r y:b - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4285
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4286
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4287
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4288
		menuPanel displayLineFromX:l - 1 y:t toX:l - 1 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4289
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4290
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4291
		menuPanel displayLineFromX:r - 1 y:t toX:r - 1 y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4292
	    ]. 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4293
	    menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4294
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4295
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4296
		menuPanel displayLineFromX:l - 2 y:t toX:l - 2 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4297
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4298
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4299
		menuPanel displayLineFromX:r - 2 y:t toX:r - 2 y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4300
	    ] 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4301
	]
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4302
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4303
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4304
    self drawLabel.  
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4305
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4306
    (ownBgCol notNil and:[isSelected]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4307
	ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4308
				 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4309
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4310
	menuPanel displayRectangleX:(l + 1) y:(t + 1) width:(w - 2) height:(h - 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4311
	menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).  
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4312
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4313
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4314
    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
  4315
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4316
    "Modified: / 20.8.1998 / 15:11:33 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4317
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4318
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4319
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4320
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4321
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4322
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4323
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4324
    |channel|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4325
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4326
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4327
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4328
    (enableChannel notNil and:[self isKindOfValueHolder:enableChannel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4329
	enableChannel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4330
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4331
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4332
    (isVisible notNil and:[self isKindOfValueHolder:isVisible]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4333
	isVisible removeDependent:self
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4334
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4335
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4336
    channel := self indication.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4337
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4338
	channel removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4339
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4340
    channel := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4341
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4342
	channel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4343
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4344
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4345
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4346
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4347
    "Modified: / 14.8.1998 / 14:37:57 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4348
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4349
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4350
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4351
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4352
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4353
    menuPanel := aPanel.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4354
    isButton  := false.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4355
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4356
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4357
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4358
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4359
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4360
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4361
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4362
    disabledRawLabel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4363
	(     rawImage notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4364
	 and:[(rawImage respondsTo:#colorMap)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4365
	 and:[rawImage colorMap notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4366
	) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4367
	    disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4368
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4369
	    disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4370
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4371
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4372
		(isButton
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4373
		  or:[((self indication notNil or:[self choice notNil])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4374
		 and:[label class == LabelAndIcon])]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4375
		) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4376
		    disabledRawLabel := LabelAndIcon form:(rawLabel icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4377
						    image:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4378
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4379
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4380
		    disabledRawLabel := LabelAndIcon form:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4381
						    image:(rawLabel image)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4382
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4383
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4384
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4385
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4386
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4387
    ^ disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4388
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4389
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4390
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4391
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4392
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4393
    |icon|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4394
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4395
    rawImage notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4396
	rawLabel isImage ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4397
	    rawLabel := menuPanel imageOnDevice:rawImage
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4398
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4399
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4400
		(icon := rawLabel image) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4401
		    rawLabel image:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4402
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4403
		(icon := rawLabel icon) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4404
		    (self indication isNil and:[self choice isNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4405
			rawLabel icon:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4406
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4407
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4408
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4409
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4410
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4411
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4412
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4413
updateRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4414
    "recreate rawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4415
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4416
    |char size form|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4417
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4418
    label isNil ifTrue:[        "/ not yet initialized
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4419
	^ self
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4420
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4421
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4422
    (form := self indicatorForm) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4423
	form := self choiceForm
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4424
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4425
    rawImage         := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4426
    disabledRawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4427
    rawLabel         := label value.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4428
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4429
    rawLabel isString ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4430
	rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4431
	    rawLabel := rawLabel withoutSeparators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4432
	].        
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4433
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4434
	form isNil ifTrue:[                             "/ check for separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4435
	    rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4436
		  rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4437
		^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4438
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4439
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4440
	    rawLabel size == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4441
		char := rawLabel first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4442
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4443
		(char == $- or:[char == $=]) ifTrue:[   "/ other line separators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4444
		    label := String new:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4445
		    label at:1 put:char.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4446
		    rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4447
		  ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4448
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4449
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4450
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4451
	rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4452
	    rawLabel := label value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4453
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4454
	size := self accessCharacterPosition.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4455
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4456
	(size notNil and:[size <= rawLabel size]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4457
	    rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4458
		rawLabel := Text string:rawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4459
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4460
	    rawLabel emphasisAt:size add:#underline
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4461
	]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4462
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4463
    rawLabel isImage ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4464
	rawImage := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4465
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4466
	form notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4467
	    isButton ifTrue:[form := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4468
	    rawLabel := LabelAndIcon form:form image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4469
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4470
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4471
	rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4472
	    rawImage := rawLabel icon.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4473
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4474
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4475
		rawLabel image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4476
		rawLabel icon:form
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4477
	    ]                
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4478
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4479
	    rawImage := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4480
	    rawLabel isNil ifTrue:[rawLabel := ''].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4481
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4482
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4483
		rawLabel := LabelAndIcon icon:form string:rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4484
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4485
		disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4486
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4487
	].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4488
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4489
    menuPanel shown ifTrue:[ self fetchImages ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4490
    menuPanel mustRearrange
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4491
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4492
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4493
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4494
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4495
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4496
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4497
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4498
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4499
    isButton ifTrue: [^menuPanel buttonActiveBackgroundColor].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4500
    ^menuPanel activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4501
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4502
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4503
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4504
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4505
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4506
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4507
    ^menuPanel activeForegroundColor
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
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4510
adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4511
    "returns adornment; if not existing yet a new instance
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4512
     is created
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4513
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4514
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4515
	adornment := Adornment new
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4516
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4517
  ^ adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4518
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4519
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4520
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4521
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4522
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4523
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4524
    isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor].
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4525
    ^menuPanel backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4526
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4527
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4528
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4529
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4530
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4531
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4532
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4533
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4534
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4535
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4536
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4537
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4538
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4539
    run size == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4540
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4541
	    ^ run value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4542
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4543
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4544
	run do:[:r|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4545
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4546
		^ r value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4547
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4548
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4549
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4550
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4551
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4552
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4553
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4554
    "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
  4555
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4556
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4557
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4558
    isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4559
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4560
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4561
    "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
  4562
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4563
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4564
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4565
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4566
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4567
    |holder|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4568
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4569
    (holder := self choice) isNil ifTrue:[^ nil].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4570
1107
0ace8de67a4e better styled round choice images + test choice values only for #=
tz
parents: 1101
diff changeset
  4571
    holder value = self choiceValue ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4572
	^ self class checkOnIcon
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4573
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4574
    ^ self class checkOffIcon
1074
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
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4577
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4578
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4579
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4580
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4581
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4582
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4583
    |subm argument sel|
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4584
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4585
    subm := nil.
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4586
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4587
    aRecv notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4588
	submenuChannel last ~~ $: ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4589
	    Object messageNotUnderstoodSignal handle:[:ex|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4590
		|selector|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4591
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4592
		((selector := ex parameter selector) == submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4593
		or:[selector == #aspectFor:]) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4594
		    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4595
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4596
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4597
		subm := aRecv aspectFor:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4598
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4599
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4600
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4601
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4602
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4603
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4604
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4605
		    subm := aRecv perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4606
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4607
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4608
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4609
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4610
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4611
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4612
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4613
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4614
		    subm := aRecv class perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4615
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4616
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4617
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4618
	    (argument := self argument) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4619
		sel := submenuChannel asSymbol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4620
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4621
		    ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4622
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4623
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4624
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4625
		    subm := aRecv perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4626
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4627
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4628
		subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4629
		    Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4630
			ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4631
			    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4632
			].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4633
		    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4634
			subm := aRecv class perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4635
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4636
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4637
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4638
	]
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4639
    ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4640
    ^ subm
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4641
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4642
    "Modified: / 4.8.1998 / 17:40:09 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4643
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4644
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4645
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4646
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4647
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4648
    |indication numArgs sel recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4649
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4650
    (indication := self indication) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4651
	^ nil                                           "/ has no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4652
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4653
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4654
    indication isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4655
	(numArgs := indication numArgs) ~~ 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4656
	    numArgs == 2 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4657
		recv := menuPanel receiver.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4658
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4659
		(recv isKindOf:ValueModel) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4660
		    (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4661
			sel := indication copyFrom:1 to:(indication indexOf:$:).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4662
			indication := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4663
			sel := sel asSymbol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4664
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4665
			Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4666
			    ex parameter selector == sel ifFalse:[
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4667
"/                                Transcript showCR:'no indication for: ' , sel.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4668
				ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4669
			    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4670
			] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4671
			    indication := recv perform:sel with:self argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4672
			]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4673
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4674
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4675
		^ indication value == true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4676
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4677
	    indication := (indication copyWithoutLast:1) asSymbol
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4678
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4679
	indication := self aspectAt:indication.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4680
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4681
	(self isKindOfValueHolder:indication) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4682
	    self adornment indication:indication.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4683
	    indication addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4684
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4685
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4686
    ^ indication value == true
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4687
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4688
    "Modified: / 8.8.1998 / 02:15:15 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4689
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4690
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4691
indicationValue:aValue
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4692
    "returns indication value or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4693
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4694
    |numArgs indication recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4695
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4696
    (indication := self indication) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4697
	^ self                                          "/ has no indication
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4698
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4699
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4700
    indication isSymbol ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4701
	(self isKindOfValueHolder:indication) ifTrue:[  "/ is value holder
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4702
	    indication value:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4703
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4704
	^ self
524
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
    recv := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4707
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4708
    (recv isKindOf:ValueModel) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4709
	recv value:indication value:aValue.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4710
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4711
	(      (numArgs := indication numArgs) ~~ 0
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4712
	  and:[recv notNil or:[(recv := menuPanel application) notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4713
	) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4714
	    Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4715
		(ex parameter selector ~~ indication) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4716
		    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4717
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4718
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4719
		numArgs == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4720
		    recv perform:indication with:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4721
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4722
		    recv perform:indication with:(self argument ? self) with:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4723
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4724
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4725
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4726
    ].
1026
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4727
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4728
    "Modified: / 28.7.1998 / 20:47:08 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4729
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4730
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4731
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4732
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4733
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4734
    |value|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4735
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4736
    (value := self indicationValue) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4737
	^ nil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4738
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4739
  ^ 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
  4740
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4741
    "Created: / 14.8.1998 / 15:53:53 / cg"
407
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
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4744
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4745
    "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
  4746
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4747
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4748
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4749
    "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
  4750
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4751
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4752
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4753
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4754
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4755
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4756
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4757
    rawLabel isNil ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4758
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4759
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4760
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4761
    (lbl := label value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4762
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4763
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4764
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4765
    lbl size == 1 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4766
	c := lbl first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4767
	c == $- ifTrue:[^ #singleLine].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4768
	c == $= ifTrue:[^ #doubleLine].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4769
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4770
  ^ #blankLine
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4771
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4772
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4773
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4774
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4775
canSelect
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4776
    "returns true if item is selectable
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4777
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4778
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4779
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4780
    (self isVisible and:[self enabled and:[rawLabel notNil]]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4781
	((holder := self choice) isNil or:[holder value ~= self choiceValue]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4782
	    ^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4783
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4784
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4785
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4786
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4787
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4788
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4789
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4790
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4791
    (self isVisible and:[layout notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4792
	^ (     (x >= layout left)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4793
	    and:[x <  layout right
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4794
	    and:[y >  layout top
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4795
	    and:[y <= layout bottom]]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4796
	  )
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4797
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4798
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4799
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4800
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4801
hasChoice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4802
    "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
  4803
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4804
  ^ self choice notNil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4805
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4806
    "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
  4807
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4808
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4809
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4810
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4811
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4812
  ^ self indication notNil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4813
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4814
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4815
hasSubmenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4816
    "returns true if a submenu exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4817
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4818
    ^ self submenu notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4819
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4820
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4821
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4822
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4823
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4824
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4825
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4826
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4827
isKindOfValueHolder:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4828
    "returns true if something is kind of vlaue holder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4829
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4830
    ^ ((something respondsTo:#value:) and:[something isBlock not])
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4831
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4832
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4833
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4834
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4835
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
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4838
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4839
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4840
    "
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4841
    ^ rawLabel isNil
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4842
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4843
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4844
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4845
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4846
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4847
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4848
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4849
    isVisible isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4850
	state := self aspectAt:isVisible.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4851
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4852
	(self isKindOfValueHolder:state) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4853
	    isVisible := state.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4854
	    isVisible addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4855
	    state := isVisible value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4856
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4857
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4858
	state := isVisible value
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4859
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4860
  ^ state ~~ false
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4861
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4862
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4863
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4864
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4865
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4866
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4867
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4868
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4869
    isVisible isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4870
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4871
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4872
	oldState := isVisible value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4873
	(self isKindOfValueHolder:isVisible) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4874
	    isVisible removeDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4875
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4876
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4877
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4878
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4879
    isVisible isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4880
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4881
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4882
	(self isKindOfValueHolder:isVisible) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4883
	    isVisible addDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4884
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4885
	    isVisible isSymbol ifTrue:[^ self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4886
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4887
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4888
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4889
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4890
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4891
    newState ~~ oldState ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4892
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4893
    ]
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4894
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4895
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4896
preferredExtent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4897
    "compute my preferred extent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4898
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4899
    |x y s isVertical sepSize|
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4900
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4901
    self isVisible ifFalse:[^ (0 @ 0) ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4902
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4903
    x := self horizontalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4904
    y := self verticalInset * 2.
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
    isVertical := menuPanel verticalLayout.
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 isSeparator ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4909
	x := x + (rawLabel widthOn:menuPanel).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4910
	y := y + (rawLabel heightOn:menuPanel).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4911
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4912
	MenuView showAcceleratorKeys == true ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4913
	    isVertical ifTrue:[ "/ only for vertical menus ...
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4914
		(s := self shortcutKeyAsString) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4915
		    x := x + LabelRightOffset + (s widthOn:menuPanel)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4916
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4917
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4918
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4919
	(isVertical and:[self hasSubmenu or:[submenuChannel notNil]]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4920
	    x := x + menuPanel subMenuIndicationWidth.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4921
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4922
	    s notNil ifTrue:[x := x + ShortcutKeyOffset]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4923
		    ifFalse:[x := x + LabelRightOffset]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4924
	].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4925
    ] ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4926
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4927
	sepSize := (self class separatorSize:(self separatorType)).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4928
	isVertical ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4929
	    x := x max:sepSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4930
	    y := y + (menuPanel font height)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4931
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4932
	    y := y max:sepSize
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4933
	].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4934
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4935
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4936
    ^ (x @ y)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4937
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4938
    "Modified: / 8.8.1998 / 01:38:26 / cg"
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4939
!
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
preferredExtentX
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4942
    "compute my preferred extent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4943
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4944
    ^ self preferredExtent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4945
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
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4948
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4949
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4950
    "
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4951
    |nm key prefix|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4952
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4953
    (key := self shortcutKey) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4954
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4955
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4956
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4957
    key isCharacter ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4958
	nm := key asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4959
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4960
	"/ this is somewhat complicated: we have the symbolic key at hand,
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4961
	"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4962
	"/ Ask the devices keyboardMap for the backtranslation.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4963
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4964
	nm := menuPanel device keyboardMap keyAtValue:key ifAbsent:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4965
	"/
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4966
	"/ some modifier-key combination ?
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4967
	"/
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4968
	(nm startsWith:#Cmd) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4969
	    prefix := #Cmd.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4970
	] ifFalse:[(nm startsWith:#Alt) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4971
	    prefix := #Alt.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4972
	] ifFalse:[(nm startsWith:#Meta) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4973
	    prefix := #Meta.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4974
	] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4975
	    prefix := #Ctrl.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4976
	]]]].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4977
	prefix notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4978
	    nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4979
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4980
	    nm := nm asString
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4981
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4982
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4983
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4984
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4985
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4986
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4987
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4988
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4989
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4990
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4991
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4992
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4993
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4994
    m notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4995
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4996
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4997
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4998
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  4999
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5000
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5001
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5002
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5003
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5004
hideSubmenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5005
    "hide submenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5006
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5007
    |subMenu id|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5008
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5009
    subMenu := self submenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5010
    subMenu realized ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5011
	(id := subMenu id) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5012
	    menuPanel device unmapWindow:id
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5013
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5014
    ] ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5015
       subMenu hide
1076
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5016
    ].
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5017
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5018
    subMenu windowGroup:nil.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5019
    menuPanel windowGroup removeView:subMenu.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5020
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5021
    "Modified: / 14.8.1998 / 17:36:01 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5022
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5023
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5024
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5025
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5026
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5027
    ^ menuPanel selection == self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5028
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5029
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5030
openSubmenuAt:aPoint
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5031
    "open submenu at a point
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5032
    "
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5033
    |top windowGrp subMenu|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5034
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5035
    windowGrp := menuPanel topMenu windowGroup.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5036
    subMenu   := self setupSubmenu.
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5037
    subMenu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5038
	^ self
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5039
    ].
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  5040
    subMenu font:(menuPanel topMenu font).
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5041
    subMenu becomesActiveMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5042
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5043
    windowGrp notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5044
	subMenu windowGroup:windowGrp.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5045
	windowGrp addTopView:subMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5046
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5047
    subMenu fixSize.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5048
    subMenu origin:aPoint.
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5049
"/    subMenu makeFullyVisible.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5050
    top := menuPanel topMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5051
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5052
    subMenu realized ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5053
	subMenu realize. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5054
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5055
	top device mapWindow:subMenu id.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5056
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5057
    subMenu makeFullyVisible.
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5058
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5059
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5060
"/    (top styleSheet at:'menu.autoSelectFirst') ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5061
"/        subMenu selectionIndex:1
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5062
"/    ]
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5063
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5064
    "Modified: / 19.5.1998 / 19:37:37 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5065
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5066
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5067
selected:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5068
    "change selection to a state. Dependant on the state open or hide an existing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5069
     submenu and perform a redraw
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5070
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5071
    |p d subMenu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5072
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5073
    subMenu := self submenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5074
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5075
    aState ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5076
	self redraw.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5077
	subMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5078
	    self hideSubmenu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5079
	].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5080
      ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5081
    ].
720
7187e69c300b some corrections for button press indication
tz
parents: 718
diff changeset
  5082
    menuPanel shown ifFalse:[^ self].  
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5083
    (self hasIndication not or: [isButton not]) ifTrue: [self redraw].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5084
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5085
    subMenu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5086
	menuPanel isPopUpView ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5087
	    menuPanel grabMouseAndKeyboard.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5088
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5089
	^ self.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5090
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5091
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  5092
    menuPanel verticalLayout ifTrue:[p := (layout right - 4) @ (layout top)]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5093
			    ifFalse:[p := (layout left)  @ (layout bottom)].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5094
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5095
    d := menuPanel device.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5096
    p := d translatePoint:p from:(menuPanel id) to:(d rootWindowId).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5097
    self openSubmenuAt:p.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5098
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5099
    "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
  5100
    "Modified: / 5.8.1998 / 00:15:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5101
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5102
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5103
!MenuPanel::Item::Adornment methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5104
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5105
accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5106
    "get the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5107
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5108
    ^ accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5109
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5110
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5111
accessCharacterPosition:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5112
    "set the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5113
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5114
    accessCharacterPosition := anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5115
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5116
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5117
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5118
    "ST/X goody; get argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5119
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5120
  ^ argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5121
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5122
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5123
argument:anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5124
    "ST/X goody; set argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5125
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5126
    argument := anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5127
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5128
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5129
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5130
    "get has choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5131
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5132
  ^ choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5133
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5134
    "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
  5135
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5136
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5137
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5138
    "set choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5139
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5140
    choice := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5141
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5142
    "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
  5143
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5144
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5145
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5146
    "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
  5147
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5148
    ^ choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5149
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5150
    "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
  5151
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5152
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5153
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5154
    "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
  5155
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5156
    choiceValue := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5157
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5158
    "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
  5159
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5160
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5161
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5162
    "get has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5163
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5164
  ^ indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5165
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5166
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5167
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5168
    "set has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5169
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5170
    indication := something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5171
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5172
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5173
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5174
    "get the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5175
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5176
  ^ shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5177
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5178
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5179
shortcutKey:aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5180
    "set the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5181
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5182
    shortcutKey := aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5183
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5184
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5185
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5186
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5187
version
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5188
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.125 1998-09-08 10:17:48 cg Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5189
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5190
MenuPanel initialize!