Brian Manning > Gtk3 > Gtk3

Download:
Gtk3-0.027.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  2
Open  1
View/Report Bugs
Module Version: 0.027   Source  

NAME ^

Gtk3 - Perl interface to the 3.x series of the gtk+ toolkit

SYNOPSIS ^

  use Gtk3 -init;
  my $window = Gtk3::Window->new ('toplevel');
  my $button = Gtk3::Button->new ('Quit');
  $button->signal_connect (clicked => sub { Gtk3::main_quit });
  $window->add ($button);
  $window->show_all;
  Gtk3::main;

ABSTRACT ^

Perl bindings to the 3.x series of the gtk+ toolkit. This module allows you to write graphical user interfaces in a Perlish and object-oriented way, freeing you from the casting and memory management in C, yet remaining very close in spirit to original API.

DESCRIPTION ^

The Gtk3 module allows a Perl developer to use the gtk+ graphical user interface library. Find out more about gtk+ at http://www.gtk.org.

The gtk+ reference manual is also a handy companion when writing Gtk3 programs in Perl: http://developer.gnome.org/gtk3/stable/. The Perl bindings follow the C API very closely, and the C reference documentation should be considered the canonical source. The principles underlying the mapping from C to Perl are explained in the documentation of Glib::Object::Introspection, on which Gtk3 is based.

Glib::Object::Introspection also comes with the perli11ndoc program which displays the API reference documentation of all installed libraries organized in accordance with these principles.

Wrapped libraries

Gtk3 automatically sets up the following correspondence between C libraries and Perl packages:

  Library       | Package
  --------------+----------
  Gtk-3.0       | Gtk3
  Gdk-3.0       | Gtk3::Gdk
  GdkPixbuf-2.0 | Gtk3::Gdk
  Pango-1.0     | Pango

Import arguments

When importing Gtk3, you can pass -init as in use Gtk3 -init; to have Gtk3::init automatically called. You can also pass a version number to require a certain version of Gtk3.

Customizations and overrides

In order to make things more Perlish or to make porting from Gtk2 to Gtk3 easier, Gtk3 customizes the API generated by Glib::Object::Introspection in a few spots:

Perl compatibility

As of 5.20.0, perl does not automatically re-check the locale environment for changes. If a function thus changes the locale behind perl's back, problems might arise whenever numbers are formatted, for example when checking versions. To ensure perl's assumption about the locale are up-to-date, the functions Gtk3::init, init_check, init_with_args and parse_args are amended to let perl know of any changes.

Porting from Gtk2 to Gtk3

The majority of the API has not changed, so as a first approximation you can run s/Gtk2/Gtk3/ on your application. A big exception to this rule is APIs that were deprecated in gtk+ 2.x -- these were all removed from gtk+ 3.0 and thus from Gtk3. The migration guide at http://developer.gnome.org/gtk3/stable/migrating.html describes what to use instead. Apart from this, here is a list of some other incompatible differences between Gtk2 and Gtk3:

Note also that Gtk3::CHECK_VERSION will always fail when passed 2.y.z, so if you have any existing version checks in your code, you will most likely need to remove them.

SEE ALSO ^

AUTHORS ^

Torsten Schönfeld <kaffeetisch@gmx.de>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011-2015 by Torsten Schoenfeld <kaffeetisch@gmx.de>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

syntax highlighting: