I’m working on a user interface and I’m hoping I can get some
feedback/advice. I have 3 main classes: Viewer, Toolbar and
ToolbarButton. Given that an instance of Viewer has an instance of
Toolbar and that Toolbar has a collection of ToolbarButtons, I’m trying
to decide how I want to implement the workflow for the “Close” process.
The creation of all these instances is all rather “pretty” at the moment
but no instances really “knows” or cares about the other. (parts is
So, consider when the user clicks a “close window” ToolbarButton.
Somehow the Viewer must be informed that its time to close the window.
For some reason, I’m trying to avoid keeping a reference to the Viewer
in the button (like with a call back). I’m hoping for a somewhat more
interesting design. I’ve tried a variety of things over the years but
I’m curious what others have tried, got working and generally like.
Any comments would be greatly appreciated.