2009-08-13 Christian Hoff <christian_hoff@gmx.net>

* gtk/Widget.custom: Set the activate/set_scroll_adjustments signal IDs
	from managed code. Use the gtk_widget_get_window accessor.
	* gtk/glue/widget.c: Remove the corresponding glue functions.

svn path=/trunk/gtk-sharp/; revision=139851
This commit is contained in:
Christian Hoff 2009-08-13 14:56:18 +00:00
parent 08b43fbd76
commit 4aa3d2510a
3 changed files with 15 additions and 45 deletions

View file

@ -1,3 +1,9 @@
2009-08-13 Christian Hoff <christian_hoff@gmx.net>
* gtk/Widget.custom: Set the activate/set_scroll_adjustments signal IDs
from managed code. Use the gtk_widget_get_window accessor.
* gtk/glue/widget.c: Remove the corresponding glue functions.
2009-08-13 Christian Hoff <christian_hoff@gmx.net> 2009-08-13 Christian Hoff <christian_hoff@gmx.net>
* generator/IGeneratable.cs: Remove MarshalReturnType, ToNativeReturnType, * generator/IGeneratable.cs: Remove MarshalReturnType, ToNativeReturnType,

View file

@ -42,19 +42,11 @@ public Gdk.Rectangle Allocation {
set { SizeAllocate (value); } set { SizeAllocate (value); }
} }
[DllImport ("gtksharpglue-2")]
static extern IntPtr gtksharp_gtk_widget_get_window (IntPtr widget);
[DllImport ("gtksharpglue-2")] [DllImport ("gtksharpglue-2")]
static extern void gtksharp_gtk_widget_set_window (IntPtr widget, IntPtr window); static extern void gtksharp_gtk_widget_set_window (IntPtr widget, IntPtr window);
public Gdk.Window GdkWindow { public Gdk.Window GdkWindow {
get { get {
IntPtr raw_ret = gtksharp_gtk_widget_get_window (Handle); return this.Window;
if (raw_ret != (IntPtr) 0){
Gdk.Window ret = (Gdk.Window) GLib.Object.GetObject(raw_ret, false);
return ret;
}
return null;
} }
set { set {
Gdk.Window window = value as Gdk.Window; Gdk.Window window = value as Gdk.Window;
@ -242,16 +234,14 @@ static void SetScrollAdjustmentsMarshal_cb (IntPtr closure, IntPtr return_val, u
static ClosureMarshal SetScrollAdjustmentsMarshalCallback; static ClosureMarshal SetScrollAdjustmentsMarshalCallback;
[DllImport("gtksharpglue-2")]
static extern void gtksharp_widget_class_set_set_scroll_adjustments_signal (IntPtr class_struct, uint signal_id);
static void ConnectSetScrollAdjustments (GLib.GType gtype) static void ConnectSetScrollAdjustments (GLib.GType gtype)
{ {
if (SetScrollAdjustmentsMarshalCallback == null) if (SetScrollAdjustmentsMarshalCallback == null)
SetScrollAdjustmentsMarshalCallback = new ClosureMarshal (SetScrollAdjustmentsMarshal_cb); SetScrollAdjustmentsMarshalCallback = new ClosureMarshal (SetScrollAdjustmentsMarshal_cb);
uint signal_id = RegisterSignal ("set_scroll_adjustments", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [] {Adjustment.GType, Adjustment.GType}, SetScrollAdjustmentsMarshalCallback); GtkWidgetClass klass = GetClassStruct (gtype, false);
gtksharp_widget_class_set_set_scroll_adjustments_signal (gtype.GetClassPtr (), signal_id); klass.SetScrollAdjustmentsSignal = RegisterSignal ("set_scroll_adjustments", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [] {Adjustment.GType, Adjustment.GType}, SetScrollAdjustmentsMarshalCallback);
OverrideClassStruct (gtype, klass);
} }
[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectSetScrollAdjustments")] [GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectSetScrollAdjustments")]
@ -277,16 +267,14 @@ static void ActivateMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_pa
static ClosureMarshal ActivateMarshalCallback; static ClosureMarshal ActivateMarshalCallback;
[DllImport("gtksharpglue-2")]
static extern void gtksharp_widget_class_set_activate_signal (IntPtr class_struct, uint signal_id);
static void ConnectActivate (GLib.GType gtype) static void ConnectActivate (GLib.GType gtype)
{ {
if (ActivateMarshalCallback == null) if (ActivateMarshalCallback == null)
ActivateMarshalCallback = new ClosureMarshal (ActivateMarshal_cb); ActivateMarshalCallback = new ClosureMarshal (ActivateMarshal_cb);
uint signal_id = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback); GtkWidgetClass klass = GetClassStruct (gtype, false);
gtksharp_widget_class_set_activate_signal (gtype.GetClassPtr (), signal_id); klass.ActivateSignal = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback);
OverrideClassStruct (gtype, klass);
} }
[GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")] [GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")]
@ -387,9 +375,9 @@ static void ClassInit (GLib.GType gtype, Type t)
arg.arg_type = GLib.GType.Long.Val; arg.arg_type = GLib.GType.Long.Val;
int binding_invoker_idx = binding_invokers.Add (new BindingInvoker (mi, attr.Parms)); int binding_invoker_idx = binding_invokers.Add (new BindingInvoker (mi, attr.Parms));
#if WIN64LONGS #if WIN64LONGS
arg.data.long_data = binding_invoker_idx; arg.data.long_data = binding_invoker_idx;
#else #else
arg.data.long_data = new IntPtr (binding_invoker_idx); arg.data.long_data = new IntPtr (binding_invoker_idx);
#endif #endif
GLib.SList binding_args = new GLib.SList (new object[] {arg}, typeof (GtkBindingArg), false, false); GLib.SList binding_args = new GLib.SList (new object[] {arg}, typeof (GtkBindingArg), false, false);

View file

@ -26,16 +26,10 @@
/* Forward declarations */ /* Forward declarations */
GdkRectangle *gtksharp_gtk_widget_get_allocation (GtkWidget *widget); GdkRectangle *gtksharp_gtk_widget_get_allocation (GtkWidget *widget);
GdkWindow *gtksharp_gtk_widget_get_window (GtkWidget *widget);
void gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window); void gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window);
int gtksharp_gtk_widget_get_state (GtkWidget *widget); int gtksharp_gtk_widget_get_state (GtkWidget *widget);
int gtksharp_gtk_widget_get_flags (GtkWidget *widget); int gtksharp_gtk_widget_get_flags (GtkWidget *widget);
void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); 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_class_set_set_scroll_adjustments_signal (GtkWidgetClass *klass, guint signal_id);
void gtksharp_widget_class_set_activate_signal (GtkWidgetClass *klass, guint signal_id);
int gtksharp_gtk_widget_get_flags (GtkWidget *widget);
void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags);
/* */ /* */
GdkRectangle* GdkRectangle*
@ -44,12 +38,6 @@ gtksharp_gtk_widget_get_allocation (GtkWidget *widget)
return &widget->allocation; return &widget->allocation;
} }
GdkWindow *
gtksharp_gtk_widget_get_window (GtkWidget *widget)
{
return widget->window;
}
void void
gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window) gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window)
{ {
@ -76,15 +64,3 @@ gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags)
GTK_OBJECT(widget)->flags = flags; GTK_OBJECT(widget)->flags = flags;
} }
void
gtksharp_widget_class_set_set_scroll_adjustments_signal (GtkWidgetClass *klass, guint signal_id)
{
klass->set_scroll_adjustments_signal = signal_id;
}
void
gtksharp_widget_class_set_activate_signal (GtkWidgetClass *klass, guint signal_id)
{
klass->activate_signal = signal_id;
}