From 05e4e0b9d3246c3775b349f0c7508210c2534d9f Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Mon, 5 Apr 2004 18:31:34 +0000 Subject: [PATCH] 2004-04-04 Mike Kestner * generator/SymbolTable.cs : don't use StringGen for gunichar. * glib/glue/unichar.c : glue to fetch a gunichar as a utf8 string. * glib/glue/Makefile.am : add unichar.c * glib/glue/makefile.win32 : add unichar.c * gtk/Gtk.metadata : hide TextIter.GetChar * gtk/TextIter.custom : manually impl Char prop. [fixes #53425] svn path=/trunk/gtk-sharp/; revision=25054 --- ChangeLog | 9 +++++++++ generator/SymbolTable.cs | 1 - glib/glue/Makefile.am | 1 + glib/glue/makefile.win32 | 1 + glib/glue/unichar.c | 23 +++++++++++++++++++++++ gtk/Gtk.metadata | 1 + gtk/TextIter.custom | 14 ++++++++++++++ 7 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 glib/glue/unichar.c diff --git a/ChangeLog b/ChangeLog index 912855a78..3db352a61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-04-04 Mike Kestner + + * generator/SymbolTable.cs : don't use StringGen for gunichar. + * glib/glue/unichar.c : glue to fetch a gunichar as a utf8 string. + * glib/glue/Makefile.am : add unichar.c + * glib/glue/makefile.win32 : add unichar.c + * gtk/Gtk.metadata : hide TextIter.GetChar + * gtk/TextIter.custom : manually impl Char prop. [fixes #53425] + 2004-04-04 Mike Kestner * pango/Layout.custom : increment an indexer. thanks to Moritz Balz diff --git a/generator/SymbolTable.cs b/generator/SymbolTable.cs index 1c0520c78..b8639c364 100644 --- a/generator/SymbolTable.cs +++ b/generator/SymbolTable.cs @@ -66,7 +66,6 @@ namespace GtkSharp.Generation { AddType (new StringGen ("char")); AddType (new SimpleGen ("double", "double")); AddType (new SimpleGen ("float", "float")); - AddType (new StringGen ("gunichar")); AddType (new SimpleGen ("uint1", "bool")); AddType (new SimpleGen ("GC", "IntPtr")); AddType (new SimpleGen ("GPtrArray", "IntPtr[]")); diff --git a/glib/glue/Makefile.am b/glib/glue/Makefile.am index 26b82d7af..aecd1a055 100644 --- a/glib/glue/Makefile.am +++ b/glib/glue/Makefile.am @@ -9,6 +9,7 @@ libglibsharpglue_la_SOURCES = \ slist.c \ time_t.c \ type.c \ + unichar.c \ value.c \ valuearray.c diff --git a/glib/glue/makefile.win32 b/glib/glue/makefile.win32 index 191da94e6..877b8e880 100755 --- a/glib/glue/makefile.win32 +++ b/glib/glue/makefile.win32 @@ -10,6 +10,7 @@ GLUE_OBJS = \ slist.o \ time_t.o \ type.o \ + unichar.o \ value.o \ valuearray.o \ win32dll.o diff --git a/glib/glue/unichar.c b/glib/glue/unichar.c new file mode 100644 index 000000000..845113072 --- /dev/null +++ b/glib/glue/unichar.c @@ -0,0 +1,23 @@ +/* unichar.c : Glue to access unichars as strings. + * + * Author: Mike Kestner + * + * Copyright 2004 Novell, Inc. + */ + + +#include + +/* Forward declarations */ +gchar *gtksharp_unichar_to_utf8_string (gunichar chr); +/* */ + +gchar * +gtksharp_unichar_to_utf8_string (gunichar chr) +{ + gchar *buf = g_new0 (gchar, 7); + gint cnt = g_unichar_to_utf8 (chr, buf); + buf [cnt] = 0; + return buf; +} + diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index dc598bc41..6d3aa2c24 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -15,6 +15,7 @@ 1 out 1 + 1 1 1 1 diff --git a/gtk/TextIter.custom b/gtk/TextIter.custom index eecab3606..30c46d1b3 100755 --- a/gtk/TextIter.custom +++ b/gtk/TextIter.custom @@ -4,6 +4,20 @@ // // Copyright (c) 2004 Novell, Inc. + [DllImport("glibsharpglue")] + static extern IntPtr gtksharp_unichar_to_utf8_string (int raw); + + [DllImport("libgtk-win32-2.0-0.dll")] + static extern int gtk_text_iter_get_char(ref Gtk.TextIter raw); + + public string Char { + get { + IntPtr raw_ret = gtksharp_unichar_to_utf8_string (gtk_text_iter_get_char (ref this)); + string ret = GLibSharp.Marshaller.PtrToStringGFree(raw_ret); + return ret; + } + } + [DllImport("libgtk-win32-2.0-0.dll")] static extern IntPtr gtk_text_iter_get_marks (ref TextIter iter);