Re: [gtk-list] toggle_button vs check_menu_item




On Sun, 21 Mar 1999 rowe@excc.ex.ac.uk wrote:
> It would seem we have gtk_toggle_button_set_active and
> gtk_check_menu_item_set_active (and similarly for _toggled) but
> no general routine that will take either type of argument.
> This does not seem very object orientated! 

It is object oriented, because a GtkCheckMenuItem and a GtkToggleButton do
not share a common base class representing "toggleable." Your proposal
would create a fundamental type error because it would allow you to apply
a set_active() function to objects that cannot be toggled. 

In a language such as C++ or Java this would be solved by multiple
inheritance, one of the base classes being a "toggleable" interface; but
the Gtk+ object system does not permit that yet. So there is an object
oriented way to do it in those languages, but without multiple interfaces
implementing gtk_widget_set_active() would amount to a switch statement
based on object type, which is the antithesis of object orientation. :-)

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]