Commit 3f7dbbd3 authored by Torsten Schönfeld's avatar Torsten Schönfeld

Add an override for Gtk3::Widget::style_get

parent bd39c3c6
......@@ -1837,6 +1837,26 @@ sub Gtk3::Widget::render_icon {
$_GTK_ICON_SIZE_NICK_TO_ID->($size), $detail);
}
=item * A Perl reimplementation of C<Gtk3::Widget::style_get> is provided.
=cut
sub Gtk3::Widget::style_get {
my ($widget, @rest) = @_;
my $properties = _rest_to_ref (\@rest);
my @values;
foreach my $property (@$properties) {
my $pspec = Gtk3::WidgetClass::find_style_property ($widget, $property);
croak "Cannot find type information for property '$property' on $widget"
unless defined $pspec;
my $value_wrapper = Glib::Object::Introspection::GValueWrapper->new (
$pspec->get_value_type, undef);
$widget->style_get_property ($property, $value_wrapper);
push @values, $value_wrapper->get_value;
}
return @values[0..$#values];
}
=item * C<Gtk3::Window::new> uses the default type = 'toplevel'.
=cut
......
......@@ -7,7 +7,7 @@ use warnings;
use utf8;
use Encode;
plan tests => 215;
plan tests => 216;
note('Gtk3::CHECK_VERSION and check_version');
{
......@@ -572,6 +572,15 @@ SKIP: {
isa_ok ($pixbuf, "Gtk3::Gdk::Pixbuf");
}
{
my $widget = Gtk3::Label->new ("Test");
my @values = $widget->style_get (qw/cursor-aspect-ratio
cursor-color
focus-line-width
focus-padding/);
is (@values, 4);
}
SKIP: {
skip 'atom stuff; missing annotations', 2
unless Gtk3::CHECK_VERSION(3, 2, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment