Skip to content

Add SpAction dynamicIconName: - #2004

Merged
jecisc merged 4 commits into
pharo-spec:Pharo15from
jordanmontt:spaction-dynamic-icon
Nov 27, 2026
Merged

jecisc merged 4 commits into
pharo-spec:Pharo15from
jordanmontt:spaction-dynamic-icon

Conversation

@jordanmontt

@jordanmontt jordanmontt commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

SpAction now has dynamic icons. It can now change its menu icon with the context, the way dynamicName: changes its label.

Goal

An action whose label depends on the state (for example Reviewed / Unmark) could not change its icon to match: the menu item always showed the static iconName.

  • SpAction>>#dynamicIconName: takes a block that answers an icon name. It is evaluated with the context each time a menu is built, like dynamicName:.

Main changes

  • SpCommand>>#dynamicIcon answers icon by default. SpAction overrides it to answer the icon of its block's name, and SpAction>>#dynamicIconName answers that name.
  • SpActionMenuPresenterBuilder>>#fillItem:with: sets the item icon from dynamicIcon, next to dynamicName. It is the only place dynamicName reaches: toolbar buttons are built from name and icon, so they are unchanged.
  • Tests for the action and for the menu builder.

🤖 Generated with Claude Code but reviewed thoroughly by jordanmontt ❤️

jordanmontt and others added 4 commits November 27, 2026 11:07
A block answering an icon name, evaluated when the menu is built, like dynamicName:.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
repository_commit rewrote it in af67460 although nothing in it changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SpCommand>>#dynamicIcon now answers icon, so an override of icon is still shown in action menus. Only SpAction keeps dynamicIconName.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
repository_commit rewrote it in 925c101 although nothing in it changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jecisc
jecisc merged commit a8854bf into pharo-spec:Pharo15 Nov 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants