MenuPanel.st
author ca
Wed, 08 Dec 1999 21:33:06 +0100
changeset 1630 01dc20096011
parent 1613 5e23d6be5918
child 1660 e4cf2881163e
permissions -rw-r--r--
grabbing cleaned up; to even allow a grabbing popUp inside an extendedComboBox !
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
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
    23
		buttonEnteredBgColor prevFocusView previousPointerGrab
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
    24
		previousKeyboardGrab'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    25
	classVariableNames:'InitialSelectionQuerySignal DefaultAdornment
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    26
		DefaultGroupDividerSize DefaultHilightLevel DefaultLevel
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    27
		DefaultItemSpace DefaultButtonItemSpace DefaultForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    28
		DefaultBackgroundColor DefaultHilightForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    29
		DefaultHilightBackgroundColor DefaultDisabledForegroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    30
		DefaultFitFirstPanel RightArrowForm RightArrowShadowForm
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    31
		SelectionFrameBrightColor SelectionFrameDarkColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    32
		ButtonActiveLevel ButtonPassiveLevel ButtonActiveBackgroundColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    33
		ButtonPassiveBackgroundColor ButtonLightColor ButtonShadowColor
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    34
		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle Images
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    35
		LigthenedImages ButtonEnteredBackgroundColor ButtonEnteredLevel'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    36
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    37
	category:'Views-Menus'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    38
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    39
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    40
Object subclass:#Item
729
18395718ec8e lighten the icon & image of a disabled LabelAndIcon if the
ca
parents: 728
diff changeset
    41
	instanceVariableNames:'layout menuPanel subMenu adornment rawLabel disabledRawLabel
18395718ec8e lighten the icon & image of a disabled LabelAndIcon if the
ca
parents: 728
diff changeset
    42
		enableChannel nameKey accessCharacterPosition value label
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
    43
		shortcutKey rawImage activeHelpKey activeHelpText submenuChannel
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
    44
		startGroup isButton isVisible'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    45
	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    46
		VerticalButtonInset LabelRightOffset ShortcutKeyOffset
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
    47
		IndicatorOn IndicatorOff'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    48
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    49
	privateIn:MenuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    50
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    51
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    52
Object subclass:#Adornment
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
    53
	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
    54
		choiceValue'
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    55
	classVariableNames:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    56
	poolDictionaries:''
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
    57
	privateIn:MenuPanel::Item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    58
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    59
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    60
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    61
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    62
copyright
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    63
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    64
 COPYRIGHT (c) 1997 by eXept Software AG
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    65
	      All Rights Reserved
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    66
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    67
 This software is furnished under a license and may be used
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    68
 only in accordance with the terms of that license and with the
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    69
 inclusion of the above copyright notice.   This software may not
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    70
 be provided or otherwise made available to, or used by, any
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    71
 other person.  No title to or ownership of the software is
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    72
 hereby transferred.
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    77
documentation
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    78
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    79
    a menu panel used for both pull-down-menus and pop-up-menus.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    80
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    81
    not yet finished MenuPanel class - this will eventually replace
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    82
    most of the MenuView and PopUpMenu stuff.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    83
    (and hopefully be ST-80 compatible ...)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    84
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    85
    To create a menu, there exists a MenuEditor which will generate
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    86
    a menu specification.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    87
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
    88
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    89
    [author:]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    90
	Claus Atzkern
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    91
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
    92
    [see also:]
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    93
	Menu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    94
	MenuItem
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
    95
	MenuEditor
388
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   100
examples
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   102
"
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   103
    start as PullDownMenu
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   104
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   105
    |top subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   107
    top := StandardSystemView new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   108
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   109
    mview := MenuPanel in:top.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   110
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   111
    labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   112
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   113
    mview verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   114
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   115
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   116
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   117
    mview shortcutKeyAt:2 put:#Cut.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   118
    mview accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   119
    mview accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   120
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   121
    mview enabledAt:5 put:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   122
    mview groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   123
    s1 := MenuPanel labels:labels.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   124
    s1 accessCharacterPositionAt:1 put:1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   125
    s1 accessCharacterPositionAt:2 put:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   126
    s1 groupSizes:#( 2 2 ).
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   127
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   128
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   130
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   131
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   132
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   133
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   134
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   135
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   136
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   137
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   138
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   139
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   140
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   141
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   142
    mview subMenuAt:2 put:(MenuPanel labels:labels).
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   143
    top extent:(mview preferredExtent).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   144
    top open.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   145
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   146
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   147
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   148
    start as PopUpMenu
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   149
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   150
    |subView mview desc s1 s2 s3 img lbs labels|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   151
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   152
    mview := MenuPanel new.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   153
    labels := #( 'foo' 'bar' 'baz' ).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   154
    mview level:2.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   155
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   156
    img := Image fromFile:'bitmaps/SBrowser.xbm'.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   157
    lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   158
    mview labels:lbs.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   159
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   160
    s1 := MenuPanel labels:labels.
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   161
    s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   162
    s3 := MenuPanel labels:lbs.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   163
    s1 subMenuAt:2 put:s2.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   164
    s1 subMenuAt:3 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   165
    s2 subMenuAt:3 put:s3.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   166
    s3 subMenuAt:3 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   167
    s3 shortcutKeyAt:3 put:$q.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   168
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   169
    mview subMenuAt:1 put:s1.
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   170
    mview subMenuAt:4 put:(MenuPanel labels:lbs).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   171
    (mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   172
    s1 shortcutKeyAt:1 put:#Copy.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   173
    s1 shortcutKeyAt:3 put:#Paste.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   174
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   175
    mview subMenuAt:2 put:(MenuPanel labels:labels).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   176
    mview startUp
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   177
										[exEnd]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   178
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   179
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   180
    start from menu spec
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   181
										[exBegin]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   182
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   183
436
c03d6faa41a6 process events befor accept
ca
parents: 434
diff changeset
   184
    menu := MenuPanel menu:
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   185
	#(#Menu #( #(#MenuItem 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   186
		    #label: 'File' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   187
		    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   188
		      #(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   189
				 (#MenuItem 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   190
				    #label: 'edit' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   191
				    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   192
				      #(#Menu #( #(#MenuItem #label: 'edit'  #value:#edit )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   193
						 #(#MenuItem #label: 'close' #value:#close)     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   194
					       )
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
					       nil
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
				  )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   199
				 #(#MenuItem #label: 'help' #value:#help )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   200
			       )
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
			       nil
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
		 ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   205
		#(#MenuItem #label: 'Inspect' #value:#inspectMenu ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   206
		#(#MenuItem #label: 'Bar' 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   207
			    #submenu:
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   208
			       #(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   209
					  #(#MenuItem #label: 'bar 2' #value:#bar2 )     
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   210
					)
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
					nil
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
	      ) 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   216
	      #( 2 )
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   217
	      nil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   218
	 ) decodeAsLiteralArray.  
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   219
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   220
    menu verticalLayout:false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   221
    Transcript showCR:(menu startUp).
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   222
										[exEnd]
388
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
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   228
!MenuPanel class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   229
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   230
fromSpec:aSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   231
    ^ self fromSpec:aSpec receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   232
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   233
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   234
fromSpec:aSpec receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   235
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   236
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   237
    aSpec notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   238
	menu := Menu new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   239
	menu fromLiteralArrayEncoding:aSpec.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   240
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   241
  ^ self menu:menu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   242
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   243
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   244
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   245
    ^ self labels:labels nameKeys:nil receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   246
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   247
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   248
labels:labels nameKeys:nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   249
    ^ self labels:labels nameKeys:nameKeys receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   250
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   251
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   252
labels:labels nameKeys:nameKeys receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   253
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   254
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   255
    mview := self menu:nil receiver:aReceiver.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   256
    mview labels:labels.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   257
    mview nameKeys:nameKeys.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   258
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   259
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   260
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   261
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   262
labels:labels receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   263
    ^ self labels:labels nameKeys:nil receiver:aReceiver
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   264
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
   265
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   266
menu:aMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   267
    ^ self menu:aMenu receiver:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   268
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   270
menu:aMenu receiver:aReceiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   271
    |mview|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   272
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   273
    mview := self new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   274
    mview menu:aMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   275
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   276
"/ a menu itself may contain a receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   277
"/ thus we do not overwrite the receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   278
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   279
    aReceiver notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   280
	mview receiver:aReceiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   281
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   282
  ^ mview
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   283
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   284
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   285
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   286
!MenuPanel class methodsFor:'class initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   287
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   288
initialize
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   289
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   290
    DefaultAdornment := nil.
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   291
    self initialize
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   292
    "
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   293
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   294
    InitialSelectionQuerySignal isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   295
	InitialSelectionQuerySignal := QuerySignal new.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   296
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   297
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   298
    DefaultAdornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   299
	DefaultAdornment := IdentityDictionary new
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   300
	    at:#showSeparatingLines put:false;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   301
	    at:#showGroupDivider    put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   302
	    at:#verticalLayout      put:true;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   303
	    at:#item                put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   304
	    at:#value               put:nil;
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   305
	    yourself
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   306
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   307
660
d1670dfe5445 Do not call #updateStyleCache from #initialize.
Stefan Vogel <sv@exept.de>
parents: 658
diff changeset
   308
    "Modified: / 15.1.1998 / 23:08:31 / stefan"
794
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
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   311
preSnapshot
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   312
    "remove all resources
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   313
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   314
    Images := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   315
    LigthenedImages := nil.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   316
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   317
! !
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   318
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   319
!MenuPanel class methodsFor:'defaults'!
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   320
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   321
updateStyleCache
657
a8246e896fa3 class initialize routine completed
tz
parents: 653
diff changeset
   322
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   323
    |menuStyle style font|
450
ac72eb2ed895 initialize fix
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   324
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   325
"/    MenuView updateStyleCache.        
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   326
"/
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   327
"/    menuStyle := MenuView styleSheet.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   328
"/    menuStyle isNil ifTrue:[
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   329
"/        "make sure that style sheet is present"
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   330
"/        MenuView updateStyleCache.        
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   331
"/        menuStyle := MenuView styleSheet.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   332
"/    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   333
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   334
    menuStyle := StyleSheet.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   335
    style := menuStyle name.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   336
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   337
"/    DefaultForegroundColor := menuStyle colorAt:'pullDownMenu.foregroundColor'.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   338
"/    DefaultForegroundColor isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   339
	DefaultForegroundColor := menuStyle colorAt:#'menu.foregroundColor'
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   340
					    default:Color black.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   341
"/    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   342
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   343
    DefaultLevel := menuStyle at:#'pullDownMenu.level' default:0.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   344
1337
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   345
    DefaultBackgroundColor := DefaultViewBackgroundColor.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   346
"/        DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   347
"/        DefaultBackgroundColor isNil ifTrue:[
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   348
    DefaultBackgroundColor := menuStyle colorAt:#'menu.backgroundColor' default:DefaultBackgroundColor.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   349
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   350
    menuStyle is3D ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   351
	DefaultHilightForegroundColor := DefaultForegroundColor.
1337
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   352
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   353
	DefaultHilightForegroundColor := DefaultBackgroundColor.
1337
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   354
    ].
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   355
"/        DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   356
"/        DefaultHilightForegroundColor isNil ifTrue:[
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   357
    DefaultHilightForegroundColor := menuStyle colorAt:#'menu.hilightForegroundColor' default:DefaultHilightForegroundColor.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   358
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   359
    (style == #motif or:[style == #iris]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   360
	DefaultHilightLevel     := 2.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   361
	DefaultLevel           := DefaultLevel + 1.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   362
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   363
	(DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   364
	    DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   365
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   366
	menuStyle is3D ifTrue:[DefaultLevel := DefaultLevel + 1].
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   367
    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   368
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   369
    DefaultDisabledForegroundColor := menuStyle colorAt:#'menu.disabledForegroundColor'.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   370
    DefaultDisabledForegroundColor isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   371
	DefaultDisabledForegroundColor := menuStyle colorAt:#'button.disabledForegroundColor'
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   372
						    default:Color darkGray.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   373
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   374
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   375
    style == #motif ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   376
	DefaultHilightBackgroundColor := DefaultBackgroundColor
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   377
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   378
	DefaultHilightBackgroundColor := menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]
1337
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   379
    ].
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   380
"/    DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   381
"/    DefaultHilightBackgroundColor isNil ifTrue:[
f0ed36b3c3d6 style fixes
Claus Gittinger <cg@exept.de>
parents: 1336
diff changeset
   382
    DefaultHilightBackgroundColor := menuStyle colorAt:#'menu.hilightBackgroundColor' default:DefaultHilightBackgroundColor.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   383
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   384
    DefaultGroupDividerSize := menuStyle at:#'menu.groupDividerSize' default:6.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   385
    DefaultItemSpace        := menuStyle at:#'menu.itemSpace' default:0.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   386
    DefaultButtonItemSpace  := menuStyle at:#'menu.buttonItemSpace' default:0.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   387
    DefaultFitFirstPanel    := menuStyle at:#'menu.fitFirstPanel' default:true.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   388
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   389
    MenuView updateStyleCache.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   390
    DefaultFont := MenuView defaultFont.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   391
"/    font := menuStyle fontAt:'pullDownMenu.font'.
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   392
"/    font isNil ifTrue:[font := menuStyle fontAt:'menu.font'].
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
   393
"/    DefaultFont := font.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   394
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   395
    RightArrowForm := SelectionInListView rightArrowFormOn:Display.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   396
1054
f56416a8d26b win95 has no 3D right-arrow for subMenus.
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
   397
    (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   398
	RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   399
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   400
	RightArrowShadowForm := nil
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   401
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   402
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   403
    SelectionFrameBrightColor    := Color white.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   404
    SelectionFrameDarkColor      := Color black.
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
   405
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   406
    ButtonActiveLevel            :=  menuStyle at:#'menu.buttonActiveLevel' 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
    ButtonActiveLevel isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   408
	ButtonActiveLevel        :=  menuStyle at:#'button.activeLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   409
    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   410
    ButtonPassiveLevel           :=  menuStyle at:#'menu.buttonPassiveLevel'.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   411
    ButtonPassiveLevel isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   412
	ButtonPassiveLevel       :=  menuStyle at:#'button.passiveLevel' default:(menuStyle is3D ifTrue:[2] ifFalse:[0]).
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   413
    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   414
    ButtonActiveBackgroundColor  :=  menuStyle at:#'button.activeBackgroundColor' default: DefaultBackgroundColor.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   415
    ButtonPassiveBackgroundColor := (menuStyle at:#'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor.
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   416
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   417
    ButtonLightColor             := menuStyle at:#'button.lightColor'.
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   418
    ButtonLightColor isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   419
	ButtonLightColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) lightened. "/ Color white
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   420
    ].
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   421
    ButtonShadowColor            :=  menuStyle at:#'button.shadowColor'.
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   422
    ButtonShadowColor isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   423
	ButtonShadowColor := (ButtonPassiveBackgroundColor averageColorIn:(0@0 corner:7@7)) darkened. "/ Color white
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   424
"/        (style == #next ifTrue:[
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   425
"/            ButtonShadowColor := Color black
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   426
"/        ] ifFalse:[
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   427
"/            ButtonShadowColor := Color gray
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   428
"/        ]
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
   429
    ].
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   430
    ButtonHalfLightColor         :=  menuStyle at:#'button.halfLightColor'.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   431
    ButtonHalfShadowColor        :=  menuStyle at:#'button.halfShadowColor'.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   432
    ButtonEdgeStyle              :=  menuStyle at:#'button.edgeStyle'.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   433
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   434
    ButtonEnteredBackgroundColor := menuStyle colorAt:#'menu.buttonEnteredBackgroundColor'.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   435
    ButtonEnteredBackgroundColor isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   436
	ButtonEnteredBackgroundColor := menuStyle colorAt:#'button.enteredBackgroundColor'
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   437
						  default:ButtonPassiveBackgroundColor.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   438
    ].
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
   439
    ButtonEnteredLevel := menuStyle at:#'menu.buttonEnteredLevel' default:ButtonPassiveLevel.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   440
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   441
    Item updateStyleCache
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
   442
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   443
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   444
     self updateStyleCache
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   445
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   446
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
   447
    "Modified: / 10.9.1998 / 21:40:32 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   448
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   449
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   450
!MenuPanel class methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   451
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   452
image:anImage onDevice:aDevice
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   453
"
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   454
Images := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   455
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   456
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   457
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   458
    anImage device == aDevice ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   459
	^ anImage
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   460
    ].
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   461
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   462
    Images isNil ifTrue:[ Images := IdentityDictionary new ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   463
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   464
    (deviceImages := Images at:aDevice ifAbsent:nil) isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   465
	Images at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   466
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   467
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   468
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   469
	^ image
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   470
    ].
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   471
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   472
    image := anImage copy onDevice:aDevice.
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   473
    image clearMaskedPixels.
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   474
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   475
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   476
1156
6fa33dc93509 fix to avoid repeated image>>onDevice
Claus Gittinger <cg@exept.de>
parents: 1151
diff changeset
   477
    "Modified: / 29.9.1998 / 12:02:41 / cg"
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   478
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   479
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   480
lightenedImage:anImage onDevice:aDevice
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
LigthenedImages := nil
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   483
"
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   484
    |deviceImages image|
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   485
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   486
    LigthenedImages isNil ifTrue:[ LigthenedImages := IdentityDictionary new ].
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 := LigthenedImages at:aDevice ifAbsent:nil) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   489
	LigthenedImages at:aDevice put:(deviceImages := Dictionary new)
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   490
    ].
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   491
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   492
    (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   493
	^ image
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   494
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   495
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   496
    ((anImage respondsTo:#colorMap) and:[anImage colorMap notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   497
	image := anImage copy lightened onDevice:aDevice.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   498
	image clearMaskedPixels.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   499
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   500
	image := self image:anImage onDevice:aDevice
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   501
    ].
1097
8a2f6c5ad1a9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1096
diff changeset
   502
    deviceImages at:anImage put:image.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   503
    ^ image
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   504
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   505
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   506
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
   507
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   508
!MenuPanel class methodsFor:'private'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   509
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   510
subMenu:aSubMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   511
    "create a submenu; can be redifined in derived classes
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   512
    "
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   513
  ^ (self new) menu:aSubMenu.
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   514
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
   515
    "Modified: / 8.8.1998 / 02:13:11 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   516
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   517
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   518
!MenuPanel methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   519
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   520
accept
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   521
    "accept current selected item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   522
    "
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   523
    ^ self accept:(self selection)
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   524
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   525
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   526
accept:anItem
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   527
    "this is the topMenu: accept item
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   528
    "
1293
5b3836bd4024 handle all exposes when hiding a popup,
Claus Gittinger <cg@exept.de>
parents: 1271
diff changeset
   529
    |value item tgState itemIdx recv panel masterGroup|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   530
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   531
"/    self ungrabMouseAndKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
   532
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   533
    self superMenu notNil ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   534
        ^ self topMenu accept:anItem
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   535
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
   536
    lastButtonSelected := nil.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   537
    self selection:nil.
420
ca
parents: 417
diff changeset
   538
ca
parents: 417
diff changeset
   539
    (anItem notNil and:[anItem canAccept]) ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   540
        tgState := anItem toggleIndication.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   541
        panel   := anItem menuPanel.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   542
        itemIdx := panel findFirst:[:el| el == anItem ].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   543
        item    := anItem.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   544
        recv    := panel receiver.
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   545
    ].
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   546
510
8f77b9382066 bug fix with redraw
ca
parents: 505
diff changeset
   547
    self isPopUpView ifFalse:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   548
        self do:[:el| el updateIndicators].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   549
        self windowGroup processExposeEvents.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   550
    ] ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   551
        self unmap.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   552
        "/ give expose event a chance to arrive
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   553
        [shown and:[realized]] whileTrue:[
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   554
            self windowGroup processExposeEventsFor:self
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   555
        ].
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   556
        masterGroup := self windowGroup previousGroup.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   557
        self destroy.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   558
        masterGroup notNil ifTrue:[masterGroup processExposeEvents].
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
    value := self accept:item index:itemIdx toggle:tgState receiver:recv.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   561
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   562
    self isPopUpView ifTrue:[
1382
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   563
        self menuAdornmentAt:#value put:value.
a852ac554869 oops - query for shown is not enough to wait for a view to
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   564
        self menuAdornmentAt:#item  put:item.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   565
    ].
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
   566
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   567
  ^ item.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   568
1212
9bd3220c9964 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   569
    "Modified: / 22.2.1999 / 20:14:48 / cg"
524
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
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   572
accept:anItem index:anIndex toggle:aState receiver:aReceiver
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   573
    "accept an item
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   574
    "
1313
0d0a82851838 only send message to app (instead of view)
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
   575
    |value argument numArgs isKindOfValueModel rec arg2 app|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   576
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   577
    anItem isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   578
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   579
      ^ nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   580
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   581
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
   582
    self menuAdornmentAt:#hasPerformed put:(aReceiver isValueModel).
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   583
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   584
    (value := anItem value) isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   585
	^ anIndex
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   586
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   587
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   588
    (argument := anItem argument) isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   589
	argument := aState ? anItem
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   590
    ].
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
    value isSymbol ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   593
	numArgs := value perform:#numArgs ifNotUnderstood:0.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   594
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   595
	numArgs == 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   596
	    value value
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   597
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   598
	    numArgs == 1 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   599
		value value:argument]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   600
	    ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   601
		value value:argument value:self
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   602
	    ]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   603
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   604
	self menuAdornmentAt:#hasPerformed put:true.
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   605
      ^ anIndex
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   606
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   607
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   608
    aReceiver isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   609
	^ value
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   610
    ].
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   611
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
   612
    isKindOfValueModel := aReceiver isValueModel.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   613
    isKindOfValueModel ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   614
	aReceiver value:value
