* parser/gapi2xml.pl (addParamsElem): deal with G_CONST_RETURN in

params... some functions use that to mark const "out" params. In
	fact, let's use it as a hint to mark them pass_as="out" too...

	* pango/pango-api-2.4.raw: 
	* pango/pango-api-2.6.raw: 
	* gtk/gtk-api-2.6.raw: Regen, fixing pango_script_iter_get_range
	and gtk_image_get_icon_name.

	* pango/Pango.metadata: 
	* pango/ScriptIter.cs: Alas, exposing GetRange makes it clear that
	PangoScriptIter is really weird and we weren't wrapping it
	correctly before anyway, so mark the whole thing hidden and wrap
	it by hand.

svn path=/trunk/gtk-sharp/; revision=47748
This commit is contained in:
Dan Winship 2005-07-27 13:21:15 +00:00
parent 5adbc46baf
commit 0fa85fccbd
10 changed files with 145 additions and 7 deletions

View File

@ -1,3 +1,20 @@
2005-07-27 Dan Winship <danw@novell.com>
* parser/gapi2xml.pl (addParamsElem): deal with G_CONST_RETURN in
params... some functions use that to mark const "out" params. In
fact, let's use it as a hint to mark them pass_as="out" too...
* pango/pango-api-2.4.raw:
* pango/pango-api-2.6.raw:
* gtk/gtk-api-2.6.raw: Regen, fixing pango_script_iter_get_range
and gtk_image_get_icon_name.
* pango/Pango.metadata:
* pango/ScriptIter.cs: Alas, exposing GetRange makes it clear that
PangoScriptIter is really weird and we weren't wrapping it
correctly before anyway, so mark the whole thing hidden and wrap
it by hand.
2005-07-25 Mike Kestner <mkestner@novell.com>
* gnome/Gnome.metadata : mark IconList.GetIconFilename retval const.

View File

@ -829,5 +829,22 @@ If the value is <see langword="null" />, the image will be looked up on the call
<since version="Gtk# 2.6" />
</Docs>
</Member>
<Member MemberName="GetIconName">
<MemberSignature Language="C#" Value="public void GetIconName (out string icon_name, out Gtk.IconSize size);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="icon_name" Type="System.String&amp;" RefType="out" />
<Parameter Name="size" Type="Gtk.IconSize&amp;" RefType="out" />
</Parameters>
<Docs>
<param name="icon_name">To be added.</param>
<param name="size">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
</Members>
</Type>

View File

@ -26,9 +26,10 @@
</ReturnValue>
<Parameters />
<Docs>
<summary>Releases the objects resources.</summary>
<summary>Obsolete. Do not use</summary>
<remarks>
</remarks>
<see cref="T:Pango.ScriptIter" /> is properly garbage-collected now. You do not need to manually free it.
</remarks>
</Docs>
</Member>
<Member MemberName="Next">
@ -72,5 +73,24 @@
</remarks>
</Docs>
</Member>
<Member MemberName="GetRange">
<MemberSignature Language="C#" Value="public void GetRange (out int start, out int len, out Pango.Script script);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="start" Type="System.Int32&amp;" RefType="out" />
<Parameter Name="len" Type="System.Int32&amp;" RefType="out" />
<Parameter Name="script" Type="Pango.Script&amp;" RefType="out" />
</Parameters>
<Docs>
<param name="start">On return, contains the index of the start of the current range.</param>
<param name="len">On return, contains the length of the current range.</param>
<param name="script">On return, contains the script type of the current range.</param>
<summary>Gets the bounds and script type of the current range.</summary>
<remarks />
</Docs>
</Member>
</Members>
</Type>

View File

@ -6568,7 +6568,7 @@
<method name="GetIconName" cname="gtk_image_get_icon_name">
<return-type type="void" />
<parameters>
<parameter type="G_CONST_RETURN" name="gchar**" />
<parameter type="const-gchar**" pass_as="out" name="icon_name" />
<parameter type="GtkIconSize*" name="size" />
</parameters>
</method>

View File

@ -28,6 +28,7 @@ sources = \
AttrVariant.cs \
AttrWeight.cs \
Scale.cs \
ScriptIter.cs \
Units.cs
customs = \

View File

@ -51,5 +51,6 @@
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetExtents']/*/*[@type='PangoRectangle*']" name="pass_as">ref</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetPixelExtents']/*/*[@type='PangoRectangle*']" name="pass_as">ref</attr>
<attr path="/api/namespace/struct[@cname='PangoLayoutLine']/method[@name='GetXRanges']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoScriptIter']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='PangoWin32FontCache']" name="hidden">1</attr>
</metadata>

78
pango/ScriptIter.cs Normal file
View File

@ -0,0 +1,78 @@
// Pango.ScriptIter
//
// Copyright (c) 2005 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace Pango {
using System;
using System.Runtime.InteropServices;
public class ScriptIter : GLib.Opaque {
IntPtr native_text;
public ScriptIter(IntPtr raw) : base(raw) {}
[DllImport("libpango-1.0-0.dll")]
static extern IntPtr pango_script_iter_new(IntPtr text, int length);
public ScriptIter (string text)
{
native_text = GLib.Marshaller.StringToPtrGStrdup (text);
Raw = pango_script_iter_new (native_text, -1);
}
[DllImport("libpango-1.0-0.dll")]
static extern void pango_script_iter_free (IntPtr raw);
~ScriptIter ()
{
GLib.Marshaller.Free (native_text);
pango_script_iter_free (Raw);
Raw = IntPtr.Zero;
}
[DllImport("libpango-1.0-0.dll")]
static extern void pango_script_iter_get_range (IntPtr raw, out IntPtr start, out IntPtr end, out Pango.Script script);
[DllImport("libglib-2.0-0.dll")]
static extern IntPtr g_utf8_pointer_to_offset (IntPtr str, IntPtr pos);
public void GetRange (out int start, out int len, out Pango.Script script)
{
IntPtr start_ptr;
IntPtr end_ptr;
pango_script_iter_get_range (Handle, out start_ptr, out end_ptr, out script);
start = (int)g_utf8_pointer_to_offset (native_text, start_ptr);
len = (int)g_utf8_pointer_to_offset (start_ptr, end_ptr);
}
[DllImport("libpango-1.0-0.dll")]
static extern bool pango_script_iter_next (IntPtr raw);
public bool Next ()
{
return pango_script_iter_next (Handle);
}
[Obsolete ("Replaced by garbage collection")]
public void Free ()
{
}
}
}

View File

@ -1316,8 +1316,8 @@
<method name="GetRange" cname="pango_script_iter_get_range">
<return-type type="void" />
<parameters>
<parameter type="G_CONST_RETURN" name="char**" />
<parameter type="G_CONST_RETURN" name="char**" />
<parameter type="const-char**" pass_as="out" name="start" />
<parameter type="const-char**" pass_as="out" name="end" />
<parameter type="PangoScript*" name="script" />
</parameters>
</method>

View File

@ -1665,8 +1665,8 @@
<method name="GetRange" cname="pango_script_iter_get_range">
<return-type type="void" />
<parameters>
<parameter type="G_CONST_RETURN" name="char**" />
<parameter type="G_CONST_RETURN" name="char**" />
<parameter type="const-char**" pass_as="out" name="start" />
<parameter type="const-char**" pass_as="out" name="end" />
<parameter type="PangoScript*" name="script" />
</parameters>
</method>

View File

@ -774,6 +774,7 @@ sub addParamsElem
foreach $parm (@params) {
$parm_num++;
$parm =~ s/\s+(\*+)/\1 /g;
my $out = $parm =~ s/G_CONST_RETURN/const/g;
$parm =~ s/(const\s+)?(\w+)\*\s+const\*/const \2\*/g;
$parm =~ s/(\*+)\s*const\s+/\1 /g;
$parm =~ s/const\s+/const-/g;
@ -818,6 +819,9 @@ sub addParamsElem
$name = $1;
$parm_elem->setAttribute('array', "true");
}
if ($out) {
$parm_elem->setAttribute('pass_as', "out");
}
$parm_elem->setAttribute('name', $name);
}
}