J
Joe Van Dyk
If you remember my previous post titled "automatically call function on
attribute set", you'll remember that I have an airplane class and a
airplane_drawing class, which represents the airplane when drawn on the
screen.
I'm using GTK for this, by the way.
Say the user right clicks on the airplane_drawing object. I want a menu to
popup on the screen with options that when selected will call methods on the
airplane object.
Information on the airplanes is also listed in table form, which reports
each airplane's position, velocity, etc. When I right click on the row that
represents the airplane, I'd like the same popup menu (for now, perhaps it
will be different in the future) to pop up with options that when selected
will call a method on the airplane object.
Question: Since the popup menu has pretty common functionality between the
graphical airplane display and the table airplane display, what would be a
good way to generalize this? Any patterns that would be useful here?
Thanks,
Joe
attribute set", you'll remember that I have an airplane class and a
airplane_drawing class, which represents the airplane when drawn on the
screen.
I'm using GTK for this, by the way.
Say the user right clicks on the airplane_drawing object. I want a menu to
popup on the screen with options that when selected will call methods on the
airplane object.
Information on the airplanes is also listed in table form, which reports
each airplane's position, velocity, etc. When I right click on the row that
represents the airplane, I'd like the same popup menu (for now, perhaps it
will be different in the future) to pop up with options that when selected
will call a method on the airplane object.
Question: Since the popup menu has pretty common functionality between the
graphical airplane display and the table airplane display, what would be a
good way to generalize this? Any patterns that would be useful here?
Thanks,
Joe