465
67a0f3dd503a in case of performing a selector '0' is returned
ca
parents: 464
diff changeset
   615
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   616
	rec := aReceiver.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   617
	arg2 := self.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   618
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   619
	"/ support for ST80 style applications
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   620
	"/ (expecting the message to go to the application
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   621
	"/  if not understood by the view)
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   622
	"/ These expect the controller to be passed as argument.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   623
	"/ sigh.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   624
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   625
	(aReceiver isView
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   626
	and:[(aReceiver respondsTo:value) not
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   627
	and:[(app := aReceiver application) ~~ aReceiver
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   628
	and:[app notNil]]]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   629
	    rec := app.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   630
	    arg2 := aReceiver controller "/ the Views controller
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   631
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   632
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   633
	(numArgs := value numArgs) == 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   634
	    rec perform:value
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   635
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   636
	    numArgs == 1 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   637
		rec perform:value with:argument
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   638
	    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   639
		rec perform:value with:argument with:arg2
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   640
	    ]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   641
	]
420
ca
parents: 417
diff changeset
   642
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
   643
    self menuAdornmentAt:#hasPerformed put:true.
1270
0ae582fd7294 send menuMessage to application,
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   644
    ^ value
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   645
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   646
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   647
lastItemAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   648
    "returns last item selected or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   649
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   650
  ^ self topMenu menuAdornmentAt:#item
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   651
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   652
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   653
lastValueAccepted
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   654
    "returns last value accepted or nil
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   655
    "
