Re: Gtk2: defaults for widget constructors



Le dim 12/01/2003 Ã 23:55, JÃrn Reder a Ãcrit :
Hi,

I'm fairly new to Gtk2 developing. Goran set me on the developer list 
some time ago, but I wasn't active since that time. That hopefully 
changes now ;)

I just began porting a very small app to see, how Gtk2 feels. I quickly
stumble over missing defaults for Gtk::VBox->new(), which was

 Gtk::VBox->new (FALSE, 10)

in the good old Perl Gtk module.

Perl Gtk simply defines these defaults in the corresponding .xs file. 
Since the .xs files of Perl Gtk2 are auto-generated through Inline's 
AUTOWRAP function, this isn't possible anymore (correct me if I'm 
wrong).

Now two questions: is it intended, that these defaults are missing in 
Gtk2 (probably to be closer to the C original - but porting existing Gtk
App's would be much easier, if we can have them). If not: I'm not yet 
familar with all details of Perl Gtk2's source structure and build 
process: what would be the easiest way to achieve that?

If you have default value to set. The easiest way to do it is to rename
*new function into *_new and write a wrapper in perl (Gtk2::VBox::new)
which set the default value and call Gtk2::VBox::_new.

I think, this is the way it is done for other functions in Gtk2-Perl.

Regards,

Joern

P.S.: just committed a small change to Gtk2/_Object.pm: catch execption
from AUTOLOADER method call and croak it again. Otherwise wrong caller 
information is printed in the error message.

Daniel




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