Re: A couple of small bugs + patches



-
it makes perfect sense in C, as Gtk+ has its own object system.
it returns a GtkWidget, but you can just use the macro:

GTK_MENU(widget); 

to cast it as a menu.

i think that the bindings should be as accurate as possible so:

bless(bless $objectmenu->get_menu, 'Gtk::Menu');

oh well, whatever.

From: Dave Carrigan
Subject: Re: A couple of small bugs + patches
Date: 28 Feb 2001 13:26:25 -0800


"Charlie Schmidt" <ishamael themes org> writes:
 
 > theyre supposed to do that.
 
 That doesn't make a lot of sense to me. Maybe in C, it should return a
 GtkWidget, but that's because C is not object-oriented, and cannot
 implement inheritence at the language level.
 
 But Perl should be returning widgets blessed into the class that the
 widget really is, should it not?
 
 For example, in Gtk, GtkBin->child is typed as a GtkWidget, but in Perl,
 GtkBin->child returns an appropriately blessed object (i.e., a GtkLabel
 or whatever).
 
 If it's really supposed to do that, then instead of writing this:
 
   $label = $objectmenu->get_menu->get_active->child->get;
 
 I have to write this:
 
   $label = bless(bless $objectmenu->get_menu, 'Gtk::Menu')->get_active,
                  'Gtk::MenuItem')->child->get;
 
 The second option seems, convoluted, error-prone, and unnecessary.
 

-- 
Charlie Schmidt - <ishamael themes org>





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