28 ! |
28 ! |
29 |
29 |
30 Object subclass:#Item |
30 Object subclass:#Item |
31 instanceVariableNames:'menuItem layout menuPanel subMenu rawLabel rawLabelExtent |
31 instanceVariableNames:'menuItem layout menuPanel subMenu rawLabel rawLabelExtent |
32 disabledRawLabel enableChannel label activeHelpText flyByHelpText |
32 disabledRawLabel enableChannel label activeHelpText flyByHelpText |
33 submenuChannel isVisible indication choice accessCharacter font' |
33 isVisible indication choice accessCharacter font' |
34 classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
34 classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset |
35 VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
35 VerticalButtonInset LabelRightOffset VerticalPopUpInset' |
36 poolDictionaries:'' |
36 poolDictionaries:'' |
37 privateIn:MenuPanel |
37 privateIn:MenuPanel |
38 ! |
38 ! |
5221 subMenu menu:aSubMenu. |
5221 subMenu menu:aSubMenu. |
5222 ] ifFalse:[ |
5222 ] ifFalse:[ |
5223 aSubMenu isView ifFalse:[ |
5223 aSubMenu isView ifFalse:[ |
5224 (aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
5224 (aSubMenu isKindOf:ApplicationModel) ifFalse:[ |
5225 "/ ... mhhhh .... |
5225 "/ ... mhhhh .... |
5226 ^ self submenuChannel:aSubMenu |
5226 ^ menuItem submenuChannel:aSubMenu |
5227 ]. |
5227 ]. |
5228 widget := SimpleView new. |
5228 widget := SimpleView new. |
5229 widget client:aSubMenu. |
5229 widget client:aSubMenu. |
5230 ] ifTrue:[ |
5230 ] ifTrue:[ |
5231 widget := aSubMenu |
5231 widget := aSubMenu |
5355 enabled |
5352 enabled |
5356 "returns the enabled state |
5353 "returns the enabled state |
5357 " |
5354 " |
5358 |state| |
5355 |state| |
5359 |
5356 |
5360 menuPanel enabled ifTrue:[ |
5357 menuPanel enabled ifFalse:[^ false]. |
5361 enableChannel isSymbol ifTrue:[ |
5358 |
5362 state := self aspectAt:enableChannel. |
5359 enableChannel isSymbol ifTrue:[ |
5363 state isNil ifTrue:[ |
5360 state := self aspectAt:enableChannel. |
5364 self ifNotInUIBuilderInfoPrintCR: |
5361 |
5365 ('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , (label?rawLabel) printString , ')') |
5362 state isNil ifTrue:[ |
5366 ] ifFalse:[ |
5363 self ifNotInUIBuilderInfoPrintCR: |
5367 state isValueModel ifTrue:[ |
5364 ('MenuPanel::Item [info]: no aspect for ', enableChannel, ' (in ' , label printString , ')'). |
5368 enableChannel := state. |
5365 ^ true |
5369 enableChannel addDependent:self. |
5366 ]. |
5370 state := enableChannel value. |
5367 |
5371 ] ifFalse:[ |
5368 state isValueModel ifTrue:[ |
5372 state := state value |
5369 enableChannel := state. |
5373 ] |
5370 enableChannel addDependent:self. |
5374 ] |
5371 state := enableChannel value. |
5375 ] ifFalse:[ |
5372 ] ifFalse:[ |
5376 state := enableChannel value |
5373 state := state value |
5377 ]. |
5374 ] |
5378 ^ state ~~ false |
5375 ] ifFalse:[ |
5379 ]. |
5376 state := enableChannel value |
5380 ^ false |
5377 ]. |
|
5378 ^ state ~~ false |
5381 ! |
5379 ! |
5382 |
5380 |
5383 enabled:something |
5381 enabled:something |
5384 "change the enabled state; if the state changed, a redraw is performed |
5382 "change the enabled state; if the state changed, a redraw is performed |
5385 " |
5383 " |
5698 |id| |
5696 |id| |
5699 |
5697 |
5700 aSubmenu ifNil:[^ self]. |
5698 aSubmenu ifNil:[^ self]. |
5701 |
5699 |
5702 aSubmenu realized ifFalse:[ |
5700 aSubmenu realized ifFalse:[ |
5703 id := aSubmenu id. |
5701 id := aSubmenu id. |
5704 id ifNotNil:[ menuPanel device unmapWindow:id ] |
5702 id ifNotNil:[ menuPanel device unmapWindow:id ] |
5705 ] ifTrue:[ |
5703 ] ifTrue:[ |
5706 aSubmenu hide |
5704 aSubmenu hide |
5707 ]. |
5705 ]. |
5708 |
5706 |
5709 aSubmenu windowGroup:nil. |
5707 aSubmenu windowGroup:nil. |
5710 menuPanel windowGroup removeView:aSubmenu. |
5708 menuPanel windowGroup removeView:aSubmenu. |
5711 |
5709 |
5712 "/ release menu if derived from channel |
5710 "/ release menu if derived from channel |
5713 submenuChannel notNil ifTrue:[ |
5711 (subMenu == aSubmenu and:[menuItem submenuChannel notNil]) ifTrue:[ |
5714 subMenu == aSubmenu ifTrue:[ |
5712 menuItem keepLinkedMenu ifFalse:[ |
5715 subMenu := nil |
5713 subMenu := nil |
5716 ] |
5714 ] |
5717 ]. |
5715 ]. |
5718 ! |
5716 ! |
5719 |
5717 |
5720 openDelayedSubmenu |
5718 openDelayedSubmenu |
5721 "called to open now my delayed submenu |
5719 "called to open now my delayed submenu |
6896 ]. |
6895 ]. |
6897 ^ #blankLine |
6896 ^ #blankLine |
6898 ! |
6897 ! |
6899 |
6898 |
6900 setupSubmenu |
6899 setupSubmenu |
6901 |appl master recv submenuHolder submenu submenuEncoding| |
6900 |appl master recv submenuHolder submenu submenuEncoding channel| |
6902 |
6901 |
6903 submenuChannel notNil ifTrue:[ |
6902 channel := menuItem submenuChannel value. |
6904 submenuChannel isSymbol ifFalse:[ |
6903 channel isNil ifTrue:[ ^ subMenu ]. |
6905 submenuHolder := submenuChannel |
6904 |
6906 ] ifTrue:[ |
6905 subMenu notNil ifTrue:[ |
6907 appl := menuPanel application. |
6906 menuItem keepLinkedMenu ifTrue:[ ^ subMenu ]. |
6908 appl isNil ifTrue:[ |
6907 ]. |
6909 appl := menuPanel receiver. |
6908 |
6910 appl notNil ifTrue:[ |
6909 channel isSymbol ifFalse:[ |
6911 (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
6910 submenuHolder := channel |
6912 [submenuHolder isNil |
6911 ] ifTrue:[ |
6913 and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
6912 appl := menuPanel application. |
6914 and:[master ~~ appl]]] whileTrue:[ |
6913 appl isNil ifTrue:[ |
6915 appl := master. |
6914 appl := menuPanel receiver. |
6916 submenuHolder := self findSubMenuIn:appl. |
6915 appl notNil ifTrue:[ |
6917 ]. |
6916 (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
6918 ] |
6917 [submenuHolder isNil |
6919 ]. |
6918 and:[(master := appl perform:#masterApplication ifNotUnderstood:nil) notNil |
|
6919 and:[master ~~ appl]]] whileTrue:[ |
|
6920 appl := master. |
|
6921 submenuHolder := self findSubMenuIn:appl. |
|
6922 ]. |
|
6923 ] |
6920 ]. |
6924 ]. |
6921 submenuHolder isNil ifTrue:[ |
6925 ]. |
6922 (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
6926 submenuHolder isNil ifTrue:[ |
6923 (recv := menuPanel receiver) ~~ appl ifTrue:[ |
6927 (submenuHolder := self findSubMenuIn:appl) isNil ifTrue:[ |
6924 appl := recv. |
6928 (recv := menuPanel receiver) ~~ appl ifTrue:[ |
6925 submenuHolder := self findSubMenuIn:appl |
6929 appl := recv. |
6926 ] |
6930 submenuHolder := self findSubMenuIn:appl |
6927 ] |
6931 ] |
6928 ] |
6932 ] |
|
6933 ] |
|
6934 ]. |
|
6935 |
|
6936 (submenu := submenuHolder value) isArray ifTrue:[ |
|
6937 submenuEncoding := submenu. |
|
6938 submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
|
6939 "/ cg: linked menus also may contain translations ... |
|
6940 submenu notNil ifTrue:[ |
|
6941 appl notNil ifTrue:[ |
|
6942 submenu findGuiResourcesIn:appl. |
|
6943 ] |
6929 ]. |
6944 ]. |
6930 |
6945 ]. |
6931 (submenu := submenuHolder value) isArray ifTrue:[ |
6946 "/ appl notNil ifTrue:[submenu application:appl]. |
6932 submenuEncoding := submenu. |
6947 self submenu:submenu. |
6933 submenu := Menu new fromLiteralArrayEncoding:submenuEncoding. |
|
6934 "/ cg: linked menus also may contain translations ... |
|
6935 submenu notNil ifTrue:[ |
|
6936 appl notNil ifTrue:[ |
|
6937 submenu findGuiResourcesIn:appl. |
|
6938 ] |
|
6939 ]. |
|
6940 ]. |
|
6941 "/ appl notNil ifTrue:[submenu application:appl]. |
|
6942 self submenu:submenu. |
|
6943 ]. |
|
6944 |
|
6945 ^ subMenu |
6948 ^ subMenu |
6946 |
6949 |
6947 "Modified: / 19.5.1998 / 19:36:56 / cg" |
6950 "Modified: / 19.5.1998 / 19:36:56 / cg" |
6948 ! ! |
6951 ! ! |
6949 |
6952 |