From 7b5efe0866da01bd315a93a57d373d1a7c7d5896 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Tue, 24 Sep 2002 03:21:37 +0000 Subject: [PATCH] 2002-09-23 Miguel de Icaza * gtk/Style.custom: bind it. * gtk/Widget.custom: bind it. * glue/widget.c: Wrapper to fetch a GdkWindow from a widget. * glue/style.c: wrapper routines for getting/setting the thickness on a GtkStyle. svn path=/trunk/gtk-sharp/; revision=7755 --- ChangeLog | 11 +++++++++++ glue/style.c | 18 ++++++++++++++++++ glue/widget.c | 5 +++++ gtk/Style.custom | 24 ++++++++++++++++++++++++ gtk/Widget.custom | 15 +++++++++++++++ 5 files changed, 73 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1eb52b668..de8b4ffdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-09-23 Miguel de Icaza + + * gtk/Style.custom: bind it. + + * gtk/Widget.custom: bind it. + + * glue/widget.c: Wrapper to fetch a GdkWindow from a widget. + + * glue/style.c: wrapper routines for getting/setting the thickness + on a GtkStyle. + 2002-09-21 Miguel de Icaza * gtk/TreeView.custom: Add Model.set to the TreeView diff --git a/glue/style.c b/glue/style.c index 60cd2cb1d..c87f5f1a6 100644 --- a/glue/style.c +++ b/glue/style.c @@ -61,3 +61,21 @@ gtksharp_gtk_style_get_bg (GtkStyle *style) return style->bg; } +int +gtksharp_gtk_style_get_thickness (GtkStyle *style, int x) +{ + if (x) + return style->xthickness; + else + return style->ythickness; +} + +void +gtksharp_gtk_style_set_thickness (GtkStyle *style, int thickness) +{ + if (thickness > 0) + style->xthickness = thickness; + else + style->ythickness = -thickness; +} + diff --git a/glue/widget.c b/glue/widget.c index b70472bb1..302ee302a 100644 --- a/glue/widget.c +++ b/glue/widget.c @@ -13,4 +13,9 @@ gtksharp_gtk_widget_get_allocation (GtkWidget *widget) return &widget->allocation; } +GdkWindow * +gtksharp_gtk_widget_get_window (GtkWidget *widget) +{ + return &widget->window; +} diff --git a/gtk/Style.custom b/gtk/Style.custom index 14ef546ac..e25092974 100644 --- a/gtk/Style.custom +++ b/gtk/Style.custom @@ -90,3 +90,27 @@ public Gdk.Color[] Background { } } +[DllImport ("gtksharpglue")] +static extern int gtksharp_gtk_style_get_thickness (IntPtr style, int x_axis); +[DllImport ("gtksharpglue")] +static extern void gtksharp_gtk_style_set_thickness (IntPtr style, int value); + +public int XThickness { + get { + return gtksharp_gtk_style_get_thickness (Handle, 0); + } + + set { + gtksharp_gtk_style_set_thickness (Handle, value); + } +} + +public int YThickness { + get { + return gtksharp_gtk_style_get_thickness (Handle, 1); + } + + set { + gtksharp_gtk_style_set_thickness (Handle, -value); + } +} diff --git a/gtk/Widget.custom b/gtk/Widget.custom index e36baebfa..4bc66f105 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -15,3 +15,18 @@ public Gdk.Rectangle Allocation { get { return Gdk.Rectangle.New (gtksharp_gtk_widget_get_allocation (Handle)); } } + +[DllImport ("gtksharpglue")] +static extern IntPtr gtksharp_gtk_widget_get_window (IntPtr widget); +public Gdk.Window GdkWindow { + get { + IntPtr raw_ret = gtksharp_gtk_widget_get_window (Handle); + + if (raw_ret != (IntPtr) 0){ + Gdk.Window ret = (Gdk.Window) GLib.Object.GetObject(raw_ret); + ret.Ref (); + return ret; + } + return null; + } +} \ No newline at end of file