Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
GTK::Simple::Switch (gtk_switch)
  • Loading branch information
timo committed Jun 16, 2014
1 parent e9c5c4e commit 3df1d25
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/GTK/Simple.pm6
Expand Up @@ -481,4 +481,30 @@ class GTK::Simple::CheckButton is GTK::Simple::ToggleButton {
}
}

class GTK::Simple::Switch is GTK::Simple::ToggleButton {
sub gtk_switch_new()
is native('libgtk-3.so.0')
returns GtkWidget
{*}

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

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

method creation_sub {
&gtk_switch_new
}

method status() {
Proxy.new:
FETCH => { gtk_switch_get_active($!gtk_widget) ?? True !! False },
STORE => -> $, $v { gtk_switch_set_active($!gtk_widget, (so $v).Int) };
}
}

# vi: foldmethod=marker

0 comments on commit 3df1d25

Please sign in to comment.