Hmm... not sure. Hiding or showing menu items turned out to be confusing for users. Microsoft tried this with those "clever" menus about 20 years ago.

-1 ... I think

Hmm.. but it is just about the label, right? Hmm... not sure. You decide. I find labels for toggle operations always tricky. One could also use a checkbox with a single label. But expand/contract/collapse is a strange set of window operations. Some word seems to be missing. "expand" seems to have two meanings.

Best,
Marcel

Am 26.12.2023 18:55:51 schrieb commits@source.squeak.org <commits@source.squeak.org>:

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.2152.mcz

==================== Summary ====================

Name: Morphic-ct.2152
Author: ct
Time: 26 December 2023, 6:55:20.675309 pm
UUID: 6ac2adc4-972f-5746-b337-3e0c6279fc48
Ancestors: Morphic-ct.2150

Proposal: In docking bar window menus, displays specific expand/collapse/contract operation based on current window status.

Possible disadvantages: Labels might be harder to find without icon, labels might be out of date in the rare scenario that windows open or change themselves while a windows menu is opened.

=============== Diff against Morphic-ct.2150 ===============

Item was added:
+ ----- Method: SystemWindow>>isExpanded (in category 'resize/collapse') -----
+ isExpanded
+ ^ self unexpandedFrame notNil!

Item was changed:
----- Method: TheWorldMainDockingBar>>windowMenuFor:on: (in category 'submenu - windows') -----
windowMenuFor: window on: menu

| closeBox closeBoxWidth |
closeBox := SystemWindow closeBoxImage.
closeBoxWidth := closeBox width.

menu
addItem: [ :item |
item
contents: 'Close' translated ;
icon: closeBox;
target: window;
selector: #closeBoxHit ];
+ addItem: [ :item |
- addItem: [ :item |
item
+ contents: (window isExpanded ifFalse: ['Expand' translated] ifTrue: ['Contract' translated]) ;
- contents: 'Expand (or contract)' translated ;
icon: (MenuIcons blankIconOfWidth: closeBoxWidth);
target: window;
selector: #expandBoxHit ];
addItem: [ :item |
item
+ contents: (window isCollapsed ifFalse: ['Collapse' translated] ifTrue: ['Expand' translated]) ;
- contents: 'Collapse (or expand)' translated ;
icon: (MenuIcons blankIconOfWidth: closeBoxWidth);
target: window;
selector: #collapseOrExpand ];
addLine;
addItem: [ :item |
item
contents: 'Close all like this' translated ;
icon: closeBox;
target: self;
selector: #closeAllWindowsLike:;
arguments: { window } ];
addItem: [ :item |
item
contents: 'Close all but this' translated ;
icon: (MenuIcons blankIconOfWidth: closeBoxWidth);
target: self;
selector: #closeAllWindowsBut:;
arguments: { window } ];
addLine;
addItem: [ :item |
item
contents: 'Collapse all like this' translated ;
icon: (MenuIcons blankIconOfWidth: closeBoxWidth);
target: self;
selector: #collapseAllWindowsLike:;
arguments: { window } ];
addItem: [ :item |
item
contents: 'Collapse all but this' translated ;
icon: (MenuIcons blankIconOfWidth: closeBoxWidth);
target: self;
selector: #collapseAllWindowsBut:;
arguments: { window } ]!