Gtk3

 view release on metacpan or  search on metacpan

NEWS  view on Meta::CPAN


* Add overrides for Gtk3::MenuItem, CheckMenuItem and ImageMenuItem.
* Require Glib 1.260 and Glib::Object::Introspection 0.009 for various
  improvements.

Overview of changes in Gtk3 0.005 [2012-04-22]
==============================================

* Require Cairo::GObject and load it automatically.
* Add overrides for Gtk3::Builder and implement its connect_signals.
* Add overrides for Gtk3::Menu::popup and popup_for_device.
* Add some documentation about porting from Gtk2 to Gtk3.

Overview of changes in Gtk3 0.004 [2012-03-18]
==============================================

* Provide GdkPixbuf bindings under Gtk3::Gdk::Pixbuf.
* Make Gtk3::[HV]Box::new provide default arg values.
* Make Gtk3::Gdk::Window::new construct the mask automatically if none is
  given.
* Clarify licensing terms.

lib/Gtk3.pm  view on Meta::CPAN


=item * C<Gtk3::ListStore::set> also accepts a list of C<< column => value >>
pairs.

=cut

sub Gtk3::ListStore::set {
  return _common_tree_model_set ('ListStore', @_);
}

=item * C<Gtk3::Menu::popup> reroutes to C<popup_for_device> for better
callback handling.

=cut

sub Gtk3::Menu::popup {
  my $self = shift;
  $self->popup_for_device (undef, @_);
}

=item * C<Gtk3::Menu::popup_for_device> allows the given menu position func to
return only x and y coordinates, defaulting C<push_in> to FALSE.

=cut

sub Gtk3::Menu::popup_for_device {
  my ($menu, $device, $parent_menu_shell, $parent_menu_item, $func, $data, $button, $activate_time) = @_;
  my $real_func = $func ? sub {
    my @stuff = eval { $func->(@_) };
    if ($@) {
      warn "*** menu position callback ignoring error: $@";
    }
    if (@stuff == 3) {
      return (@stuff);
    } elsif (@stuff == 2) {
      return (@stuff, Glib::FALSE); # provide a default for push_in
    } else {
      warn "*** menu position callback must return two integers " .
           "(x, y) or two integers and a boolean (x, y, push_in)";
      return (0, 0, Glib::FALSE);
    }
  } : undef;
  return Glib::Object::Introspection->invoke (
    $_GTK_BASENAME, 'Menu', 'popup_for_device',
    $menu, $device, $parent_menu_shell, $parent_menu_item, $real_func, $data, $button, $activate_time);
}

=item * The default C<new> constructor of Gtk3::MenuItem reroutes to
C<new_with_mnemonic> if given an extra argument.

=cut

sub Gtk3::MenuItem::new {
  my ($class, $mnemonic) = @_;

lib/Gtk3.pm  view on Meta::CPAN


=item * The types Gtk3::Allocation and Gtk3::Gdk::Rectangle are now aliases for
Cairo::RectangleInt, and as such they are represented as plain hashes with
keys 'width', 'height', 'x' and 'y'.

=item * Gtk3::Editable: Callbacks connected to the "insert-text" signal do not
have as many options anymore as they had in Gtk2.  Changes to arguments will
not be propagated to the next signal handler, and only the updated position can
and must be returned.

=item * Gtk3::Menu: In gtk+ < 3.16, the position callback passed to popup()
does not receive x and y parameters.

=item * Gtk3::RadioAction: The constructor now follows the C API.

=item * Gtk3::TreeModel: iter_next() is now a method that is modifying the iter
directly, instead of returning a new one.  rows_reordered() and the
"rows-reordered" signal are currently unusable.

=item * Gtk3::TreeSelection: get_selected_rows() now returns two values: an
array ref containing the selected paths, and the model.  get_user_data() is not

t/overrides.t  view on Meta::CPAN

    local $@;
    eval { $model->insert_with_values (-1, 0); };
    like ($@, qr/Usage/);
  }
}

SKIP: {
  skip 'Gtk3::Menu; incorrect annotations', 2
    unless Gtk3::CHECK_VERSION (3, 2, 0);

  note('Gtk3::Menu::popup and popup_for_device');
  {
    my $menu = Gtk3::Menu->new;
    my $position_callback;
    if (Gtk3::CHECK_VERSION (3, 16, 0)) {
      $position_callback = sub {
        my ($menu, $x, $y, $data) = @_;
        isa_ok ($menu, "Gtk3::Menu");
        return @$data;
      };
    } else {
      $position_callback = sub {
        my ($menu, $data) = @_;
        isa_ok ($menu, "Gtk3::Menu");
        return @$data;
      };
    }
    $menu->popup (undef, undef, $position_callback, [50, 50], 1, 0);
    $menu->popup_for_device (undef, undef, undef, $position_callback, [50, 50, Glib::TRUE], 1, 0);
  }

  # Test this separately to ensure that specifying no callback does not lead to
  # an invalid invocation of the destroy notify func.
  {
    my $menu = Gtk3::Menu->new;
    $menu->popup (undef, undef, undef, undef, 1, 0);
  }
}

note('Gtk2::MenuItem::new, Gtk2::CheckMenuItem::new, Gtk2::ImageMenuItem::new');
{
  foreach my $class (qw/Gtk3::MenuItem Gtk3::CheckMenuItem Gtk3::ImageMenuItem/) {
    my $item;

    $item = $class->new;
    isa_ok ($item, $class);



( run in 2.432 seconds using v1.01-cache-2.11-cpan-364913b4093 )