From 3eb398a12f467edceac7651ca24be9249b7bd8cb Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 23 Sep 2004 16:50:18 +0000 Subject: [PATCH] 2004-09-23 Mike Kestner * gtk/Widget.custom : new OnSetScrollAdjustments VM. * gtk/glue/widget.c : glue for new VM. svn path=/trunk/gtk-sharp/; revision=34293 --- ChangeLog | 9 +++++++ doc/ChangeLog | 4 +++ doc/en/Gtk/Widget.xml | 49 ++++++++++++++++++++++-------------- gtk/Widget.custom | 28 +++++++++++++++++++++ gtk/glue/widget.c | 58 ++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 128 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d4830a76..5ef3c67e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-09-23 Mike Kestner + + * gtk/Widget.custom : new OnSetScrollAdjustments VM. + * gtk/glue/widget.c : glue for new VM. + 2004-09-18 Miguel de Icaza * glib/Source.cs: Add new base class to hold the method to be @@ -21,6 +26,10 @@ * configure.in : bump version and tag for 1.0.2. +2004-09-17 Mike Kestner + + * configure.in : bump version and tag for 1.0.2. + 2004-09-17 Mike Kestner * configure.in : use either gtkhtml 3.0 or 3.2 diff --git a/doc/ChangeLog b/doc/ChangeLog index 36c90e4cc..7b62814a3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2004-09-23 Mike Kestner + + * en/Gtk/Widget.xml : docs for new OnSetScrollAdjustments VM. + 2004-09-20 Shane Landrum * en/Gdk/FilterFunc.xml diff --git a/doc/en/Gtk/Widget.xml b/doc/en/Gtk/Widget.xml index 00e0f5f12..bd984ec75 100644 --- a/doc/en/Gtk/Widget.xml +++ b/doc/en/Gtk/Widget.xml @@ -19,11 +19,9 @@ Use , or to obtain the value of a style property. - - + Gtk.Object - - + Atk.Implementor @@ -36,9 +34,7 @@ System.IDisposable - - - + Method @@ -1730,7 +1726,7 @@ handle focus grabs. - Fired whenever this widget (or its parent, if is true for the parent) is told to hide itself. + Fired whenever this widget (or its parent, if is true for the parent) is told to hide itself. @@ -1815,7 +1811,7 @@ handle focus grabs. Fired when a drag action leaves this widget. - + @@ -1839,7 +1835,7 @@ handle focus grabs. Fired whenever the visibility state of the widget changes--- partially visible or fully visible, for example. - It may be preferable to handle a instead. + It may be preferable to handle a instead. @@ -1958,7 +1954,7 @@ handle focus grabs. Fired when the state of the widget changes. - See for the possible states of a widget. + See for the possible states of a widget. @@ -2042,7 +2038,7 @@ handle focus grabs. Fired when the widget needs to be (fully or partially) redrawn. - See , . + See , . @@ -2138,7 +2134,7 @@ handle focus grabs. Fired when the user is using a stylus or touch screen and their pointer comes near the widget. - See for context. + See for context. @@ -2150,7 +2146,7 @@ handle focus grabs. Fired when the user is using a stylus or touch screen and their pointer leaves the area near the widget. - See for context. + See for context. @@ -2257,7 +2253,7 @@ handle focus grabs. - Fired when a is set for this widget.t + Fired when a is set for this widget.t @@ -2294,7 +2290,7 @@ handle focus grabs. Fired when the widget is unmapped on the screen. - + @@ -2365,7 +2361,7 @@ handle focus grabs. - Fired when the user has clicked on the "close" button in the window's frame (the button that is automatically set by the window manager). + Fired when the user has clicked on the "close" button in the window's frame (the button that is automatically set by the window manager). If the handler returns False, the widget will be destroyed (and the window closed), but if the handler returns True, nothing will be done. This is a good way to prevent the user from closing your application's window if there should be some cleanups first (like saving the document). @@ -3958,5 +3954,20 @@ Widgets are required to honor the size allocation they receive; a size request i a to set None - - + + + Method + + System.Void + + + + + + + Virtual method to support scrollable widgets. + a horizontal plane + a vertical plane + Override this method in a subclass to support scrolling of the widget within a viewport smaller than the widget's size. + + diff --git a/gtk/Widget.custom b/gtk/Widget.custom index 8d05a1524..06a75ccb4 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -164,3 +164,31 @@ public int FocusLineWidth { return gtksharp_gtk_widget_style_get_int (Handle, "focus-line-width"); } } + +[DllImport("gtksharpglue")] +static extern int gtksharp_widget_connect_set_scroll_adjustments_signal (IntPtr gtype, SetScrollAdjustmentsDelegate cb); + +delegate void SetScrollAdjustmentsDelegate (IntPtr widget, IntPtr hadj, IntPtr vadj); + +static SetScrollAdjustmentsDelegate SetScrollAdjustmentsCallback; + +static void SetScrollAdjustments_cb (IntPtr widget, IntPtr hadj, IntPtr vadj) +{ + Widget obj = GLib.Object.GetObject (widget, false) as Widget; + Gtk.Adjustment h = GLib.Object.GetObject (hadj, false) as Gtk.Adjustment; + Gtk.Adjustment v = GLib.Object.GetObject (vadj, false) as Gtk.Adjustment; + obj.OnSetScrollAdjustments (h, v); +} + +static void ConnectSetScrollAdjustments (GLib.GType gtype) +{ + if (SetScrollAdjustmentsCallback == null) + SetScrollAdjustmentsCallback = new SetScrollAdjustmentsDelegate (SetScrollAdjustments_cb); + gtksharp_widget_connect_set_scroll_adjustments_signal (gtype.Val, SetScrollAdjustmentsCallback); +} + +[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectSetScrollAdjustments")] +protected virtual void OnSetScrollAdjustments (Gtk.Adjustment hadj, Gtk.Adjustment vadj) +{ +} + diff --git a/gtk/glue/widget.c b/gtk/glue/widget.c index 622efa166..e187b3607 100644 --- a/gtk/glue/widget.c +++ b/gtk/glue/widget.c @@ -30,6 +30,8 @@ int gtksharp_gtk_widget_get_state (GtkWidget *widget); int gtksharp_gtk_widget_get_flags (GtkWidget *widget); void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); int gtksharp_gtk_widget_style_get_int (GtkWidget *widget, const char *name); +void gtksharp_widget_connect_set_scroll_adjustments_signal (GType gtype, gpointer callback); +void _gtksharp_marshal_VOID__OBJECT_OBJECT (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); /* */ GdkRectangle* @@ -53,7 +55,7 @@ gtksharp_gtk_widget_get_window (GtkWidget *widget) void gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window) { - widget->window = window; + widget->window = g_object_ref (window); } int @@ -81,3 +83,57 @@ gtksharp_gtk_widget_style_get_int (GtkWidget *widget, const char *name) gtk_widget_style_get (widget, name, &value, NULL); return value; } + +#include + +#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer + +void +_gtksharp_marshal_VOID__OBJECT_OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, + gpointer arg_1, + gpointer arg_2, + gpointer data2); + register GMarshalFunc_VOID__OBJECT_OBJECT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_object (param_values + 1), + g_marshal_value_peek_object (param_values + 2), + data2); +} + +void +gtksharp_widget_connect_set_scroll_adjustments_signal (GType gtype, gpointer cb) +{ + GType parm_types[] = {GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT}; + GtkWidgetClass *klass = g_type_class_peek (gtype); + if (!klass) + klass = g_type_class_ref (gtype); + klass->set_scroll_adjustments_signal = g_signal_newv ( + "set_scroll_adjustments", gtype, G_SIGNAL_RUN_LAST, + g_cclosure_new (cb, NULL, NULL), NULL, NULL, _gtksharp_marshal_VOID__OBJECT_OBJECT, + G_TYPE_NONE, 2, parm_types); +} +