Re: [gtk-list] Re: Gtk & Perl



On Sun, 17 Aug 1997, Shawn T. Amundson wrote:

> Something like the below is *much* better for Perl:

You misunderstand. I _want_ something like you show, but the way arguments
are supported by Gtk, the code can only be writted as I showed (at least
without severely more work then should be expected.)

> use Glib; # Exports g_print, etc.

I've avoided Glib entirely (figuring that everything should be translated
directly into Perl) and Gdk is in the Gtk::Gdk namespace, to avoid
cluttering the root.

> use Gtk;  # Only exports GtkMainLoop()

I'm not exporting anything. :-)

> my $app = new Gtk::Application;

I've not added any convenience functions, so if Gtk doesn't have a
gtk_application_new, then I don't either. At the moment, anyhow.

> my $window = $app->Window(
>                           -user_data    => undef,
>                           -type         => 0,
>                           -title        => 'hello world',
>                           -allow_grow   => 0,
>                           -allow_shrink => 0,
>                           -border_width => 10
>                          );
> 
> my $button = $app->Button( # Should allow $window->Button to rid -parent arg
>                           -label       => 'hello world',
>                           -sig_clicked => sub { g_print "hello world\n"; },
>                           -parent      => $window,
>                           -visible     => 1
>                          );

I probably could support this sort of sub-allocation
($app->Window()->Button) with some AUTOLOAD trickery. 


> $window->show;
>
> GtkMainLoop $app;
> 
> > 
> > I'll mail you a copy -- it's not too large.
> > 
> 
> Please me too.  I'd recommend letting the whole list at it for a week or
> so before you put it up on CPAN.  ;-)

Done. I don't have anywhere to upload it (save CPAN), so I'll mail it at
request.

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)




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