----Next_Part(Thu_Jan_28_20:50:45_1999_302)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

村上毅とます

ruby-gtk-0.15 用に、spin button を追加してみました
本メールにパッチを添付いたします。

 村上 毅  takeshi / SoftAgency.co.jp
 PGP fingerprint  5 5D 54 12 B4 55 77 7F  D4 52 66 EC 03 3F 1B E9
 [ http://www.softagency.co.jp/mysql/ ]
 [ MySQL ML: mysql-guide / ml.database.ne.jp ]

----Next_Part(Thu_Jan_28_20:50:45_1999_302)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: ruby-gtk-0.15.patch

diff -ru gtk.orig/src/global.h gtk/src/global.h
--- gtk.orig/src/global.h	Thu Dec 31 04:36:09 1998
+++ gtk/src/global.h	Thu Jan 28 16:14:29 1999
@@ -33,6 +33,7 @@
 extern VALUE gAdjustment;
 extern VALUE gBox;
 extern VALUE gButton;
+extern VALUE gSButton;
 extern VALUE gTButton;
 extern VALUE gCButton;
 extern VALUE gRButton;
diff -ru gtk.orig/src/rbgtk.c gtk/src/rbgtk.c
--- gtk.orig/src/rbgtk.c	Tue Dec 29 03:27:25 1998
+++ gtk/src/rbgtk.c	Thu Jan 28 16:42:32 1999
@@ -15,6 +15,7 @@
 VALUE gAdjustment;
 VALUE gBox;
 VALUE gButton;
+VALUE gSButton;
 VALUE gTButton;
 VALUE gCButton;
 VALUE gRButton;
@@ -3962,6 +3963,103 @@
     return self;
 }
 
+/*--- spin button ---- */
+static VALUE
+sbtn_initialize(argc, argv, self)
+    int argc;
+    VALUE *argv;
+{
+    VALUE arg1, arg2, arg3;
+    GtkAdjustment *adj  ULL;
+    GtkWidget *widget;
+
+    rb_scan_args(argc, argv, "03", &arg1, &arg2, &arg3);
+
+    if (!NIL_P(arg1)) adj  GtkAdjustment*)get_gobject(arg1);
+
+    widget  tk_spin_button_new(adj,arg2,arg3);
+
+    set_widget(self, widget);
+    return Qnil;
+}
+static VALUE
+sbtn_set_adjustment(self,adj)
+    VALUE self, adj;
+{
+  gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(get_widget(self))
+                           ,(GtkAdjustment*)get_gobject(adj));
+}
+static VALUE
+sbtn_get_adjustment(self,adj)
+    VALUE self, adj;
+{
+  return get_gobject(gtk_spin_button_get_adjustment(
+                        GTK_SPIN_BUTTON(get_widget(self))
+                      )
+                    );
+}
+static VALUE
+sbtn_set_digits(self,n)
+    VALUE self, n;
+{
+  (void)gtk_spin_button_set_digits(GTK_SPIN_BUTTON(get_widget(self))
+                                    , NUM2INT(n));
+}
+static VALUE
+sbtn_get_value_as_float(self)
+    VALUE self;
+{
+  float w;
+  w  tk_spin_button_get_value_as_float(GTK_SPIN_BUTTON(get_widget(self)));
+  return float_new(w);
+}
+static VALUE
+sbtn_get_value_as_int(self)
+    VALUE self;
+{
+  int w;
+  w  tk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(get_widget(self)));
+  return INT2NUM(w);
+}
+static VALUE
+sbtn_set_value(self,n)
+    VALUE self, n;
+{
+  (void)gtk_spin_button_set_value(GTK_SPIN_BUTTON(get_widget(self))
+                                     , NUM2DBL(n));
+}
+static VALUE
+sbtn_set_numeric(self,n)
+    VALUE self, n;
+{
+  (void)gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(get_widget(self))
+                                     , NUM2INT(n));
+}
+static VALUE
+sbtn_set_update_policy(self,w)
+    VALUE self, w;
+{
+  (void)gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(get_widget(self))
+                                ,NUM2INT(w) );
+}
+static VALUE
+sbtn_spin(self,n,m)
+    VALUE self, n, m;
+{
+  (void)gtk_spin_button_spin(GTK_SPIN_BUTTON(get_widget(self))
+                                    ,NUM2INT(n)
+                                    ,NUM2DBL(m));
+}
+static VALUE
+sbtn_set_wrap(self,n)
+    VALUE self, n;
+{
+  (void)gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(get_widget(self))
+                                    , NUM2INT(n) );
+}
+
+/*------- spin button end ------ */
+
 static VALUE
 tbtn_initialize(argc, argv, self)
     int argc;
@@ -5779,6 +5877,7 @@
   gAdjustment  b_define_class_under(mGtk, "Adjustment", gData);
   gBox  b_define_class_under(mGtk, "Box", gContainer);
   gButton  b_define_class_under(mGtk, "Button", gContainer);
+  gSButton  b_define_class_under(mGtk, "SpinButton", gContainer);
   gTButton  b_define_class_under(mGtk, "ToggleButton", gButton);
   gCButton  b_define_class_under(mGtk, "CheckButton", gTButton);
   gRButton  b_define_class_under(mGtk, "RadioButton", gCButton);
@@ -6047,6 +6146,23 @@
   rb_define_method(gButton, "clicked", button_clicked, 0);
   rb_define_method(gButton, "enter", button_enter, 0);
   rb_define_method(gButton, "leave", button_leave, 0);
+
+  /* Spin_Button */
+  rb_define_method(gSButton, "initialize",        sbtn_initialize, -1);
+  rb_define_method(gSButton, "set_adjustment",    sbtn_set_adjustment,1);
+  rb_define_method(gSButton, "get_adjustment",    sbtn_get_adjustment,1);
+  rb_define_method(gSButton, "set_digits",        sbtn_set_digits, 1);
+  rb_define_method(gSButton, "get_value_as_float",sbtn_get_value_as_float,0);
+  rb_define_method(gSButton, "get_value_as_int",  sbtn_get_value_as_int, 0);
+  rb_define_method(gSButton, "set_value",         sbtn_set_value, 1);
+  rb_define_method(gSButton, "set_numeric",       sbtn_set_numeric, 1);
+  rb_define_method(gSButton, "set_update_policy", sbtn_set_update_policy,1);
+  rb_define_method(gSButton, "spin",              sbtn_spin,2);
+  rb_define_method(gSButton, "set_wrap",          sbtn_set_wrap,1);
+  /*
+  rb_define_method(gSButton, "get_type",          sbtn_get_type,0);
+  rb_define_method(gSButton, "construct",         sbtn_construct,4);
+  */
 
   /* ToggleButton */
   rb_define_method(gTButton, "initialize", tbtn_initialize, -1);

----Next_Part(Thu_Jan_28_20:50:45_1999_302)----