[perl-Gtk2] Wrap GtkAdjustment methods added in gtk+ 2.14
- From: Torsten Schönfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk2] Wrap GtkAdjustment methods added in gtk+ 2.14
- Date: Tue, 20 Apr 2010 21:36:52 +0000 (UTC)
commit 1d9262fc65500c6ea89274c6a039383e6bf49aeb
Author: Keyin Ryde <user42 zip com au>
Date: Tue Apr 20 23:30:04 2010 +0200
Wrap GtkAdjustment methods added in gtk+ 2.14
https://bugzilla.gnome.org/show_bug.cgi?id=604403
t/GtkAdjustment.t | 36 ++++++++++++++++++++++++-
xs/GtkAdjustment.xs | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 103 insertions(+), 3 deletions(-)
---
diff --git a/t/GtkAdjustment.t b/t/GtkAdjustment.t
index 6c799d1..dd168db 100644
--- a/t/GtkAdjustment.t
+++ b/t/GtkAdjustment.t
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
use strict;
-use Gtk2::TestHelper tests => 14, noinit => 1;
+use Gtk2::TestHelper tests => 25, noinit => 1;
# $Id$
@@ -33,7 +33,39 @@ $adjustment -> clamp_page(0, 100);
$adjustment -> changed();
$adjustment -> value_changed();
+SKIP: {
+ skip "stuff that's new in 2.14", 5
+ unless Gtk2->CHECK_VERSION (2, 14, 0);
+
+ # note "value" forced to "lower <= value <= upper-page_size" by
+ # gtk_adjustment_configure(), so must ensure that among these numbers
+ $adjustment->configure(1002,1001,10003,1004,1005,1006);
+ is ($adjustment->value, 1002);
+ is ($adjustment->lower, 1001);
+ is ($adjustment->upper, 10003);
+ is ($adjustment->step_increment, 1004);
+ is ($adjustment->page_increment, 1005);
+ is ($adjustment->page_size, 1006);
+
+ # see that they match up with the accessors
+
+ $adjustment->set_lower(2001);
+ is ($adjustment->lower, 2001);
+
+ $adjustment->set_page_increment(2002);
+ is ($adjustment->page_increment, 2002);
+
+ $adjustment->set_page_size(2003);
+ is ($adjustment->page_size, 2003);
+
+ $adjustment->set_step_increment(2004);
+ is ($adjustment->step_increment, 2004);
+
+ $adjustment->set_upper(2005);
+ is ($adjustment->upper, 2005);
+}
+
__END__
-Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
+Copyright (C) 2003, 2009 by the gtk2-perl team (see the file AUTHORS for the
full list). See LICENSE for more information.
diff --git a/xs/GtkAdjustment.xs b/xs/GtkAdjustment.xs
index a26ca3e..f0fd834 100644
--- a/xs/GtkAdjustment.xs
+++ b/xs/GtkAdjustment.xs
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS)
+ * Copyright (c) 2003, 2009 by the gtk2-perl team (see the file AUTHORS)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -140,3 +140,71 @@ gtk_adjustment_set_value (adjustment, value)
GtkAdjustment *adjustment
gdouble value
+#if GTK_CHECK_VERSION (2, 14, 0)
+
+void
+gtk_adjustment_configure (adjustment, value, lower, upper, step_increment, page_increment, page_size)
+ GtkAdjustment *adjustment
+ gdouble value
+ gdouble lower
+ gdouble upper
+ gdouble step_increment
+ gdouble page_increment
+ gdouble page_size
+
+=for apidoc Gtk2::Adjustment::set_lower
+=for signature double = $adjustment->set_lower ($newval)
+=for signature double = $adjustment->set_page_increment ($newval)
+=for signature double = $adjustment->set_page_size ($newval)
+=for signature double = $adjustment->set_step_increment ($newval)
+=for signature double = $adjustment->set_upper ($newval)
+
+These functions differ from the plain C<< ->lower >> etc setters in that
+they emit C<notify> and C<changed> signals if C<$newval> is different from
+the current value.
+
+The corresponding C<get_lower> etc are not wrapped because they're the
+same as the C<lower> etc field accessors above.
+
+=cut
+
+=for apidoc set_lower __hide__
+=cut
+
+=for apidoc set_page_increment __hide__
+=cut
+
+=for apidoc set_page_size __hide__
+=cut
+
+=for apidoc set_step_increment __hide__
+=cut
+
+=for apidoc set_upper __hide__
+=cut
+
+gdouble
+set_lower (GtkAdjustment *adjustment, gdouble newval)
+ ALIAS:
+ set_page_increment = 1
+ set_page_size = 2
+ set_step_increment = 3
+ set_upper = 4
+ CODE:
+ switch (ix) {
+ case 0: gtk_adjustment_set_lower (adjustment, newval);
+ break;
+ case 1: gtk_adjustment_set_page_increment (adjustment, newval);
+ break;
+ case 2: gtk_adjustment_set_page_size (adjustment, newval);
+ break;
+ case 3: gtk_adjustment_set_step_increment (adjustment, newval);
+ break;
+ case 4: gtk_adjustment_set_upper (adjustment, newval);
+ break;
+ }
+ OUTPUT:
+ RETVAL
+
+#endif /* 2.14 */
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]