Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
widget size request and get_allocated_width/height
  • Loading branch information
timo committed Jun 16, 2014
1 parent 3df1d25 commit 330b860
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/GTK/Simple.pm6
Expand Up @@ -20,6 +20,20 @@ sub gtk_widget_get_sensitive(GtkWidget $widget) returns int
is native('libgtk-3.so.0')
{*}

sub gtk_widget_set_size_request(GtkWidget $widget, int $w, int $h)
is native('libgtk-3.so.0')
{*}

sub gtk_widget_get_allocated_height(GtkWidget $widget)
returns int
is native('libgtk-3.so.0')
{*}

sub gtk_widget_get_allocated_width(GtkWidget $widget)
returns int
is native('libgtk-3.so.0')
{*}

# gtk_widget_ ... }}}

# gtk_container_... {{{
Expand Down Expand Up @@ -72,6 +86,17 @@ role GTK::Simple::Widget {
}
}

method size_request(Cool $width, Cool $height) {
gtk_widget_set_size_request($!gtk_widget, $width.Int, $height.Int);
}

method width() {
gtk_widget_get_allocated_width($!gtk_widget);
}
method height() {
gtk_widget_get_allocated_height($!gtk_widget);
}

method destroy() {
gtk_widget_destroy($!gtk_widget);
}
Expand Down

0 comments on commit 330b860

Please sign in to comment.