971
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   656
    ^ (self lastItemAccepted) value
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   657
"/    |top|
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   658
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   659
"/    top := self topMenu.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   660
"/
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   661
"/    (top menuAdornmentAt:#hasPerformed) == true ifTrue:[
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   662
"/        ^ self topMenu menuAdornmentAt:#value.
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   663
"/    ].
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   664
"/  ^ nil
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   665
c000e2691543 fixed #lastValueSelected
Claus Gittinger <cg@exept.de>
parents: 963
diff changeset
   666
    "Modified: / 18.6.1998 / 23:37:09 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   667
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   668
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   669
!MenuPanel methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   670
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   671
accessCharacterPositionAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   672
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   673
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   674
  ^ self itemAt:stringOrNumber do:[:el| el accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   675
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   676
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   677
accessCharacterPositionAt:stringOrNumber put:anIndexOrNil
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   678
    "get the access character position for a textLabel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   679
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   680
    self itemAt:stringOrNumber do:[:el| el accessCharacterPosition:anIndexOrNil ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   681
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   682
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   683
accessCharacterPositions
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   684
    "returns a collection of accessCharacterPosition's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   685
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   686
    ^ self collect:[:anItem| anItem accessCharacterPosition ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   687
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   688
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   689
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   690
accessCharacterPositions:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   691
    "define accessCharacterPosition's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   692
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   693
    self onEachPerform:#accessCharacterPosition: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   694
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   695
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   696
args
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   697
    "returns a collection of argument's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   698
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   699
    ^ self collect:[:anItem| anItem argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   700
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   701
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   702
args:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   703
    "define arguments for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   704
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   705
    self onEachPerform:#argument: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   706
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   707
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   708
argsAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   709
    "gets the argument of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   710
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   711
  ^ self itemAt:stringOrNumber do:[:el| el argument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   712
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   713
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   714
argsAt:stringOrNumber put:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   715
    "sets the argument of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   716
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   717
    self itemAt:stringOrNumber do:[:el| el argument:anArgument ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   718
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   719
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   720
enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   721
    "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
   722
     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
   723
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   724
    ^ enteredItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   725
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   726
    "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
   727
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   728
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   729
groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   730
    "gets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   731
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   732
  ^ groupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   733
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   734
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   735
groupSizes:aGroupSizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   736
    "sets collection of group sizes
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   737
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   738
    aGroupSizes = groupSizes ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   739
	groupSizes := aGroupSizes copy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   740
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   741
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   742
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   743
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   744
labelAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   745
    "gets the label of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   746
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   747
  ^ self itemAt:stringOrNumber do:[:el| el label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   748
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   749
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   750
labelAt:stringOrNumber put:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   751
    "sets the label of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   752
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   753
    self itemAt:stringOrNumber do:[:el| el label:aLabel ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   754
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   755
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   756
labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   757
    "returns a collection of labels's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   758
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   759
    ^ self collect:[:anItem| anItem label ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   760
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   761
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   762
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   763
labels:labels
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   764
    "define labels for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   765
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   766
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   767
	self removeAll.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   768
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   769
	labels notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   770
	    labels do:[:aLabel|(self createAtIndex:nil) label:aLabel]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   771
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   772
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   773
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   774
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   775
nameKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   776
    "gets the nameKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   777
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   778
  ^ self itemAt:stringOrNumber do:[:el| el nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   779
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   780
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   781
nameKeyAt:stringOrNumber put:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   782
    "sets the nameKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   783
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   784
    self itemAt:stringOrNumber do:[:el| el nameKey:aNameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   785
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   786
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   787
nameKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   788
    "returns a collection of nameKeys's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   789
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   790
    ^ self collect:[:anItem| anItem nameKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   791
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   792
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   793
nameKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   794
    "define nameKeys for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   795
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   796
    self onEachPerform:#nameKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   797
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   798
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   799
numberOfItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   800
    "gets number of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   801
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   802
    ^ items size
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   803
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   804
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   805
receiver
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   806
    "get the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   807
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   808
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   809
    (receiver isNil and:[superMenu notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   810
	^ superMenu receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   811
    ].
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   812
  ^ receiver
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   813
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   814
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   815
receiver:anObject 
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   816
    "set the menu-receiver. Thats the one who gets the messages ( both from myself and
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   817
     from all submenus no specific receiver is defined ).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   818
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
   819
    receiver := anObject
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   820
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   821
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   822
shortcutKeyAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   823
    "gets the shortCutKey of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   824
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   825
  ^ self itemAt:stringOrNumber do:[:el| el shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   826
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   827
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   828
shortcutKeyAt:stringOrNumber put:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   829
    "sets the shortCutKey of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   830
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   831
    self itemAt:stringOrNumber do:[:el| el shortcutKey:aKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   832
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   833
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   834
shortcutKeys
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   835
    "returns a collection of shortcutKey's or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   836
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   837
    ^ self collect:[:anItem| anItem shortcutKey ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   838
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   839
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   840
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   841
shortcutKeys:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   842
    "define shortcutKey's for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   843
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   844
    self onEachPerform:#shortcutKey: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   845
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   846
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   847
valueAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   848
    "gets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   849
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   850
  ^ self itemAt:stringOrNumber do:[:el| el value ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   851
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   852
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   853
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   854
valueAt:stringOrNumber put:someThing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   855
    "sets value of an item; a block, valueHolder, ...
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   856
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   857
    self itemAt:stringOrNumber do:[:el| el value:someThing ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   858
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   859
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   860
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   861
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   862
values:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   863
    "define values for each item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   864
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   865
    self onEachPerform:#value: withArgList:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   866
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   867
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   868
!MenuPanel methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   869
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   870
disableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   871
    "disable all items; not the menu in case of enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   872
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   873
    self do:[:anItem| anItem enabled:false]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   874
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   875
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   876
disableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   877
    "disable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   878
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   879
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:false ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   880
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   881
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   882
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   883
enableAll
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   884
    "enable all items; not the menu in case of disabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   885
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   886
    self do:[:anItem| anItem enabled:true]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   887
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   888
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   889
enableAll:collectionOfIndicesOrNames
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   890
    "enable an collection of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   891
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   892
    collectionOfIndicesOrNames do:[:entry| self enabledAt:entry put:true ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   893
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   894
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   895
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   896
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   897
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   898
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   899
    ^ enabled
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   900
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   901
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   902
enabled:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   903
    "change enabled state of menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   904
    "
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 524
diff changeset
   905
    |state|
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   906
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   907
    state := aState ? true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   908
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
   909
    enabled == state ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   910
	^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   911
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   912
    enabled := state.
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   913
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   914
    self canDrawItem ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
   915
	self do:[:anItem| anItem enabledStateOfMenuChangedTo:enabled]
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   916
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   917
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   918
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   919
enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   920
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   921
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   922
  ^ self itemAt:stringOrNumber do:[:el| el enabled ] ifAbsent:false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   923
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   924
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   925
enabledAt:stringOrNumber put:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   926
    "sets the enabled state of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   927
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   928
    self itemAt:stringOrNumber do:[:el| el enabled:aState ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   929
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   930
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   931
isEnabled:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   932
    "gets the enabled state of an item or false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   933
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   934
    ^ self enabledAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   935
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
   936
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   937
!MenuPanel methodsFor:'accessing channels'!
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
enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   940
    "gets a enable channel or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   941
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   942
    ^ enableChannel
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   943
!
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
enableChannel:aValueHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   946
    "set my enableChannel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   947
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   948
    enableChannel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   949
	enableChannel removeDependent:self
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
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   952
    (enableChannel := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   953
	enableChannel addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   954
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   955
    self enabled:(enableChannel value).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   956
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   957
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   958
menuHolder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   959
    "gets a menu holder or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   960
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   961
    ^ menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   962
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   963
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   964
menuHolder:aValueHolder
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   965
    "set my menuHolder
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   966
    "
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   967
    menuHolder notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   968
	menuHolder removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   969
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   970
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   971
    (menuHolder := aValueHolder) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   972
	menuHolder addDependent:self.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   973
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
   974
    self menu:(menuHolder value)
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   975
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
   976
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   977
!MenuPanel methodsFor:'accessing color & font'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   978
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   979
activeBackgroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   980
    "get the background drawing color used to highlight selection
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   981
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   982
    ^ activeBgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   983
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   984
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   985
activeBackgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   986
    "set the background drawing color used to highlight selection. You should not 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   987
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
   988
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   989
    activeBgColor ~~ aColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   990
        activeBgColor := aColor onDevice:device.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   991
        shown ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   992
            self invalidate "/ RepairNow:true
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
   993
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   994
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   995
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
   996
    "Modified: / 6.6.1998 / 19:49:46 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   997
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   998
a6157b083830 support of different styles
ca
parents: 608
diff changeset
   999
activeForegroundColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1000
    "get the foreground color used to highlight selections
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1001
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1002
    ^ activeFgColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1003
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1004
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1005
activeForegroundColor:aColor
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1006
    "set the foreground color used to highlight selections; You should not
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1007
     use this method; instead leave the value as defined in the styleSheet.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1008
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1009
    activeFgColor ~~ aColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1010
        activeFgColor := aColor onDevice:device.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1011
        shown ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1012
            self invalidate "/ RepairNow:true
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1013
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1014
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1015
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1016
    "Modified: / 6.6.1998 / 19:50:01 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1017
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1018
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1019
backgroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1020
    "return the background color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1021
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  1022
    ^ super viewBackground
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1023
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1024
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1025
backgroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1026
    "set the background drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1027
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1028
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1029
    super viewBackground ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1030
	super viewBackground:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1031
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1032
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1033
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1034
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1035
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1036
    "Modified: / 6.6.1998 / 19:50:06 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1037
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1038
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1039
buttonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1040
    "get the background drawing color used to highlight button selection
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1041
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1042
    ^ButtonActiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1043
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1044
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1045
buttonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1046
    "get the button edge style
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
    ^ButtonEdgeStyle
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1049
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1050
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1051
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1052
    "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
  1053
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1054
    ^ buttonEnteredBgColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1055
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1056
    "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
  1057
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1058
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1059
buttonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1060
    "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
  1061
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1062
    ^ ButtonEnteredLevel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1063
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1064
    "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
  1065
    "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
  1066
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1067
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1068
buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1069
    "get the background drawing color used to half light button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1070
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1071
    ^buttonHalfLightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1072
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1073
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1074
buttonHalfShadowColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1075
    "get the background drawing color used to half shadow button frame
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1076
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1077
    ^buttonHalfShadowColor
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1078
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1079
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1080
buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1081
    "get the background drawing color used to light button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1082
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1083
    ^buttonLightColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1084
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1085
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1086
buttonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1087
    "get the background drawing color used for button
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1088
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1089
    ^ButtonPassiveBackgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1090
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1091
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1092
buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1093
    "get the background drawing color used to shadow button frame
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1094
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1095
    ^buttonShadowColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1096
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1097
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1098
disabledForegroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1099
    "return the foreground color used by disabled items
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1100
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1101
  ^ disabledFgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1102
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1103
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1104
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1105
disabledForegroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1106
    "set the foregroundColor drawing color used by disabled items. You should not
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1107
     use this method; instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1108
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1109
    disabledFgColor ~~ aColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1110
        disabledFgColor := aColor onDevice:device.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1111
        shown ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1112
            self invalidate "/ RepairNow:true
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1113
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1114
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1115
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1116
    "Modified: / 6.6.1998 / 19:50:17 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1117
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1118
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1119
font:aFont
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1120
    "set the font
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1121
    "
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  1122
    (aFont notNil and:[aFont ~= font]) ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1123
        super font:(aFont onDevice:device).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1124
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1125
        superMenu notNil ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1126
            self extent:(self preferredExtent)
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1127
        ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1128
        self mustRearrange.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1129
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1130
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1131
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1132
foregroundColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1133
    "return the passive foreground color
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1134
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1135
  ^ fgColor
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1136
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1137
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1138
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1139
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1140
foregroundColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1141
    "set the foregroundColor drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1142
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1143
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1144
    fgColor ~~ aColor ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1145
        fgColor := aColor onDevice:device.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1146
        shown ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1147
            self invalidate "/ RepairNow:true
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1148
        ]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1149
    ]
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1150
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1151
    "Modified: / 6.6.1998 / 19:50:46 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1152
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  1153
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1154
lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1155
    "get the lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1156
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1157
    ^ lightColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1158
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1159
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1160
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1161
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1162
lightColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1163
    "set the light drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1164
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1165
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1166
    lightColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1167
	super lightColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1168
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1169
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1170
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1171
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1172
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1173
    "Modified: / 6.6.1998 / 19:50:39 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1174
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1175
730
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1176
selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1177
    "get the selection frame bright color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1178
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1179
    ^selectionFrameBrightColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1180
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1181
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1182
selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1183
    "get the selection frame dark color
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1184
    "
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1185
    ^selectionFrameDarkColor
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1186
!
9e45051a4fbd better button draw routine + style sheet support
tz
parents: 729
diff changeset
  1187
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1188
shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1189
    "get the shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1190
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1191
    ^ shadowColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1192
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1193
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1194
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1195
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1196
shadowColor:aColor
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1197
    "set the shadow drawing color. You should not use this method;
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1198
     instead leave the value as defined in the styleSheet.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1199
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1200
    shadowColor ~~ aColor ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1201
	super shadowColor:aColor.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1202
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1203
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1204
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1205
    ]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1206
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1207
    "Modified: / 6.6.1998 / 19:50:32 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1208
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1209
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1210
!MenuPanel methodsFor:'accessing dimensions'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1211
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1212
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1213
    "default height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1214
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1215
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1216
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1217
    (explicitExtent ~~ true) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1218
	(item := self itemAt:1) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1219
	    self rearrangeItems.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1220
	  ^ item height
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1221
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1222
	^ 4 + (font height + (font descent * 2)).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1223
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1224
    ^ super height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1225
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1226
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1227
preferredExtent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1228
    "compute and returns my preferred extent
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1229
    "
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1230
    |x y hasMenu shCtKey space hrzInset|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1231
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1232
    self numberOfItems == 0 ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1233
        ^ 32 @ 32
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1234
    ].
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1235
    space := (items size + 1) * itemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1236
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1237
    self isFitPanel ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1238
        x := 0
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1239
    ] ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1240
        x := groupSizes size * groupDividerSize.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1241
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  1242
    hrzInset := items first horizontalInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1243
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1244
    self verticalLayout ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1245
        "/ horizontal - add x-extents; take max of y-extents
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1246
        y := 0.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1247
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1248
        self do:[:el| |elY elPref|
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1249
            el isVisible ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1250
                elPref := el preferredExtent.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1251
                x := x + elPref x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1252
                elY := elPref y.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1253
                el isButton ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1254
                    elY := elY + (2 * DefaultButtonItemSpace).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1255
                    x := x + (2 * DefaultButtonItemSpace).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1256
                ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1257
                y := y max:elY.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1258
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1259
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1260
        x := x + space.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1261
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1262
        "/ vertical - add y-extents
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1263
        hasMenu := false.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1264
        shCtKey := 0.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1265
        y := x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1266
        x := 0.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1267
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1268
        self do:[:el| |l e|
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1269
            el isVisible ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1270
                (l := el rawLabel) notNil ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1271
                    (e := l widthOn:self) > x ifTrue:[x := e].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1272
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1273
                    el hasSubmenu ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1274
                        hasMenu := true
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1275
                    ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1276
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1277
                    (     (l := el shortcutKeyAsString) notNil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1278
                     and:[(e := l widthOn:self) > shCtKey]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1279
                    ) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1280
                        shCtKey := e
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1281
                    ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1282
                ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1283
                y := y + el preferredExtent y
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1284
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1285
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1286
        x := x + hrzInset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1287
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1288
        (hasMenu or:[shCtKey ~~ 0]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1289
            shortKeyInset := x + Item labelRightOffset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1290
            x := shortKeyInset + shCtKey + self subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1291
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1292
            (shCtKey ~~ 0 and:[hasMenu]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1293
                x := x + (Item shortcutKeyOffset) 
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1294
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1295
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1296
        y := y + space.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  1297
        x := x + hrzInset.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1298
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  1299
    ^ (x @ y) + (margin + margin)
1095
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1300
44b55760239b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1301
    "Modified: / 24.8.1998 / 19:16:02 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1302
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1303
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1304
shortKeyInset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1305
    "left inset of shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1306
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1307
  ^ shortKeyInset
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1308
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1309
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1310
subMenuIndicationWidth
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1311
    ^ RightArrowForm width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1312
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1313
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1314
!MenuPanel methodsFor:'accessing items'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1315
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1316
itemAt:stringOrNumber
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1317
    "returns item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1318
     If no item match nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1319
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1320
    |idx|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1321
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1322
    idx := self indexOf:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1323
    (idx > 0 and:[idx <= items size]) ifTrue:[ ^ items at:idx ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1324
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1325
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1326
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1327
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1328
itemAt:stringOrNumber do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1329
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1330
     the item not exists nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1331
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1332
    ^ self itemAt:stringOrNumber do:aOneArgBlock ifAbsent:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1333
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1334
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1335
itemAt:stringOrNumber do:aOneArgBlock ifAbsent:exceptionBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1336
    "evaluate teh block for an item and return the result from the block. In case that  
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1337
     the item not exists the result of the exception block is returned (no arguments).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1338
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1339
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1340
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1341
    item := self itemAt:stringOrNumber.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1342
    item notNil ifTrue:[ ^ aOneArgBlock value:item ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1343
  ^ exceptionBlock value
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1344
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1345
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1346
itemAtIndex:anIndex
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1347
    "returns item at an index or nil
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1348
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  1349
    ^ items notNil ifTrue:[items at:anIndex ifAbsent:nil] ifFalse:[nil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1350
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1351
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1352
!MenuPanel methodsFor:'accessing look'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1353
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1354
buttonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1355
    "get the button active level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1356
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1357
    ^ButtonActiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1358
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1359
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1360
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1361
buttonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1362
    "get the button passive level
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1363
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1364
    ^ButtonPassiveLevel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1365
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1366
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  1367
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1368
fitFirstPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1369
    "gets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1370
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1371
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1372
    ^ fitFirstPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1373
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1374
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1375
fitFirstPanel:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1376
    "sets true if the first panel in the menu hierarchy must be fit 
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1377
     to the extent of its superView
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1378
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1379
    (fitFirstPanel == aState or:[self isPopUpView]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1380
	fitFirstPanel := aState.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1381
	self mustRearrange
616
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
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1385
groupDividerSize
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1386
    "get the size of the group dividers
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1387
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1388
  ^ groupDividerSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1389
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1390
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1391
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1392
groupDividerSize:aSize
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1393
    "set the size of the group dividers. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1394
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1395
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1396
    aSize ~~ groupDividerSize ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1397
	groupDividerSize := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1398
	self mustRearrange.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1399
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1400
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1401
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1402
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1403
itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1404
    "get the space space between to items
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1405
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1406
  ^ itemSpace
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1407
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1408
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1409
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1410
itemSpace:aSize
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1411
    "set the horizontal space between to items. You should not use this
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1412
     method; instead leave the value as defined in the styleSheet.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1413
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1414
    aSize ~~ itemSpace ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1415
	itemSpace := aSize.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1416
	self mustRearrange
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1417
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1418
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1419
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1420
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1421
level:anInt
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1422
    super level:anInt.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1423
    mustRearrange := true
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1424
!
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1425
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1426
rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1427
    ^ rightArrow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1428
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1429
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1430
rightArrowShadow
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1431
    ^ rightArrowShadow
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1432
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1433
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1434
showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1435
    "get the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1436
    "
1222
8d58a1a93582 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
  1437
  ^ (self menuAdornmentAt:#showGroupDivider)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1438
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1439
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1440
showGroupDivider:aState
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1441
    "set the enabled flag for showing groupDiveders
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1442
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1443
    (self menuAdornmentAt:#showGroupDivider put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1444
	self mustRearrange.
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1445
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1446
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1447
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1448
showSeparatingLines
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1449
    "gets true if drawing of separating lines is enabled.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1450
    "
1222
8d58a1a93582 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
  1451
  ^ (self menuAdornmentAt:#showSeparatingLines)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1452
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1453
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1454
showSeparatingLines:aState
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1455
    "turn on/off drawing of separating lines.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1456
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1457
    (self menuAdornmentAt:#showSeparatingLines put:aState) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1458
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1459
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1460
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1461
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1462
verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1463
    "get the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1464
    "
1222
8d58a1a93582 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1221
diff changeset
  1465
  ^ (self menuAdornmentAt:#verticalLayout)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1466
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1467
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1468
verticalLayout:aState
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1469
    "set the layout: or vertical( true ) or horizontal( false )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1470
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1471
    (self menuAdornmentAt:#verticalLayout put:aState) ifTrue:[        
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1472
	self mustRearrange
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  1473
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1474
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1475
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1476
!MenuPanel methodsFor:'accessing submenu'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1477
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1478
subMenuAt:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1479
    "gets the submenu of an item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1480
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1481
  ^ self itemAt:stringOrNumber do:[:el| el submenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1482
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1483
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1484
subMenuAt:stringOrNumber put:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1485
    "sets the submenu of an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1486
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1487
    self itemAt:stringOrNumber do:[:el| el submenu:aSubMenu ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1488
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1489
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1490
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1491
subMenuShown
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1492
    "return the currently visible submenu - or nil if there is none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1493
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1494
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1495
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1496
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1497
	^ item submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1498
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1499
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1500
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1501
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1502
!MenuPanel methodsFor:'activation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1503
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1504
hide
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1505
    "hide the view, leave its modal event loop
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1506
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1507
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1508
    self selection:nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1509
    self unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1510
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1511
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1512
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1513
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1514
show
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1515
    "realize the view at its last position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1516
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1517
  ^ self showAt:(self origin) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1518
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1519
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1520
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1521
showAt:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1522
    "realize the view at aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1523
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1524
  ^ self showAt:aPoint resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1525
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1526
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1527
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1528
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1529
showAt:aPoint resizing:aBoolean
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1530
    "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
  1531
     or if I have already performed.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1532
     Return the items value, otherwise.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1533
     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
  1534
     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
  1535
     if a non-nil is returned.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1536
    "
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1537
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1538
    self initPopUpDependentStyle:true.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1539
    self rearrangeItemsIfItemVisibilityChanged.
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1540
"/    self rearrangeItems.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1541
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1542
    aBoolean ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1543
        self fixSize.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1544
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1545
    self origin:aPoint.
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1546
"/    self makeFullyVisible.   -- done in realize
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1547
    self openModal:[true]. "realize     "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1548
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1549
    "/ if I have already performed,
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1550
    "/ return nil - to avoid items triggering twice.
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1551
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1552
    (self topMenu menuAdornmentAt:#hasPerformed) == true ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  1553
        ^ nil
984
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1554
    ].
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1555
    ^ self lastValueAccepted
87d36803b9d8 oops - menu items fired twice.
Claus Gittinger <cg@exept.de>
parents: 971
diff changeset
  1556
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1557
    "Modified: / 15.9.1998 / 12:50:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1558
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1559
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1560
showAtPointer
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1561
    "realize the view at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1562
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1563
  ^ self showAt:(device pointerPosition) resizing:true
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1564
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1565
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1566
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1567
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1568
showCenteredIn:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1569
    "make myself visible at the screen center.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1570
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1571
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1572
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1573
    top := aView topView.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1574
    top raise.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1575
    ^ 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
  1576
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  1577
    "Modified: / 15.9.1998 / 12:45:50 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1578
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1579
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1580
startUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1581
    "realize the menu at the current pointer position
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1582
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1583
    ^ self showAtPointer
897
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1584
!
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1585
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1586
startUpAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1587
    "realize the menu at aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1588
    "
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1589
    ^ self showAt:aPoint
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1590
6bbc8c15ac0a added #startUpAt: (MenuView compatibility)
Claus Gittinger <cg@exept.de>
parents: 890
diff changeset
  1591
    "Created: / 21.5.1998 / 14:15:57 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1592
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1593
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1594
!MenuPanel methodsFor:'adding & removing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1595
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1596
createAtIndex:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1597
    "create an item and add this item to the index. In case of nil the item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1598
     is added to the end. If the index is not valid nil is returned otherwise
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1599
     the new created item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1600
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1601
    |max item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1602
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1603
    max := (items size) + 1.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1604
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1605
    anIndexOrNil notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1606
	(anIndexOrNil < 1 or:[anIndexOrNil > max]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1607
	    ^ nil
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1608
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1609
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1610
    items isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1611
	items := OrderedCollection new
1151
199863d6a463 items: convert Array to OrderedCollection
Claus Gittinger <cg@exept.de>
parents: 1137
diff changeset
  1612
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1613
	items := items asOrderedCollection
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1614
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1615
    item := Item in:self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1616
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1617
    (anIndexOrNil isNil or:[anIndexOrNil == max]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1618
	items add:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1619
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1620
	items add:item beforeIndex:anIndexOrNil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1621
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1622
    ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1623
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1624
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1625
remove:stringOrNumber
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1626
    "remove the first item which is assigned to stringOrNumber;
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1627
     if found, remove and return it
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1628
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1629
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1630
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1631
    (item := self itemAt:stringOrNumber) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1632
	items remove:item.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1633
	item  destroy.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1634
	items isEmpty ifTrue:[items := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1635
	self mustRearrange.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1636
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1637
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1638
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1639
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1640
removeAll
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1641
    "remove all items and submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1642
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1643
    self disabledRedrawDo:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1644
	self selection:nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1645
	groupSizes := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1646
	self do:[:el| el destroy ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1647
	items := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1648
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1649
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1650
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1651
!MenuPanel methodsFor:'change & update'!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1652
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1653
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1654
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1655
    changedObject == menuHolder    ifTrue:[^ self menu:(menuHolder value)].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  1656
    changedObject == enableChannel ifTrue:[^ self enabled:(enableChannel value)].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1657
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1658
    super update:something with:aParameter from:changedObject
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1659
! !
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1660
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1661
!MenuPanel methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1662
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1663
asMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1664
    "convert contents to menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1665
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1666
    |menu|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1667
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1668
    menu := Menu new.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1669
    menu groupSizes:groupSizes.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1670
    self do:[:anItem| menu addItem:(anItem asMenuItem) ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1671
  ^ menu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1672
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1673
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1674
fromSpec:aMenuSpec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1675
    "build from spec
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1676
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1677
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1678
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1679
    menu := Menu new.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1680
    menu fromLiteralArrayEncoding:aMenuSpec.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1681
    self menu:menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1682
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1683
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1684
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1685
menu:aMenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1686
    "convert to Menu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1687
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1688
    self disabledRedrawDo:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1689
	|menu newItems|
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1690
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1691
	self removeAll.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1692
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1693
	(menu := aMenu) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1694
	    (aMenu isCollection) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1695
		menu := Menu new.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1696
		menu fromLiteralArrayEncoding:aMenu.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1697
	    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1698
		menu receiver notNil ifTrue:[receiver := menu receiver]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1699
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1700
	    (newItems := menu menuItems) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1701
		items := newItems collect:[:ni | 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1702
				|i|
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1703
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1704
				i:= Item in:self.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1705
				i menuItem:ni.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1706
				i.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1707
			    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1708
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1709
	    self groupSizes:(menu groupSizes).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1710
	]
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1711
    ]
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1712
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  1713
    "Modified: / 8.8.1998 / 02:05:04 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1714
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1715
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1716
!MenuPanel methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1717
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1718
disabledRedrawDo:aBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1719
    "evaluate a block without redrawing within the block; after processing
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1720
     of the block a redraw might be performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1721
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1722
    |state|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1723
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1724
    state := mustRearrange.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1725
    mustRearrange := true.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1726
    aBlock value.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1727
    mustRearrange := state.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1728
    self mustRearrange
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1729
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1730
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1731
drawButtonEdgesInLayout: layout withLevel: aLevel selected:isSelected
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1732
    |shadow|
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1733
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1734
    styleSheet is3D ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1735
	^ self displayRectangle:layout.
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1736
    ].
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1737
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1738
    shadow := buttonShadowColor.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1739
"/
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1740
"/ never encountered ?
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1741
"/
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1742
"/    isSelected ifTrue:[
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1743
"/        buttonShadowColor == self buttonActiveBackgroundColor ifTrue:[
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1744
"/            shadow := buttonShadowColor darkened
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1745
"/        ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  1746
"/    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1747
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1748
    self drawEdgesForX: layout left y: layout top width: layout width height: layout height level: aLevel 
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1749
	shadow:      shadow 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1750
	light:       buttonLightColor
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1751
	halfShadow:  buttonHalfShadowColor 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1752
	halfLight:   buttonHalfLightColor
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1753
	style:       ButtonEdgeStyle
1018
67c883ab05d6 kludge fixes for normal style.
Claus Gittinger <cg@exept.de>
parents: 1010
diff changeset
  1754
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1755
    "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
  1756
    "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
  1757
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1758
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1759
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
  1760
    |level|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1761
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1762
    level := selectedBool 
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1763
		ifTrue:[onLevel] 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1764
		ifFalse:[offLevel].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1765
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  1766
    level ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1767
	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
  1768
    ].
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
    "Modified: / 20.8.1998 / 15:43:11 / cg"
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1771
!
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  1772
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1773
mustRearrange
910
5c9592e782fd always repairNow (to make change visible immediately)
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  1774
    "force rearrange (i.e. set the rearrange flag)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1775
    "
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1776
    mustRearrange == true ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1777
	mustRearrange := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1778
	shown ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1779
	    self invalidate "/ RepairNow:true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  1780
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1781
    ]
590
3177528b5f95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
  1782
911
6b1ad8b039c5 no, repairNow should not be needed here
Claus Gittinger <cg@exept.de>
parents: 910
diff changeset
  1783
    "Modified: / 6.6.1998 / 19:51:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1784
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1785
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1786
rearrangeGroups
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1787
    |layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1788
     dltX  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1789
     start "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1790
    |
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1791
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1792
    (self isPopUpView or:[self verticalLayout]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1793
	^ self
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1794
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1795
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1796
    layout := items last layout.
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1797
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  1798
    (dltX := width "- margin" "- 2" - layout right) <= 0 ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1799
	^ self  "/ no free space
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1800
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1801
    start := items findFirst:[:anItem| anItem startGroup == #right ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1802
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1803
    start == 0 ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1804
	^ self  "/ no item detected
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1805
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1806
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1807
    "/ change layout
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1808
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1809
    items from:start do:[:anItem|
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1810
	anItem isVisible ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1811
	    layout := anItem layout.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1812
	    layout  left:(layout  left + dltX).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1813
	    layout right:(layout right + dltX).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  1814
	]
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1815
    ].
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1816
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1817
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1818
rearrangeItems
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1819
    "recompute layout of my items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1820
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1821
    |expLast e grpDivSz layout isVert
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1822
     x  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1823
     y  "{ Class:SmallInteger }"
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1824
     noItems "{ Class:SmallInteger }"
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1825
     f
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1826
    |
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1827
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1828
    mustRearrange ifFalse:[ ^ self ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1829
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1830
"/  fetch font from superMenu
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1831
    (superMenu notNil and:[(f := superMenu font) ~~ font]) ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1832
        super font:(f onDevice:device)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1833
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1834
    (noItems := items size) == 0 ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1835
        mustRearrange := false.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1836
      ^ self
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1837
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1838
    expLast  := false.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  1839
    isVert   := self verticalLayout.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1840
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1841
    self hasGroupDividers ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1842
        self isFitPanel ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1843
            grpDivSz := groupDividerSize
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1844
        ] ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1845
            expLast := true.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1846
            x := margin.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1847
            e := self computeExtent.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1848
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1849
            isVert ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1850
                items do:[:el | x := x + el preferredExtent y].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1851
                y := e y.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1852
            ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1853
                items do:[:el|x := x + el preferredExtent x].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1854
                y := e x.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1855
            ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1856
            x := x + (noItems + 1 * itemSpace).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1857
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1858
            (grpDivSz := (y - x) // (groupSizes size)) <= 0 ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1859
                grpDivSz := nil
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1860
            ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1861
            x > (width-margin) ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1862
                grpDivSz := nil
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1863
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1864
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1865
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1866
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1867
    (self isPopUpView or:[explicitExtent ~~ true]) ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1868
        e := self preferredExtent copy.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1869
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1870
        self isPopUpView ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1871
            isVert ifTrue:[e y:1.0]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1872
                  ifFalse:[e x:1.0]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1873
        ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1874
        self extent:e
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1875
    ] ifFalse:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1876
        e := self computeExtent
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1877
    ].
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1878
1093
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1879
    x := y := margin.
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1880
7cb44303b016 margin fixes
Claus Gittinger <cg@exept.de>
parents: 1090
diff changeset
  1881
    isVert ifTrue:[y := y + itemSpace]
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1882
          ifFalse:[x := x + itemSpace].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1883
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  1884
    self keysAndValuesDo:[:anIndex :el| |org corn elPref|
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1885
        el isVisible ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1886
            el isButton ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1887
                org := Point x:(x+DefaultButtonItemSpace) y:(y+DefaultButtonItemSpace).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1888
            ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1889
                org := Point x:x y:y.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1890
            ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1891
            elPref := el preferredExtent.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1892
            isVert ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1893
                y := y + elPref y.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1894
                corn := (e x - margin @ y).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1895
                el isButton ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1896
                    corn := corn - (DefaultButtonItemSpace @ 0).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1897
                    el layout:(Rectangle origin:org corner:corn).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1898
                    y := y + (2 * DefaultButtonItemSpace).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1899
                ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1900
                    el layout:(Rectangle origin:org corner:corn).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1901
                ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1902
                y := y + itemSpace.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1903
            ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1904
                x := x + elPref x.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1905
                el isButton ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1906
                    x := x + DefaultButtonItemSpace.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1907
                    corn := (x @ (e y - margin)).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1908
                    corn := corn - (0 @ DefaultButtonItemSpace).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1909
                    el layout:(Rectangle origin:org corner:corn).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1910
                    x := x + DefaultButtonItemSpace.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1911
                ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1912
                    corn := (x @ e y).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1913
                    el layout:(Rectangle origin:org corner:corn).
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1914
                ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1915
                x := x + itemSpace.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1916
            ].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1917
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1918
            (grpDivSz notNil and:[self hasGroupDividerAt:anIndex]) ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1919
                isVert ifTrue:[y := y + grpDivSz]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1920
                      ifFalse:[x := x + grpDivSz]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1921
            ]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1922
        ] ifFalse:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1923
            org := Point x:x y:y.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1924
            el layout:(Rectangle origin:org corner:org)
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1925
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1926
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1927
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1928
    expLast ifTrue:[
1478
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1929
        e := items last.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1930
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1931
        e isVisible ifTrue:[
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1932
            layout := items last layout.
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1933
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1934
            isVert ifTrue:[layout bottom:((self extent y) + 1)]
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1935
                  ifFalse:[layout  right:((self extent x) + 1)].
38f08dec8e34 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1475
diff changeset
  1936
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  1937
    ].
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1938
    self rearrangeGroups.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1939
    mustRearrange := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1940
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  1941
    "Modified: / 19.1.1999 / 16:00:14 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1942
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1943
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1944
rearrangeItemsIfItemVisibilityChanged
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1945
    "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
  1946
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1947
    items isNil ifTrue:[^ self].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1948
    items do:[:item |
1464
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1949
        item canChangeVisibility ifTrue:[
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1950
            mustRearrange := true.
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1951
            self rearrangeItems.
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1952
            ^ self
3070de4c8b88 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1459
diff changeset
  1953
        ].
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1954
    ]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1955
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  1956
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1957
redrawX:x y:y width:w height:h
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1958
    "redraw a rectangle
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1959
    "
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1960
    |start end isVrt x1 x2 y1 y2 item layout lnSz hrzInset 
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1961
     prevClip didRearrange|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1962
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  1963
    (shown and:[w ~~ 0]) ifFalse:[^ self].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1964
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1965
    self  paint:(self backgroundColor).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1966
    self  clearRectangleX:x y:y width:w height:h.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1967
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1968
    isVrt := self verticalLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1969
    end   := items size.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1970
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1971
    (didRearrange := mustRearrange) ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1972
        self isPopUpView not ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1973
            explicitExtent := true
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1974
        ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1975
        self rearrangeItems.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1976
        start := 1
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1977
    ] ifFalse:[
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1978
        end == 0 ifTrue:[ ^ self ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1979
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1980
        isVrt ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1981
            start := self findFirst:[:el| (el layout bottom) >= y ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1982
            start == 0 ifTrue:[ ^ self ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1983
            end := y + h.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1984
            end := self findLast:[:el| (el layout top) < end ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1985
        ] ifFalse:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1986
            start := self findFirst:[:el| (el layout right) >= x ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1987
            start == 0 ifTrue:[ ^ self ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1988
            end := x + w.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1989
            end := self findLast:[:el| (el layout left) < end ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1990
        ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1991
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1992
        (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1993
            start := start - 1
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  1994
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1995
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  1996
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1997
    (     self hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1998
     and:[self showGroupDivider
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  1999
     and:[self isFitPanel not]]
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2000
    ) ifTrue:[
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2001
        lnSz := groupDividerSize // 2
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2002
    ].
1101
22eb87115477 level on default 1
ca
parents: 1097
diff changeset
  2003
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2004
    end == 0 ifTrue:[^ self ].
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2005
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2006
    hrzInset := items first horizontalInset.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2007
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2008
    didRearrange ifFalse:[
1388
e82976e15b92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1387
diff changeset
  2009
        prevClip := clipRect.
e82976e15b92 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1387
diff changeset
  2010
        self clippingRectangle:(Rectangle left:x top:y width:w height:h).
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2011
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  2012
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2013
    start to:end do:[:i|
1387
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2014
        item := items at:i.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2015
        item redraw.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2016
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2017
        (lnSz notNil and:[self hasGroupDividerAt:i]) ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2018
            layout := item layout.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2019
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2020
            isVrt ifTrue:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2021
                x1 := layout left  + hrzInset.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2022
                x2 := layout right - hrzInset.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2023
                y1 := (layout bottom) + lnSz.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2024
                y2 := y1.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2025
            ] ifFalse:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2026
                x1 := (layout right) + lnSz.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2027
                x2 := x1.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2028
                y1 := layout top.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2029
                y2 := layout bottom.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2030
            ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2031
            self paint:(self shadowColor).
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2032
            self displayLineFromX:x1 y:y1 toX:x2 y:y2.
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2033
            self paint:(self lightColor).
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2034
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2035
            isVrt ifTrue:[y1 := y1 + 1. y2 := y1 ]
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2036
                 ifFalse:[x1 := x1 + 1. x2 := x1 ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2037
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2038
            self displayLineFromX:x1 y:y1 toX:x2 y:y2
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2039
        ]
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2040
    ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2041
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2042
    didRearrange ifFalse:[
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2043
        self clippingRectangle:prevClip
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2044
    ].
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2045
ad7a920fdf61 less flicker by using a clipRect in redraw
Claus Gittinger <cg@exept.de>
parents: 1382
diff changeset
  2046
    "Modified: / 21.5.1999 / 20:14:07 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2047
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2048
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2049
!MenuPanel methodsFor:'enumerting & searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2050
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2051
collect:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2052
    "evaluate the argument, aOneArgBlock for every item in the menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2053
     and return a collection of the results
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2054
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2055
    items notNil ifTrue:[^ items collect:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2056
  ^ nil
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
do:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2061
    "evaluate the argument, aOneArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2062
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2063
    items notNil ifTrue:[ items do:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2064
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2065
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2066
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2067
findFirst:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2068
    "find the first item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2069
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2070
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2071
    items notNil ifTrue:[ ^ items findFirst:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2072
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2073
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2074
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2075
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2076
findLast:aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2077
    "find the last item, for which evaluation of the argument, aOneArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2078
     returns true; return its index or 0 if none detected.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2079
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2080
    items notNil ifTrue:[ ^ items findLast:aOneArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2081
  ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2082
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2083
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2084
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2085
indexOf:something
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2086
    "returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2087
     If no item match 0 is returned. No range checks are performed on a number argument
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2088
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2089
    |i v|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2090
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2091
    something isNumber ifTrue:[ ^ something ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2092
    something isNil    ifTrue:[ ^ 0 ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2093
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2094
    i := self findFirst:[:el | (el nameKey = something) or: [el = something]].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2095
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2096
    i ~~ 0 ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2097
	^ i
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2098
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2099
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2100
    something isSymbol ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2101
	i := self findFirst:[:el|
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2102
				v := el value.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2103
				v isSymbol and:[v == something]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2104
			    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2105
	i ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2106
	    ^ i
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2107
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2108
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2109
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2110
    (something respondsTo:#string) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2111
	v := something string.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2112
      ^ self findFirst:[:el | el textLabel = v].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2113
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2114
    ^ 0
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2115
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2116
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2117
indexOfItem:anItem
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2118
    "returns the index of the item or 0
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2119
    "
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2120
    ^ items notNil ifTrue:[items identityIndexOf:anItem] ifFalse:[0]
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2121
!
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  2122
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2123
keysAndValuesDo:aTwoArgBlock
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2124
    "evaluate the argument, aTwoArgBlock for every item in the menuPanel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2125
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2126
    items notNil ifTrue:[ items keysAndValuesDo:aTwoArgBlock ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2127
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2128
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2129
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2130
!MenuPanel methodsFor:'event handling'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2131
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2132
buttonMotion:state x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2133
    "open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2134
    "
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2135
    |menu point sensor sel itm|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2136
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2137
    (    (sensor := self sensor) notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2138
     and:[sensor hasButtonMotionEventFor:nil]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2139
    ) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2140
	^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2141
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2142
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2143
    sensor anyButtonPressed ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2144
	"/ TODO: remember item over which pointer is
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2145
	"/ (for enteredFG/enteredBG/enteredLevel handling)
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2146
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2147
        
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2148
	(buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2149
	or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2150
	    (self containsPointX:x y:y) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2151
		((sel := self itemAtX:x y:y) notNil 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2152
		and:[sel isButton 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2153
		and:[superMenu isNil
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2154
		and:[sel canSelect]]]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2155
		    itm := sel.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2156
		] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2157
		    itm := nil
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2158
		].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2159
		self itemEntered:itm.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2160
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2161
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2162
	^ self
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2163
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2164
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2165
    "/ ok, a button is pressed.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2166
    (buttonEnteredBgColor ~= ButtonPassiveBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2167
    or:[ButtonEnteredLevel ~~ ButtonPassiveLevel]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2168
	self itemEntered:nil.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2169
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2170
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2171
    lastButtonSelected notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2172
	^ self
1044
3584c06b9e44 add button behaviour:
ca
parents: 1039
diff changeset
  2173
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2174
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2175
    (self containsPointX:x y:y) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2176
	((sel := self itemAtX:x y:y) notNil 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2177
	and:[sel isButton 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2178
	and:[superMenu isNil
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2179
	and:[sel canSelect]]]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2180
	    lastButtonSelected := sel
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2181
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2182
	^ self selection:sel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2183
    ].
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2184
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2185
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2186
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2187
    menu isNil ifTrue:[
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2188
       ^ self selection:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2189
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2190
    point := self translatePoint:(x@y) to:menu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2191
    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
  2192
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  2193
    "Modified: / 22.8.1998 / 12:51:17 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2194
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2195
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2196
buttonPress:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2197
    "any button pressed; open or close the corresponding submenus
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2198
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2199
    |menu point item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2200
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2201
    menu := self superMenuAtX:x y:y.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2202
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2203
    menu isNil ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2204
        menu := self topMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2205
    ] ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2206
        point := self translatePoint:(x@y) to:menu.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2207
        item  := menu itemAtX:(point x) y:(point y)
1255
f18c03dc613f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
  2208
    ].
f18c03dc613f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
  2209
    menu selection:item.
f18c03dc613f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
  2210
f18c03dc613f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
  2211
    self requestFocus
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2212
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2213
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2214
buttonRelease:button x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2215
    "button release action; accept selection and close all views
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2216
    "
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2217
    |menu item|
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2218
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2219
    menu := self topMenu activeMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2220
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2221
    (    menu selection notNil
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2222
     or:[menu isPopUpView not
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2223
     or:[(OperatingSystem millisecondTimeDeltaBetween:(Time millisecondClockValue)
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2224
                                and:(menu mapTime)) > 400]]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2225
    ) ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2226
        item := nil.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2227
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2228
        (     (menu := self superMenuAtX:x y:y) notNil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2229
         and:[(item := menu selection) notNil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2230
         and:[item hasSubmenu]]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2231
        ) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2232
            menu selection:nil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2233
        ] ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2234
            (    lastButtonSelected isNil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2235
             or:[item isNil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2236
             or:[(menu itemAtX:x y:y) == lastButtonSelected]]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2237
            ) ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2238
                item := nil
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2239
            ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2240
            self topMenu accept:item
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  2241
        ]
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2242
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2243
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2244
    "Modified: / 27.2.1998 / 17:41:23 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2245
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2246
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2247
cursorPressed:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2248
    "handle a cursor key
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2249
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2250
    |next submenu item
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2251
     n     "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2252
     idx   "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2253
     first "{ Class:SmallInteger }"
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2254
    |
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2255
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2256
    (self selection isNil 
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2257
    and:[superMenu notNil]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2258
	^ superMenu cursorPressed:aKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2259
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2260
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2261
    self verticalLayout ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2262
	aKey == #CursorLeft  ifTrue:[^ self selection:nil].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2263
	aKey ~~ #CursorRight ifTrue:[next := aKey == #CursorDown].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2264
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2265
	aKey == #CursorUp ifTrue:[^ self selection:nil].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2266
	aKey ~~ #CursorDown ifTrue:[next := aKey == #CursorRight].        
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2267
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2268
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2269
    next isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2270
	(item := self selection) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2271
	    (submenu := item submenu) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2272
		idx := submenu findFirst:[:el| el canSelect ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2273
	      ^ submenu selectionIndex:idx
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2274
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2275
	  ^ self selection:nil
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2276
	].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2277
      ^ self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2278
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2279
    first := self findFirst:[:el| el canSelect ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2280
    first == 0 ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2281
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2282
    idx := self selectionIndex.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2283
    n   := 1 + (self sensor compressKeyPressEventsWithKey:aKey).
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2284
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2285
    n timesRepeat:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2286
	next ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2287
	    [((idx := idx + 1) <= items size and:[(items at:idx) canSelect not])
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2288
	    ] whileTrue.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2289
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2290
	    idx > items size ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2291
		idx := first
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2292
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2293
	] ifFalse:[    
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2294
	    [((idx := idx - 1) > 0  and:[(items at:idx) canSelect not])
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2295
	    ] whileTrue.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2296
            
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2297
	    idx < 1 ifTrue:[ idx := self findLast:[:el| el canSelect ] ]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2298
	]
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2299
    ].
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2300
    self selectionIndex:idx.
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2301
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2302
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2303
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2304
handleFocusNext
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2305
    "handle focus next key
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2306
    "
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2307
    |idx|
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2308
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2309
    (self isPopUpView or:[items isNil]) ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2310
	idx := self selectionIndex.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2311
	idx := items findFirst:[:el|el canSelect] startingAt:(1 + idx).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2312
	idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ]
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2313
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2314
    self selection:nil.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2315
    self windowGroup focusNextFrom:self.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2316
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
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2319
handleFocusPrevious
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2320
    "handle focus previous
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
    |idx sel|
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2323
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2324
    (self isPopUpView or:[items isNil]) ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2325
	sel := self selectionIndex.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2326
	idx := sel == 0 ifTrue:[self numberOfItems]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2327
		       ifFalse:[sel - 1].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2328
	idx := items findLast:[:el|el canSelect] startingAt:idx.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2329
	idx ~~ 0 ifTrue:[ ^ self selectionIndex:idx ]
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2330
    ].
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2331
    self selection:nil.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2332
    self windowGroup focusPreviousFrom:self.
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2333
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
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2336
itemEntered:anItem
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2337
    |prevEnteredItem|
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2338
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2339
    anItem == enteredItem ifTrue:[^ self].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2340
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2341
    prevEnteredItem := enteredItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2342
    enteredItem := anItem.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2343
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2344
    prevEnteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2345
	prevEnteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2346
    ].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2347
    enteredItem notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2348
	enteredItem redraw
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2349
    ].
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
    "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
  2352
    "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
  2353
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2354
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2355
keyPress:key x:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2356
    "any key is pressed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2357
    "
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2358
    |item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2359
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2360
    shown ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2361
        superMenu notNil ifTrue:[superMenu keyPress:key x:x y:y].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2362
      ^ self
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2363
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2364
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2365
    key == #Return ifTrue:[^ self accept].
1199
73c48a823430 add focusNext/focusPrevious
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  2366
1250
021204b5bde5 hide menu on ESC;
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  2367
    "/ cg: must hide the active menu ...
021204b5bde5 hide menu on ESC;
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  2368
    key == #Escape ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2369
        superMenu notNil ifTrue:[superMenu selection:nil].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2370
      ^ self
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2371
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2372
1250
021204b5bde5 hide menu on ESC;
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  2373
    "/ tabbing to the next view ...
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2374
       (key == #Tab 
1250
021204b5bde5 hide menu on ESC;
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  2375
    or:[key == #FocusNext
021204b5bde5 hide menu on ESC;
Claus Gittinger <cg@exept.de>
parents: 1240
diff changeset
  2376
    or:[key == #FocusPrevious]]) ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2377
        "/ if there is a menu open, hide it ...
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2378
        superMenu notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2379
            superMenu selection:nil
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2380
        ] ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2381
            super keyPress:key x:x y:y
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2382
        ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2383
        ^ self
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2384
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2385
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2386
    (     key == #CursorDown or:[key == #CursorUp
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2387
      or:[key == #CursorLeft or:[key == #CursorRight]]]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2388
    ) ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2389
        ^ self cursorPressed:key
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2390
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2391
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2392
    (self processShortcutKeyInMenuBar:key) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2393
        ^ self
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2394
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2395
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2396
    (item := self detectItemForKey:key) notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2397
        ^ self selection:item.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2398
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2399
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2400
    superMenu notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2401
        item := superMenu detectItemForKey:key.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2402
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2403
        (item notNil or:[superMenu superMenu notNil]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2404
            superMenu selection:item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2405
        ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2406
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2407
    "/ nothing changed, nothing closed
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2408
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2409
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2410
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2411
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2412
pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2413
    self itemEntered:nil.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2414
    super pointerLeave:state
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2415
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2416
    "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
  2417
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2418
1240
167fcc9bd9de prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
  2419
processShortcutKeyEventInMenuBar:event
167fcc9bd9de prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
  2420
    "an event as forwarded from the keyboardProcessor -
167fcc9bd9de prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
  2421
     if there is a short-key for that character, process it
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2422
     and return true. Otherwise, return false.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2423
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2424
    |key|
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2425
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2426
    key := event key.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2427
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2428
    key isCharacter ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2429
        ( #(
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2430
            #Meta_L
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2431
            #CursorUp
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2432
            #CursorDown
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2433
            #CursorLeft
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2434
            #CursorRight
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2435
            #Return
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2436
            #Tab
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2437
            #FocusNext
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2438
            #FocusPrevious
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2439
            #Escape
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2440
           ) includesIdentical:key
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2441
        ) ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2442
           ^ self processShortcutKeyInMenuBar:key
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2443
        ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2444
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  2445
    ^ false
1240
167fcc9bd9de prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
  2446
!
167fcc9bd9de prepared for shortKey processing (via keyboardProcessor)
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
  2447
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2448
sizeChanged:how
1367
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2449
    "redraw #right groups
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2450
    "
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2451
    |index layout invRect w right|
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2452
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2453
    mustRearrange ifTrue:[
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2454
        ^ super sizeChanged:how
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2455
    ].
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2456
1367
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2457
    index := self findFirst:[:anItem| anItem startGroup == #right ].
3213704f7ca2 sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2458
    index ~~ 0 ifTrue:[
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2459
        (shown not or:[index == 1]) ifTrue:[
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2460
            self mustRearrange.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2461
        ] ifFalse:[
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2462
            layout := (items at:(index -1)) layout.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2463
            right  := 1 + layout right.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2464
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2465
            (w := width - right) > margin ifTrue:[
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2466
                invRect := Rectangle left:right top:0 width:w height:height.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2467
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2468
                items from:index do:[:anItem|
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2469
                    anItem isVisible ifTrue:[
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2470
                        layout := anItem layout.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2471
                        layout setLeft:right.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2472
                        right := layout right.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2473
                    ]
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2474
                ].
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2475
                self rearrangeGroups.
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2476
                self invalidate:invRect
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2477
            ]
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2478
        ]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2479
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  2480
    super sizeChanged:how
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2481
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2482
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2483
!MenuPanel methodsFor:'grabbing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2484
420
ca
parents: 417
diff changeset
  2485
forceUngrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2486
    "ungrab resources (mouse and keyboard)
420
ca
parents: 417
diff changeset
  2487
    "
ca
parents: 417
diff changeset
  2488
    |sensor|
ca
parents: 417
diff changeset
  2489
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2490
    self forceUngrabPointer.
420
ca
parents: 417
diff changeset
  2491
ca
parents: 417
diff changeset
  2492
    (sensor := self sensor) notNil ifTrue:[
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2493
        "/ make certain all X events have been received
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2494
        device sync.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2495
        "/ now all events have been received.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2496
        "/ now, flush all pointer events
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2497
        sensor flushKeyboardFor:nil
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2498
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2499
    self forceUngrabKeyboard.
420
ca
parents: 417
diff changeset
  2500
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2501
    "Modified: / 2.2.1998 / 09:24:48 / stefan"
420
ca
parents: 417
diff changeset
  2502
!
ca
parents: 417
diff changeset
  2503
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2504
grabKeyboard
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2505
    previousKeyboardGrab := device activeKeyboardGrab.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2506
"/ Transcript show:'k-ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2507
    ^ super grabKeyboard
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2508
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2509
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2510
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2511
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2512
grabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2513
    "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
  2514
     Only used for popUp menus."
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2515
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2516
    |sensor|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2517
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2518
    realized ifTrue:[
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  2519
        prevFocusView isNil ifTrue:[
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  2520
            prevFocusView := self windowGroup focusView.
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  2521
        ].
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  2522
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2523
        sensor := self sensor.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2524
        device activePointerGrab ~~ self ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2525
            sensor notNil ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2526
                sensor flushMotionEventsFor:nil.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2527
            ].
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2528
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2529
            (self grabPointer) ifFalse:[
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2530
                Delay waitForSeconds:0.1.
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2531
                (self grabPointer) ifFalse:[
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2532
                    "give up"
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2533
                    'MenuPanel [warning]: could not grab pointer' errorPrintCR.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2534
                    self unmap
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2535
                ]
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2536
            ]
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2537
        ].
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2538
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2539
        device activeKeyboardGrab ~~ self ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2540
            sensor notNil ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2541
                device sync.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2542
                sensor flushKeyboardFor:nil
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2543
            ].
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2544
            self grabKeyboard.
1575
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2545
        ].
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2546
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2547
        superMenu notNil ifTrue:[
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2548
            windowGroup focusView:self byTab:true.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2549
"/            self requestFocus.
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2550
"/            self getKeyboardFocus
c56d76e45113 force set focus
ca
parents: 1574
diff changeset
  2551
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2552
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2553
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2554
    "Modified: / 2.2.1998 / 23:43:59 / stefan"
1254
38b8bcfabbd7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1253
diff changeset
  2555
    "Modified: / 15.3.1999 / 12:01:38 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2556
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2557
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2558
grabPointerWithCursor:aCursorOrNil
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2559
    previousPointerGrab := device activePointerGrab.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2560
"/ Transcript show:'ggg by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2561
    ^ super grabPointerWithCursor:aCursorOrNil
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2562
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2563
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2564
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2565
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2566
ungrabKeyboard
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2567
"/ Transcript show:'k-uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousKeyboardGrab printString.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2568
    super ungrabKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2569
    previousKeyboardGrab notNil ifTrue:[
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2570
        device grabKeyboardInView:previousKeyboardGrab
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2571
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2572
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2573
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2574
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2575
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2576
ungrabMouseAndKeyboard
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2577
    "ungrab resources (mouse and keyboard)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2578
    "
1610
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2579
    self ungrabMouseAndKeyboardRestoreFocus:true
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2580
!
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2581
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2582
ungrabMouseAndKeyboardRestoreFocus:doRestore
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2583
    "ungrab resources (mouse and keyboard)
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  2584
    "
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2585
    self ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2586
    self ungrabKeyboard.
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  2587
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2588
    "Modified: / 2.2.1998 / 10:27:12 / stefan"
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2589
!
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2590
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2591
ungrabPointer
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2592
"/ Transcript show:'uuu by '; show:self; show:'[',self identityHash printString,']'; showCR:' - previous is ' , previousPointerGrab printString.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2593
    super ungrabPointer.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2594
    previousPointerGrab notNil ifTrue:[
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2595
        device grabPointerInView:previousPointerGrab
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2596
    ].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2597
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2598
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2599
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2600
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2601
!MenuPanel methodsFor:'help'!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2602
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2603
helpText
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2604
    "return the helpText for the currently selected item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2605
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2606
    ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2607
!
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2608
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2609
helpTextAt:aPoint
1252
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  2610
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  2611
     If there is a selection, that items helpText is used (ignoreing the given point).
6db6906da49b debug print
Claus Gittinger <cg@exept.de>
parents: 1251
diff changeset
  2612
     "
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2613
    |menu point|
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2614
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2615
    selection notNil ifTrue:[
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2616
        ^ self helpTextForItem:selection
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2617
    ].
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2618
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2619
    (self containsPoint:aPoint) ifFalse:[
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2620
        superMenu notNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2621
            ^ superMenu helptext
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2622
        ]
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2623
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2624
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2625
    (menu := self superMenuAtX:aPoint x y:aPoint y) isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2626
        ^ ''
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2627
    ].
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2628
    point := self translatePoint:aPoint to:menu.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2629
  ^ menu helpTextForItem:(menu itemAtX:(point x) y:(point y)).
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2630
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2631
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2632
helpTextForItem:anItem
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2633
    "returns the helpText for an item (empty if none)
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2634
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2635
    |key val app|
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2636
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2637
    anItem isNil ifTrue:[^ ''].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2638
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2639
    (val := anItem activeHelpText) isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2640
        (     (key := anItem activeHelpKey) notNil
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2641
         and:[(app := self application) notNil]
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2642
        ) ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2643
            val := app helpTextForKey:key.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2644
        ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2645
        anItem activeHelpText:(val ? '').
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2646
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2647
    ^ val
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  2648
1251
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2649
! !
eb5b4cdbacde fixed helpText display;
Claus Gittinger <cg@exept.de>
parents: 1250
diff changeset
  2650
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2651
!MenuPanel methodsFor:'image registration'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2652
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2653
imageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2654
    "returns image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2655
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2656
    ^ self class image:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2657
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2658
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2659
lightenedImageOnDevice:anImage
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2660
    "returns lightened image registered on device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2661
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2662
    ^ self class lightenedImage:anImage onDevice:device
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2663
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  2664
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2665
!MenuPanel methodsFor:'initialize / release'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2666
767
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2667
addToCurrentProject
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2668
    "ignored here"
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2669
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2670
    ^self
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2671
!
ffa2a09a1039 added #addToCurrentProject in order to avoid restart errors
tz
parents: 746
diff changeset
  2672
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2673
create
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2674
    "create the shadow view for a none contained submenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2675
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2676
    super create.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2677
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2678
    self isPopUpView ifTrue:[
1499
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2679
        (PopUpView shadowsOnDevice:device) ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2680
            shadowView isNil ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2681
                shadowView := (ShadowView onDevice:device) for:self
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2682
            ] ifFalse:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2683
                self saveUnder:true.
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2684
            ].
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2685
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2686
    ] ifFalse:[
1499
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2687
        explicitExtent == true ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2688
            (self width) == (superView width) ifTrue:[
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2689
                self verticalLayout:false
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2690
            ]
07951b17b43e allow for a device to suppress shadowViews.
Claus Gittinger <cg@exept.de>
parents: 1478
diff changeset
  2691
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2692
    ]
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2693
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2694
    "Modified: / 28.7.1998 / 02:11:44 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2695
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2696
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2697
destroy
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2698
    "destroy items and shadowView; remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2699
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2700
    self clearLastActiveMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2701
    self do:[:el|el destroy].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2702
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2703
    menuHolder    notNil ifTrue:[menuHolder    removeDependent:self].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2704
    enableChannel notNil ifTrue:[enableChannel removeDependent:self].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2705
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2706
    super destroy.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2707
    superMenu := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2708
    items     := nil.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2709
    shadowView notNil ifTrue:[shadowView destroy].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2710
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2711
    "Modified: / 27.2.1998 / 17:41:25 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2712
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2713
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2714
fetchDeviceResources
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2715
    "fetch device colors, to avoid reallocation at redraw time"
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2716
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2717
    |style|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2718
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2719
    super fetchDeviceResources.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2720
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2721
    style := styleSheet name.
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2722
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2723
    "/ 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
  2724
    "/ (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
  2725
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2726
    onLevel := styleSheet at:#'menu.hilightLevel' default:0.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  2727
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2728
    superMenu isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2729
	fgColor                   := DefaultForegroundColor         onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2730
	activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2731
	activeFgColor             := DefaultHilightForegroundColor  onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2732
	disabledFgColor           := DefaultDisabledForegroundColor onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2733
	rightArrow                := RightArrowForm                 onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2734
	selectionFrameBrightColor := SelectionFrameBrightColor      onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2735
	selectionFrameDarkColor   := SelectionFrameDarkColor        onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2736
	buttonLightColor          := ButtonLightColor               onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2737
	buttonShadowColor         := ButtonShadowColor              onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2738
	ButtonHalfLightColor notNil ifTrue: [
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2739
	    buttonHalfLightColor      := ButtonHalfLightColor           onDevice:device].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2740
	ButtonHalfShadowColor notNil ifTrue: [
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2741
	    buttonHalfShadowColor     := ButtonHalfShadowColor          onDevice:device].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2742
	buttonEnteredBgColor      := ButtonEnteredBackgroundColor   onDevice:device.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2743
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2744
	(rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2745
	    rightArrowShadow := rightArrowShadow onDevice:device
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2746
	]
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2747
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2748
	fgColor                   := superMenu foregroundColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2749
	activeBgColor             := superMenu activeBackgroundColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2750
	activeFgColor             := superMenu activeForegroundColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2751
	disabledFgColor           := superMenu disabledForegroundColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2752
	rightArrow                := superMenu rightArrow.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2753
	rightArrowShadow          := superMenu rightArrowShadow.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2754
	selectionFrameBrightColor := superMenu selectionFrameBrightColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2755
	selectionFrameDarkColor   := superMenu selectionFrameDarkColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2756
	buttonLightColor          := superMenu buttonLightColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2757
	buttonShadowColor         := superMenu buttonShadowColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2758
	buttonHalfLightColor      := superMenu buttonHalfLightColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2759
	buttonHalfShadowColor     := superMenu buttonHalfShadowColor.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2760
	buttonEnteredBgColor      := superMenu buttonEnteredBackgroundColor.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2761
    ].
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2762
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2763
    "Modified: / 15.9.1998 / 12:51:29 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2764
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2765
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2766
initPopUpDependentStyle:isPopUp
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2767
    "/ stupid - must be invoked explicit, since, 
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2768
    "/ #isPopUpView does not return a correct value at initStyle time
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2769
    "/ (thinks that all are popup views) ...
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2770
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2771
    |bw lvl|
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2772
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2773
    isPopUp ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2774
	bw := styleSheet at:#'popup.borderWidth' default:1.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2775
	lvl := styleSheet at:#'popup.level' default:0.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2776
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2777
	bw := (styleSheet is3D ifFalse:[1] ifTrue:[0]).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2778
	lvl := DefaultLevel.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2779
    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2780
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2781
    bw notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2782
	self borderWidth:bw
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2783
    ].
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2784
    lvl notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2785
	self level:lvl
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2786
    ]
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2787
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2788
!
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2789
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2790
initStyle
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2791
    "initialize style specific stuff"
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2792
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2793
    super initStyle.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2794
1336
6087005f59a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1332
diff changeset
  2795
    viewBackground := DefaultBackgroundColor.
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2796
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2797
    onLevel   := DefaultHilightLevel.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2798
    offLevel  := 0. "/ DefaultLevel.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2799
    itemSpace := DefaultItemSpace.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2800
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2801
    groupDividerSize := DefaultGroupDividerSize.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2802
    fitFirstPanel := DefaultFitFirstPanel.
1082
382324ddce3f support and additional buttonSpacing (for normal and win95 styles)
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  2803
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2804
    "/ for now, assume not popUp (since superMenu is always nil at this time)
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2805
    self initPopUpDependentStyle:false.  
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2806
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2807
    font := MenuView defaultFont.
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2808
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2809
    "Modified: / 15.9.1998 / 12:50:14 / cg"
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2810
!
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  2811
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2812
initialize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2813
    "set default configuration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2814
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2815
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2816
    super initialize.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  2817
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  2818
    enabled := true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2819
    originChanged  := extentChanged := false.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2820
    explicitExtent := nil.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2821
    shortKeyInset  := 0.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2822
    mustRearrange  := false.
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  2823
1137
7df0b776e47a fixes for 2D styles (borderWidth)
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
  2824
    "Modified: / 15.9.1998 / 12:49:51 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2825
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2826
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  2827
map
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2828
    "grab the pointer here, when visible (but not if control has already been lost). 
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2829
     If the grab fails, try again and unmap myself if that fails too.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2830
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2831
    |anItemList|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2832
1024
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2833
    self enableMotionEvents.
28c87a2369f6 show active help on pointer motion.
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
  2834
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  2835
    lastButtonSelected := nil.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2836
    self becomesActiveMenu.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  2837
    super map.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2838
1257
79a40d3f8c2f Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 1255
diff changeset
  2839
    anItemList := InitialSelectionQuerySignal query.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2840
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2841
    self do:[:anItem| anItem fetchImages ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2842
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2843
    self isPopUpView ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2844
        self grabMouseAndKeyboard
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2845
    ] ifFalse:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2846
        super viewBackground:(self backgroundColor).
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2847
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2848
    self do:[:el| el updateIndicators ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2849
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2850
    anItemList size > 0 ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2851
        self redrawX:0 y:0 width:width height:height.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  2852
        self openMenusFromItems:anItemList.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2853
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2854
1177
cfd7f71639f3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
  2855
    "Modified: / 19.11.1998 / 12:59:00 / cg"
1257
79a40d3f8c2f Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 1255
diff changeset
  2856
    "Modified: / 18.3.1999 / 18:22:18 / stefan"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2857
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2858
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2859
realize
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2860
    "realize menu and shadowView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2861
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  2862
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2863
    self isPopUpView ifTrue:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2864
        "Because of #saveUnder of ShadowView the order of realize is significant:
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2865
         shadowView must be realized before self"
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2866
        self hiddenOnRealize:true.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2867
        super realize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2868
        self resize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2869
        self makeFullyVisible.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2870
        shadowView notNil ifTrue:[
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2871
            shadowView realize.
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2872
        ].
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2873
        self raise.
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  2874
        self map.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2875
    ] ifFalse:[
1459
53f83c83b354 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  2876
        super realize.
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2877
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2878
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2879
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2880
recreate
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2881
    "this is called after a snapin. If the image was saved with an active menu,
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2882
     hide the menu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2883
    "
1455
5685ec322a5b sizeChanged:...
Claus Gittinger <cg@exept.de>
parents: 1388
diff changeset
  2884
    selection := nil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2885
    super recreate.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2886
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2887
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2888
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2889
reinitStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2890
    "handle style change while being open (win32 only - for now)"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2891
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2892
    super reinitStyle.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2893
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2894
    self fetchDeviceResources.
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2895
    items notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2896
	items do:[:anItem |
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2897
	    anItem reinitSubmenuStyle
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2898
	]
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2899
    ]
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2900
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2901
    "Created: / 10.9.1998 / 21:37:05 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2902
    "Modified: / 11.9.1998 / 13:20:57 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2903
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  2904
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2905
unmap
1330
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  2906
    "unmap the view - the view stays created (but invisible), and can be remapped again later.
63d2fe5ebd48 comment
Claus Gittinger <cg@exept.de>
parents: 1313
diff changeset
  2907
     If we have a popup supermenu, it will get all keyboard and mouse events."
736
220741d8049b Use #saveUnder.
Claus Gittinger <cg@exept.de>
parents: 735
diff changeset
  2908
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2909
    self clearLastActiveMenu.
879
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  2910
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2911
self isPopUpView ifTrue:[
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2912
     self ungrabMouseAndKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2913
].
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2914
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2915
"/        "/
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2916
"/        "/ Kludge for X11: after grabbing and ungrabbing other views may get buttonMotionEvents
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2917
"/        "/ when a mouse button is still pressed. To avoid this we grab the mouse for the superview.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2918
"/        "/ (Move from upperMenuPanel of NewLauncher to lowerMenuPanel)
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2919
"/        "/
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2920
"/        (superMenu notNil 
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2921
"/        and:[superMenu shown 
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2922
"/        and:[superMenu isPopUpView 
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2923
"/             or:[superMenu sensor anyButtonPressed]]]) 
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2924
"/        ifTrue:[
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2925
"/    "/        superMenu grabMouseAndKeyboard
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2926
"/        ] ifFalse:[
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2927
"/            self ungrabMouseAndKeyboard.
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  2928
"/        ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2929
    super unmap.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2930
    shadowView notNil ifTrue:[shadowView unmap].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2931
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  2932
    "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
  2933
    "Modified: / 27.2.1998 / 17:41:24 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2934
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2935
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2936
!MenuPanel methodsFor:'misc'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2937
427
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2938
raiseDeiconified
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2939
    ^ self raise
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2940
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2941
    "Created: 21.6.1997 / 13:29:12 / cg"
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2942
!
82cbad72e197 raiseDeiconified is treated like a raise
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
  2943
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2944
superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2945
    "returns supermenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2946
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2947
    ^ superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2948
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2949
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2950
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2951
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2952
superMenu:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2953
    "set the supermenu starting from
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2954
    "
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2955
    |prev|
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2956
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2957
    prev := superMenu.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2958
    superMenu := aSuperMenu.
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2959
    (prev isNil and:[superMenu notNil]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  2960
	self initPopUpDependentStyle:(self isPopUpView)
1331
aae37cbfb30a fixed style handling to avoid bad resizing when popup-level/bw
Claus Gittinger <cg@exept.de>
parents: 1330
diff changeset
  2961
    ].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2962
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2963
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2964
topMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2965
    "returns the topMenu; the one having no superMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2966
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2967
    |top|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2968
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2969
    top := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2970
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2971
    [ top superMenu notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2972
	top := top superMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2973
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2974
  ^ top
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2975
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2976
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2977
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2978
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2979
!MenuPanel methodsFor:'printing'!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2980
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2981
printString
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2982
    "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
  2983
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2984
    |string label|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2985
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2986
    string := 'Menu:'.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2987
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2988
    self do:[:anItem|
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2989
	label  := anItem label ? ''.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  2990
	string := string ,' ', label printString.
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2991
    ].
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2992
    ^ string
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2993
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2994
    "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
  2995
! !
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  2996
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2997
!MenuPanel methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  2998
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  2999
application
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3000
    "optimize access to retrive the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3001
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3002
    |appl akey|
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3003
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3004
    superMenu notNil ifTrue:[
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3005
        ^ superMenu application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3006
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3007
    akey := #appl.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3008
    appl := self menuAdornmentAt:akey.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3009
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3010
    appl isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3011
        (appl := super application) isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3012
            windowGroup isNil ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3013
                ^ nil   "/ RETRY LATER
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3014
            ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3015
            appl := (windowGroup mainGroup topViews first application) ? akey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3016
        ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3017
        self menuAdornmentAt:akey put:appl
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3018
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  3019
    ^ appl ~~ akey ifTrue:[appl] ifFalse:[nil]
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3020
!
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3021
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3022
detectItemForKey:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3023
    "returns the item assigned to a key, accessCharacter or starts with.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3024
     if no item is detected nil is returned.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3025
    "
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3026
    |cIdx uKey lKey item|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3027
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3028
    cIdx := self selectionIndex.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3029
    uKey := aKey asUppercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3030
    lKey := aKey asLowercase.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3031
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3032
    self keysAndValuesDo:[:anIndex :anItem| |char label|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3033
        (     anIndex ~~ cIdx
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3034
         and:[anItem canSelect
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3035
         and:[(label := anItem textLabel) notNil
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3036
         and:[label size ~~ 0]]]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3037
        ) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3038
            (char := anItem accessCharacter) notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3039
                (char == uKey or:[char == lKey]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3040
                    ^ anItem
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3041
                ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3042
            ] ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3043
                char := label at:1.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3044
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3045
                (char == uKey or:[char == lKey]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3046
                    anIndex > cIdx ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3047
                        ^ anItem
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3048
                    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3049
                    item isNil ifTrue:[item := anItem]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3050
                ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3051
            ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3052
        ]
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3053
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3054
    ^ item
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3055
!
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3056
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3057
menuAdornmentAt:aSymbol
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3058
    "returns a value derived from adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3059
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3060
    |adm|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3061
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3062
    adm := adornment ? DefaultAdornment.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3063
  ^ adm at:aSymbol ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3064
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3065
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3066
menuAdornmentAt:aSymbol put:something
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3067
    "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
  3068
     current stored value, true is returned otherwise false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3069
    "
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3070
    (self menuAdornmentAt:aSymbol) == something ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3071
	^ false
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3072
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3073
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3074
	adornment := DefaultAdornment copy
653
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3075
    ].
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3076
    adornment at:aSymbol put:something.
cf9b6ef11ade bug fix; no automatic rearrange of items
ca
parents: 650
diff changeset
  3077
  ^ true
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3078
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3079
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3080
onEachPerform:aSelector withArgList:aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3081
    "on each item perform selector with an argument derived from aList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3082
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3083
    aList isCollection ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3084
	items size >= aList size ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3085
	    aList keysAndValuesDo:[:anIndex :anArg|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3086
		(items at:anIndex) perform:aSelector with:anArg
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3087
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3088
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3089
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3090
	self do:[:anItem| anItem perform:aSelector with:aList ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3091
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3092
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3093
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3094
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3095
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3096
openMenusFromItems:anItemList
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3097
    "open all menus derived from sequence of items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3098
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3099
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3100
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3101
    anItemList size == 0 ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3102
        ^ self
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3103
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3104
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3105
    item := anItemList removeFirst.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3106
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3107
    item enabled ifFalse:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3108
        ^ self
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
    InitialSelectionQuerySignal answer:anItemList do:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3112
        self selection:item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3113
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3114
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3115
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3116
processShortcutKeyInMenuBar:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3117
    "if there is a short-key for that character, process it
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3118
     and return true. Otherwise, return false.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3119
    "
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3120
    |rawKey loItems item maxDepth menu|
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3121
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3122
    superMenu notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3123
        "/ must start from topMenu
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3124
        ^ self topMenu processShortcutKeyInMenuBar:aKey
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3125
    ].
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3126
    "/ 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
  3127
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3128
    maxDepth := 10.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3129
    rawKey   := device keyboardMap keyAtValue:aKey ifAbsent:aKey.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3130
    loItems  := self selectItemsForShortcutKey:rawKey maxDepth:maxDepth.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3131
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3132
    (loItems isNil and:[aKey ~~ rawKey]) ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3133
        loItems := self selectItemsForShortcutKey:aKey maxDepth:maxDepth.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3134
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3135
    loItems size == 0 ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3136
        ^ false
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3137
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3138
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3139
    item := loItems last.
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3140
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3141
    item hasSubmenu ifFalse:[
1574
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3142
        self accept:item.
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3143
      ^ true
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3144
    ].
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3145
    menu := self.
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3146
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3147
    [menu selection == (loItems at:1)] whileTrue:[
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3148
        loItems removeFirst.
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3149
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3150
        loItems isEmpty ifTrue:[
1610
8684ca8df70c checkin from browser
Stefan Vogel <sv@exept.de>
parents: 1609
diff changeset
  3151
          ^ false
1574
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3152
        ].
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3153
        menu := selection submenu.
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3154
    ].
4b9c4eb08dcb check whether menu already is open
ca
parents: 1573
diff changeset
  3155
    menu openMenusFromItems:loItems.
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3156
    ^ true.
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3157
!
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3158
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3159
selectItemsForShortcutKey:aKey maxDepth:maxDepth
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3160
    "get sequence of items up to the item providing the key (inclusive). The
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3161
     last entry into the collection is the item providing the key, the first
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3162
     entry is the item in the topMenu
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3163
    "
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3164
    |seq menu|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3165
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3166
    maxDepth <= 0 ifTrue:[^ nil].
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3167
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3168
    self do:[:anItem|
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3169
        anItem isEnabled ifTrue:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3170
            anItem shortcutKey == aKey ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3171
                seq := OrderedCollection new.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3172
            ] ifFalse:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3173
                (menu := anItem basicGetSubmenu) notNil ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3174
                    seq := menu selectItemsForShortcutKey:aKey maxDepth:maxDepth-1
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3175
                ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3176
            ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3177
            seq notNil ifTrue:[
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3178
                seq addFirst:anItem.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3179
              ^ seq
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3180
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  3181
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3182
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3183
  ^ nil
1181
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3184
97ee0869b374 care for endless recursion with linked menus
Claus Gittinger <cg@exept.de>
parents: 1177
diff changeset
  3185
    "Created: / 19.1.1999 / 16:00:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3186
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3187
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3188
translatePoint:aPoint to:aView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3189
    "translate a point into a views point; in case of no view nil is returned
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3190
    "
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3191
    aView == self ifTrue:[^ aPoint].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3192
    aView notNil ifTrue:[
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3193
      ^ device translatePoint:aPoint from:(self id) to:(aView id)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3194
    ].
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3195
    ^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3196
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3197
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3198
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3199
!MenuPanel methodsFor:'private activation'!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3200
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3201
activeMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3202
    "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
  3203
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3204
    ^ lastActiveMenu ? self
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3205
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3206
    "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
  3207
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3208
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3209
activeMenu:aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3210
    "set the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3211
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3212
    lastActiveMenu := aMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3213
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3214
    "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
  3215
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3216
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3217
becomesActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3218
    "submenu becomes the active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3219
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3220
    mapTime := Time millisecondClockValue.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3221
    self topMenu activeMenu:self.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3222
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3223
    "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
  3224
!
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3225
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3226
clearLastActiveMenu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3227
    "reset the current active menu
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3228
    "
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3229
    |top|
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3230
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3231
    top := self topMenu.
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3232
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3233
    prevFocusView notNil ifTrue:[
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3234
        self windowGroup focusView:prevFocusView.
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3235
        prevFocusView := nil.
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3236
    ].
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3237
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3238
    top activeMenu == self ifTrue:[
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  3239
        top activeMenu:nil
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3240
    ]
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3241
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3242
    "Created: / 27.2.1998 / 17:41:17 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3243
!
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3244
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3245
mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3246
    "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
  3247
    "
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3248
    ^ mapTime
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3249
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3250
    "Modified: / 27.2.1998 / 17:41:18 / cg"
687
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3251
! !
23ce9888d76f bug fixes:
ca
parents: 681
diff changeset
  3252
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3253
!MenuPanel methodsFor:'private searching'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3254
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3255
itemAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3256
    "returns item at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3257
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3258
    self do:[:el| (el containsPointX:x y:y) ifTrue:[^el] ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3259
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3260
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3261
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3262
superMenuAtX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3263
    "returns supermenu at a point or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3264
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3265
    |menu|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3266
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3267
    (self containsPointX:x y:y) ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3268
    menu := self.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3269
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3270
    [ (menu := menu superMenu) notNil ] whileTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3271
	(menu containsPoint:(self translatePoint:(x@y) to:menu)) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3272
	    ^ menu
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3273
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3274
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3275
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3276
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3277
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3278
!MenuPanel methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3279
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3280
canDrawItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3281
    "returns true if an item could be drawn otherwise false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3282
    "
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3283
    ^ (mustRearrange not and:[shown])
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3284
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3285
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3286
containsPoint:aPoint
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3287
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3288
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3289
    ^ self containsPointX:(aPoint x) y:(aPoint y)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3290
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3291
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3292
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3293
    "returns true if point is contained by the view
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3294
    "
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3295
    ^ (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
  3296
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3297
"/    |ext|
837cee20fdcb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 878
diff changeset
  3298
"/
708
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3299
"/    (x >= 0 and:[y >= 0]) ifTrue:[
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3300
"/        ext := self computeExtent.
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3301
"/      ^ (x < ext x and:[y < ext y])
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3302
"/    ].
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3303
"/    ^ false
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3304
245b1aa06151 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 706
diff changeset
  3305
    "Modified: / 29.1.1998 / 16:46:10 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3306
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3307
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3308
hasGroupDividerAt:anIndex
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3309
    "returns true if a divider is defined at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3310
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3311
    |i|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3312
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3313
    groupSizes size ~~ 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3314
	i := 0.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3315
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3316
	groupSizes do:[:t|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3317
	    (i := i + t) == anIndex ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3318
		^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3319
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3320
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3321
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3322
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3323
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3324
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3325
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3326
hasGroupDividers
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3327
    "returns true if any group divider exists
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3328
    "
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3329
  ^ (items size ~~ 0 and:[groupSizes size ~~ 0])
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3330
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3331
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3332
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3333
    "returns enabled state of menu and items
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3334
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3335
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3336
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3337
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3338
isFitPanel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3339
    "returns true if the panel is the first in the menu hierarchy in must
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3340
     be fit to the extent of its superView
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3341
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3342
    ^ self isPopUpView ifTrue:[false] ifFalse:[fitFirstPanel]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3343
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3344
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3345
isPopUpView
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3346
    "return true if view is a popup view; without decoration
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3347
     and popUp to top immediately
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3348
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3349
    ^ superView isNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3350
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3351
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3352
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3353
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3354
isVerticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3355
    "returns true if vertical layout otherwise false( horizontal layout )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3356
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3357
  ^ self verticalLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3358
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3359
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3360
!
c05874084d4c implement
ca
parents: 407
diff changeset
  3361
c05874084d4c implement
ca
parents: 407
diff changeset
  3362
type
428
ca
parents: 427
diff changeset
  3363
    ^ nil.
416
c05874084d4c implement
ca
parents: 407
diff changeset
  3364
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3365
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3366
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3367
!MenuPanel methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3368
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3369
hasSelection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3370
    "returns true if a selection exists
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3371
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3372
    ^ self selection notNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3373
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3374
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3375
isValidSelection:something
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3376
    "returns true if something could be selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3377
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3378
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3379
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  3380
    enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3381
	(item := self itemAt:something) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3382
	    ^ item canSelect
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3383
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3384
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3385
  ^ false
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3386
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3387
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3388
selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3389
    "returns current selected item or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3390
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3391
    ^ selection
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3392
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3393
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3394
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3395
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3396
selection:anItemOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3397
    "change selection to an item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3398
    "
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  3399
    |item newSel hlp|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3400
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3401
    (newSel := anItemOrNil) isNumber ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3402
        newSel := self itemAt:anItemOrNil
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3403
    ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3404
    (newSel notNil and:[newSel canSelect]) ifFalse:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3405
        newSel := nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3406
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3407
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3408
    selection == newSel ifTrue:[^ self].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3409
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3410
    (item := selection) notNil ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3411
        selection := nil.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3412
        item selected:false.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3413
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3414
    newSel notNil ifTrue:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3415
        selection := newSel.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3416
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3417
        ActiveHelp isActive ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3418
            hlp := ActiveHelp currentHelpListener.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3419
            hlp initiateHelpFor:self atX:nil y:nil now:true.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3420
        ].
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  3421
        realized ifTrue:[self rearrangeItems].
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  3422
        selection selected:true.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3423
    ].
717
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3424
540e638fdebb Avoid pointer and keyboard grabbing if not necessary
Stefan Vogel <sv@exept.de>
parents: 712
diff changeset
  3425
    "Modified: / 2.2.1998 / 10:13:46 / stefan"
1039
faa24ee79e12 fixed invalid help text display.
Claus Gittinger <cg@exept.de>
parents: 1033
diff changeset
  3426
    "Modified: / 31.7.1998 / 03:14:18 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3427
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3428
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3429
selectionIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3430
    "returns index of current selection or 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3431
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3432
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3433
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3434
    (item := self selection) notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3435
	^ self findFirst:[:el| el == item ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3436
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3437
    ^ 0
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3438
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3439
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3440
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3441
selectionIndex:anIndex
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3442
    "set selection at an index
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3443
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3444
    self selection:(self itemAt:anIndex)
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3445
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3446
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3447
!MenuPanel::Item class methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3448
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3449
horizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3450
    ^ HorizontalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3451
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3452
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3453
labelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3454
    ^ LabelRightOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3455
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3456
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3457
shortcutKeyOffset
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3458
    ^ ShortcutKeyOffset
689
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3459
!
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3460
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3461
verticalInset
aa13913add84 clear lastActiveMenu when closed
ca
parents: 687
diff changeset
  3462
    ^ VerticalInset
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3463
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3464
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3465
!MenuPanel::Item class methodsFor:'defaults'!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3466
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3467
separatorSize:aType
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3468
    "returns size of a separator
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3469
    "
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3470
    aType == #doubleLine ifTrue:[^ 10 ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3471
    aType == #singleLine ifTrue:[^ 10 ].
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  3472
  ^ 10
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3473
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3474
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  3475
updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3476
    "setup defaults
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3477
     self updateStyleCache
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3478
    "
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3479
    HorizontalInset       := 4.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3480
    VerticalInset         := 3.
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3481
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3482
    HorizontalButtonInset := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3483
    VerticalButtonInset   := 3.
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  3484
681
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3485
    LabelRightOffset      := 15.
62c7cdaca188 extra default inset values for button behaviour added
tz
parents: 680
diff changeset
  3486
    ShortcutKeyOffset     := 5.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3487
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3488
    IndicatorOn  := self checkedImage.
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3489
    IndicatorOff := self uncheckedImage.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3490
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3491
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3492
!MenuPanel::Item class methodsFor:'image specs'!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3493
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3494
checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3495
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3496
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3497
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3498
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3499
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3500
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3501
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3502
     self checkOffIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3503
     ImageEditor openOnClass:self andSelector:#checkOffIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3504
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3505
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3506
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3507
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3508
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3509
	constantNamed:#'MenuPanel::Item checkOffIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3510
	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
  3511
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3512
checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3513
    "This resource specification was automatically generated
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3514
     by the ImageEditor of ST/X."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3515
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3516
    "Do not manually edit this!! If it is corrupted,
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3517
     the ImageEditor may not be able to read the specification."
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3518
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3519
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3520
     self checkOnIcon inspect
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3521
     ImageEditor openOnClass:self andSelector:#checkOnIcon
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3522
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3523
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3524
    <resource: #image>
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3525
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3526
    ^Icon
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3527
	constantNamed:#'MenuPanel::Item checkOnIcon'
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3528
	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
  3529
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3530
checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3531
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3532
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3533
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3534
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3535
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3536
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3537
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3538
     self checkedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3539
     ImageEditor openOnClass:self andSelector:#checkedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3540
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3541
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3542
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3543
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3544
    ^Icon
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  3545
	constantNamed:#'MenuPanel::Item checkedImage'
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  3546
	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]
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3547
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3548
    "Modified: / 6.9.1998 / 22:29:58 / cg"
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3549
!
1110
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3550
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3551
uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3552
    "This resource specification was automatically generated
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3553
     by the ImageEditor of ST/X."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3554
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3555
    "Do not manually edit this!! If it is corrupted,
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3556
     the ImageEditor may not be able to read the specification."
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3557
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3558
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3559
     self uncheckedImage inspect
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3560
     ImageEditor openOnClass:self andSelector:#uncheckedImage
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3561
    "
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3562
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3563
    <resource: #image>
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3564
eac7291cc4bb draw real checks in check icons
tz
parents: 1108
diff changeset
  3565
    ^Icon
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  3566
	constantNamed:#'MenuPanel::Item uncheckedImage'
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  3567
	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]
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3568
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3569
    "Modified: / 6.9.1998 / 22:24:24 / cg"
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  3570
! !
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3571
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3572
!MenuPanel::Item class methodsFor:'instance creation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3573
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3574
in:aSuperMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3575
    ^ self in:aSuperMenu label:nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3576
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3577
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3578
in:aSuperMenu label:aLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3579
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3580
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3581
    item := self new in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3582
    item label:aLabel.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3583
  ^ item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3584
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3585
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3586
in:aSuperMenu menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3587
    |item|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3588
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3589
    item := self in:aSuperMenu.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3590
    item menuItem:aMenuItem.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3591
  ^ item.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3592
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3593
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3594
!MenuPanel::Item methodsFor:'accept'!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3595
420
ca
parents: 417
diff changeset
  3596
canAccept
ca
parents: 417
diff changeset
  3597
    "returns true if item is acceptable
ca
parents: 417
diff changeset
  3598
    "
ca
parents: 417
diff changeset
  3599
  ^ (self enabled and:[self hasSubmenu not])
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3600
!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3601
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3602
toggleIndication
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3603
    "toggle indication or choice
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3604
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3605
    |arg|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3606
723
4f05cbdcaede once again some corrections for button press indication
tz
parents: 720
diff changeset
  3607
    self hasIndication ifTrue:[    
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3608
	arg := self indicationValue not.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3609
	self indicationValue:arg.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3610
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3611
	self hasChoice ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3612
	    arg := self choiceValue.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3613
	    self choice value:arg.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3614
	    arg := true.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3615
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3616
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3617
    ^ arg
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3618
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3619
    "Modified: / 14.8.1998 / 16:13:37 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3620
! !
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3621
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3622
!MenuPanel::Item methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3623
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3624
accessCharacter
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3625
    "returns my accessCharacter or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3626
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3627
    accessCharacterPosition isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3628
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3629
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3630
  ^ (rawLabel string) at:accessCharacterPosition ifAbsent:nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3631
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3632
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3633
accessCharacterPosition
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3634
    "get the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3635
    "
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3636
  ^ accessCharacterPosition
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3637
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3638
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3639
accessCharacterPosition:anIndex
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3640
    "set the access character position or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3641
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  3642
    accessCharacterPosition ~~ anIndex ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3643
	accessCharacterPosition := anIndex.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3644
	self updateRawLabel.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3645
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3646
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3647
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3648
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3649
    "gets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3650
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3651
    adornment isNil ifTrue:[^ nil ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3652
  ^ adornment argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3653
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3654
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3655
argument:anArgument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3656
    "sets the argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3657
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3658
    self argument ~~ anArgument ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3659
	self adornment argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3660
    ]
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3661
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3662
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3663
basicGetSubmenu
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3664
    "returns my submenu or nil
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3665
    "
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3666
    ^ subMenu
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3667
!
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3668
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3669
compareAccessCharacterWith:aKey
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3670
    "returns true if key is my access character
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3671
    "
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3672
    ^ self accessCharacter == aKey
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  3673
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3674
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3675
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3676
label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3677
    "returns the label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3678
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3679
    ^ label
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3680
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3681
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3682
label:aLabel
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3683
    "set a new label; if the label changed, a redraw is performed;
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3684
     handle characters $& (ST-80 compatibility)
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3685
    "
475
b604babd1f4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 467
diff changeset
  3686
    |i rest s|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3687
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3688
    accessCharacterPosition := nil.
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3689
    label := aLabel value.
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3690
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3691
    (label isString and:[(s := label size) > 1]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3692
	i := 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3693
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3694
	[((i := label indexOf:$& startingAt:i) ~~ 0 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3695
	and:[i < s])] whileTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3696
	    rest := label copyFrom:(i+1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3697
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3698
	    i == 1 ifTrue:[label := rest]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3699
		  ifFalse:[label := (label copyFrom:1 to:(i-1)), rest].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3700
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3701
	    (label at:i) == $& ifTrue:[i := i + 1]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3702
			      ifFalse:[accessCharacterPosition := i].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3703
	    s := s - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3704
	]
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3705
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3706
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3707
    self updateRawLabel
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3708
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  3709
    "Modified: / 31.7.1998 / 00:52:26 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3710
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3711
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3712
menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3713
    "returns my menuPanel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3714
    "
399
d083b1bce58d ST-80 compatibility
ca
parents: 396
diff changeset
  3715
    ^ menuPanel
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3716
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3717
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3718
nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3719
    "gets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3720
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3721
    ^ nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3722
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3723
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3724
nameKey:aNameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3725
    "sets the nameKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3726
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3727
    nameKey := aNameKey.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3728
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3729
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3730
rawLabel
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3731
    "returns my printable Label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3732
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3733
    ^ rawLabel
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3734
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3735
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3736
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3737
    "get the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3738
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3739
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3740
    ^ shortcutKey
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3741
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3742
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3743
shortcutKey:aKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3744
    "set the key to press to select the submenu from the keyboard or if
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3745
     no submenu exists evaluate the action assigned to the item (accept).
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3746
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3747
    shortcutKey ~~ aKey ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3748
        shortcutKey := aKey.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3749
        self redraw.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3750
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3751
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3752
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3753
startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3754
    "start group #left #right #center ... or nil
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3755
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3756
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3757
    ^ startGroup
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3758
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3759
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3760
startGroup:aSymbol
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3761
    "start group #left #right #center ...
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3762
     at the moment only #right is implemented
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3763
    "
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3764
    (startGroup isNil or:[startGroup == #right]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3765
	startGroup := aSymbol
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3766
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3767
	self warn:('not supported group: ', aSymbol printString ).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3768
    ]
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3769
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3770
!
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  3771
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3772
submenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3773
    "returns my submenu or nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3774
    "
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3775
    subMenu notNil ifTrue:[^ subMenu].
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3776
  ^ self setupSubmenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3777
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3778
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3779
submenu:aSubMenu
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3780
    "set a new submenu; an existing submenu will be destroyed. This might lead
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3781
     to a redraw if 'hasSubmenu' changed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3782
    "
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3783
    (aSubMenu notNil 
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3784
     and:[(aSubMenu isView or:[aSubMenu isKindOf:Menu]) not]) ifTrue:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3785
        ^ self submenuChannel:aSubMenu
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3786
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3787
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3788
    (subMenu := aSubMenu) notNil ifTrue:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3789
        aSubMenu class == Menu ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3790
            subMenu := MenuPanel new.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3791
            menuPanel notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3792
                subMenu receiver:menuPanel receiver.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3793
            ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3794
            subMenu menu:aSubMenu.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3795
            subMenu superMenu:menuPanel.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3796
        ] ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3797
            subMenu isView ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3798
                subMenu superMenu:menuPanel.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3799
            ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  3800
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3801
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3802
1068
155168a813ad oops - subMenu must be an instance of MenuPanel
Claus Gittinger <cg@exept.de>
parents: 1063
diff changeset
  3803
    "Modified: / 10.8.1998 / 13:26:28 / cg"
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3804
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3805
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3806
textLabel
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3807
    "returns my textLabel or nil if none text
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3808
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3809
    (rawLabel respondsTo:#string) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3810
	^ rawLabel string
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3811
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3812
  ^ nil
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3813
!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3814
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3815
value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3816
    "gets value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3817
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3818
    ^ value
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3819
!
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3820
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3821
value:something
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3822
    "could be a value holder, an action or selector
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3823
    "
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3824
    value := something.
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3825
!
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3826
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3827
value:aValue argument:anArgument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3828
    "set the value and an argument
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3829
    "
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3830
    self value:aValue.
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  3831
    self argument:anArgument.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3832
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3833
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3834
!MenuPanel::Item methodsFor:'accessing behavior'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3835
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3836
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3837
    "get choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3838
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3839
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3840
  ^ adornment choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3841
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3842
    "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
  3843
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3844
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3845
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3846
    "set choice indication
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3847
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3848
    |old new|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3849
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3850
    old := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3851
    old == something ifTrue:[^ self].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3852
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3853
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3854
	old removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3855
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3856
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3857
    new := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3858
    new isSymbol ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3859
	new := self aspectAt:new.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3860
	new isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3861
	    new := something
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3862
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3863
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3864
    (self isKindOfValueHolder:new) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3865
	new addDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3866
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3867
    self adornment choice:new.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3868
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3869
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3870
    "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
  3871
    "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
  3872
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3873
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3874
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3875
    "get choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3876
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3877
    adornment isNil ifTrue:[^ nil].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3878
  ^ adornment choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3879
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3880
    "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
  3881
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3882
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3883
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3884
    "set choice value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3885
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3886
    self adornment choiceValue:something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3887
    self updateRawLabel.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3888
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3889
    "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
  3890
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  3891
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3892
enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3893
    "returns the enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3894
    "
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3895
    |state|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3896
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3897
    menuPanel enabled ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3898
	enableChannel isSymbol ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3899
	    state := self aspectAt:enableChannel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3900
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3901
	    (self isKindOfValueHolder:state) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3902
		enableChannel := state.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3903
		enableChannel addDependent:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3904
		state := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3905
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3906
		state := state value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3907
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3908
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3909
	    state := enableChannel value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3910
	].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3911
      ^ state ~~ false
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  3912
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  3913
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3914
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3915
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  3916
enabled:something
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3917
    "change the enabled state; if the state changed, a redraw is performed
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3918
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3919
    |oldState newState|
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3920
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3921
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3922
	oldState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3923
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3924
	oldState := enableChannel value.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3925
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3926
	    enableChannel removeDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3927
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3928
    ].
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3929
    enableChannel := something.
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3930
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3931
    enableChannel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3932
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3933
	newState := true
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3934
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3935
	(self isKindOfValueHolder:enableChannel) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3936
	    enableChannel addDependent:self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3937
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3938
	    enableChannel isSymbol ifTrue:[^ self]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3939
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3940
	menuPanel shown ifFalse:[^ self].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3941
	newState := enableChannel value.
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3942
    ].
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3943
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3944
    newState ~~ oldState ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3945
	(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3946
	    self drawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3947
	]
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  3948
    ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  3949
580
249f6cfc5bb2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 571
diff changeset
  3950
    "Modified: / 27.10.1997 / 16:13:42 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3951
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3952
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3953
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3954
    "get on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3955
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3956
    adornment isNil ifTrue:[^ nil].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3957
  ^ adornment indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3958
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3959
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3960
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3961
    "set on/off indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3962
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3963
    |old|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3964
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3965
    old := self indication.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3966
    old == something ifTrue:[^ self].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3967
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3968
    (self isKindOfValueHolder:old) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3969
	old removeDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3970
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3971
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3972
    (self isKindOfValueHolder:something) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3973
	something addDependent:self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3974
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3975
    self adornment indication:something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  3976
    self updateRawLabel.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3977
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3978
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3979
isButton
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3980
    "returns whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3981
    "
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  3982
    ^ isButton
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3983
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3984
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3985
isButton:anBoolean
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3986
    "sets whether item looks like a Button
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3987
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3988
    isButton := anBoolean.
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3989
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3990
    layout notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  3991
	self redrawAsButton
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  3992
    ]
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3993
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3994
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3995
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3996
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  3997
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3998
submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  3999
    "get the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4000
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4001
  ^ submenuChannel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4002
!
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4003
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4004
submenuChannel:aSelectorOrNil
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4005
    "returns the submenu channel
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4006
    "
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4007
    submenuChannel := aSelectorOrNil.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4008
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4009
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4010
!MenuPanel::Item methodsFor:'accessing dimension'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4011
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4012
height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4013
    "gets height
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4014
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4015
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4016
	^ self preferredExtent y
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4017
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4018
    ^ layout height
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4019
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4020
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4021
horizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4022
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4023
    isButton ifTrue: [^menuPanel buttonPassiveLevel + HorizontalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4024
    ^HorizontalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4025
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4026
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4027
layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4028
    "returns my layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4029
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4030
    ^ layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4031
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4032
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4033
layout:aLayout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4034
    "set a new layout ( Rectangle )
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4035
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4036
    layout := aLayout.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4037
    self redraw.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4038
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4039
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4040
verticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4041
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4042
    isButton ifTrue: [^menuPanel buttonPassiveLevel + VerticalButtonInset].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4043
    ^VerticalInset
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4044
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4045
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4046
width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4047
    "gets width
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4048
    "
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4049
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4050
    layout isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4051
	^ self preferredExtent x
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4052
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4053
    ^ layout width
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4054
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4055
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4056
!MenuPanel::Item methodsFor:'accessing help'!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4057
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4058
activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4059
    "get the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4060
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4061
    ^ activeHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4062
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4063
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4064
activeHelpKey:aHelpKey
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4065
    "set the active helpKey; the key to retrieve the helpText from the application
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4066
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4067
    activeHelpKey ~~ aHelpKey ifTrue:[
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4068
        activeHelpKey  := aHelpKey.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4069
        activeHelpText := nil.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4070
    ].
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4071
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4072
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4073
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4074
activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4075
    "get the active helpText or nil if not yet resolved
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4076
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4077
    ^ activeHelpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4078
!
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4079
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4080
activeHelpText:aText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4081
    "set the active helpText
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4082
    "
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4083
    activeHelpText := aText.
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4084
! !
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4085
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4086
!MenuPanel::Item methodsFor:'building'!
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4087
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4088
aspectAt:aKey
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4089
    "retursns value assigned to key or nil
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4090
    "
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4091
    |appl value|
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4092
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4093
    appl := menuPanel receiver.
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4094
1219
6a0d677a6fac removed some #isKindOf: calls.
Claus Gittinger <cg@exept.de>
parents: 1218
diff changeset
  4095
    (appl isValueModel) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4096
	^ appl value:aKey
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4097
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4098
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4099
    (appl notNil or:[(appl := menuPanel application) notNil]) ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4100
	Object messageNotUnderstoodSignal handle:[:ex|
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4101
	    ex parameter selector == aKey ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4102
		ex reject
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4103
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4104
	] do:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4105
	    (appl isKindOf:ApplicationModel) 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4106
		ifTrue:[value := appl aspectFor:aKey]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4107
		ifFalse:[value := appl perform:aKey]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4108
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4109
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4110
    ^ value
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4111
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4112
    "Modified: / 29.7.1998 / 11:59:50 / cg"
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4113
! !
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4114
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4115
!MenuPanel::Item methodsFor:'change & update'!
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4116
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4117
choiceChanged
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4118
    "called when the choice changed
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4119
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4120
    |indicator|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4121
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4122
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4123
	indicator := self choiceForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4124
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4125
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4126
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4127
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4128
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4129
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4130
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4131
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4132
	]
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4133
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4134
    self redraw
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4135
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4136
    "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
  4137
    "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
  4138
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4139
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4140
enabledStateOfMenuChangedTo:aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4141
    "enabled state of menu changed to aState
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4142
    "
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4143
    rawLabel notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4144
	self drawLabel
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4145
    ].
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4146
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4147
!
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4148
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4149
indicationChanged
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4150
    "called when the indication changed
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4151
    "
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4152
    |indicator|
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4153
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4154
    isButton ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4155
	indicator := self indicatorForm.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4156
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4157
	indicator = rawLabel icon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4158
	    ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4159
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4160
	rawLabel icon:indicator.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4161
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4162
	disabledRawLabel notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4163
	    disabledRawLabel icon:indicator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4164
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4165
    ].
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4166
    self redraw
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4167
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4168
    "Modified: / 14.8.1998 / 17:19:38 / cg"
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4169
!
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4170
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4171
update:something with:aParameter from:changedObject
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4172
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4173
    changedObject == self indication ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4174
	^ self indicationChanged
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4175
    ].
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4176
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4177
    changedObject == self choice ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4178
	^ self choiceChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4179
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4180
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4181
    changedObject == enableChannel ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4182
	(rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4183
	    self drawLabel
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4184
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4185
	^ self
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4186
    ].
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4187
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4188
    changedObject == isVisible ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4189
	menuPanel mustRearrange.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4190
	menuPanel rearrangeItems.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4191
	^ self.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4192
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4193
498
b4c341497621 bug fixes:
ca
parents: 475
diff changeset
  4194
    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
  4195
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4196
    "Modified: / 14.8.1998 / 16:13:41 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4197
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4198
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4199
updateIndicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4200
    "update indicators
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4201
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4202
    |indicator| 
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4203
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4204
    (indicator := self indication) notNil ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4205
"/        (isButton and:[menuPanel isPopUpView]) ifFalse:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4206
"/            (self isKindOfValueHolder:indicator) ifTrue:[
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4207
"/                ^ self
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4208
"/            ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4209
"/        ].
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4210
	self indicationChanged
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4211
    ]
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4212
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4213
    "Modified: / 14.8.1998 / 15:19:38 / cg"
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4214
! !
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  4215
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4216
!MenuPanel::Item methodsFor:'converting'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4217
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4218
asMenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4219
    "convert to a MenuItem
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4220
    "
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4221
    |item label rcv|
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4222
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4223
    label := self label.
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4224
    item  := MenuItem labeled:(label printString).
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4225
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4226
    label isImage ifTrue:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4227
        rcv := ResourceRetriever new.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4228
        rcv className:#MenuEditor.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4229
        rcv selector:#iconUnknown.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4230
        item labelImage:rcv.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4231
    ].
466
f025831cdae8 pick a imaged label; create a ResourceRetriever
ca
parents: 465
diff changeset
  4232
434
9898a2909ef0 add active help for items
ca
parents: 433
diff changeset
  4233
    item activeHelpKey:activeHelpKey.
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4234
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4235
    enableChannel notNil ifTrue:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4236
        item enabled:(enableChannel value)
460
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4237
    ].
5334456cedf8 handle enabled symbol; get aspect from application
ca
parents: 450
diff changeset
  4238
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4239
    item accessCharacterPosition:(self accessCharacterPosition).
710
4453e463ff16 add new feature:
ca
parents: 709
diff changeset
  4240
    item startGroup:(self startGroup).
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4241
    item argument:(self argument).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4242
    item nameKey:(self nameKey).
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4243
    item shortcutKeyCharacter:shortcutKey.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4244
    item value:(value value).
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4245
    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
  4246
    item choice:(self choice value).
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4247
    item choiceValue:(self choiceValue).
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4248
    item isVisible:(self isVisible).
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4249
    item isButton:isButton.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4250
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4251
    submenuChannel isSymbol ifTrue:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4252
        item submenuChannel:submenuChannel
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4253
    ] ifFalse:[
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4254
        subMenu notNil ifTrue:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4255
            item submenu:(subMenu asMenu)
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  4256
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4257
    ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4258
  ^ item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4259
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4260
    "Modified: / 14.8.1998 / 15:47:21 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4261
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4262
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4263
menuItem:aMenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4264
    "setup attributes from a MenuItem
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4265
    "
502
dedc1b29b6ac support of arguments
ca
parents: 498
diff changeset
  4266
    |var lbl|
389
d5487b5fb834 st80: perform on value
ca
parents: 388
diff changeset
  4267
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4268
    menuPanel disabledRedrawDo:[
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4269
        label := nil.
1613
5e23d6be5918 optimize accessing helpText
ca
parents: 1612
diff changeset
  4270
        self activeHelpKey:(aMenuItem activeHelpKey).
1572
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4271
        self enabled:(aMenuItem enabled).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4272
        self nameKey:(aMenuItem nameKey).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4273
        self indication:(aMenuItem indication).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4274
        self choice:(aMenuItem choice).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4275
        self choiceValue:(aMenuItem choiceValue).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4276
        self isButton:(aMenuItem isButton).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4277
        self startGroup:(aMenuItem startGroup).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4278
        self isVisible:(aMenuItem isVisible).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4279
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4280
        (lbl := aMenuItem labelImage value) isNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4281
            lbl := aMenuItem rawLabel. "/ avoid translating &'s twice
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4282
        ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4283
        self label:lbl.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4284
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4285
        (var := aMenuItem accessCharacterPosition) notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4286
            self accessCharacterPosition:var.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4287
        ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4288
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4289
        self shortcutKey:(aMenuItem shortcutKeyCharacter).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4290
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4291
        (var := aMenuItem argument) notNil ifTrue:[
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4292
            self argument:var.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4293
        ].
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4294
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4295
        submenuChannel := aMenuItem submenuChannel.
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4296
        self submenu:(aMenuItem submenu).
80a8e8a38fb1 ca: bugfix
ca
parents: 1499
diff changeset
  4297
        self value:(aMenuItem value).
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4298
    ]
1033
9badc22e3d03 oops &'s where eliminated twice - leading to double &'s
Claus Gittinger <cg@exept.de>
parents: 1032
diff changeset
  4299
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4300
    "Modified: / 22.8.1998 / 15:34:16 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4301
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4302
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4303
!MenuPanel::Item methodsFor:'drawing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4304
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4305
drawLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4306
    "draw label
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4307
    "
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4308
    |y x h l t scKey cLb cLa img fg asc arrow hrzInset 
1267
10577a2ca319 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1257
diff changeset
  4309
     buttonLevel isSelected|
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4310
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4311
    self isVisible ifFalse:[^ self].
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4312
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4313
    img := rawLabel.
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4314
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4315
    asc := menuPanel font ascent.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4316
    h   := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4317
    l   := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4318
    t   := layout top.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4319
    hrzInset := self horizontalInset.
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4320
    isSelected := self drawSelected.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4321
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4322
    self enabled ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4323
        fg := isSelected ifTrue:[self activeForegroundColor]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4324
                        ifFalse:[menuPanel foregroundColor].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4325
    ] ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4326
        fg := menuPanel disabledForegroundColor.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4327
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4328
        (img := disabledRawLabel) isNil ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4329
            img := self disabledRawLabel
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4330
        ]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4331
    ].
1090
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4332
    menuPanel paint:fg.
cf3d9f5648da only draw with enteredLevel, if item is enabled
Claus Gittinger <cg@exept.de>
parents: 1083
diff changeset
  4333
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4334
    "/ t := t + menuPanel level.
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4335
    y := t + ((h - (img heightOn:menuPanel)) // 2).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4336
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4337
    (self textLabel) notNil ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4338
        y := y + asc.
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  4339
    ].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4340
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4341
    isButton ifTrue:[   
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4342
        (isSelected or:[self indicationValue == true]) ifTrue:
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4343
        [   
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4344
            img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4345
            buttonLevel := menuPanel buttonActiveLevel.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4346
        ] ifFalse:[   
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4347
            img displayOn:menuPanel x:(l + hrzInset) y:y.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4348
            self isEntered ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4349
                buttonLevel := menuPanel buttonEnteredLevel
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4350
            ] ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4351
                buttonLevel := menuPanel buttonPassiveLevel
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4352
            ]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4353
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4354
        buttonLevel ~~ 0 ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4355
            menuPanel 
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4356
                drawButtonEdgesInLayout:layout 
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4357
                withLevel:buttonLevel
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4358
                selected:isSelected.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4359
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4360
        ^ self
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4361
    ].
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4362
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4363
"/ 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
  4364
1046
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4365
    img displayOn:menuPanel x:(l + hrzInset) y:y.
c03b42debacb bug fixes:
ca
parents: 1045
diff changeset
  4366
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4367
    "/ DRAW SHORTCUT KEY
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4368
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  4369
    (shortcutKey notNil and:[MenuView showAcceleratorKeys == true]) ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4370
        menuPanel isVerticalLayout ifTrue:[ "/ only for vertical menus ...
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4371
            (scKey:= self shortcutKeyAsString) notNil ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4372
                (x := menuPanel shortKeyInset) == 0 ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4373
                    x := hrzInset + LabelRightOffset + (img widthOn:menuPanel)
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4374
                ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4375
                x := l + x.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4376
                y := t + ((h - (scKey heightOn:menuPanel)) // 2).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4377
                y := y + asc.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4378
                scKey displayOn:menuPanel x:x y:y. 
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4379
            ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4380
        ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4381
    ].
963
2660033bc16e hide shortKeys in menu (may be later enabled via a classVar)
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
  4382
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4383
    "/ DRAW SUBMENU INDICATION
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4384
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4385
    (menuPanel isVerticalLayout and:[self hasSubmenu]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4386
        arrow := menuPanel rightArrow.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4387
        x := layout right - arrow width - hrzInset.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4388
        y := t + (h - arrow height // 2).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4389
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4390
        (menuPanel styleSheet is3D not
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4391
        or:[(img := menuPanel rightArrowShadow) isNil]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4392
            ^ menuPanel displayForm:arrow x:x y:y
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4393
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4394
        cLa := menuPanel shadowColor.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4395
        cLb := menuPanel lightColor.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4396
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4397
        isSelected ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4398
            fg  := cLa.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4399
            cLa := cLb.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4400
            cLb := fg
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4401
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4402
        menuPanel paint:cLa.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4403
        menuPanel displayForm:arrow x:x y:y.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4404
        menuPanel paint:cLb.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  4405
        menuPanel displayForm:img x:x y:y. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4406
    ]
746
bd252bbe276f better drawing routine for button behavior
tz
parents: 739
diff changeset
  4407
1124
4a7fec62a572 smaller checkbox.
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
  4408
    "Modified: / 6.9.1998 / 21:48:53 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4409
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4410
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4411
drawSelected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4412
    "return true if item is selected or if item implements
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4413
     a toggle in a radio group which is selected
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4414
    "
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4415
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4416
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4417
    self isSelected ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4418
	^ true
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4419
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4420
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4421
	^ ((holder := self choice) notNil and:[holder value = self choiceValue])
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4422
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4423
    ^ false
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4424
!
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4425
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4426
redraw
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4427
    "redraw item
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4428
    "
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4429
    |isSelected ownBgCol showItemSep type paint lgCol shCol
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4430
     h  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4431
     w  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4432
     l  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4433
     t  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4434
     r  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4435
     b  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4436
     x  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4437
     y  "{ Class:SmallInteger }"
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4438
     hrzInset "{ Class:SmallInteger }"
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4439
     isEntered
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4440
    |
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4441
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4442
    (self isVisible and:[menuPanel canDrawItem]) ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4443
	^ self
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4444
    ].
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4445
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4446
    isSelected := self drawSelected.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4447
    isEntered := self isEntered.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4448
    hrzInset   := self horizontalInset.
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4449
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4450
    isSelected ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4451
	(isButton and:[isEntered]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4452
	    paint := self buttonEnteredBackgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4453
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4454
	    paint := self backgroundColor
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4455
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4456
    ] ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4457
	paint := self activeBackgroundColor
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4458
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4459
    l := layout left.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4460
    t := layout top.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4461
    r := layout right.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4462
    b := layout bottom.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4463
    h := layout height.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4464
    w := layout width.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4465
    (ownBgCol := self backgroundColorFromLabel) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4466
	menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4467
	menuPanel fillRectangle:layout.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4468
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4469
	self hasIndication ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4470
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4471
	    menuPanel fillRectangle:layout.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4472
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4473
	    menuPanel paint:paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4474
	    x := (rawLabel icon width) + hrzInset + 4.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4475
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4476
	    menuPanel fillRectangleX:l y:t width:x height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4477
	    menuPanel paint:ownBgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4478
	    menuPanel fillRectangleX:(l + x) y:t width:(w - x) height:h.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4479
	    ownBgCol := nil.
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4480
       ].
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4481
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4482
    lgCol       := menuPanel lightColor.
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4483
    shCol       := menuPanel shadowColor.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4484
    showItemSep := menuPanel showSeparatingLines.
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4485
    type        := self separatorType.
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4486
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4487
    type notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4488
	type == #blankLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4489
	    ^ self
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
	"/ draw separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4492
	menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4493
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4494
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4495
	    l := l + hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4496
	    r := r - hrzInset.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4497
	    y := t - 1 + (h // 2).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4498
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4499
	    type == #doubleLine ifTrue:[y := y - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4500
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4501
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4502
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4503
	    y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4504
	    menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4505
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4506
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4507
		y := y + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4508
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4509
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4510
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4511
		y := y + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4512
		menuPanel displayLineFromX:l y:y toX:r y:y.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4513
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4514
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4515
	    x := l - 1 + (w // 2).
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
	    type == #doubleLine ifTrue:[x := x - 2].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4518
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4519
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4520
	    menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4521
	    x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4522
	    menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4523
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4524
	    type == #doubleLine ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4525
		x := x + 3.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4526
		menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4527
		menuPanel displayLineFromX:x y:t toX:x y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4528
		menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4529
		x := x + 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4530
		menuPanel displayLineFromX:x y:t toX:x y:b.
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
	^ self
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4534
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4535
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4536
    isButton ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4537
	^ self drawLabel
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4538
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4539
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4540
    showItemSep ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4541
	|col index item lfSep rtSep|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4542
	col := menuPanel paint.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4543
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4544
	index := menuPanel indexOfItem:self.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4545
	item  := menuPanel itemAtIndex:(index - 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4546
	lfSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4547
	item  := menuPanel itemAtIndex:(index + 1).
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4548
	rtSep := item notNil and:[item isButton not].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4549
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4550
	menuPanel paint:lgCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4551
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4552
	menuPanel verticalLayout ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4553
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4554
		menuPanel displayLineFromX:l y:t - 1 toX:r y:t - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4555
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4556
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4557
		menuPanel displayLineFromX:l y:b - 1 toX:r y:b - 1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4558
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4559
	    menuPanel paint:shCol.
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
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4562
		menuPanel displayLineFromX:l y:t - 2 toX:r y:t - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4563
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4564
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4565
		menuPanel displayLineFromX:l y:b - 2 toX:r y:b - 2.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4566
	    ]
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
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4569
		menuPanel displayLineFromX:l - 1 y:t toX:l - 1 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4570
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4571
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4572
		menuPanel displayLineFromX:r - 1 y:t toX:r - 1 y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4573
	    ]. 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4574
	    menuPanel paint:shCol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4575
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4576
	    lfSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4577
		menuPanel displayLineFromX:l - 2 y:t toX:l - 2 y:b
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4578
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4579
	    rtSep ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4580
		menuPanel displayLineFromX:r - 2 y:t toX:r - 2 y:b.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4581
	    ] 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4582
	]
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4583
    ].
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4584
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4585
    self drawLabel.  
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4586
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4587
    (ownBgCol notNil and:[isSelected]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4588
	ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4589
				 ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4590
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4591
	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
  4592
	menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).  
706
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4593
    ].
d716edbdbe47 show separators bug cleaned
tz
parents: 689
diff changeset
  4594
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4595
    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
  4596
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4597
    "Modified: / 20.8.1998 / 15:11:33 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4598
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4599
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4600
!MenuPanel::Item methodsFor:'initialization'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4601
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4602
destroy
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4603
    "destroy submenus, remove dependencies
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4604
    "
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4605
    |channel|
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4606
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4607
    self submenu:nil.
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4608
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4609
    (enableChannel notNil and:[self isKindOfValueHolder:enableChannel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4610
	enableChannel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4611
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4612
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4613
    (isVisible notNil and:[self isKindOfValueHolder:isVisible]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4614
	isVisible removeDependent:self
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4615
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  4616
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4617
    channel := self indication.
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4618
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4619
	channel removeDependent:self
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4620
    ].
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4621
    channel := self choice.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4622
    (channel notNil and:[self isKindOfValueHolder:channel]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4623
	channel removeDependent:self
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4624
    ].
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4625
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4626
    menuPanel := nil.
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4627
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4628
    "Modified: / 14.8.1998 / 14:37:57 / cg"
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4629
!
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4630
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4631
in:aPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4632
    "create item in a menuPanel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4633
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4634
    menuPanel := aPanel.
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4635
    isButton  := false.
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4636
! !
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4637
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4638
!MenuPanel::Item methodsFor:'label basics'!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4639
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4640
disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4641
    "returns the label used if the item is disabled
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4642
    "
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4643
    disabledRawLabel isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4644
	(     rawImage notNil
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4645
	 and:[(rawImage respondsTo:#colorMap)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4646
	 and:[rawImage colorMap notNil]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4647
	) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4648
	    disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4649
	] ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4650
	    disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4651
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4652
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4653
		(isButton
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4654
		  or:[((self indication notNil or:[self choice notNil])
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4655
		 and:[label class == LabelAndIcon])]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4656
		) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4657
		    disabledRawLabel := LabelAndIcon form:(rawLabel icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4658
						    image:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4659
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4660
		] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4661
		    disabledRawLabel := LabelAndIcon form:disabledRawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4662
						    image:(rawLabel image)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4663
						   string:(rawLabel string)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4664
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4665
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4666
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4667
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4668
    ^ disabledRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4669
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4670
616
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4671
fetchImages
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4672
    "fetch images
a6157b083830 support of different styles
ca
parents: 608
diff changeset
  4673
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4674
    |icon|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4675
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4676
    rawImage notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4677
	rawLabel isImage ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4678
	    rawLabel := menuPanel imageOnDevice:rawImage
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4679
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4680
	    rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4681
		(icon := rawLabel image) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4682
		    rawLabel image:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4683
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4684
		(icon := rawLabel icon) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4685
		    (self indication isNil and:[self choice isNil]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4686
			rawLabel icon:(menuPanel imageOnDevice:icon)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4687
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4688
		]
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
	]
1048
a8755e51706d bug fixes:
ca
parents: 1046
diff changeset
  4691
    ].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4692
!
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4693
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4694
updateRawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4695
    "recreate rawLabel
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4696
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4697
    |char size form|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4698
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4699
    label isNil ifTrue:[        "/ not yet initialized
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4700
	^ self
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4701
    ].
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4702
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4703
    (form := self indicatorForm) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4704
	form := self choiceForm
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4705
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4706
    rawImage         := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4707
    disabledRawLabel := nil.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4708
    rawLabel         := label value.
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4709
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4710
    rawLabel isString ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4711
	rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4712
	    rawLabel := rawLabel withoutSeparators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4713
	].        
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4714
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4715
	form isNil ifTrue:[                             "/ check for separator
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4716
	    rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4717
		  rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4718
		^ self
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
	    rawLabel size == 1 ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4722
		char := rawLabel first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4723
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4724
		(char == $- or:[char == $=]) ifTrue:[   "/ other line separators
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4725
		    label := String new:1.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4726
		    label at:1 put:char.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4727
		    rawLabel := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4728
		  ^ self
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4729
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4730
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4731
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4732
	rawLabel isEmpty ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4733
	    rawLabel := label value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4734
	].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4735
	size := self accessCharacterPosition.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4736
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4737
	(size notNil and:[size <= rawLabel size]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4738
	    rawLabel isText ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4739
		rawLabel := Text string:rawLabel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4740
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4741
	    rawLabel emphasisAt:size add:#underline
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4742
	]
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4743
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4744
    rawLabel isImage ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4745
	rawImage := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4746
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4747
	form notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4748
	    isButton ifTrue:[form := nil].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4749
	    rawLabel := LabelAndIcon form:form image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4750
	]
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4751
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4752
	rawLabel class == LabelAndIcon ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4753
	    rawImage := rawLabel icon.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4754
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4755
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4756
		rawLabel image:rawImage.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4757
		rawLabel icon:form
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4758
	    ]                
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4759
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4760
	    rawImage := nil.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4761
	    rawLabel isNil ifTrue:[rawLabel := ''].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4762
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4763
	    (form notNil and:[isButton not]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4764
		rawLabel := LabelAndIcon icon:form string:rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4765
	    ] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4766
		disabledRawLabel := rawLabel.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4767
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4768
	].
794
5ac9de4f5c82 basic routine to access the images; at the moment
ca
parents: 781
diff changeset
  4769
    ].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4770
    menuPanel shown ifTrue:[ self fetchImages ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4771
    menuPanel mustRearrange
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4772
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4773
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4774
!MenuPanel::Item methodsFor:'printing & storing'!
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4775
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4776
displayString
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4777
    ^ self class name, '[', (label ? ''), ']'
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4778
! !
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  4779
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4780
!MenuPanel::Item methodsFor:'private'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4781
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4782
activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4783
    "returns the active background color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4784
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4785
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4786
    isButton ifTrue: [^menuPanel buttonActiveBackgroundColor].
650
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4787
    ^menuPanel activeBackgroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4788
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4789
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4790
activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4791
    "returns the active foreground color derived from menuPanel
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4792
    "
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4793
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4794
    ^menuPanel activeForegroundColor
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4795
!
29dcdf6a5994 button and label translation support added
tz
parents: 638
diff changeset
  4796
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4797
adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4798
    "returns adornment; if not existing yet a new instance
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4799
     is created
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4800
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4801
    adornment isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4802
	adornment := Adornment new
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4803
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4804
  ^ adornment
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4805
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4806
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4807
backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4808
    "returns the background color derived from menuPanel
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4809
    "
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4810
1045
25d174d7b019 optimize:
ca
parents: 1044
diff changeset
  4811
    isButton ifTrue: [^menuPanel buttonPassiveBackgroundColor].
727
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4812
    ^menuPanel backgroundColor
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4813
!
3ba54333342a button style from style sheet
tz
parents: 723
diff changeset
  4814
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4815
backgroundColorFromLabel
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4816
    "returns the background color derived from label or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4817
    "
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4818
    |run|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4819
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4820
    label isText ifFalse:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4821
    run := label emphasis.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4822
    run size == 0 ifTrue:[^ nil ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4823
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4824
    run := run first.
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
    run size == 0 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4827
	(run value isColor and:[run key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4828
	    ^ run value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4829
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4830
    ] ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4831
	run do:[:r|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4832
	    (r value isColor and:[r key == #backgroundColor]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4833
		^ r value
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4834
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4835
	]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4836
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4837
  ^ nil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4838
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  4839
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4840
buttonEnteredBackgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4841
    "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
  4842
     derived from menuPanel
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4843
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4844
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4845
    isButton ifTrue: [^ menuPanel buttonEnteredBackgroundColor].
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4846
    ^ menuPanel backgroundColor
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4847
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4848
    "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
  4849
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  4850
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4851
choiceForm
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4852
    "returns choice form or nil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4853
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4854
    |holder|
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4855
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4856
    (holder := self choice) isNil ifTrue:[^ nil].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4857
1107
0ace8de67a4e better styled round choice images + test choice values only for #=
tz
parents: 1101
diff changeset
  4858
    holder value = self choiceValue ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4859
	^ self class checkOnIcon
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4860
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  4861
    ^ self class checkOffIcon
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4862
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  4863
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4864
findSubMenuIn:aRecv
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4865
    "ask the receiver for a submenu aspect, sending it
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4866
     #aspectFor: first; then trying the selector itself.
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4867
     Ignore the error if that message is not understood
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4868
     (but not other message-not-understoods)"
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4869
890
28c4470c6858 dont catch all messageNotUnderstoods
Claus Gittinger <cg@exept.de>
parents: 879
diff changeset
  4870
    |subm argument sel|
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4871
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4872
    subm := nil.
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4873
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4874
    aRecv notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4875
	submenuChannel last ~~ $: ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4876
	    Object messageNotUnderstoodSignal handle:[:ex|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4877
		|selector|
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4878
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4879
		((selector := ex parameter selector) == submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4880
		or:[selector == #aspectFor:]) ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4881
		    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4882
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4883
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4884
		subm := aRecv aspectFor:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4885
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4886
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4887
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4888
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4889
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4890
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4891
	    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4892
		    subm := aRecv perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4893
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4894
	    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4895
	    subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4896
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4897
		    ex parameter selector == submenuChannel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4898
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4899
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4900
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4901
		    subm := aRecv class perform:submenuChannel
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4902
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4903
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4904
	] ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4905
	    (argument := self argument) notNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4906
		sel := submenuChannel asSymbol.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4907
		Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4908
		    ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4909
			ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4910
		    ].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4911
		] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4912
		    subm := aRecv perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4913
		].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4914
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4915
		subm isNil ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4916
		    Object messageNotUnderstoodSignal handle:[:ex| 
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4917
			ex parameter selector == sel ifFalse:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4918
			    ex reject
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4919
			].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4920
		    ] do:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4921
			subm := aRecv class perform:sel with:argument
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4922
		    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4923
		]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4924
	    ]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  4925
	]
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4926
    ].
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4927
    ^ subm
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4928
1051
a448c854fcbb catch messageNotUnderstood for #aspectFor:
Claus Gittinger <cg@exept.de>
parents: 1048
diff changeset
  4929
    "Modified: / 4.8.1998 / 17:40:09 / cg"
663
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4930
!
b418df6b72d8 retrive submenu:
ca
parents: 661
diff changeset
  4931
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4932
indicationValue
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4933
    "returns indication value or nil in case of no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4934
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4935
    |indication numArgs sel recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4936
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4937
    (indication := self indication) isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4938
	^ nil                                           "/ has no indication
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4939
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4940
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4941
    indication isSymbol ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4942
	(numArgs := indication numArgs) ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4943
	    numArgs == 2 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4944
		recv := menuPanel receiver.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4945
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4946
		(recv isValueModel) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4947
		    (recv notNil or:[(recv := menuPanel application) notNil]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4948
			sel := indication copyFrom:1 to:(indication indexOf:$:).
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4949
			indication := nil.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4950
			sel := sel asSymbol.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4951
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4952
			Object messageNotUnderstoodSignal handle:[:ex| 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4953
			    ex parameter selector == sel ifFalse:[
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4954
"/                                Transcript showCR:'no indication for: ' , sel.
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4955
				ex reject
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4956
			    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4957
			] do:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4958
			    indication := recv perform:sel with:self argument
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4959
			]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4960
		    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4961
		].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4962
		^ indication value == true
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4963
	    ].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4964
	    indication := (indication copyWithoutLast:1) asSymbol
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4965
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4966
	indication := self aspectAt:indication.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4967
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4968
	(self isKindOfValueHolder:indication) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4969
	    self adornment indication:indication.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4970
	    indication addDependent:self.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4971
	]
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4972
    ].
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4973
    ^ indication value == true
1029
c9e90585fa89 only ignore messageNotUnderstood for my aspects.
Claus Gittinger <cg@exept.de>
parents: 1026
diff changeset
  4974
1063
08b7ca464437 dont show accelerators for horizontal layouts
Claus Gittinger <cg@exept.de>
parents: 1054
diff changeset
  4975
    "Modified: / 8.8.1998 / 02:15:15 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4976
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4977
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4978
indicationValue:aValue
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4979
    "set the indication value
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  4980
    "
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  4981
    |numArgs indication recv|
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4982
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4983
    (indication := self indication) isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4984
	^ self                                          "/ has no indication
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4985
    ].
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4986
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4987
    indication isSymbol ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4988
	(indication respondsTo:#value:) ifTrue:[        "/ valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4989
	    indication value:aValue
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4990
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4991
	^ self
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4992
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4993
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  4994
    recv := menuPanel receiver.
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4995
    recv isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4996
	recv := menuPanel application.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  4997
	recv isNil ifTrue:[^ self].
1218
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4998
    ].
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  4999
6ce43fcb2603 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  5000
    (numArgs := indication numArgs) ~~ 0 ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5001
	Object messageNotUnderstoodSignal handle:[:ex| 
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5002
	    (ex parameter selector ~~ indication) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5003
		ex reject
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5004
	    ]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5005
	] do:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5006
	    numArgs == 1 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5007
		recv perform:indication with:aValue
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5008
	    ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5009
		recv perform:indication with:(self argument ? self) with:aValue
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5010
	    ]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5011
	]
524
d602402ce5ae receiver might be a ValueModel; VW
ca
parents: 510
diff changeset
  5012
    ].
1026
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  5013
29bd433b27d3 dont catch too many errors - it makes debugging so hard.
Claus Gittinger <cg@exept.de>
parents: 1024
diff changeset
  5014
    "Modified: / 28.7.1998 / 20:47:08 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5015
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5016
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5017
indicatorForm
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5018
    "returns indication form or nil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5019
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5020
    |value|
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5021
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5022
    (value := self indicationValue) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5023
	^ nil
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5024
    ].
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5025
  ^ 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
  5026
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5027
    "Created: / 14.8.1998 / 15:53:53 / cg"
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5028
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5029
1081
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5030
isEntered
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5031
    "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
  5032
    "
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5033
    ^ menuPanel enteredItem == self
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5034
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5035
    "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
  5036
!
fd67c198eeea added enter/leave processing for enteredLevel/enteredBG processing.
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
  5037
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5038
reinitSubmenuStyle
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5039
    "returns my submenu or nil
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5040
    "
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5041
    subMenu notNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5042
	subMenu reinitStyle
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5043
    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5044
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5045
    "Created: / 10.9.1998 / 21:36:09 / cg"
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5046
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5047
464
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5048
separatorType
a788fdce92e2 add submenuChannel
ca
parents: 461
diff changeset
  5049
    "returns type of separator line or nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5050
    "
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5051
    |c lbl|
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5052
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5053
    rawLabel isNil ifFalse:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5054
	^ nil
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5055
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5056
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5057
    (lbl := label value) isNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5058
	^ #singleLine
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5059
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5060
390
a0cf1f90da2c enabled and style
ca
parents: 389
diff changeset
  5061
    lbl size == 1 ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5062
	c := lbl first.
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5063
	c == $- ifTrue:[^ #singleLine].
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5064
	c == $= ifTrue:[^ #doubleLine].
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5065
    ].
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5066
  ^ #blankLine
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5067
!
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5068
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5069
setupSubmenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5070
    |appl recv subm|
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5071
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5072
    submenuChannel notNil ifTrue:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5073
        submenuChannel isSymbol ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5074
            subm := submenuChannel
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5075
        ] ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5076
            appl := menuPanel application.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5077
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5078
            (subm := self findSubMenuIn:appl) isNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5079
                (recv := menuPanel receiver) ~~ appl ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5080
                    subm := self findSubMenuIn:recv
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5081
                ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5082
            ]
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5083
        ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5084
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5085
        (subm := subm value) isArray ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5086
            subm := Menu new fromLiteralArrayEncoding:subm.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5087
            "/ cg: linked menus also may contain translations ...
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5088
            subm notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5089
                appl notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5090
                    subm findGuiResourcesIn:appl.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5091
                ]                
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5092
            ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5093
        ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5094
        self submenu:subm.
1130
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5095
    ].
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5096
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5097
    ^ subMenu
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5098
fb79ef4aeec8 style changes
Claus Gittinger <cg@exept.de>
parents: 1124
diff changeset
  5099
    "Modified: / 19.5.1998 / 19:36:56 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5100
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5101
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5102
!MenuPanel::Item methodsFor:'queries'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5103
1217
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5104
canChangeVisibility
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5105
    "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
  5106
    "
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5107
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5108
    ^ isVisible notNil and:[isVisible ~~ true]
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5109
!
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5110
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5111
canSelect
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5112
    "returns true if item is selectable
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5113
    "
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5114
    |holder|
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5115
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5116
    (self isVisible and:[self enabled and:[rawLabel notNil]]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5117
	((holder := self choice) isNil or:[holder value ~= self choiceValue]) ifTrue:[
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5118
	    ^ true
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5119
	].
1078
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5120
    ].
3adf74275ebd support choice for buttons
ca
parents: 1076
diff changeset
  5121
    ^ false
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
containsPointX:x y:y
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5125
    "returns true if point is contained in my layout
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5126
    "
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5127
    (self isVisible and:[layout notNil]) ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5128
	^ (     (x >= layout left)
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5129
	    and:[x <  layout right
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5130
	    and:[y >  layout top
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5131
	    and:[y <= layout bottom]]]
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5132
	  )
505
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  5133
    ].
562d5661a855 check for valid layout
ca
parents: 502
diff changeset
  5134
    ^ false
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5135
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5136
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5137
hasChoice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5138
    "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
  5139
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5140
  ^ self choice notNil
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5141
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5142
    "Created: / 14.8.1998 / 14:38:20 / cg"
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5143
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5144
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5145
hasIndication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5146
    "returns true if on/off indication exists
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5147
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5148
  ^ self indication notNil
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5149
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5150
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5151
hasSubmenu
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5152
    "returns true if the item is configured as an subMenu entry
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5153
    "
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5154
    ^ subMenu notNil or:[submenuChannel notNil]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5155
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5156
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5157
isEnabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5158
    "returns enabled state
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5159
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5160
    ^ self enabled
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5161
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5162
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5163
isKindOfValueHolder:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5164
    "returns true if something is kind of vlaue holder
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5165
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5166
    ^ ((something respondsTo:#value:) and:[something isBlock not])
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5167
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5168
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5169
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5170
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5171
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5172
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5173
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5174
isSeparator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5175
    "returns true if item is a separator
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5176
    "
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5177
    ^ rawLabel isNil
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5178
!
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5179
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5180
isVisible
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5181
    "returns the visibility state
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5182
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5183
    |state|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5184
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5185
    isVisible isSymbol ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5186
	state := self aspectAt:isVisible.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5187
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5188
	(self isKindOfValueHolder:state) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5189
	    isVisible := state.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5190
	    isVisible addDependent:self.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5191
	    state := isVisible.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5192
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5193
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5194
	state := isVisible
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5195
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5196
  ^ state value ~~ false
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5197
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5198
    "Modified: / 5.10.1998 / 12:08:28 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5199
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5200
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5201
isVisible:something
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5202
    "change the state; if the state changed, a redraw is performed
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5203
    "
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5204
    |oldState newState|
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5205
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5206
    isVisible isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5207
	oldState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5208
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5209
	oldState := isVisible value.
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5210
	(self isKindOfValueHolder:isVisible) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5211
	    isVisible removeDependent:self
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5212
	]
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5213
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5214
    isVisible := something.
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5215
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5216
    isVisible isNil ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5217
	newState := true
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5218
    ] ifFalse:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5219
	(self isKindOfValueHolder:isVisible) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5220
	    isVisible addDependent:self
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5221
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5222
	    isVisible isSymbol ifTrue:[^ self]
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5223
	].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5224
	menuPanel shown ifFalse:[^ self].
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5225
	newState := isVisible value.
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5226
    ].
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5227
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5228
    newState ~~ oldState ifTrue:[
1368
Claus Gittinger <cg@exept.de>
parents: 1367
diff changeset
  5229
	menuPanel mustRearrange
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5230
    ]
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5231
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5232
    "Modified: / 5.10.1998 / 12:12:04 / cg"
712
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5233
!
4167a3f39bff support of visible/invisible items
ca
parents: 711
diff changeset
  5234
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5235
preferredExtent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5236
    "compute my preferred extent
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5237
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5238
    |x y s isVertical sepSize|
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5239
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5240
    self isVisible ifFalse:[^ (0 @ 0) ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5241
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5242
    x := self horizontalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5243
    y := self verticalInset * 2.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5244
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5245
    isVertical := menuPanel verticalLayout.
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5246
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5247
    self isSeparator ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5248
        x := x + (rawLabel widthOn:menuPanel).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5249
        y := y + (rawLabel heightOn:menuPanel).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5250
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5251
        MenuView showAcceleratorKeys == true ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5252
            isVertical ifTrue:[ "/ only for vertical menus ...
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5253
                (s := self shortcutKeyAsString) notNil ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5254
                    x := x + LabelRightOffset + (s widthOn:menuPanel)
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5255
                ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5256
            ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5257
        ].
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5258
        (isVertical and:[self hasSubmenu]) ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5259
            x := x + menuPanel subMenuIndicationWidth.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5260
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5261
            s notNil ifTrue:[x := x + ShortcutKeyOffset]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5262
                    ifFalse:[x := x + LabelRightOffset]
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5263
        ].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5264
    ] ifTrue:[
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5265
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5266
        sepSize := (self class separatorSize:(self separatorType)).
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5267
        isVertical ifFalse:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5268
            x := x max:sepSize.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5269
            y := y + (menuPanel font height)
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5270
        ] ifTrue:[
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5271
            y := y max:sepSize
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5272
        ].
1096
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5273
    ].
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5274
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5275
    ^ (x @ y)
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5276
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5277
    "Modified: / 8.8.1998 / 01:38:26 / cg"
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5278
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5279
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5280
preferredExtentX
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5281
    "compute my preferred extent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5282
    "
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5283
    ^ self preferredExtent x
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5284
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5285
!
6ab44a6939bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5286
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5287
shortcutKeyAsString
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5288
    "converts shortcutKey to a text object
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5289
    "
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5290
    |nm prefix|
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5291
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5292
    shortcutKey isNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5293
        ^ nil
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5294
    ].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5295
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5296
    shortcutKey isCharacter ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5297
        nm := shortcutKey asString
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5298
    ] ifFalse:[
1609
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5299
        "/ this is somewhat complicated: we have the symbolic key at hand,
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5300
        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5301
        "/ Ask the devices keyboardMap for the backtranslation.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5302
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5303
        nm := menuPanel device keyboardMap keyAtValue:shortcutKey ifAbsent:shortcutKey.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5304
        "/
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5305
        "/ some modifier-key combination ?
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5306
        "/
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5307
        (nm startsWith:#Cmd) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5308
            prefix := #Cmd.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5309
        ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5310
            prefix := #Alt.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5311
        ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5312
            prefix := #Meta.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5313
        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5314
            prefix := #Ctrl.
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5315
        ]]]].
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5316
        prefix notNil ifTrue:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5317
            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5318
        ] ifFalse:[
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5319
            nm := nm asString
2c8d62894ebe optimize searchinf for shortCutKeys
ca
parents: 1600
diff changeset
  5320
        ]
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5321
    ].
608
0d8d910768af use default font derived from style
ca
parents: 601
diff changeset
  5322
    ^ nm
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5323
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5324
    "Modified: / 17.7.1998 / 11:56:40 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5325
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5326
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5327
shortcutKeyPrefixFor:aModifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5328
    "returns prefix assigned to a modifier
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5329
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5330
    |m|
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5331
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5332
    m := menuPanel device modifierKeyTopFor:aModifier.
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5333
    m notNil ifTrue:[
1117
3181b8002e05 background color setting
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
  5334
	^ m , '-'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5335
    ].
987
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5336
    ^ aModifier , '-'.
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5337
541dff179cc2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 984
diff changeset
  5338
    "Modified: / 17.7.1998 / 11:56:46 / cg"
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5339
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5340
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5341
!MenuPanel::Item methodsFor:'selection'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5342
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5343
hideSubmenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5344
    "hide submenu
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5345
    "
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5346
    |id|
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5347
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5348
    subMenu notNil ifTrue:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5349
        subMenu realized ifFalse:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5350
            (id := subMenu id) notNil ifTrue:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5351
                menuPanel device unmapWindow:id
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5352
            ]
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5353
        ] ifTrue:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5354
           subMenu hide
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5355
        ].
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5356
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5357
        subMenu windowGroup:nil.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5358
        menuPanel windowGroup removeView:subMenu.
1474
bc9d6e39c2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
  5359
bc9d6e39c2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
  5360
        "/ release menu if derived from channel
bc9d6e39c2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
  5361
        submenuChannel notNil ifTrue:[
bc9d6e39c2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
  5362
            subMenu := nil
bc9d6e39c2e7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
  5363
        ]
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5364
     ].
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5365
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5366
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5367
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5368
isSelected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5369
    "returns true if item is selected
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5370
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5371
    ^ menuPanel selection == self
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5372
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5373
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5374
selected:aState
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5375
    "change selection to a state. Dependant on the state open or hide an existing
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5376
     submenu and perform a redraw
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5377
    "
1475
2eebc866712e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1474
diff changeset
  5378
    |p d top windowGrp|
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5379
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5380
    aState ifFalse:[
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5381
        self redraw.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5382
        self hideSubmenu.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5383
      ^ self
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5384
    ].
1573
fd124ee2bce5 shortcutKeys; arrange layout if selection changed
ca
parents: 1572
diff changeset
  5385
    menuPanel realized ifFalse:[^ self].
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5386
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5387
    (self hasIndication not or:[isButton not]) ifTrue: [self redraw].
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5388
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  5389
    (subMenu := self setupSubmenu) isNil ifTrue:[|m|
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  5390
        self hasSubmenu ifTrue:[
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  5391
            menuPanel selection:nil
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  5392
        ] ifFalse:[
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  5393
"/            menuPanel isPopUpView ifTrue:[menuPanel grabMouseAndKeyboard]
1612
42e2fce5a1f9 set focus back
ca
parents: 1610
diff changeset
  5394
        ].
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5395
      ^ self.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5396
    ].
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5397
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5398
    menuPanel verticalLayout ifTrue:[p := (layout right - 4) @ (layout top)]
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5399
                            ifFalse:[p := (layout left)  @ (layout bottom)].
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5400
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5401
    d := menuPanel device.
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5402
    p := d translatePoint:p from:(menuPanel id) to:(d rootWindowId).
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5403
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5404
    windowGrp := menuPanel topMenu windowGroup.
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5405
829
c86ed87da63b bug fix:
ca
parents: 828
diff changeset
  5406
    subMenu font:(menuPanel topMenu font).
798
74f4e7b66a46 ca's fixes for mapTime (fast-button-release)
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
  5407
    subMenu becomesActiveMenu.
1600
ded7554a66a6 show a hand cursor in submenu
Claus Gittinger <cg@exept.de>
parents: 1575
diff changeset
  5408
    subMenu cursor:Cursor hand.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5409
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5410
    windowGrp notNil ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5411
        subMenu windowGroup:windowGrp.
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5412
        windowGrp addTopView:subMenu.
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5413
    ].
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5414
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5415
    "/ 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
  5416
    "/ 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
  5417
    "/       (since I react correctly on valueHolder changes)
