MenuPanel.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Feb 1999 19:35:13 +0100
changeset 1217 c6a4c536aa8c
parent 1212 9bd3220c9964
child 1218 6ce43fcb2603
permissions -rw-r--r--
care for items which change visibility via a block (and resize correctly)
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
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   324
    MenuView updateStyleCache.        
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   325
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
   326
    menuStyle := MenuView styleSheet.
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   327
    menuStyle isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   328
        "make sure that style sheet is present"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   329
        MenuView updateStyleCache.        
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   330
        menuStyle := MenuView styleSheet.
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   331
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   332
    style := menuStyle name.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   333
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   334
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   335
    DefaultForegroundColor := menuStyle colorAt:'pullDownMenu.foregroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   336
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   337
    DefaultForegroundColor isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   338
        DefaultForegroundColor := menuStyle colorAt:'menu.foregroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   339
                                            default:Color black.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   340
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   341
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   342
    (style == #motif or:[style == #iris]) ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   343
        DefaultBackgroundColor        := DefaultViewBackgroundColor.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   344
        DefaultHilightForegroundColor := DefaultForegroundColor.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   345
        DefaultHilightLevel     := 2.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   346
        DefaultLevel            := 0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   347
    ] ifFalse:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   348
        (DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   349
            DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   350
        ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   351
        DefaultLevel           := menuStyle at:'pullDownMenu.level' default:1.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   352
        DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   353
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   354
        DefaultBackgroundColor isNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   355
            DefaultBackgroundColor := menuStyle colorAt:'menu.backgroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   356
                                                default:DefaultViewBackgroundColor.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   357
        ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   358
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   359
        DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   360
        DefaultHilightForegroundColor isNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   361
            DefaultHilightForegroundColor := menuStyle colorAt:'menu.hilightForegroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   362
                                                       default:DefaultBackgroundColor
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   363
        ].
601
b0c2644b5982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   364
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   365
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   366
    DefaultDisabledForegroundColor := menuStyle colorAt:'menu.disabledForegroundColor'.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   367
    DefaultDisabledForegroundColor isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   368
        DefaultDisabledForegroundColor := menuStyle colorAt:'button.disabledForegroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   369
                                                    default:Color darkGray.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   370
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   371
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   372
    style == #motif ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   373
        DefaultHilightBackgroundColor := DefaultBackgroundColor
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   374
    ] ifFalse:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   375
        DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   376
        DefaultHilightBackgroundColor isNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   377
            DefaultHilightBackgroundColor := menuStyle colorAt:'menu.hilightBackgroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   378
                                                       default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]).
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   379
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   380
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   381
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   382
    DefaultGroupDividerSize := menuStyle at:'menu.groupDividerSize' default:6.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   383
    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
   384
    DefaultButtonItemSpace  := menuStyle at:'menu.buttonItemSpace' default:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   385
    DefaultFitFirstPanel    := menuStyle at:'menu.fitFirstPanel' default:true.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   386
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   387
    MenuView updateStyleCache.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   388
    DefaultFont := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   389
