From 395c0cdf6f3eadae781c40474badc5573499a16a Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Sat, 8 Feb 2003 17:33:17 +0000 Subject: [PATCH] 2003-02-08 Radek Doulik * glib/MainContext.cs: beginning of MainContext class, just Iteration and Pending methods to be able to refresh Gtk in the middle of time consuming function where it's not worth while to use threads * glue/style.c (gtksharp_gtk_style_get_font_description): new function to access style's font_description field * gtk/Style.custom: added font description property svn path=/trunk/gtk-sharp/; revision=11358 --- ChangeLog | 10 ++++++++++ glib/MainContext.cs | 35 +++++++++++++++++++++++++++++++++++ glue/style.c | 10 ++++++++-- gtk/Style.custom | 21 +++++++++++++++++++-- 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 glib/MainContext.cs diff --git a/ChangeLog b/ChangeLog index b5f653608..7fe75ce39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2003-02-08 Radek Doulik + * glib/MainContext.cs: beginning of MainContext class, just + Iteration and Pending methods to be able to refresh Gtk in the + middle of time consuming function where it's not worth while to + use threads + + * glue/style.c (gtksharp_gtk_style_get_font_description): new + function to access style's font_description field + + * gtk/Style.custom: added font description property + * gconf/GConf/Client.cs: added SyggestSync method 2003-02-07 Peter Williams diff --git a/glib/MainContext.cs b/glib/MainContext.cs new file mode 100644 index 000000000..41c116c67 --- /dev/null +++ b/glib/MainContext.cs @@ -0,0 +1,35 @@ +// GLib.MainContext.cs - mainContext class implementation +// +// Author: Radek Doulik +// +// (C) 2003 Radek Doulik + +namespace GLib { + + using System; + using System.Runtime.InteropServices; + + public class MainContext { + + [DllImport("glib-2.0")] + static extern bool g_main_context_iteration (IntPtr Raw, bool MayBlock); + + public static bool Iteration () + { + return g_main_context_iteration (IntPtr.Zero, false); + } + + public static bool Iteration (bool MayBlock) + { + return g_main_context_iteration (IntPtr.Zero, MayBlock); + } + + [DllImport("glib-2.0")] + static extern bool g_main_context_pending (IntPtr Raw); + + public static bool Pending () + { + return g_main_context_pending (IntPtr.Zero); + } + } +} diff --git a/glue/style.c b/glue/style.c index 69ad9789a..d106228a2 100644 --- a/glue/style.c +++ b/glue/style.c @@ -1,8 +1,9 @@ /* style.c : Glue to access fields in GtkStyle. * * Author: Rachel Hestilow + * Radek Doulik * - * 2002 Rachel Hestilow, Mike Kestner + * 2002, 2003 Rachel Hestilow, Mike Kestner, Radek Doulik */ #include @@ -61,6 +62,12 @@ gtksharp_gtk_style_get_bg (GtkStyle *style, int i) return &style->bg[i]; } +PangoFontDescription * +gtksharp_gtk_style_get_font_description (GtkStyle *style) +{ + return style->font_desc; +} + int gtksharp_gtk_style_get_thickness (GtkStyle *style, int x) { @@ -78,4 +85,3 @@ gtksharp_gtk_style_set_thickness (GtkStyle *style, int thickness) else style->ythickness = -thickness; } - diff --git a/gtk/Style.custom b/gtk/Style.custom index ed049bbc3..438123fd5 100644 --- a/gtk/Style.custom +++ b/gtk/Style.custom @@ -1,9 +1,10 @@ // // Gtk.Style.custom - Gtk Style class customizations // -// Author: Rachel Hestilow +// Authors: Rachel Hestilow +// Radek Doulik // -// Copyright (C) 2002 Rachel Hestilow +// Copyright (C) 2002, 2003 Rachel Hestilow, Radek Doulik // // This code is inserted after the automatically generated code. // @@ -149,3 +150,19 @@ public int YThickness { gtksharp_gtk_style_set_thickness (Handle, -value); } } + +[DllImport ("gtksharpglue")] +static extern IntPtr gtksharp_gtk_style_get_font_description (IntPtr style); + +public Pango.FontDescription FontDescription { + get { + IntPtr Raw = gtksharp_gtk_style_get_font_description (Handle); + + if (Raw == IntPtr.Zero) + return null; + Pango.FontDescription ret = (Pango.FontDescription) GLib.Opaque.GetOpaque (Raw); + if (ret == null) + ret = new Pango.FontDescription (Raw); + return ret; + } +}