c6a4c536aa8c care for items which change visibility via
Claus Gittinger <cg@exept.de>
parents: 1212
diff changeset
  5418
    subMenu rearrangeItemsIfItemVisibilityChanged.
1164
e6e9633abf48 kludge fix: invoke mustRearrange to care for block-visibility attributes
Claus Gittinger <cg@exept.de>
parents: 1156
diff changeset
  5419
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5420
    subMenu fixSize.
1473
1f62652f146e use hasSubmenu insteat of submenu if possible;
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
  5421
    subMenu origin:p.
680
a4220a7a79c4 grab & ungrab: bug fix
ca
parents: 671
diff changeset
  5422
    top := menuPanel topMenu.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5423
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5424
    subMenu realized ifFalse:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5425
        subMenu realize. 
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5426
    ] ifTrue:[
1472
fd1871a0d888 call hasSubmenu insteat of submenu
Claus Gittinger <cg@exept.de>
parents: 1464
diff changeset
  5427
        top device mapWindow:subMenu id.
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5428
    ].
816
8f8f8e19d983 implement button behaviour
ca
parents: 798
diff changeset
  5429
    subMenu makeFullyVisible.
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5430
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5431
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5432
!MenuPanel::Item::Adornment methodsFor:'accessing'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5433
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5434
accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5435
    "get the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5436
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5437
    ^ accessCharacterPosition
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5438
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5439
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5440
accessCharacterPosition:anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5441
    "set the index of the access character in the label text or string, or nil if none
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5442
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5443
    accessCharacterPosition := anIndexOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5444
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5445
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5446
argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5447
    "ST/X goody; get argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5448
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5449
  ^ argument
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5450
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5451
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5452
argument:anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5453
    "ST/X goody; set argunment to a selector or block
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5454
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5455
    argument := anArgumentOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5456
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5457
1074
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5458
choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5459
    "get has choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5460
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5461
  ^ choice
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5462
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5463
    "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
  5464
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5465
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5466
choice:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5467
    "set choice indicator value
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5468
    "
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5469
    choice := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5470
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5471
    "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
  5472
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5473
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5474
choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5475
    "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
  5476
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5477
    ^ choiceValue
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5478
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5479
    "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
  5480
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5481
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5482
choiceValue:something
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5483
    "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
  5484
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5485
    choiceValue := something.
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5486
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5487
    "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
  5488
!
25e3910947de added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1068
diff changeset
  5489
407
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5490
indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5491
    "get has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5492
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5493
  ^ indication
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5494
!
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5495
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5496
indication:something
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5497
    "set has on/off indicator value
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5498
    "
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5499
    indication := something.
40554a07d5aa fix bugs; implement indication; text with backgroundColor
ca
parents: 399
diff changeset
  5500
!
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5501
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5502
shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5503
    "get the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5504
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5505
  ^ shortcutKey
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5506
!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5507
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5508
shortcutKey:aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5509
    "set the character that is used as a shortcut key for this item
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5510
    "
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5511
    shortcutKey := aKeyOrNil
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5512
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5513
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5514
!MenuPanel class methodsFor:'documentation'!
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5515
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5516
version
1630
01dc20096011 grabbing cleaned up;
ca
parents: 1613
diff changeset
  5517
    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.185 1999-12-08 20:33:06 ca Exp $'
388
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5518
! !
dce33f8bb806 intitial checkin
ca
parents:
diff changeset
  5519
MenuPanel initialize!