"/    font := menuStyle fontAt:'pullDownMenu.font'.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   390
"/    font isNil ifTrue:[font := menuStyle fontAt:'menu.font'].
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   391
"/    DefaultFont := font.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   392
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   393
    RightArrowForm := SelectionInListView rightArrowFormOn:Display.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   394
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
   395
    (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   396
        RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   397
    ] ifFalse:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   398
        RightArrowShadowForm := nil
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   399
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   400
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   401
    SelectionFrameBrightColor    := Color white.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   402
    SelectionFrameDarkColor      := Color black.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   403
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   404
    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
   405
    ButtonActiveLevel isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   406
        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
   407
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   408
    ButtonPassiveLevel           :=  menuStyle at:'menu.buttonPassiveLevel'.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   409
    ButtonPassiveLevel isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   410
        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
   411
    ].
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   412
    ButtonActiveBackgroundColor  :=  menuStyle at:'button.activeBackgroundColor' default: DefaultBackgroundColor.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
   413
    ButtonPassiveBackgroundColor := (menuStyle at:'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor.
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   414
    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
   415
    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
   416
    ButtonHalfLightColor         :=  menuStyle at:'button.halfLightColor'.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   417
    ButtonHalfShadowColor        :=  menuStyle at:'button.halfShadowColor'.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   418
    ButtonEdgeStyle              :=  menuStyle at:'button.edgeStyle'.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
   419
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   420
    ButtonEnteredBackgroundColor := menuStyle colorAt:'menu.buttonEnteredBackgroundColor'.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   421
    ButtonEnteredBackgroundColor isNil ifTrue:[
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   422
        ButtonEnteredBackgroundColor := menuStyle colorAt:'button.enteredBackgroundColor'
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   423
                                                  default:ButtonPassiveBackgroundColor.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   424
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   425
    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
   426
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   427
    Item updateStyleCache
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   428
1081
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
     self updateStyleCache
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   431
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   432
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   433
    "Modified: / 10.9.1998 / 21:40:32 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   434
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   435
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   436
!MenuPanel class methodsFor:'image registration'!
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
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   439
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   440
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   441
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   442
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   443
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   444
    anImage device == aDevice ifTrue:[
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   445
        ^ anImage
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   446
    ].
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   447
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   448
    Images isNil ifTrue:[ Images := IdentityDictionary new ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   449
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   450
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   451
        Images at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   452
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   453
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   454
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   455
        ^ image
794
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
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   458
    image := anImage copy onDevice:aDevice.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   459
    image clearMaskedPixels.
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   460
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   461
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   462
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   463
    "Modified: / 29.9.1998 / 12:02:41 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   464
!
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
lightenedImage:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   467
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   468
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   469
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   470
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   471
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   472
    LigthenedImages isNil ifTrue:[ LigthenedImages := IdentityDictionary new ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   473
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   474
    (deviceImages := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   475
	LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   476
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   477
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   478
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   479
	^ image
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   480
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   481
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   482
    ((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   483
	image := anImage copy lightened onDevice:aDevice.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   484
	image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   485
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   486
	image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   487
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   488
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   489
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   490
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   491
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   492
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   493
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   494
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   495
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   496
subMenu:aSubMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   497
    "create a submenu; can be redifined in derived classes
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   498
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   499
  ^ (self new) menu:aSubMenu.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   500
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   501
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   502
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   503
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   504
!MenuPanel methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   505
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   506
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   507
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   508
    "
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   509
    ^ self accept:(self selection)
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   510
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   511
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   512
accept:anItem
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   513
    "this is the topMenu: accept item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   514
    "
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   515
    |value item tgState itemIdx recv panel|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   516
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   517
    self superMenu notNil ifTrue:[
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   518
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   519
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
   520
    lastButtonSelected := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   521
    self selection:nil.
420
ca
parents: 417
diff changeset
   522
    self forceUngrabMouseAndKeyboard.
ca
parents: 417
diff changeset
   523
ca
parents: 417
diff changeset
   524
    (anItem notNil and:[anItem canAccept]) ifTrue:[
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   525
        tgState := anItem toggleIndication.
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   526
        panel   := anItem menuPanel.
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   527
        itemIdx := panel findFirst:[:el| el == anItem ].
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   528
        item    := anItem.
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   529
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   530
    ].
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   531
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   532
    self isPopUpView ifFalse:[
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   533
        self do:[:el| el updateIndicators].
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   534
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   535
    ] ifTrue:[
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   536
        self unmap.
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   537
        "/ give expose event a chance to arrive
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   538
        [shown] whileTrue:[
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   539
            self windowGroup processExposeEventsFor:self
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   540
        ].
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   541
        self destroy.
524
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
    value := self accept:item index:itemIdx toggle:tgState receiver:recv.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   544
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   545
    self isPopUpView ifTrue:[
1211
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   546
        self menuAdornmentAt:#value put:value.
e675ff419dc1 if popup:
Claus Gittinger <cg@exept.de>
parents: 1199
diff changeset
   547
        self menuAdornmentAt:#item  put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   548
    ].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   549
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   550
  ^ item.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   551
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   552
    "Modified: / 22.2.1999 / 20:14:48 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   553
!
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
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   556
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   557
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   558
    |value argument numArgs isKindOfValueModel|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   559
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   560
    anItem isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   561
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   562
      ^ nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   563
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   564
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   565
    self menuAdornmentAt:#hasPerformed put:(aReceiver isKindOf:ValueModel).
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   566
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   567
    (value := anItem value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   568
	^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   569
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   570
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   571
    (argument := anItem argument) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   572
	argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   573
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   574
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   575
    value isSymbol ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   576
	(value respondsTo:#numArgs) ifTrue:[numArgs := value numArgs]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   577
				   ifFalse:[numArgs := 0].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   578
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   579
	numArgs == 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   580
	    value value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   581
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   582
	    numArgs == 1 ifTrue:[value value:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   583
			ifFalse:[value value:argument value:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   584
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   585
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   586
      ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   587
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   588
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   589
    aReceiver isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   590
	^ value
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   591
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   592
    isKindOfValueModel := aReceiver isKindOf:ValueModel.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   593
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   594
    (numArgs := value numArgs) == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   595
	isKindOfValueModel ifFalse:[aReceiver perform:value]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   596
			    ifTrue:[aReceiver value:value]
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   597
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   598
	numArgs == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   599
	    isKindOfValueModel ifFalse:[aReceiver perform:value with:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   600
				ifTrue:[aReceiver value:value value:argument]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   601
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   602
	    isKindOfValueModel ifFalse:[aReceiver perform:value with:argument with:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   603
				ifTrue:[aReceiver value:value value:argument value:self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   604
	]
420
ca
parents: 417
diff changeset
   605
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   606
    self menuAdornmentAt:#hasPerformed put:true.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   607
  ^ value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   608
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   609
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   610
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   611
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   612
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   613
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   614
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   615
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   616
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   617
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   618
    "
971
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   619
    ^ (self lastItemAccepted) value
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   620
"/    |top|
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   621
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   622
"/    top := self topMenu.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   623
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   624
"/    (top menuAdornmentAt:#hasPerformed) == true ifTrue:[
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   625
"/        ^ self topMenu menuAdornmentAt:#value.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   626
"/    ].
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   627
"/  ^ nil
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   628
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   629
    "Modified: / 18.6.1998 / 23:37:09 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   630
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   631
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   632
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   633
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   634
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   635
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   636
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   637
  ^ self itemAt:stringOrNumber do:[:el| el 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
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   641
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   642
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   643
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   644
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   645
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   646
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   647
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   648
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   649
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   650
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   651
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   652
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   653
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   654
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   655
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   656
    self onEachPerform:#accessCharacterPosition: 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
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   660
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   661
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   662
    ^ self collect:[:anItem| anItem 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
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   666
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   667
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   668
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   669
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   670
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   671
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   672
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   673
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   674
  ^ self itemAt:stringOrNumber do:[:el| el argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   675
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   676
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   677
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   678
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   679
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   680
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   681
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   682
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   683
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   684
    "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
   685
     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
   686
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   687
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   688
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   689
    "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
   690
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   691
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   692
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   693
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   694
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   695
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   696
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   697
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   698
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   699
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   700
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   701
    aGroupSizes = groupSizes ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   702
	groupSizes := aGroupSizes copy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   703
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   704
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   705
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   706
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   707
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   708
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   709
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   710
  ^ self itemAt:stringOrNumber do:[:el| el 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
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   714
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   715
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   716
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   717
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   718
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   719
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   720
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   721
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   722
    ^ self collect:[:anItem| anItem label ]
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
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   727
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   728
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   729
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   730
	self removeAll.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   731
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   732
	labels notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   733
	    labels do:[:aLabel|(self createAtIndex:nil) label:aLabel]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   734
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   735
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   736
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   737
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   738
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   739
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   740
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   741
  ^ self itemAt:stringOrNumber do:[:el| el 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
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   745
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   746
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   747
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   748
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   749
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   750
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   751
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   752
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   753
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   754
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   755
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   756
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   757
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   758
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   759
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   760
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   761
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   762
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   763
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   764
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   765
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   766
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   767
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   768
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   769
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   770
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   771
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   772
    (receiver isNil and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   773
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   774
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   775
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   776
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   777
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   778
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   779
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   780
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   781
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   782
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   783
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   784
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   785
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   786
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   787
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   788
  ^ self itemAt:stringOrNumber do:[:el| el 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
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   792
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   793
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   794
    self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   795
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   796
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   797
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   798
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   799
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   800
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   801
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   802
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   803
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   804
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   805
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   806
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   807
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   808
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   809
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   810
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   811
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   812
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   813
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   814
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   815
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   816
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   817
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   818
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   819
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   820
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   821
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   822
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   823
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   824
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   825
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   826
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   827
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   828
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   829
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   830
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   831
!MenuPanel methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   832
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   833
disable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   834
    "disable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   835
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   836
    self enabled: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
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   840
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   841
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   842
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   843
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   844
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   845
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   846
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   847
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   848
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   849
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   850
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   851
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   852
enable
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   853
    "enable the menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   854
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   855
    self enabled: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
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   859
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   860
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   861
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   862
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   863
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   864
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   865
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   866
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   867
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   868
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   869
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   870
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   871
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   872
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   873
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   874
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   875
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   876
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   877
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   878
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   879
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   880
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   881
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   882
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   883
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   884
    self enabled == state ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   885
	^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   886
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   887
    enabled := state.
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   888
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   889
    self canDrawItem ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   890
	self do:[:anItem| anItem enabledStateOfMenuChangedTo:enabled]
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   891
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   892
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   893
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   894
enabledAt: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 itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   898
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   899
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   900
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   901
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   902
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   903
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   904
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   905
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   906
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   907
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   908
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   909
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   910
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   911
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   912
!MenuPanel methodsFor:'accessing channels'!
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
enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   915
    "gets a enable channel or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   916
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   917
    ^ enableChannel
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   918
!
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
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   921
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   922
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   923
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   924
	enableChannel removeDependent:self
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
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   927
    (enableChannel := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   928
	enableChannel addDependent:self.
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
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   931
!
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
menuHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   934
    "gets a menu holder or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   935
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   936
    ^ menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   937
!
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
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   940
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   941
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   942
    menuHolder notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   943
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   944
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   945
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   946
    (menuHolder := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   947
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   948
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   949
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   950
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   951
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   952
!MenuPanel methodsFor:'accessing color & font'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   953
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   954
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   955
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   956
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   957
    ^ activeBgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   958
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   959
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   960
activeBackgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   961
    "set the background drawing color used to highlight selection. You should not 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   962
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   963
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   964
    activeBgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   965
	activeBgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   966
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   967
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   968
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   969
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   970
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   971
    "Modified: / 6.6.1998 / 19:49:46 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   972
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   973
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   974
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   975
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   976
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   977
    ^ activeFgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   978
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   979
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   980
activeForegroundColor:aColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   981
    "set the foreground color used to highlight selections; You should not
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   982
     use this method; instead leave the value as defined in the styleSheet.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   983
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   984
    activeFgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   985
	activeFgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   986
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   987
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   988
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   989
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   990
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   991
    "Modified: / 6.6.1998 / 19:50:01 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   992
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   993
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   994
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   995
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   996
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   997
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   998
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   999
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1000
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1001
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1002
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1003
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1004
    super viewBackground ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1005
	super viewBackground:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1006
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1007
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1008
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1009
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1010
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1011
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1012
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1013
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1014
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1015
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1016
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1017
    ^ButtonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1018
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1019
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1020
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1021
    "get the button edge style
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1022
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1023
    ^ButtonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1024
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1025
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1026
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1027
    "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
  1028
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1029
    ^ buttonEnteredBgColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1030
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1031
    "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
  1032
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1033
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1034
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1035
    "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
  1036
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1037
    ^ ButtonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1038
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1039
    "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
  1040
    "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
  1041
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1042
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1043
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1044
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1045
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1046
    ^buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1047
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1048
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1049
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1050
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1051
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1052
    ^buttonHalfShadowColor
727
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
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1056
    "get the background drawing color used to light 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
    ^buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1059
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1060
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1061
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1062
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1063
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1064
    ^ButtonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1065
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1066
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1067
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1068
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1069
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1070
    ^buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1071
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1072
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1073
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1074
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1075
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1076
  ^ disabledFgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1077
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1078
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1079
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1080
disabledForegroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1081
    "set the foregroundColor drawing color used by disabled items. You should not
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1082
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1083
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1084
    disabledFgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1085
	disabledFgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1086
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1087
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1088
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1089
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1090
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1091
    "Modified: / 6.6.1998 / 19:50:17 / cg"
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
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1095
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1096
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1097
    (aFont notNil and:[aFont ~= font]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1098
	super font:(aFont on:device).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1099
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1100
	superMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1101
	    self extent:(self preferredExtent)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1102
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1103
	self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1104
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1105
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1106
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1107
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1108
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1109
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1110
  ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1111
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1112
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1113
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1114
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1115
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1116
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1117
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1118
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1119
    fgColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1120
	fgColor := aColor on:device.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1121
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1122
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1123
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1124
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1125
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1126
    "Modified: / 6.6.1998 / 19:50:46 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1127
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1128
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1129
lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1130
    "get the lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1131
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1132
    ^ lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1133
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1134
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1135
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1136
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1137
lightColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1138
    "set the light drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1139
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1140
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1141
    lightColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1142
	super lightColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1143
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1144
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1145
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1146
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1147
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1148
    "Modified: / 6.6.1998 / 19:50:39 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1149
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1150
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1151
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1152
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1153
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1154
    ^selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1155
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1156
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1157
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1158
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1159
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1160
    ^selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1161
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1162
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1163
shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1164
    "get the shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1165
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1166
    ^ shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1167
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1168
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1169
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1170
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1171
shadowColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1172
    "set the shadow drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1173
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1174
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1175
    shadowColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1176
	super shadowColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1177
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1178
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1179
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1180
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1181
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1182
    "Modified: / 6.6.1998 / 19:50:32 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1183
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1184
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1185
!MenuPanel methodsFor:'accessing dimensions'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1186
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1187
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1188
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1189
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1190
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1191
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1192
    (explicitExtent ~~ true) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1193
	(item := self itemAt:1) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1194
	    self rearrangeItems.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1195
	  ^ item height
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1196
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1197
	^ 4 + (font height + (font descent * 2)).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1198
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1199
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1200
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1201
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1202
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1203
    "compute and returns my preferred extent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1204
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1205
    |x y hasMenu shCtKey space hrzInset|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1206
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1207
    self numberOfItems == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1208
	^ 32 @ 32
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1209
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1210
    space := (items size + 1) * itemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1211
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1212
    self isFitPanel ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1213
	x := 0
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1214
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1215
	x := groupSizes size * groupDividerSize.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1216
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1217
    hrzInset := items first horizontalInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1218
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1219
    self verticalLayout ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1220
	"/ horizontal - add x-extents; take max of y-extents
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1221
	y := 0.
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
	self do:[:el| |elY elPref|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1224
	    el isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1225
		elPref := el preferredExtent.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1226
		x := x + elPref x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1227
		elY := elPref y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1228
		el isButton ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1229
		    elY := elY + (2 * DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1230
		    x := x + (2 * DefaultButtonItemSpace).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1231
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1232
		y := y max:elY.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1233
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1234
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1235
	x := x + space.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1236
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1237
	"/ vertical - add y-extents
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1238
	hasMenu := false.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1239
	shCtKey := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1240
	y := x.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1241
	x := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1242
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1243
	self do:[:el| |l e|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1244
	    el isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1245
		(l := el rawLabel) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1246
		    (e := l widthOn:self) > x ifTrue:[x := e].
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
		    (el hasSubmenu or:[el submenuChannel notNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1249
			hasMenu := true
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
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1252
		    (     (l := el shortcutKeyAsString) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1253
		     and:[(e := l widthOn:self) > shCtKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1254
		    ) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1255
			shCtKey := e
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1256
		    ].
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
		y := y + el preferredExtent y
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1259
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1260
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1261
	x := x + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1262
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1263
	(hasMenu or:[shCtKey ~~ 0]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1264
	    shortKeyInset := x + Item labelRightOffset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1265
	    x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1266
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1267
	    (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1268
		x := x + (Item shortcutKeyOffset) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1269
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1270
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1271
	y := y + space.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1272
	x := x + hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1273
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1274
    ^ (x @ y) + (margin + margin)
1095
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1275
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1276
    "Modified: / 24.8.1998 / 19:16:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1277
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1279
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1280
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1281
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1282
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1283
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1284
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1285
subMenuIndicationWidth
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1286
    ^ RightArrowForm width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1287
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1288
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1289
!MenuPanel methodsFor:'accessing items'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1290
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1291
itemAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1292
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1293
     If no item match nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1294
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1295
    |idx|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1296
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1297
    idx := self indexOf:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1299
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1300
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1301
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1303
itemAt:stringOrNumber do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
     the item not exists nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1306
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1307
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1308
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1309
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1310
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1311
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1312
     the item not exists the result of the exception block is returned (no arguments).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1313
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1317
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1318
  ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1319
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1320
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1321
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1322
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1323
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1324
    ^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1325
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1326
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1327
!MenuPanel methodsFor:'accessing look'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1328
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1329
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1330
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1331
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1332
    ^ButtonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1333
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1334
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1335
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1336
buttonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1337
    "get the button passive level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1338
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1339
    ^ButtonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1340
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1341
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1342
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1343
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1344
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1345
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1346
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1347
    ^ fitFirstPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1348
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1349
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1350
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1351
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1352
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1353
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1354
    (fitFirstPanel == aState or:[self isPopUpView]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1355
	fitFirstPanel := aState.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1356
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1357
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1358
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1359
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1360
groupDividerSize
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1361
    "get the size of the group dividers
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1362
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1363
  ^ groupDividerSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1364
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1365
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1366
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1367
groupDividerSize:aSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1368
    "set the size of the group dividers. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1369
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1370
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1371
    aSize ~~ groupDividerSize ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1372
	groupDividerSize := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1373
	self mustRearrange.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1374
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1375
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1376
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1377
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1378
itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1379
    "get the space space between to items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1380
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1381
  ^ itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1382
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1383
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1384
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1385
itemSpace:aSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1386
    "set the horizontal space between to items. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1387
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1388
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1389
    aSize ~~ itemSpace ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1390
	itemSpace := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1391
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1392
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1393
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1394
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1395
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1396
level:anInt
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1397
    super level:anInt.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1398
    mustRearrange := true
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1399
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1400
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1401
rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1402
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1403
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1404
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1405
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1406
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1407
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1408
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1409
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1410
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1411
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1412
  ^ self menuAdornmentAt:#showGroupDivider
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1413
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1414
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1415
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1416
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1417
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1418
    (self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1419
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1420
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1421
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1422
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1423
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1424
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1425
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1426
  ^ self menuAdornmentAt:#showSeparatingLines
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1427
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1428
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1429
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1430
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1431
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1432
    (self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1433
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1434
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1435
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1437
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1438
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1440
  ^ self menuAdornmentAt:#verticalLayout
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1441
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1442
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1443
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1444
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1445
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1446
    (self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1447
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1448
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1450
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1451
!MenuPanel methodsFor:'accessing submenu'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1452
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1454
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1457
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1458
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1459
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1460
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1464
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1465
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1466
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1467
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1470
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1471
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1472
	^ item submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1473
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1474
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1477
!MenuPanel methodsFor:'activation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1478
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1479
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1482
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1483
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1484
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1488
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1489
show
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
    "realize the view at its last position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1494
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1495
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1496
showAt:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1497
    "realize the view at aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1500
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1501
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1502
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1505
    "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
  1506
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1507
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1508
     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
  1509
     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
  1510
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1511
    "
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1512
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1513
    self rearrangeItems.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1514
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1515
    aBoolean ifTrue:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1516
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
    self origin:aPoint.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
    self makeFullyVisible.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1521
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1522
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1523
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1524
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1525
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1526
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1527
    ].
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1528
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1529
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1530
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1531
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1532
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1533
showAtPointer
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1534
    "realize the view at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1535
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
  ^ self showAt:(device pointerPosition) resizing:true
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1541
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1542
    "make myself visible at the screen center.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1543
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1544
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1545
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1546
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1547
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1548
    ^ self showAt:(top origin + (aView originRelativeTo:top) + (aView extent // 2) - (self extent // 2))
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1549
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1550
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1551
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1552
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1553
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1554
    "realize the menu at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1555
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1556
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1557
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1558
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1559
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1560
    "realize the menu at aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1561
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1562
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1563
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1564
    "Created: / 21.5.1998 / 14:15:57 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1565
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1566
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1567
!MenuPanel methodsFor:'active help'!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1568
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1569
helpText
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1570
    |appl item key|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1571
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1572
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1573
	(key := item activeHelpKey) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1574
	    (appl := self application) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1575
		^ appl helpTextForKey:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1576
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1577
	]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1578
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1579
    ^ nil.
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1580
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1581
    "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
  1582
!
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1583
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1584
helpTextAt:aPoint
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1585
    |menu point item key appl|
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1586
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1587
    menu := self superMenuAtX:aPoint x y:aPoint y.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1588
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1589
    menu isNil ifTrue:[
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1590
"/        'nil menu' printCR.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1591
	^ ''
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1592
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1593
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1594
    point := self translatePoint:aPoint to:menu.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1595
    item  := menu itemAtX:(point x) y:(point y).
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1596
    item  notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1597
	(key := item activeHelpKey) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1598
	    (appl := self application) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1599
		^ appl helpTextForKey:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1600
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1601
	]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1602
    ].
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1603
"/    'nil item' printCR.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1604
    ^ nil.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  1605
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  1606
    "Modified: / 31.7.1998 / 03:15:07 / cg"
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1607
! !
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  1608
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1609
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1610
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1611
createAtIndex:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1612
    "create an item and add this item to the index. In case of nil the item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1613
     is added to the end. If the index is not valid nil is returned otherwise
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1614
     the new created item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1615
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1616
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1617
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1618
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1619
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1620
    anIndexOrNil notNil ifTrue:[
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1621
        (anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1622
            ^ nil
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1623
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1624
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1625
    items isNil ifTrue:[
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1626
        items := OrderedCollection new
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1627
    ] ifFalse:[
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1628
        items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1629
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1630
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1631
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1632
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1633
        items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1634
    ] ifFalse:[
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1635
        items add:item beforeIndex:anIndexOrNil
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
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1643
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1644
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1645
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1646
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1647
	items remove:item.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1648
	item  destroy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1649
	items isEmpty ifTrue:[items := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1650
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1651
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1652
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1653
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1654
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1655
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1656
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1657
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1658
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1659
	self selection:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1660
	groupSizes := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1661
	self do:[:el| el destroy ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1662
	items := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1663
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1664
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1665
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1666
!MenuPanel methodsFor:'change & update'!
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
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1669
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1670
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1671
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
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
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1674
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1675
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1676
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1677
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1678
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1679
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1680
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1681
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1682
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1683
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1684
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1685
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1686
  ^ menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1687
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1688
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1689
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1690
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1691
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1692
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1693
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1694
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1695
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1696
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1697
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1698
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1699
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1700
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1701
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1702
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1703
    self disabledRedrawDo:[
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1704
        |menu newItems|
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1705
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1706
        self removeAll.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1707
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1708
        (menu := aMenu) notNil ifTrue:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1709
            (aMenu isCollection) ifTrue:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1710
                menu := Menu new.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1711
                menu fromLiteralArrayEncoding:aMenu.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1712
            ] ifFalse:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1713
                menu receiver notNil ifTrue:[receiver := menu receiver]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1714
            ].
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1715
            (newItems := menu menuItems) notNil ifTrue:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1716
                items := newItems collect:[:ni | 
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1717
                                |i|
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1718
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1719
                                i:= Item in:self.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1720
                                i menuItem:ni.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1721
                                i.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1722
                            ].
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1723
            ].
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1724
            self groupSizes:(menu groupSizes).
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1725
        ]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1726
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1727
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1728
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1729
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1730
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1731
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1732
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1733
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1734
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1735
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1736
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1737
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1738
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1739
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1740
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1741
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1742
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1743
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1744
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1745
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1746
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
  1747
    |shadow|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1748
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1749
    styleSheet is3D ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1750
	^ self displayRectangle:layout.
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1751
    ].
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1752
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1753
    shadow := buttonShadowColor.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1754
    isSelected ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1755
	buttonShadowColor == self buttonActiveBackgroundColor ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1756
	    shadow := self buttonActiveBackgroundColor darkened
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1757
	].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1758
    ].
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1759
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1760
    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
  1761
	shadow:      shadow 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1762
	light:       buttonLightColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1763
	halfShadow:  buttonHalfShadowColor 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1764
	halfLight:   buttonHalfLightColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1765
	style:       ButtonEdgeStyle
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1766
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1767
    "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
  1768
    "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
  1769
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1770
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1771
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
  1772
    |level|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1773
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1774
    level := selectedBool 
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1775
		ifTrue:[onLevel] 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1776
		ifFalse:[offLevel].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1777
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1778
    level ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1779
	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
  1780
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1781
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1782
    "Modified: / 20.8.1998 / 15:43:11 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1783
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1784
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1785
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1786
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1787
    "
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1788
    mustRearrange == true ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1789
	mustRearrange := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1790
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1791
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1792
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1793
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1794
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1795
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1796
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1797
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1798
rearrangeGroups
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1799
    |layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1800
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1801
     start "{ Class:SmallInteger }"
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
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1805
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1806
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1807
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1808
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1809
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1810
    (dltX := width - margin "- 2" - layout right) <= 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1811
	^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1812
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1813
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1814
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1815
    start == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1816
	^ self  "/ no item detected
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1817
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1818
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1819
    "/ change layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1820
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1821
    items from:start do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1822
	anItem isVisible ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1823
	    layout := anItem layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1824
	    layout  left:(layout  left + dltX).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1825
	    layout right:(layout right + dltX).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1826
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1827
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1828
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1829
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1830
rearrangeItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1831
    "recompute layout of my items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1832
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1833
    |expLast e grpDivSz layout isVert
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1834
     x  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1835
     y  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1836
     noItems "{ Class:SmallInteger }"
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1837
     f
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1838
    |
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1839
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1840
    mustRearrange ifFalse:[ ^ self ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1841
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1842
"/  fetch font from superMenu
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1843
    (superMenu notNil and:[(f := superMenu font) ~~ font]) ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1844
        super font:(f on:device)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1845
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1846
    (noItems := items size) == 0 ifTrue:[
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1847
        mustRearrange := false.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1848
      ^ self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1849
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1850
    expLast  := false.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1851
    isVert   := self verticalLayout.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1852
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1853
    self hasGroupDividers ifTrue:[
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1854
        self isFitPanel ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1855
            grpDivSz := groupDividerSize
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1856
        ] ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1857
            expLast := true.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1858
            x := margin.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1859
            e := self computeExtent.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1860
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1861
            isVert ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1862
                items do:[:el | x := x + el preferredExtent y].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1863
                y := e y.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1864
            ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1865
                items do:[:el|x := x + el preferredExtent x].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1866
                y := e x.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1867
            ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1868
            x := x + (noItems + 1 * itemSpace).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1869
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1870
            (grpDivSz := (y - x) // (groupSizes size)) <= 0 ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1871
                grpDivSz := nil
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1872
            ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1873
            x > (width-margin) ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1874
                grpDivSz := nil
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1875
            ]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1876
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1877
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1878
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1879
    (self isPopUpView or:[explicitExtent ~~ true]) ifTrue:[
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1880
        e := self preferredExtent copy.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1881
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1882
        self isPopUpView ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1883
            isVert ifTrue:[e y:1.0]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1884
                  ifFalse:[e x:1.0]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1885
        ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1886
        self extent:e
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1887
    ] ifFalse:[
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1888
        e := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1889
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1890
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1891
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1892
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1893
    isVert ifTrue:[y := y + itemSpace]
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1894
          ifFalse:[x := x + itemSpace].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1895
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1896
    self keysAndValuesDo:[:anIndex :el| |org corn elPref|
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1897
        el isVisible ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1898
            el isButton ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1899
                org := Point x:(x+DefaultButtonItemSpace) y:(y+DefaultButtonItemSpace).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1900
            ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1901
                org := Point x:x y:y.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1902
            ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1903
            elPref := el preferredExtent.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1904
            isVert ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1905
                y := y + elPref y.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1906
                corn := (e x - margin @ y).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1907
                el isButton ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1908
                    corn := corn - (DefaultButtonItemSpace @ 0).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1909
                    el layout:(Rectangle origin:org corner:corn).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1910
                    y := y + (2 * DefaultButtonItemSpace).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1911
                ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1912
                    el layout:(Rectangle origin:org corner:corn).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1913
                ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1914
                y := y + itemSpace.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1915
            ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1916
                x := x + elPref x.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1917
                el isButton ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1918
                    x := x + DefaultButtonItemSpace.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1919
                    corn := (x @ (e y - margin)).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1920
                    corn := corn - (0 @ DefaultButtonItemSpace).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1921
                    el layout:(Rectangle origin:org corner:corn).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1922
                    x := x + DefaultButtonItemSpace.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1923
                ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1924
                    corn := (x @ e y).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1925
                    el layout:(Rectangle origin:org corner:corn).
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1926
                ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1927
                x := x + itemSpace.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1928
            ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1929
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1930
            (grpDivSz notNil and:[self hasGroupDividerAt:anIndex]) ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1931
                isVert ifTrue:[y := y + grpDivSz]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1932
                      ifFalse:[x := x + grpDivSz]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1933
            ]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1934
        ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1935
            org := Point x:x y:y.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1936
            el layout:(Rectangle origin:org corner:org)
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1937
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1938
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1939
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1940
    expLast ifTrue:[
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1941
        e := items last.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1942
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1943
        e isVisible ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1944
            layout := items last layout.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1945
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1946
            isVert ifTrue:[layout bottom:((self extent y) + 1)]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1947
                  ifFalse:[layout  right:((self extent x) + 1)].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1948
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1949
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1950
    self rearrangeGroups.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1951
    mustRearrange := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1952
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1953
    "Modified: / 19.1.1999 / 16:00:14 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1954
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1955
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1956
rearrangeItemsIfItemVisibilityChanged
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1957
    "if I have any items with changing visibility, rearrange"
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1958
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1959
    items do:[:item |
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1960
        item canChangeVisibility ifTrue:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1961
            mustRearrange := true.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1962
            self rearrangeItems.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1963
            ^ self
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1964
        ].
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1965
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1966
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1967
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1968
redrawX:x y:y width:w height:h
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1969
    "redraw a rectangle
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1970
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1971
    |start end isVrt x1 x2 y1 y2 item layout lnSz hrzInset prevClipArea|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1972
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1973
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1974
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1975
    self  paint:(self backgroundColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1976
    self  clearRectangleX:x y:y width:w height:h.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1977
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1978
    isVrt := self verticalLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1979
    end   := items size.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1980
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1981
    mustRearrange ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1982
	self isPopUpView not ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1983
	    explicitExtent := true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1984
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1985
	self rearrangeItems.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1986
	start := 1
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1987
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1988
	end == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1989
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1990
	isVrt ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1991
	    start := self findFirst:[:el| (el layout bottom) >= y ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1992
	    start == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1993
	    end := y + h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1994
	    end := self findLast:[:el| (el layout top) < end ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1995
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1996
	    start := self findFirst:[:el| (el layout right) >= x ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1997
	    start == 0 ifTrue:[ ^ self ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1998
	    end := x + w.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1999
	    end := self findLast:[:el| (el layout left) < end ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2000
	].
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
	(start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2003
	    start := start - 1
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2004
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2005
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2006
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2007
    (     self hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2008
     and:[self showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2009
     and:[self isFitPanel not]]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2010
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2011
	lnSz := groupDividerSize // 2
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2012
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2013
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2014
    end == 0 ifTrue:[^ self ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2015
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2016
    hrzInset := items first horizontalInset.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2017
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2018
    prevClipArea   := clipRect.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2019
    clipRect       := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2020
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2021
    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
  2022
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2023
    start to:end do:[:i|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2024
	item := items at:i.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2025
	item redraw.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2026
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2027
	(lnSz notNil and:[self hasGroupDividerAt:i]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2028
	    layout := item layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2029
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2030
	    isVrt ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2031
		x1 := layout left  + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2032
		x2 := layout right - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2033
		y1 := (layout bottom) + lnSz.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2034
		y2 := y1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2035
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2036
		x1 := (layout right) + lnSz.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2037
		x2 := x1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2038
		y1 := layout top.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2039
		y2 := layout bottom.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2040
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2041
	    self paint:(self shadowColor).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2042
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2043
	    self paint:(self lightColor).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2044
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2045
	    isVrt ifTrue:[y1 := y1 + 1. y2 := y1 ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2046
		 ifFalse:[x1 := x1 + 1. x2 := x1 ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2047
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2048
	    self displayLineFromX:x1 y:y1 toX:x2 y:y2
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2049
	]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2050
    ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2051
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2052
    clipRect := nil.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2053
    prevClipArea isNil ifTrue:[device noClipIn:drawableId  gc:gcId]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2054
		      ifFalse:[self clippingRectangle:prevClipArea].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2055
388
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2060
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2063
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2064
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2065
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2066
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2067
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2068
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2069
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2070
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2071
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2072
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2073
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2074
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2076
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2077
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2078
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2079
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2080
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2081
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2082
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2083
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2085
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2086
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2087
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2088
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2089
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2090
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2091
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2092
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2093
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2094
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2095
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2096
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2097
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2098
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2099
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2100
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2101
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2102
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2103
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2104
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2105
    i := self findFirst:[:el|(el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2106
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2107
    i ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2108
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2109
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2110
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2111
    something isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2112
	i := self findFirst:[:el|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2113
	    v := el value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2114
	    v isSymbol and:[v == something]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2115
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2116
	i ~~ 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2117
	    ^ i
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2118
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2119
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2120
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2121
    (something respondsTo:#string) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2122
	v := something string.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2123
      ^ self findFirst:[:el|el textLabel = v].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2124
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2125
  ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2126
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2127
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2128
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2129
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2130
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2131
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2132
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2133
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2134
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2135
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2136
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2137
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2138
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2139
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2140
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2141
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2142
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2143
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2144
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2145
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2146
    |menu point sensor sel|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2148
    (    (sensor := self sensor) notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2149
     and:[sensor hasButtonMotionEventFor:nil]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2150
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2151
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2152
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2153
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2154
    sensor anyButtonPressed ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2155
	"/ TODO: remember item over which pointer is
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2156
	"/ (for enteredFG/enteredBG/enteredLevel handling)
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2157
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2158
        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2159
	(buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2160
	or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2161
	    (self containsPointX:x y:y) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2162
		((sel := self itemAtX:x y:y) notNil 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2163
		and:[sel isButton 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2164
		and:[superMenu isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2165
		and:[sel canSelect]]]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2166
		    self itemEntered:sel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2167
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2168
		    self itemEntered:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2169
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2170
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2171
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2172
	^ self
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2173
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2174
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2175
    "/ ok, a button is pressed.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2176
    (buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2177
    or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2178
	self itemEntered:nil.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2179
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2180
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2181
    lastButtonSelected notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2182
	^ self
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2183
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2184
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2185
    (self containsPointX:x y:y) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2186
	((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
  2187
	    sel canSelect ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2188
		lastButtonSelected := sel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2189
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2190
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2191
	^ self selection:sel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2192
    ].
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2193
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2194
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2196
    menu isNil ifTrue:[
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2197
       ^ self selection:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2198
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2199
    point := self translatePoint:(x@y) to:menu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2200
    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
  2201
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2202
    "Modified: / 22.8.1998 / 12:51:17 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2203
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2204
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2205
buttonPress:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2206
    "any button pressed; open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2207
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2208
    |menu point item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2209
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2210
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2211
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2212
    menu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2213
	menu := self topMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2214
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2215
	point := self translatePoint:(x@y) to:menu.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2216
	item  := menu itemAtX:(point x) y:(point y)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2217
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2218
    menu selection:item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2219
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2220
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2221
buttonRelease:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2222
    "button release action; accept selection and close all views
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2223
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2224
    |menu item|
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2225
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2226
    menu := self topMenu activeMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2227
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2228
    (    menu hasSelection
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2229
     or:[menu isPopUpView not
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2230
     or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue)
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2231
				and:(menu mapTime)) > 200]]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2232
    ) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2233
	item := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2234
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2235
	(     (menu := self superMenuAtX:x y:y) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2236
	 and:[(item := menu selection) notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2237
	 and:[item submenu notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2238
	) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2239
	    menu selection:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2240
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2241
	    (    lastButtonSelected isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2242
	     or:[item isNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2243
	     or:[(menu itemAtX:x y:y) == lastButtonSelected]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2244
	    ) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2245
		item := nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2246
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2247
	    self topMenu accept:item
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2248
	]
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2249
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2250
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2251
    "Modified: / 27.2.1998 / 17:41:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2252
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2253
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2254
cursorPressed:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2255
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2256
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2257
    |next submenu item
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2258
     n     "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2259
     idx   "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2260
     first "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2261
    |
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2262
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2263
	^ superMenu cursorPressed:aKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2264
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2266
    self verticalLayout ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2267
	aKey == #CursorLeft  ifTrue:[^ self selection:nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2268
	aKey ~~ #CursorRight ifTrue:[next := aKey == #CursorDown].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2269
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2270
	aKey == #CursorUp ifTrue:[^ self selection:nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2271
	aKey ~~ #CursorDown ifTrue:[next := aKey == #CursorRight].        
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2272
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2273
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2274
    next isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2275
	(item := self selection) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2276
	    (submenu := item submenu) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2277
		idx := submenu findFirst:[:el| el canSelect ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2278
	      ^ submenu selectionIndex:idx
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2279
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2280
	  ^ self selection:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2281
	].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2282
      ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2283
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2284
    first := self findFirst:[:el| el canSelect ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2285
    first == 0 ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2286
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2287
    idx := self selectionIndex.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2288
    n   := 1 + (self sensor compressKeyPressEventsWithKey:aKey).
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2289
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2290
    n timesRepeat:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2291
	next ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2292
	    [((idx := idx + 1) <= items size and:[(items at:idx) canSelect not])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2293
	    ] whileTrue.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2294
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2295
	    idx > items size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2296
		idx := first
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2297
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2298
	] ifFalse:[    
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2299
	    [((idx := idx - 1) > 0  and:[(items at:idx) canSelect not])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2300
	    ] whileTrue.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2301
            
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2302
	    idx < 1 ifTrue:[ idx := self findLast:[:el| el canSelect ] ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2303
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2304
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2305
    self selectionIndex:idx
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2306
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2307
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2308
handleFocusNext
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2309
    "handle focus next key
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2310
    "
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2311
    |idx|
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2312
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2313
    (self isPopUpView or:[items isNil]) ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2314
        idx := self selectionIndex.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2315
        idx := items findFirst:[:el|el canSelect] startingAt:(1 + idx).
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2316
        idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2317
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2318
    self selection:nil.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2319
    self windowGroup focusNextFrom:self.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2320
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2321
!
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2322
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2323
handleFocusPrevious
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2324
    "handle focus previous
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2325
    "
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2326
    |idx sel|
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2327
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2328
    (self isPopUpView or:[items isNil]) ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2329
        sel := self selectionIndex.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2330
        idx := sel == 0 ifTrue:[self numberOfItems]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2331
                       ifFalse:[sel - 1].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2332
        idx := items findLast:[:el|el canSelect] startingAt:idx.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2333
        idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2334
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2335
    self selection:nil.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2336
    self windowGroup focusPreviousFrom:self.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2337
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2338
!
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2339
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2340
itemEntered:anItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2341
    |prevEnteredItem|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2342
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2343
    anItem == enteredItem ifTrue:[^ self].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2344
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2345
    prevEnteredItem := enteredItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2346
    enteredItem := anItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2347
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2348
    prevEnteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2349
	prevEnteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2350
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2351
    enteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2352
	enteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2353
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2354
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2355
    "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
  2356
    "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
  2357
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2358
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2359
keyPress:key x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2360
    "any key is pressed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2361
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2362
    |listOfItems item menu idx cIdx upperKey lowerKey rawKey|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2363
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2364
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2365
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2366
    [ menu shown ] whileFalse:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2367
        (menu := superMenu) isNil ifTrue:[^ self]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2368
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2369
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2370
    key == #Return ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2371
        ^ menu accept
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2372
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2373
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2374
    (key == #Tab or:[key == #FocusNext]) ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2375
        ^ self topMenu handleFocusNext
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2376
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2377
    key == #FocusPrevious ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2378
        ^ self topMenu handleFocusPrevious
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2379
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2380
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2381
    (     key == #CursorDown or:[key == #CursorUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2382
      or:[key == #CursorLeft or:[key == #CursorRight]]]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2383
    ) ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2384
        ^ menu cursorPressed:key
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2385
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2386
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2387
    rawKey := device keyboardMap keyAtValue:key ifAbsent:key.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2388
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2389
    listOfItems := self selectItemsForShortcutKey:rawKey.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2390
    listOfItems isNil ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2391
        listOfItems := self selectItemsForShortcutKey:key.
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2392
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2393
    listOfItems notNil ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2394
        item := listOfItems first.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2395
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2396
        item hasSubmenu ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2397
            ^ menu accept:item
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2398
        ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2399
        ^ self openMenusFromItems:listOfItems
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2400
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2401
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2402
    (self hasSelection not and:[superMenu notNil]) ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2403
        (superMenu containsPoint:(self translatePoint:(x@y) to:superMenu)) ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2404
            menu := superMenu
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2405
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2406
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2407
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2408
    cIdx := menu selectionIndex.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2409
    cIdx isNil ifTrue:[cIdx := 0].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2410
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2411
    upperKey := key asUppercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2412
    lowerKey := key asLowercase.
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  2413
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2414
    menu keysAndValuesDo:[:anIndex :el| |c l|
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2415
        (el canSelect and:[(l := el textLabel) notNil]) ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2416
            l size ~~ 0 ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2417
                (c := el accessCharacter) notNil ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2418
                    (c == upperKey or:[c == lowerKey]) ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2419
                        ^ menu selection:el
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2420
                    ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2421
                ] ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2422
                    ((c := l first) == upperKey or:[c == lowerKey]) ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2423
                        anIndex > cIdx ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2424
                            ^ menu selection:el
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2425
                        ] ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2426
                            idx isNil ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2427
                                idx := anIndex
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2428
                            ] ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2429
                                anIndex > idx ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2430
                                    anIndex ~~ cIdx ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2431
                                        idx := anIndex
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2432
                                    ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2433
                                ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2434
                            ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2435
                        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2436
                        
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2437
                    ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2438
                ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2439
            ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2440
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2441
    ].
417
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2442
    (item := menu itemAt:idx) isNil ifTrue:[
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2443
        menu hasSelection ifFalse:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2444
            (menu := menu superMenu) isNil ifTrue:[
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2445
                ^ super keyPress:key x:x y:y
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2446
            ]
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2447
        ]
417
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2448
    ].
5b6e4e3b44dd focusSequence no longer used; in SimpleView
ca
parents: 416
diff changeset
  2449
    menu selection:item.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2450
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  2451
    "Modified: / 8.8.1998 / 13:38:36 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2452
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2453
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2454
pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2455
    self itemEntered:nil.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2456
    super pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2457
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2458
    "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
  2459
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2460
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2461
sizeChanged:how
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2462
    self isFitPanel ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2463
	self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2464
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2465
    super sizeChanged:how
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2466
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2467
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2468
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2469
420
ca
parents: 417
diff changeset
  2470
forceUngrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2471
    "ungrab resources (mouse and keyboard)
420
ca
parents: 417
diff changeset
  2472
    "
ca
parents: 417
diff changeset
  2473
    |sensor|
ca
parents: 417
diff changeset
  2474
ca
parents: 417
diff changeset
  2475
    device ungrabPointer.
ca
parents: 417
diff changeset
  2476
ca
parents: 417
diff changeset
  2477
    (sensor := self sensor) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2478
	"/ make certain all X events have been received
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2479
	device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2480
	"/ now all events have been received.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2481
	"/ now, flush all pointer events
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2482
	sensor flushKeyboardFor:nil
420
ca
parents: 417
diff changeset
  2483
    ].
ca
parents: 417
diff changeset
  2484
    device ungrabKeyboard.
ca
parents: 417
diff changeset
  2485
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2486
    "Modified: / 2.2.1998 / 09:24:48 / stefan"
420
ca
parents: 417
diff changeset
  2487
!
ca
parents: 417
diff changeset
  2488
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2489
grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2490
    "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
  2491
     Only used for popUp menus."
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2492
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2493
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2494
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2495
    realized ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2496
	sensor := self sensor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2497
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2498
	device activePointerGrab ~~ self ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2499
	    sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2500
		sensor flushMotionEventsFor:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2501
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2502
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2503
	    (device grabPointerInView:self) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2504
		Delay waitForSeconds:0.1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2505
		(device grabPointerInView:self) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2506
		    "give up"
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2507
		    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2508
		    self unmap
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2509
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2510
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2511
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2512
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2513
	device activeKeyboardGrab ~~ self ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2514
	    sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2515
		device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2516
		sensor flushKeyboardFor:nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2517
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2518
	    device grabKeyboardInView:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2519
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2520
	    superMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2521
		self getKeyboardFocus
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2522
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2523
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2524
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2525
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2526
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2527
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2528
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2529
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2530
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2531
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2532
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2533
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2534
    device activePointerGrab == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2535
	device ungrabPointer.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2536
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2537
    device activeKeyboardGrab == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2538
	sensor := self sensor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2539
	sensor notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2540
	    "/ make certain all X events have been received
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2541
	    device sync.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2542
	    "/ now all events have been received.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2543
	    "/ now, flush all pointer events
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2544
	    sensor flushKeyboardFor:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2545
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2546
	device ungrabKeyboard.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2547
    ].
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2548
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2549
    "Modified: / 2.2.1998 / 10:27:12 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2550
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2551
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2552
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2553
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2554
imageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2555
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2556
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2557
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2558
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2559
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2560
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2561
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2562
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2563
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2564
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2565
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2566
!MenuPanel methodsFor:'initialize / release'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2567
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2568
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2569
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2570
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2571
    ^self
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2572
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2573
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2574
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2575
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2576
    "
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2577
    |style|
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2578
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2579
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2580
	style := styleSheet name.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2581
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2582
	(style ~~ #normal and:[style ~~ #mswindows]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2583
	    self borderWidth:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2584
	]
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2585
    ].
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
  2586
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2587
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2588
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2589
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2590
	(PopUpView styleSheet at:'popup.shadow' default:false) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2591
	    shadowView isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2592
		shadowView := (ShadowView onDevice:device) for:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2593
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2594
		self saveUnder:true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2595
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2596
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2597
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2598
	explicitExtent == true ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2599
	    (self width) == (superView width) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2600
		self verticalLayout:false
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
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2603
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2604
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2605
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2606
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2607
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2608
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2609
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2610
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2611
    self clearLastActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2612
    self do:[:el|el destroy].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2613
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2614
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2615
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2616
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2617
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2618
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2619
    items     := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2620
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2621
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2622
    "Modified: / 27.2.1998 / 17:41:25 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2623
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2624
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2625
fetchDeviceResources
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2626
    "fetch device colors, to avoid reallocation at redraw time"
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2627
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2628
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2629
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2630
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2631
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2632
    style := styleSheet name.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2633
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2634
    "/ 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
  2635
    "/ (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
  2636
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2637
    self isPopUpView ifFalse:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2638
        (style == #motif or:[style == #iris]) ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2639
            self topView == self superView ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2640
                self level:2
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2641
            ]
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2642
        ]
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2643
    ] ifTrue:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2644
        (style == #next or:[style == #normal]) ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2645
            onLevel := offLevel := 0
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2646
        ] ifFalse:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2647
            style == #openwin ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2648
                offLevel := 0.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2649
            ]
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2650
        ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2651
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2652
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2653
    superMenu isNil ifTrue:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2654
        fgColor                   := DefaultForegroundColor         onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2655
        activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2656
        activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2657
        disabledFgColor           := DefaultDisabledForegroundColor onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2658
        rightArrow                := RightArrowForm                 onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2659
        selectionFrameBrightColor := SelectionFrameBrightColor      onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2660
        selectionFrameDarkColor   := SelectionFrameDarkColor        onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2661
        buttonLightColor          := ButtonLightColor               onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2662
        buttonShadowColor         := ButtonShadowColor              onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2663
        ButtonHalfLightColor notNil ifTrue: [
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2664
            buttonHalfLightColor      := ButtonHalfLightColor           onDevice:device].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2665
        ButtonHalfShadowColor notNil ifTrue: [
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2666
            buttonHalfShadowColor     := ButtonHalfShadowColor          onDevice:device].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2667
        buttonEnteredBgColor      := ButtonEnteredBackgroundColor   onDevice:device.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2668
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2669
        (rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2670
            rightArrowShadow := rightArrowShadow onDevice:device
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2671
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2672
    ] ifFalse:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2673
        fgColor                   := superMenu foregroundColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2674
        activeBgColor             := superMenu activeBackgroundColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2675
        activeFgColor             := superMenu activeForegroundColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2676
        disabledFgColor           := superMenu disabledForegroundColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2677
        rightArrow                := superMenu rightArrow.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2678
        rightArrowShadow          := superMenu rightArrowShadow.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2679
        selectionFrameBrightColor := superMenu selectionFrameBrightColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2680
        selectionFrameDarkColor   := superMenu selectionFrameDarkColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2681
        buttonLightColor          := superMenu buttonLightColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2682
        buttonShadowColor         := superMenu buttonShadowColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2683
        buttonHalfLightColor      := superMenu buttonHalfLightColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2684
        buttonHalfShadowColor     := superMenu buttonHalfShadowColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2685
        buttonEnteredBgColor      := superMenu buttonEnteredBackgroundColor.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2686
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2687
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2688
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2689
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2690
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2691
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2692
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2693
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2694
    |style|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2695
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2696
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2697
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2698
    self viewBackground:DefaultBackgroundColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2699
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2700
    onLevel   := DefaultHilightLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2701
    offLevel  := DefaultLevel.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2702
    itemSpace := DefaultItemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2703
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2704
    groupDividerSize := DefaultGroupDividerSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2705
    fitFirstPanel := DefaultFitFirstPanel.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2706
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2707
    style := styleSheet name.
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2708
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2709
"/    style == #st80 ifTrue:[
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2710
"/        self level:0
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2711
"/    ] ifFalse:[
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2712
        self level:1.
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2713
"/    ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2714
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2715
    styleSheet is3D ifFalse:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2716
        self borderWidth:1
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2717
    ] ifTrue:[
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2718
        self borderWidth:0.
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2719
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2720
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2721
    "Modified: / 15.9.1998 / 12:50:14 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2722
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2723
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2724
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2725
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2726
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2727
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2728
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2729
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2730
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2731
    enabled := true.
1083
934218c3acfe level setting fixed.
Claus Gittinger <cg@exept.de>
parents: 1082
diff changeset
  2732
"/    self origin:0.0@0.0.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2733
    originChanged  := extentChanged := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2734
    explicitExtent := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2735
    shortKeyInset  := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2736
    mustRearrange  := false.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2737
"/    self borderWidth:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2738
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2739
    font := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2740
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2741
    "Modified: / 15.9.1998 / 12:49:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2742
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2743
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2744
mapped
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2745
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2746
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2747
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2748
    |anItemList|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2749
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2750
    self enableMotionEvents.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2751
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2752
    lastButtonSelected := nil.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2753
    self becomesActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2754
    super mapped.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  2755
    self do:[:anItem| anItem fetchImages ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2756
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2757
    anItemList := InitialSelectionQuerySignal raise.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2758
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2759
    self isPopUpView ifTrue:[
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2760
        self grabMouseAndKeyboard
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2761
    ] ifFalse:[
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2762
"/        styleSheet is3D ifTrue:[self borderWidth:0].
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2763
        super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2764
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2765
    self do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2766
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2767
    anItemList size > 0 ifTrue:[
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2768
"/        self invalidateRepairNow:false.
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2769
        self redrawX:0 y:0 width:width height:height.
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2770
        self openMenusFromItems:anItemList.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2771
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2772
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2773
    "Modified: / 2.2.1998 / 09:27:21 / stefan"
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2774
    "Modified: / 19.11.1998 / 12:59:00 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2775
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2776
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2777
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2778
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2779
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2780
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2781
    self isPopUpView ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2782
	"Because of #saveUnder of ShadowView the order of realize is significant:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2783
	 shadowView must be realized before self"
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2784
	self hiddenOnRealize:true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2785
	super realize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2786
	self resize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2787
	shadowView notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2788
	    shadowView realize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2789
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2790
	super map.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2791
	self raise.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2792
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2793
	super realize.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2794
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2795
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2796
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2797
recreate
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2798
    "this is called after a snapin. If the image was saved with an active menu,
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2799
     hide the menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2800
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2801
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2802
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2803
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2804
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2805
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2806
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2807
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2808
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2809
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2810
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2811
    self fetchDeviceResources.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2812
    items notNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2813
        items do:[:anItem |
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2814
            anItem reinitSubmenuStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2815
        ]
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2816
    ]
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2817
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2818
    "Created: / 10.9.1998 / 21:37:05 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2819
    "Modified: / 11.9.1998 / 13:20:57 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2820
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2821
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2822
unmap
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2823
    "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
  2824
     mouse events.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2825
    "
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2826
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2827
    self clearLastActiveMenu.
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  2828
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2829
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2830
    "/ Kludge for X11: after grabbing and ungrabbing other views may get buttonMotionEvents
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2831
    "/ 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
  2832
    "/ (Move from upperMenuPanel of NewLauncher to lowerMenuPanel)
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2833
    "/
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2834
    (superMenu notNil and:[superMenu shown and:[superMenu isPopUpView 
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2835
     or:[superMenu sensor anyButtonPressed]]]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2836
	superMenu grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2837
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2838
	self ungrabMouseAndKeyboard.
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2839
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2840
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2841
    shadowView notNil ifTrue:[shadowView unmap].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2842
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2843
    "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
  2844
    "Modified: / 27.2.1998 / 17:41:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2845
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2846
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2847
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2848
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2849
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2850
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2851
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2852
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2853
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2854
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2855
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2856
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2857
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2858
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2859
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2860
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2861
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2862
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2863
superMenu:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2864
    "set the supermenu starting from
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2865
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2866
    superMenu := aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2867
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2868
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2869
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2870
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2871
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2872
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2873
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2874
    top := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2875
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2876
    [ top superMenu notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2877
	top := top superMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2878
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2879
  ^ top
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2880
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2881
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2882
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2883
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2884
!MenuPanel methodsFor:'printing'!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2885
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2886
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2887
    "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
  2888
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2889
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2890
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2891
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2892
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2893
    self do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2894
	label  := anItem label ? ''.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2895
	string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2896
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2897
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2898
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2899
    "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
  2900
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2901
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2902
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2903
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2904
application
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2905
    |appl|
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2906
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2907
    superMenu notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2908
	^ superMenu application
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2909
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2910
    (appl := super application) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2911
	windowGroup notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2912
	    appl := windowGroup mainGroup topViews first application
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2913
	]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2914
    ].
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2915
  ^ appl
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2916
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2917
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2918
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2919
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2920
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2921
    |adm|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2922
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2923
    adm := adornment ? DefaultAdornment.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2924
  ^ adm at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2925
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2926
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2927
menuAdornmentAt:aSymbol put:something
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2928
    "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
  2929
     current stored value, true is returned otherwise false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2930
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2931
    (self menuAdornmentAt:aSymbol) == something ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2932
	^ false
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2933
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2934
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2935
	adornment := DefaultAdornment copy
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2936
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2937
    adornment at:aSymbol put:something.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  2938
  ^ true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2939
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2940
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2941
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2942
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2943
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2944
    aList isCollection ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2945
	items size >= aList size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2946
	    aList keysAndValuesDo:[:anIndex :anArg|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2947
		(items at:anIndex) perform:aSelector with:anArg
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2948
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2949
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2950
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2951
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2952
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2953
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2954
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2955
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2956
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2957
openMenusFromItems:anItemList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2958
    "open all menus derived from sequence of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2959
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2960
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2961
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2962
    (anItemList isNil or:[anItemList isEmpty]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2963
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2964
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2965
    item := anItemList removeLast.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2966
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2967
    item enabled ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2968
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2969
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2970
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2971
    InitialSelectionQuerySignal answer:anItemList do:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2972
	self selection:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2973
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2974
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2975
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2976
selectItemsForShortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2977
    "get sequence of items up to the item providing the key (inclusive). The
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2978
     first entry into the collection is the item providing the key, the last
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2979
     entry is the item in the topMenu( reverse )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2980
    "
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2981
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2982
    "/ cg: must limit the recursion (see GUIDemoToolBar - pressing CTRL in the recursive-link example)
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2983
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2984
    ^ self selectItemsForShortcutKey:aKey maxDepth:10
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2985
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2986
    "Modified: / 19.1.1999 / 16:00:22 / cg"
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2987
!
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2988
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2989
selectItemsForShortcutKey:aKey maxDepth:maxDepth
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2990
    "get sequence of items up to the item providing the key (inclusive). The
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2991
     first entry into the collection is the item providing the key, the last
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2992
     entry is the item in the topMenu( reverse )
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2993
    "
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2994
    |seq|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2995
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2996
    maxDepth <= 0 ifTrue:[^ nil].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2997
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2998
    self do:[:anItem|
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  2999
        anItem isEnabled ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3000
            anItem shortcutKey = aKey ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3001
                seq := OrderedCollection new.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3002
            ] ifFalse:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3003
                anItem hasSubmenu ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3004
                    seq := anItem submenu selectItemsForShortcutKey:aKey maxDepth:maxDepth-1
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3005
                ]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3006
            ].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3007
            seq notNil ifTrue:[
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3008
                seq add:anItem.
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3009
              ^ seq
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3010
            ]
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3011
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3012
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3013
  ^ nil
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3014
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3015
    "Created: / 19.1.1999 / 16:00:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3016
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3017
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3018
translatePoint:aPoint to:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3019
    "translate a point into a views point; in case of no view nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3020
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3021
    aView notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3022
	aView == self ifTrue:[^ aPoint].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3023
      ^ device translatePoint:aPoint from:(self id) to:(aView id)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3024
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3025
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3026
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3027
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3028
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3029
!MenuPanel methodsFor:'private activation'!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3030
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3031
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3032
    "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
  3033
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3034
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3035
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3036
    "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
  3037
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3038
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3039
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3040
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3041
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3042
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3043
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3044
    "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
  3045
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3046
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3047
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3048
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3049
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3050
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3051
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3052
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3053
    "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
  3054
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3055
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3056
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3057
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3058
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3059
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3060
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3061
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3062
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3063
    top activeMenu == self ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3064
	top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3065
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3066
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3067
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3068
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3069
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3070
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3071
    "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
  3072
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3073
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3074
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3075
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3076
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3077
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3078
!MenuPanel methodsFor:'private searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3079
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3080
itemAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3081
    "returns item at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3082
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3083
    self do:[:el| (el containsPointX:x y:y) ifTrue:[^el] ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3084
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3085
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3086
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3087
superMenuAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3088
    "returns supermenu at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3089
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3090
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3092
    (self containsPointX:x y:y) ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3093
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3094
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3095
    [ (menu := menu superMenu) notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3096
	(menu containsPoint:(self translatePoint:(x@y) to:menu)) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3097
	    ^ menu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3098
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3099
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3100
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3101
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3102
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3103
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3104
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3105
canDrawItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3106
    "returns true if an item could be drawn otherwise false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3107
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3108
    ^ (mustRearrange not and:[shown])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3109
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3110
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3111
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3112
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3113
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3114
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3115
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3116
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3117
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3118
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3119
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3120
    ^ (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
  3121
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3122
"/    |ext|
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3123
"/
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3124
"/    (x >= 0 and:[y >= 0]) ifTrue:[
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3125
"/        ext := self computeExtent.
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3126
"/      ^ (x < ext x and:[y < ext y])
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3127
"/    ].
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3128
"/    ^ false
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3129
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3130
    "Modified: / 29.1.1998 / 16:46:10 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3131
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3132
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3133
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3134
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3135
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3136
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3137
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3138
    groupSizes size ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3139
	i := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3140
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3141
	groupSizes do:[:t|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3142
	    (i := i + t) == anIndex ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3143
		^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3144
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3145
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3146
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3147
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3148
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3149
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3150
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3151
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3152
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3153
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3154
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3155
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3156
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3157
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3158
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3159
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3160
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3161
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3162
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3163
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3164
    "returns true if the panel is the first in the menu hierarchy in must
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3165
     be fit to the extent of its superView
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3166
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3167
    ^ self isPopUpView ifTrue:[false] ifFalse:[fitFirstPanel]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3168
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3169
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3170
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3171
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3172
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3173
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3174
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3175
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3176
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3177
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3178
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3179
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3180
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3181
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3182
  ^ self verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3183
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3184
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3185
!
c05874084d4c implement
ca
parents: 407
diff changeset
  3186
c05874084d4c implement
ca
parents: 407
diff changeset
  3187
type
428
ca
parents: 427
diff changeset
  3188
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3189
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3190
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3191
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3192
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3193
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3194
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3195
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3196
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3197
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3198
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3199
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3200
isValidSelection:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3201
    "returns true if something could be selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3202
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3203
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3204
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3205
    enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3206
	(item := self itemAt:something) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3207
	    ^ item canSelect
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3208
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3209
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3210
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3211
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3212
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3213
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3214
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3215
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3216
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3217
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3218
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3219
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3220
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3221
selection:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3222
    "change selection to an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3223
    "
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3224
    |item newSel hlp|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3225
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3226
    selection isNumber ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3227
	newSel := self itemAt:anItemOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3228
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3229
	(anItemOrNil notNil and:[anItemOrNil canSelect]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3230
	    newSel := anItemOrNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3231
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3232
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3233
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3234
    selection == newSel ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3235
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3236
    (item := selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3237
	selection := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3238
	item selected:false.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3239
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3240
    newSel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3241
	selection := newSel.
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3242
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3243
"/ 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
  3244
"/ but not the selected one ...
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3245
"/        ActiveHelp isActive ifTrue:[
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3246
"/            hlp := ActiveHelp currentHelpListener.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3247
"/            hlp initiateHelpFor:self atX:1 y:1 now:true.
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3248
"/        ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3249
	selection selected:true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3250
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3251
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3252
    "Modified: / 2.2.1998 / 10:13:46 / stefan"
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3253
    "Modified: / 31.7.1998 / 03:14:18 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3254
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3255
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3256
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3257
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3258
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3259
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3260
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3261
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3262
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3263
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3264
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3265
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3266
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3267
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3268
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3269
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3270
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3271
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3272
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3273
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3274
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3275
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3276
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3277
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3278
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3279
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3280
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3281
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3282
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3284
shortcutKeyOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3285
    ^ ShortcutKeyOffset
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3286
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3287
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3288
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3289
    ^ VerticalInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3290
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3291
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3292
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3293
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3294
separatorSize:aType
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3295
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3296
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3297
    aType == #doubleLine ifTrue:[^ 10 ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3298
    aType == #singleLine ifTrue:[^ 10 ].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3299
  ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3300
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3301
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3302
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3303
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3304
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3305
    "
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3306
    HorizontalInset       := 4.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3307
    VerticalInset         := 3.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3308
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3309
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3310
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3311
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3312
    LabelRightOffset      := 15.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3313
    ShortcutKeyOffset     := 5.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3314
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3315
    IndicatorOn  := self checkedImage.
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3316
    IndicatorOff := self uncheckedImage.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3317
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3318
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3319
!MenuPanel::Item class methodsFor:'image specs'!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3320
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3321
checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3322
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3323
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3324
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3325
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3326
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3327
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3328
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3329
     self checkOffIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3330
     ImageEditor openOnClass:self andSelector:#checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3331
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3332
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3333
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3334
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3335
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3336
	constantNamed:#'MenuPanel::Item checkOffIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3337
	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
  3338
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3339
checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3340
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3341
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3342
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3343
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3344
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3345
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3346
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3347
     self checkOnIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3348
     ImageEditor openOnClass:self andSelector:#checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3349
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3350
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3351
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3352
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3353
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3354
	constantNamed:#'MenuPanel::Item checkOnIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3355
	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
  3356
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3357
checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3358
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3359
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3360
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3361
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3362
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3363
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3364
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3365
     self checkedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3366
     ImageEditor openOnClass:self andSelector:#checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3367
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3368
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3369
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3370
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3371
    ^Icon
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3372
        constantNamed:#'MenuPanel::Item checkedImage'
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3373
        ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'****$H@@@MBEUUWP!!UUU4HUUT]BEUTGP!!ETA4HPTA]BD@AWP!!PAU4HUAU]BEUUWP/???4EUUUU@b') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3374
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3375
    "Modified: / 6.9.1998 / 22:29:58 / cg"
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3376
!
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3377
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3378
uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3379
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3380
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3381
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3382
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3383
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3384
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3385
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3386
     self uncheckedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3387
     ImageEditor openOnClass:self andSelector:#uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3388
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3389
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3390
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3391
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3392
    ^Icon
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3393
        constantNamed:#'MenuPanel::Item uncheckedImage'
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3394
        ifAbsentPut:[(Depth2Image new) width: 14; height: 14; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUPG???8A0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@\@@@ G@@@HA0@@B@Z*** @@@@@@b') ; colorMapFromArray:#[255 255 255 127 127 127 170 170 170 0 0 0]; mask:((Depth1Image new) width: 14; height: 14; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??3??O?<??3??O?<??3??O?<??3??O?<??3??@@a') ; yourself); yourself]
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3395
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3396
    "Modified: / 6.9.1998 / 22:24:24 / cg"
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3397
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3398
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3399
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3400
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3401
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3402
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3403
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3404
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3405
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3406
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3407
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3408
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3409
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3410
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3411
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3412
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3413
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3414
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3415
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3416
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3417
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3418
  ^ item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3419
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3420
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3421
!MenuPanel::Item methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3422
420
ca
parents: 417
diff changeset
  3423
canAccept
ca
parents: 417
diff changeset
  3424
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  3425
    "
ca
parents: 417
diff changeset
  3426
  ^ (self enabled and:[self hasSubmenu not])
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3427
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3428
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3429
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3430
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3431
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3432
    |arg|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3433
723
4f05cbdcaede once again some corrections for button press indication
tz
parents: 720
diff changeset
  3434
    self hasIndication ifTrue:[    
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3435
	arg := self indicationValue not.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3436
	self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3437
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3438
	self hasChoice ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3439
	    arg := self choiceValue.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3440
	    self choice value:arg.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3441
	    arg := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3442
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3443
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3444
    ^ arg
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3445
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3446
    "Modified: / 14.8.1998 / 16:13:37 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3447
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3448
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3449
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3450
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3451
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3452
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3453
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3454
    accessCharacterPosition isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3455
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3457
  ^ (rawLabel string) at:accessCharacterPosition ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3458
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3459
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3460
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3461
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3462
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3463
  ^ accessCharacterPosition
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3464
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3465
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3466
accessCharacterPosition:anIndex
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3467
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3468
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3469
    accessCharacterPosition ~~ anIndex ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3470
	accessCharacterPosition := anIndex.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3471
	self updateRawLabel.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3472
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3473
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3474
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3475
activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3476
    ^ activeHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3477
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3478
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3479
activeHelpKey:aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3480
    activeHelpKey := aHelpKey
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3481
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3482
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3483
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3484
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3485
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3486
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3487
  ^ adornment argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3488
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3489
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3490
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3491
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3492
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3493
    self argument ~~ anArgument ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3494
	self adornment argument:anArgument.
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
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3498
compareAccessCharacterWith:aKey
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3499
    "returns true if key is my access character
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3500
    "
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3501
    ^ self accessCharacter == aKey
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3502
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3503
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3504
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3505
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3506
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3507
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3508
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3509
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3510
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3511
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3512
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3513
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3514
    "
475
b604babd1f4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  3515
    |i rest s|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3516
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3517
    accessCharacterPosition := nil.
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3518
    label := aLabel value.
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3519
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3520
    (label isString and:[(s := label size) > 1]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3521
	i := 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3522
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3523
	[((i := label indexOf:$& startingAt:i) ~~ 0 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3524
	and:[i < s])] whileTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3525
	    rest := label copyFrom:(i+1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3526
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3527
	    i == 1 ifTrue:[label := rest]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3528
		  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3529
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3530
	    (label at:i) == $& ifTrue:[i := i + 1]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3531
			      ifFalse:[accessCharacterPosition := i].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3532
	    s := s - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3533
	]
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3534
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3535
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3536
    self updateRawLabel
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3537
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3538
    "Modified: / 31.7.1998 / 00:52:26 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3539
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3540
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3541
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3542
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3543
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3544
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3545
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3546
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3547
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3548
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3549
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3550
    ^ nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3551
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3552
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3553
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3554
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3555
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3556
    nameKey := aNameKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3557
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3558
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3559
rawLabel
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3560
    "returns my printable Label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3561
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3562
    ^ rawLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3563
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3564
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3565
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3566
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3567
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3568
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3569
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3570
  ^ adornment shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3571
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3572
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3573
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3574
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3575
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3576
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3577
    self shortcutKey ~~ aKey ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3578
	self adornment shortcutKey:aKey.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3579
	self redraw.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3580
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3581
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3582
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3583
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3584
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3585
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3586
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3587
    ^ startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3588
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3589
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3590
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3591
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3592
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3593
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3594
    (startGroup isNil or:[startGroup == #right]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3595
	startGroup := aSymbol
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3596
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3597
	self warn:('not supported group: ', aSymbol printString ).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3598
    ]
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3599
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3600
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3601
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3602
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3603
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3604
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3605
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3606
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3607
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3608
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3609
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3610
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3611
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3612
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3613
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3614
    (aSubMenu notNil 
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3615
     and:[(aSubMenu isView or:[aSubMenu isKindOf:Menu]) not]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3616
	^ self submenuChannel:aSubMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3617
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3618
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3619
    (subMenu := aSubMenu) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3620
	aSubMenu class == Menu ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3621
	    subMenu := MenuPanel new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3622
	    menuPanel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3623
		subMenu receiver:menuPanel receiver.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3624
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3625
	    subMenu menu:aSubMenu
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
	(subMenu notNil and:[subMenu isView]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3628
	    subMenu superMenu:menuPanel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3629
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3630
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3631
1068
155168a813ad oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  3632
    "Modified: / 10.8.1998 / 13:26:28 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3633
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3634
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3635
textLabel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3636
    "returns my textLabel or nil if none text
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3637
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3638
    (rawLabel respondsTo:#string) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3639
	^ rawLabel string
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3640
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3641
  ^ nil
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3642
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3643
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3644
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3645
    "gets value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3646
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3647
    ^ value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3648
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3649
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3650
value:something
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3651
    "could be a value holder, an action or selector
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3652
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3653
    value := something.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3654
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3655
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3656
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3657
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3658
    "
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3659
    self value:aValue.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3660
    self argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3661
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3662
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3663
!MenuPanel::Item methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3664
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3665
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3666
    "get choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3667
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3668
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3669
  ^ adornment choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3670
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3671
    "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
  3672
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3673
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3674
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3675
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3676
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3677
    |old new|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3678
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3679
    old := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3680
    old == something ifTrue:[^ self].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3681
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3682
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3683
	old removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3684
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3685
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3686
    new := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3687
    new isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3688
	new := self aspectAt:new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3689
	new isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3690
	    new := something
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3691
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3692
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3693
    (self isKindOfValueHolder:new) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3694
	new addDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3695
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3696
    self adornment choice:new.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3697
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3698
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3699
    "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
  3700
    "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
  3701
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3702
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3703
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3704
    "get choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3705
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3706
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3707
  ^ adornment choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3708
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3709
    "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
  3710
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3711
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3712
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3713
    "set choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3714
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3715
    |old|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3716
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3717
    self adornment choiceValue:something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3718
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3719
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3720
    "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
  3721
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3722
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3723
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3724
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3725
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3726
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3727
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3728
    menuPanel enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3729
	enableChannel isSymbol ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3730
	    state := self aspectAt:enableChannel.
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
	    (self isKindOfValueHolder:state) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3733
		enableChannel := state.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3734
		enableChannel addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3735
		state := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3736
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3737
		state := state value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3738
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3739
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3740
	    state := enableChannel value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3741
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3742
      ^ state ~~ false
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3743
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3744
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3745
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3746
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3747
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3748
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3749
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3750
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3751
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3752
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3753
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3754
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3755
	oldState := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3756
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3757
	    enableChannel removeDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3758
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3759
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3760
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3761
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3762
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3763
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3764
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3765
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3766
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3767
	    enableChannel addDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3768
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3769
	    enableChannel isSymbol ifTrue:[^ self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3770
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3771
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3772
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3773
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3774
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3775
    newState ~~ oldState ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3776
	(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3777
	    self drawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3778
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3779
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3780
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3781
    "Modified: / 27.10.1997 / 16:13:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3782
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3783
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3784
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3785
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3786
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3787
    adornment isNil ifTrue:[^ nil].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3788
  ^ adornment indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3789
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3790
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3791
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3792
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3793
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3794
    |old|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3795
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3796
    old := self indication.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3797
    old == something ifTrue:[^ self].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3798
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3799
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3800
	old removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3801
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3802
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3803
    (self isKindOfValueHolder:something) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3804
	something addDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3805
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3806
    self adornment indication:something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3807
    self updateRawLabel.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3808
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3809
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3810
isButton
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3811
    "returns whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3812
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3813
    ^ isButton
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3814
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3815
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3816
isButton:anBoolean
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3817
    "sets whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3818
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3819
    isButton := anBoolean.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3820
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3821
    layout notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3822
	self redrawAsButton
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3823
    ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3824
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3825
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3826
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3827
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3828
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3829
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3830
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3831
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3832
  ^ submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3833
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3834
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3835
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3836
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3837
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3838
    submenuChannel := aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3839
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3840
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3841
!MenuPanel::Item methodsFor:'accessing dimension'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3842
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3843
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3844
    "gets height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3845
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3846
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3847
	^ self preferredExtent y
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3848
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3849
    ^ layout height
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3850
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3851
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3852
horizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3853
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3854
    isButton ifTrue: [^menuPanel buttonPassiveLevel + HorizontalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3855
    ^HorizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3856
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3857
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3858
layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3859
    "returns my layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3860
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3861
    ^ layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3862
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3863
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3864
layout:aLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3865
    "set a new layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3866
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3867
    layout := aLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3868
    self redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3869
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3870
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3871
verticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3872
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3873
    isButton ifTrue: [^menuPanel buttonPassiveLevel + VerticalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3874
    ^VerticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3875
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3876
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3877
width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3878
    "gets width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3879
    "
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3880
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3881
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3882
	^ self preferredExtent x
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3883
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  3884
    ^ layout width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3885
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3886
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3887
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3888
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3889
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3890
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3891
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3892
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3893
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3894
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3895
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3896
    (appl isKindOf:ValueModel) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3897
	^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3898
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3899
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3900
    (appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3901
	Object messageNotUnderstoodSignal handle:[:ex|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3902
	    ex parameter selector == aKey ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3903
		ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3904
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3905
	] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3906
	    (appl isKindOf:ApplicationModel) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3907
		ifTrue:[value := appl aspectFor:aKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3908
		ifFalse:[value := appl perform:aKey]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3909
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3910
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3911
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3912
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  3913
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3914
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3915
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3916
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3917
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3918
choiceChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3919
    "called when the choice changed
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3920
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3921
    |indicator|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3922
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3923
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3924
	indicator := self choiceForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3925
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3926
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3927
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3928
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3929
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3930
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3931
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3932
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3933
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3934
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3935
    self redraw
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3936
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3937
    "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
  3938
    "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
  3939
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3940
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3941
enabledStateOfMenuChangedTo:aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3942
    "enabled state of menu changed to aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3943
    "
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3944
    rawLabel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3945
	self drawLabel
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3946
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3947
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3948
!
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3949
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3950
indicationChanged
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3951
    "called when the indication changed
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3952
    "
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3953
    |indicator|
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3954
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3955
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3956
	indicator := self indicatorForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3957
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3958
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3959
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3960
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3961
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3962
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3963
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3964
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3965
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3966
    ].
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3967
    self redraw
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3968
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3969
    "Modified: / 14.8.1998 / 17:19:38 / cg"
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3970
!
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3971
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3972
update:something with:aParameter from:changedObject
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3973
    |indicator|
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3974
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3975
    changedObject == self indication ifTrue:[
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3976
        ^ self indicationChanged
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3977
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3978
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3979
    changedObject == self choice ifTrue:[
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3980
        ^ self choiceChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3981
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3982
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3983
    changedObject == enableChannel ifTrue:[
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3984
        (rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3985
            self drawLabel
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3986
        ].
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3987
        ^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3988
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3989
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3990
    changedObject == isVisible ifTrue:[
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3991
        menuPanel mustRearrange.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3992
        menuPanel rearrangeItems.
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  3993
        ^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3994
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  3995
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3996
    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
  3997
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3998
    "Modified: / 14.8.1998 / 16:13:41 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3999
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4000
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4001
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4002
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4003
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4004
    |indicator| 
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4005
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4006
    (indicator := self indication) notNil ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4007
"/        (isButton and:[menuPanel isPopUpView]) ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4008
"/            (self isKindOfValueHolder:indicator) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4009
"/                ^ self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4010
"/            ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4011
"/        ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4012
	self indicationChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4013
    ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4014
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4015
    "Modified: / 14.8.1998 / 15:19:38 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4016
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4017
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4018
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4019
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4020
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4021
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4022
    "
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4023
    |item label rcv|
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4024
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4025
    label := self label.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4026
    item  := MenuItem labeled:(label printString).
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4027
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4028
    label isImage ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4029
	rcv := ResourceRetriever new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4030
	rcv className:#MenuEditor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4031
	rcv selector:#iconUnknown.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4032
	item labelImage:rcv.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4033
    ].
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4034
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4035
    item activeHelpKey:activeHelpKey.
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4036
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4037
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4038
	item enabled:(enableChannel value)
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4039
    ].
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4040
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4041
    item accessCharacterPosition:(self accessCharacterPosition).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4042
    item startGroup:(self startGroup).
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4043
    item argument:(self argument).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4044
    item nameKey:(self nameKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4045
    item shortcutKeyCharacter:(self shortcutKey).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4046
    item value:(value value).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4047
    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
  4048
    item choice:(self choice value).
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4049
    item choiceValue:(self choiceValue).
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4050
    item isVisible:(self isVisible).
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4051
    item isButton:isButton.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4052
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4053
    submenuChannel isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4054
	item submenuChannel:submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4055
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4056
	self submenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4057
	    item submenu:(self submenu asMenu)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4058
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4059
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4060
  ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4061
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4062
    "Modified: / 14.8.1998 / 15:47:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4063
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4064
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4065
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4066
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4067
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4068
    |var lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4069
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4070
    menuPanel disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4071
	label := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4072
	activeHelpKey := aMenuItem activeHelpKey.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4073
	self enabled:(aMenuItem enabled).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4074
	self nameKey:(aMenuItem nameKey).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4075
	self indication:(aMenuItem indication).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4076
	self choice:(aMenuItem choice).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4077
	self choiceValue:(aMenuItem choiceValue).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4078
	self isButton:(aMenuItem isButton).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4079
	self startGroup:(aMenuItem startGroup).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4080
	self isVisible:(aMenuItem isVisible).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4081
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4082
	(var := aMenuItem accessCharacterPosition) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4083
	    self accessCharacterPosition:var.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4084
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4085
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4086
	(lbl := aMenuItem labelImage value) isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4087
	    lbl := aMenuItem rawLabel. "/ avoid translating &'s twice
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4088
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4089
	self label:lbl.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4090
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4091
	self shortcutKey:(aMenuItem shortcutKeyCharacter).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4092
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4093
	(var := aMenuItem argument) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4094
	    self argument:var.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4095
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4096
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4097
	submenuChannel := aMenuItem submenuChannel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4098
	self submenu:(aMenuItem submenu).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4099
	self value:(aMenuItem value).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4100
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  4101
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4102
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4103
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4104
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4105
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4106
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4107
drawLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4108
    "draw label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4109
    "
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4110
    |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
  4111
     buttonLevel isSelected clr|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4112
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4113
    self isVisible ifFalse:[^ self].
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4114
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4115
    img := rawLabel.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4116
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4117
    asc := menuPanel font ascent.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4118
    h   := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4119
    l   := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4120
    t   := layout top.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4121
    hrzInset := self horizontalInset.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4122
    isSelected := self drawSelected.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4123
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4124
    self enabled ifTrue:[
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4125
        fg := isSelected ifTrue:[self activeForegroundColor]
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4126
                        ifFalse:[menuPanel foregroundColor].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4127
    ] ifFalse:[
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4128
        fg := menuPanel disabledForegroundColor.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4129
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4130
        (img := disabledRawLabel) isNil ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4131
            img := self disabledRawLabel
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4132
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4133
    ].
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4134
    menuPanel paint:fg.
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4135
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4136
    "/ t := t + menuPanel level.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4137
    y := t + ((h - (img heightOn:menuPanel)) // 2).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4138
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4139
    (self textLabel) notNil ifTrue:[
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4140
        y := y + asc.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4141
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4142
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4143
    isButton ifTrue:[   
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4144
        (isSelected or:[self indicationValue == true]) ifTrue:
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4145
        [   
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4146
            img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4147
            buttonLevel := menuPanel buttonActiveLevel.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4148
        ] ifFalse:[   
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4149
            img displayOn:menuPanel x:(l + hrzInset) y:y.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4150
            self isEntered ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4151
                buttonLevel := menuPanel buttonEnteredLevel
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4152
            ] ifFalse:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4153
                buttonLevel := menuPanel buttonPassiveLevel
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4154
            ]
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4155
        ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4156
        buttonLevel ~~ 0 ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4157
            menuPanel 
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4158
                drawButtonEdgesInLayout:layout 
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4159
                withLevel:buttonLevel
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4160
                selected:isSelected.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4161
        ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4162
        ^ self
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4163
    ].
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4164
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4165
"/ 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
  4166
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4167
    img displayOn:menuPanel x:(l + hrzInset) y:y.
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4168
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4169
    "/ DRAW SHORTCUT KEY
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4170
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4171
    MenuView showAcceleratorKeys == true ifTrue:[
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4172
        menuPanel isVerticalLayout ifTrue:[ "/ only for vertical menus ...
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4173
            (scKey:= self shortcutKeyAsString) notNil ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4174
                (x := menuPanel shortKeyInset) == 0 ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4175
                    x := hrzInset + LabelRightOffset + (img widthOn:menuPanel)
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4176
                ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4177
                x := l + x.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4178
                y := t + ((h - (scKey heightOn:menuPanel)) // 2).
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4179
                y := y + asc.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4180
                scKey displayOn:menuPanel x:x y:y. 
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4181
            ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4182
        ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4183
    ].
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  4184
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4185
    "/ DRAW SUBMENU INDICATION
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4186
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4187
    (menuPanel isVerticalLayout and:[self submenu notNil]) ifTrue:[
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4188
        arrow := menuPanel rightArrow.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4189
        x := layout right - arrow width - hrzInset.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4190
        y := t + (h - arrow height // 2).
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4191
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4192
        (menuPanel styleSheet is3D not
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4193
        or:[(img := menuPanel rightArrowShadow) isNil]) ifTrue:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4194
            ^ menuPanel displayForm:arrow x:x y:y
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4195
        ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4196
        cLa := menuPanel shadowColor.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4197
        cLb := menuPanel lightColor.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4198
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4199
        isSelected ifFalse:[
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4200
            fg  := cLa.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4201
            cLa := cLb.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4202
            cLb := fg
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4203
        ].
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4204
        menuPanel paint:cLa.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4205
        menuPanel displayForm:arrow x:x y:y.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4206
        menuPanel paint:cLb.
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4207
        menuPanel displayForm:img x:x y:y. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4208
    ]
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  4209
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4210
    "Modified: / 6.9.1998 / 21:48:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4211
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4212
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4213
drawSelected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4214
    "return true if item is selected or if item implements
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4215
     a toggle in a radio group which is selected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4216
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4217
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4218
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4219
    self isSelected ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4220
	^ true
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4221
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4222
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4223
	^ ((holder := self choice) notNil and:[holder value = self choiceValue])
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4224
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4225
    ^ false
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4226
!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4227
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4228
redraw
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4229
    "redraw item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4230
    "
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4231
    |isSelected ownBgCol showItemSep type paint lgCol shCol
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4232
     h  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4233
     w  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4234
     l  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4235
     t  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4236
     r  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4237
     b  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4238
     x  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4239
     y  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4240
     hrzInset "{ Class:SmallInteger }"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4241
     isEntered
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4242
    |
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4243
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4244
    (self isVisible and:[menuPanel canDrawItem]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4245
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4246
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4247
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4248
    isSelected := self drawSelected.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4249
    isEntered := self isEntered.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4250
    hrzInset   := self horizontalInset.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4251
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4252
    isSelected ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4253
	(isButton and:[isEntered]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4254
	    paint := self buttonEnteredBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4255
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4256
	    paint := self backgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4257
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4258
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4259
	paint := self activeBackgroundColor
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4260
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4261
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4262
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4263
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4264
    b := layout bottom.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4265
    h := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4266
    w := layout width.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4267
    (ownBgCol := self backgroundColorFromLabel) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4268
	menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4269
	menuPanel fillRectangle:layout.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4270
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4271
	self hasIndication ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4272
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4273
	    menuPanel fillRectangle:layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4274
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4275
	    menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4276
	    x := (rawLabel icon width) + hrzInset + 4.
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 fillRectangleX:l y:t width:x height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4279
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4280
	    menuPanel fillRectangleX:(l + x) y:t width:(w - x) height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4281
	    ownBgCol := nil.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4282
       ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4283
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4284
    lgCol       := menuPanel lightColor.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4285
    shCol       := menuPanel shadowColor.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4286
    showItemSep := menuPanel showSeparatingLines.
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4287
    type        := self separatorType.
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4288
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4289
    type notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4290
	type == #blankLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4291
	    ^ self
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
	"/ draw separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4294
	menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4295
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4296
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4297
	    l := l + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4298
	    r := r - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4299
	    y := t - 1 + (h // 2).
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
	    type == #doubleLine ifTrue:[y := y - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4302
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4303
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4304
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4305
	    y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4306
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4307
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4308
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4309
		y := y + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4310
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4311
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4312
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4313
		y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4314
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4315
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4316
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4317
	    x := l - 1 + (w // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4318
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4319
	    type == #doubleLine ifTrue:[x := x - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4320
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4321
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4322
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4323
	    x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4324
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4325
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4326
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4327
		x := x + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4328
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4329
		menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4330
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4331
		x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4332
		menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4333
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4334
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4335
	^ self
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4336
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4337
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4338
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4339
	^ self drawLabel
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4340
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4341
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4342
    showItemSep ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4343
	|col index item lfSep rtSep|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4344
	col := menuPanel paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4345
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4346
	index := menuPanel indexOfItem:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4347
	item  := menuPanel itemAtIndex:(index - 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4348
	lfSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4349
	item  := menuPanel itemAtIndex:(index + 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4350
	rtSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4351
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4352
	menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4353
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4354
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4355
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4356
		menuPanel displayLineFromX:l y:t - 1 toX:r y:t - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4357
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4358
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4359
		menuPanel displayLineFromX:l y:b - 1 toX:r y:b - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4360
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4361
	    menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4362
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4363
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4364
		menuPanel displayLineFromX:l y:t - 2 toX:r y:t - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4365
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4366
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4367
		menuPanel displayLineFromX:l y:b - 2 toX:r y:b - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4368
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4369
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4370
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4371
		menuPanel displayLineFromX:l - 1 y:t toX:l - 1 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4372
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4373
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4374
		menuPanel displayLineFromX:r - 1 y:t toX:r - 1 y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4375
	    ]. 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4376
	    menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4377
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4378
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4379
		menuPanel displayLineFromX:l - 2 y:t toX:l - 2 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4380
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4381
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4382
		menuPanel displayLineFromX:r - 2 y:t toX:r - 2 y:b.
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
	]
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4385
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4386
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4387
    self drawLabel.  
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4388
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4389
    (ownBgCol notNil and:[isSelected]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4390
	ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4391
				 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4392
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4393
	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
  4394
	menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).  
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4395
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4396
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4397
    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
  4398
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4399
    "Modified: / 20.8.1998 / 15:11:33 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4400
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4401
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4402
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4403
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4404
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4405
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4406
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4407
    |channel|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4408
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4409
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4410
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4411
    (enableChannel notNil and:[self isKindOfValueHolder:enableChannel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4412
	enableChannel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4413
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4414
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4415
    (isVisible notNil and:[self isKindOfValueHolder:isVisible]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4416
	isVisible removeDependent:self
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4417
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4418
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4419
    channel := self indication.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4420
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4421
	channel removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4422
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4423
    channel := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4424
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4425
	channel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4426
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4427
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4428
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4429
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4430
    "Modified: / 14.8.1998 / 14:37:57 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4431
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4432
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4433
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4434
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4435
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4436
    menuPanel := aPanel.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4437
    isButton  := false.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4438
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4439
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4440
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4441
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4442
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4443
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4444
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4445
    disabledRawLabel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4446
	(     rawImage notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4447
	 and:[(rawImage respondsTo:#colorMap)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4448
	 and:[rawImage colorMap notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4449
	) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4450
	    disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4451
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4452
	    disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage.
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
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4455
		(isButton
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4456
		  or:[((self indication notNil or:[self choice notNil])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4457
		 and:[label class == LabelAndIcon])]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4458
		) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4459
		    disabledRawLabel := LabelAndIcon form:(rawLabel icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4460
						    image:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4461
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4462
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4463
		    disabledRawLabel := LabelAndIcon form:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4464
						    image:(rawLabel image)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4465
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4466
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4467
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4468
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4469
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4470
    ^ disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4471
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4472
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4473
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4474
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4475
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4476
    |icon|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4477
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4478
    rawImage notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4479
	rawLabel isImage ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4480
	    rawLabel := menuPanel imageOnDevice:rawImage
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4481
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4482
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4483
		(icon := rawLabel image) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4484
		    rawLabel image:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4485
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4486
		(icon := rawLabel icon) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4487
		    (self indication isNil and:[self choice isNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4488
			rawLabel icon:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4489
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4490
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4491
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4492
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4493
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4494
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4495
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4496
updateRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4497
    "recreate rawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4498
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4499
    |char size form|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4500
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4501
    label isNil ifTrue:[        "/ not yet initialized
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4502
	^ self
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4503
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4504
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4505
    (form := self indicatorForm) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4506
	form := self choiceForm
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4507
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4508
    rawImage         := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4509
    disabledRawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4510
    rawLabel         := label value.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4511
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4512
    rawLabel isString ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4513
	rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4514
	    rawLabel := rawLabel withoutSeparators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4515
	].        
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4516
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4517
	form isNil ifTrue:[                             "/ check for separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4518
	    rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4519
		  rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4520
		^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4521
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4522
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4523
	    rawLabel size == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4524
		char := rawLabel first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4525
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4526
		(char == $- or:[char == $=]) ifTrue:[   "/ other line separators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4527
		    label := String new:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4528
		    label at:1 put:char.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4529
		    rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4530
		  ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4531
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4532
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4533
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4534
	rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4535
	    rawLabel := label value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4536
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4537
	size := self accessCharacterPosition.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4538
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4539
	(size notNil and:[size <= rawLabel size]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4540
	    rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4541
		rawLabel := Text string:rawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4542
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4543
	    rawLabel emphasisAt:size add:#underline
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4544
	]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4545
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4546
    rawLabel isImage ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4547
	rawImage := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4548
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4549
	form notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4550
	    isButton ifTrue:[form := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4551
	    rawLabel := LabelAndIcon form:form image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4552
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4553
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4554
	rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4555
	    rawImage := rawLabel icon.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4556
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4557
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4558
		rawLabel image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4559
		rawLabel icon:form
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4560
	    ]                
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4561
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4562
	    rawImage := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4563
	    rawLabel isNil ifTrue:[rawLabel := ''].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4564
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4565
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4566
		rawLabel := LabelAndIcon icon:form string:rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4567
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4568
		disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4569
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4570
	].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4571
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4572
    menuPanel shown ifTrue:[ self fetchImages ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4573
    menuPanel mustRearrange
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4574
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4575
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4576
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4577
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4578
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4579
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4580
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4581
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4582
    isButton ifTrue: [^menuPanel buttonActiveBackgroundColor].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4583
    ^menuPanel activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4584
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4585
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4586
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4587
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4588
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4589
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4590
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4591
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4592
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4593
adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4594
    "returns adornment; if not existing yet a new instance
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4595
     is created
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4596
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4597
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4598
	adornment := Adornment new
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4599
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4600
  ^ adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4601
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4602
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4603
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4604
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4605
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4606
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4607
    isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor].
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4608
    ^menuPanel backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4609
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4610
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4611
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4612
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4613
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4614
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4615
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4616
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4617
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4618
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4619
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4620
    run := run first.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4621
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4622
    run size == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4623
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4624
	    ^ run value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4625
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4626
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4627
	run do:[:r|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4628
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4629
		^ r value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4630
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4631
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4632
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4633
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4634
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4635
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4636
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4637
    "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
  4638
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4639
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4640
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4641
    isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4642
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4643
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4644
    "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
  4645
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4646
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4647
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4648
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4649
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4650
    |holder|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4651
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4652
    (holder := self choice) isNil ifTrue:[^ nil].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4653
1107
0ace8de67a4e better styled round choice images + test choice values only for #=
tz
parents: 1101
diff changeset
  4654
    holder value = self choiceValue ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4655
	^ self class checkOnIcon
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4656
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4657
    ^ self class checkOffIcon
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4658
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4659
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4660
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4661
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4662
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4663
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4664
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4665
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4666
    |subm argument sel|
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4667
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4668
    subm := nil.
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4669
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4670
    aRecv notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4671
	submenuChannel last ~~ $: ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4672
	    Object messageNotUnderstoodSignal handle:[:ex|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4673
		|selector|
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
		((selector := ex parameter selector) == submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4676
		or:[selector == #aspectFor:]) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4677
		    ex reject
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
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4680
		subm := aRecv aspectFor:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4681
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4682
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4683
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4684
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4685
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4686
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4687
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4688
		    subm := aRecv perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4689
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4690
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4691
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4692
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4693
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4694
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4695
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4696
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4697
		    subm := aRecv class perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4698
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4699
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4700
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4701
	    (argument := self argument) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4702
		sel := submenuChannel asSymbol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4703
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4704
		    ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4705
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4706
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4707
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4708
		    subm := aRecv perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4709
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4710
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4711
		subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4712
		    Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4713
			ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4714
			    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4715
			].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4716
		    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4717
			subm := aRecv class perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4718
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4719
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4720
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4721
	]
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4722
    ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4723
    ^ subm
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4724
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4725
    "Modified: / 4.8.1998 / 17:40:09 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4726
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4727
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4728
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4729
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4730
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4731
    |indication numArgs sel recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4732
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4733
    (indication := self indication) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4734
	^ nil                                           "/ has no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4735
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4736
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4737
    indication isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4738
	(numArgs := indication numArgs) ~~ 0 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4739
	    numArgs == 2 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4740
		recv := menuPanel receiver.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4741
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4742
		(recv isKindOf:ValueModel) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4743
		    (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4744
			sel := indication copyFrom:1 to:(indication indexOf:$:).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4745
			indication := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4746
			sel := sel asSymbol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4747
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4748
			Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4749
			    ex parameter selector == sel ifFalse:[
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4750
"/                                Transcript showCR:'no indication for: ' , sel.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4751
				ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4752
			    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4753
			] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4754
			    indication := recv perform:sel with:self argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4755
			]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4756
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4757
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4758
		^ indication value == true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4759
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4760
	    indication := (indication copyWithoutLast:1) asSymbol
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4761
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4762
	indication := self aspectAt:indication.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4763
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4764
	(self isKindOfValueHolder:indication) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4765
	    self adornment indication:indication.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4766
	    indication addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4767
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4768
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4769
    ^ indication value == true
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4770
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4771
    "Modified: / 8.8.1998 / 02:15:15 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4772
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4773
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4774
indicationValue:aValue
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4775
    "returns indication value or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4776
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4777
    |numArgs indication recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4778
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4779
    (indication := self indication) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4780
	^ self                                          "/ has no indication
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4781
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4782
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4783
    indication isSymbol ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4784
	(self isKindOfValueHolder:indication) ifTrue:[  "/ is value holder
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4785
	    indication value:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4786
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4787
	^ self
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4788
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4789
    recv := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4790
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4791
    (recv isKindOf:ValueModel) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4792
	recv value:indication value:aValue.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4793
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4794
	(      (numArgs := indication numArgs) ~~ 0
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4795
	  and:[recv notNil or:[(recv := menuPanel application) notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4796
	) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4797
	    Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4798
		(ex parameter selector ~~ indication) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4799
		    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4800
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4801
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4802
		numArgs == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4803
		    recv perform:indication with:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4804
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4805
		    recv perform:indication with:(self argument ? self) with:aValue
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4806
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4807
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4808
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4809
    ].
1026
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4810
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  4811
    "Modified: / 28.7.1998 / 20:47:08 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4812
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4813
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4814
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4815
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4816
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4817
    |value|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4818
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4819
    (value := self indicationValue) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4820
	^ nil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4821
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4822
  ^ 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
  4823
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4824
    "Created: / 14.8.1998 / 15:53:53 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4825
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4826
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4827
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4828
    "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
  4829
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4830
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4831
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4832
    "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
  4833
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4834
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4835
reinitSubmenuStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4836
    "returns my submenu or nil
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4837
    "
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4838
    subMenu notNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4839
        subMenu reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4840
    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4841
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4842
    "Created: / 10.9.1998 / 21:36:09 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4843
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4844
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4845
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4846
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4847
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4848
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4849
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4850
    rawLabel isNil ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4851
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4852
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4853
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4854
    (lbl := label value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4855
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4856
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4857
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4858
    lbl size == 1 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4859
	c := lbl first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4860
	c == $- ifTrue:[^ #singleLine].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4861
	c == $= ifTrue:[^ #doubleLine].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4862
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4863
  ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4864
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4865
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4866
setupSubmenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4867
    |appl recv subm|
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4868
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4869
    submenuChannel notNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4870
	submenuChannel isSymbol ifFalse:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4871
	    subm := submenuChannel
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4872
	] ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4873
	    appl := menuPanel application.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4874
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4875
	    (subm := self findSubMenuIn:appl) isNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4876
		(recv := menuPanel receiver) ~~ appl ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4877
		    subm := self findSubMenuIn:recv
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4878
		]
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4879
	    ]
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4880
	].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4881
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4882
	(subm := subm value) isArray ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4883
	    subm := Menu new fromLiteralArrayEncoding:subm.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4884
	    "/ cg: linked menus also may contain translations ...
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4885
	    subm notNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4886
		appl notNil ifTrue:[
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4887
		    subm findGuiResourcesIn:appl.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4888
		]                
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4889
	    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4890
	].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4891
	self submenu:subm.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4892
    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4893
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4894
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4895
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  4896
    "Modified: / 19.5.1998 / 19:36:56 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4897
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4898
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4899
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4900
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4901
canChangeVisibility
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4902
    "return true if I am not always visible
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4903
    "
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4904
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4905
    ^ isVisible notNil and:[isVisible ~~ true]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4906
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  4907
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4908
canSelect
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4909
    "returns true if item is selectable
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4910
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4911
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4912
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4913
    (self isVisible and:[self enabled and:[rawLabel notNil]]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4914
	((holder := self choice) isNil or:[holder value ~= self choiceValue]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4915
	    ^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4916
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4917
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4918
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4919
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4920
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4921
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4922
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4923
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4924
    (self isVisible and:[layout notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4925
	^ (     (x >= layout left)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4926
	    and:[x <  layout right
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4927
	    and:[y >  layout top
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4928
	    and:[y <= layout bottom]]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4929
	  )
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4930
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  4931
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4932
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4933
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4934
hasChoice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4935
    "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
  4936
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4937
  ^ self choice notNil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4938
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4939
    "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
  4940
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4941
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4942
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4943
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4944
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4945
  ^ self indication notNil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4946
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4947
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4948
hasSubmenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4949
    "returns true if a submenu exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4950
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4951
    ^ self submenu notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4952
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4953
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4954
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4955
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4956
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4957
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4958
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4959
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4960
isKindOfValueHolder:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4961
    "returns true if something is kind of vlaue holder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4962
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4963
    ^ ((something respondsTo:#value:) and:[something isBlock not])
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4964
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4965
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4966
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4967
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4968
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4969
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4970
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4971
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4972
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4973
    "
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4974
    ^ rawLabel isNil
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4975
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4976
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4977
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4978
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4979
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4980
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4981
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4982
    isVisible isSymbol ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4983
        state := self aspectAt:isVisible.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4984
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4985
        (self isKindOfValueHolder:state) ifTrue:[
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4986
            isVisible := state.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4987
            isVisible addDependent:self.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4988
            state := isVisible.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4989
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4990
    ] ifFalse:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4991
        state := isVisible
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4992
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4993
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4994
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  4995
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4996
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4997
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4998
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4999
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5000
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5001
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5002
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5003
    isVisible isNil ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5004
        oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5005
    ] ifFalse:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5006
        oldState := isVisible value.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5007
        (self isKindOfValueHolder:isVisible) ifTrue:[
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5008
            isVisible removeDependent:self
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5009
        ]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5010
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5011
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5012
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5013
    isVisible isNil ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5014
        newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5015
    ] ifFalse:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5016
        (self isKindOfValueHolder:isVisible) ifTrue:[
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5017
            isVisible addDependent:self
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5018
        ] ifFalse:[
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5019
            isVisible isSymbol ifTrue:[^ self]
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5020
        ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5021
        menuPanel shown ifFalse:[^ self].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5022
        newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5023
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5024
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5025
    newState ~~ oldState ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5026
        menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5027
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5028
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5029
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5030
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5031
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5032
preferredExtent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5033
    "compute my preferred extent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5034
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5035
    |x y s isVertical sepSize|
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5036
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5037
    self isVisible ifFalse:[^ (0 @ 0) ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5038
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5039
    x := self horizontalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5040
    y := self verticalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5041
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5042
    isVertical := menuPanel verticalLayout.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5043
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5044
    self isSeparator ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5045
	x := x + (rawLabel widthOn:menuPanel).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5046
	y := y + (rawLabel heightOn:menuPanel).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5047
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5048
	MenuView showAcceleratorKeys == true ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5049
	    isVertical ifTrue:[ "/ only for vertical menus ...
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5050
		(s := self shortcutKeyAsString) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5051
		    x := x + LabelRightOffset + (s widthOn:menuPanel)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5052
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5053
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5054
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5055
	(isVertical and:[self hasSubmenu or:[submenuChannel notNil]]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5056
	    x := x + menuPanel subMenuIndicationWidth.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5057
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5058
	    s notNil ifTrue:[x := x + ShortcutKeyOffset]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5059
		    ifFalse:[x := x + LabelRightOffset]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5060
	].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5061
    ] ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5062
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5063
	sepSize := (self class separatorSize:(self separatorType)).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5064
	isVertical ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5065
	    x := x max:sepSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5066
	    y := y + (menuPanel font height)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5067
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5068
	    y := y max:sepSize
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5069
	].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5070
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5071
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5072
    ^ (x @ y)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5073
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5074
    "Modified: / 8.8.1998 / 01:38:26 / cg"
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5075
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5076
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5077
preferredExtentX
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5078
    "compute my preferred extent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5079
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5080
    ^ self preferredExtent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5081
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5082
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5083
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5084
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5085
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5086
    "
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5087
    |nm key prefix|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5088
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5089
    (key := self shortcutKey) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5090
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5091
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5092
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5093
    key isCharacter ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5094
	nm := key asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5095
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5096
	"/ this is somewhat complicated: we have the symbolic key at hand,
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5097
	"/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5098
	"/ Ask the devices keyboardMap for the backtranslation.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5099
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5100
	nm := menuPanel device keyboardMap keyAtValue:key ifAbsent:key.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5101
	"/
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5102
	"/ some modifier-key combination ?
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5103
	"/
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5104
	(nm startsWith:#Cmd) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5105
	    prefix := #Cmd.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5106
	] ifFalse:[(nm startsWith:#Alt) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5107
	    prefix := #Alt.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5108
	] ifFalse:[(nm startsWith:#Meta) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5109
	    prefix := #Meta.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5110
	] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5111
	    prefix := #Ctrl.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5112
	]]]].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5113
	prefix notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5114
	    nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5115
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5116
	    nm := nm asString
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5117
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5118
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5119
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5120
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5121
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5122
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5123
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5124
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5125
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5126
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5127
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5128
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5129
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5130
    m notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5131
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5132
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5133
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5134
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5135
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5136
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5137
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5138
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5139
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5140
hideSubmenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5141
    "hide submenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5142
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  5143
    |subMenu id|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5144
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5145
    subMenu := self submenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5146
    subMenu realized ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5147
	(id := subMenu id) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5148
	    menuPanel device unmapWindow:id
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5149
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5150
    ] ifTrue:[
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5151
       subMenu hide
1076
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5152
    ].
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5153
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5154
    subMenu windowGroup:nil.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5155
    menuPanel windowGroup removeView:subMenu.
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5156
1bd7e9b6fee8 remove submenu from windowGroup when hiding
Claus Gittinger <cg@exept.de>
parents: 1074
diff changeset
  5157
    "Modified: / 14.8.1998 / 17:36:01 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5158
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5159
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5160
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5161
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5162
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5163
    ^ menuPanel selection == self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5164
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5165
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5166
openSubmenuAt:aPoint
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5167
    "open submenu at a point
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5168
    "
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5169
    |top windowGrp|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5170
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5171
    windowGrp := menuPanel topMenu windowGroup.
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5172
    self setupSubmenu.
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5173
    subMenu isNil ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5174
        ^ self
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  5175
    ].
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  5176
    subMenu font:(menuPanel topMenu font).
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5177
    subMenu becomesActiveMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5178
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5179
    windowGrp notNil ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5180
        subMenu windowGroup:windowGrp.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5181
        windowGrp addTopView:subMenu.
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5182
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5183
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5184
    "/ Q&D kludge - if any visibility attributes are blocks;
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5185
    "/ TODO: only invoke mustRearrange if any are blocks
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5186
    "/       (since I react correctly on valueHolder changes)
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5187
    subMenu rearrangeItemsIfItemVisibilityChanged.
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5188
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5189
    subMenu fixSize.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5190
    subMenu origin:aPoint.
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5191
"/    subMenu makeFullyVisible.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5192
    top := menuPanel topMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5193
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5194
    subMenu realized ifFalse:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5195
        subMenu realize. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5196
    ] ifTrue:[
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5197
        top device mapWindow:subMenu id.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5198
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5199
    subMenu makeFullyVisible.
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5200
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5201
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5202
"/    (top styleSheet at:'menu.autoSelectFirst') ifTrue:[
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5203
"/        subMenu selectionIndex:1
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5204
"/    ]
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5205
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5206
    "Modified: / 5.10.1998 / 12:16:27 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5207
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5208
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5209
selected:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5210
    "change selection to a state. Dependant on the state open or hide an existing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5211
     submenu and perform a redraw
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5212
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5213
    |p d subMenu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5214
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5215
    subMenu := self submenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5216
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5217
    aState ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5218
	self redraw.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5219
	subMenu notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5220
	    self hideSubmenu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5221
	].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5222
      ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5223
    ].
720
7187e69c300b some corrections for button press indication
tz
parents: 718
diff changeset
  5224
    menuPanel shown ifFalse:[^ self].  
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  5225
    (self hasIndication not or: [isButton not]) ifTrue: [self redraw].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5226
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5227
    subMenu isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5228
	menuPanel isPopUpView ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5229
	    menuPanel grabMouseAndKeyboard.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5230
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5231
	^ self.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5232
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5233
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  5234
    menuPanel verticalLayout ifTrue:[p := (layout right - 4) @ (layout top)]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5235
			    ifFalse:[p := (layout left)  @ (layout bottom)].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5236
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5237
    d := menuPanel device.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5238
    p := d translatePoint:p from:(menuPanel id) to:(d rootWindowId).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5239
    self openSubmenuAt:p.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5240
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  5241
    "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
  5242
    "Modified: / 5.8.1998 / 00:15:36 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5243
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5244
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5245
!MenuPanel::Item::Adornment methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5247
accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5248
    "get the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5249
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5250
    ^ accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5251
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5252
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5253
accessCharacterPosition:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5254
    "set the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5255
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5256
    accessCharacterPosition := anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5257
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5258
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5259
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5260
    "ST/X goody; get argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5261
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5262
  ^ argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5263
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5264
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5265
argument:anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5266
    "ST/X goody; set argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5267
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5268
    argument := anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5269
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5270
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5271
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5272
    "get has choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5273
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5274
  ^ choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5275
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5276
    "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
  5277
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5278
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5279
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5280
    "set choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5281
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5282
    choice := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5283
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5284
    "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
  5285
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5286
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5287
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5288
    "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
  5289
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5290
    ^ choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5291
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5292
    "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
  5293
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5294
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5295
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5296
    "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
  5297
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5298
    choiceValue := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5299
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5300
    "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
  5301
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5302
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5303
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5304
    "get has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5305
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5306
  ^ indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5307
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5308
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5309
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5310
    "set has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5311
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5312
    indication := something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5313
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5314
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5315
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5316
    "get the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5317
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5318
  ^ shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5319
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5320
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5321
shortcutKey:aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5322
    "set the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5323
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5324
    shortcutKey := aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5325
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5326
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5327
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5328
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5329
version
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5330
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.137 1999-02-25 18:35:13 cg Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5331
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5332
MenuPanel initialize!