* gtk/Gtk.metadata: Pass TextIters by ref almost everywhere.

[Fixes #70187]. Kill two varargs warnings.

        * gtk/TextBuffer.custom: Update for that, and also implement
        InsertWithTagsByName

        * sample/GtkDemo/DemoHyperText.cs:
        * sample/GtkDemo/DemoTextView.cs: Remove kludges for broken
        TextIter handling. Also fix the i18n demo bits by translating the
        octal-encoded UTF-8 to hex-encoded UTF-16.

svn path=/trunk/gtk-sharp/; revision=37039
This commit is contained in:
Dan Winship 2004-12-03 18:00:30 +00:00
parent 8a6ba75f45
commit 2c9ce7d64e
8 changed files with 207 additions and 185 deletions

View File

@ -1,3 +1,16 @@
2004-12-03 Dan Winship <danw@novell.com>
* gtk/Gtk.metadata: Pass TextIters by ref almost everywhere.
[Fixes #70187]. Kill two varargs warnings.
* gtk/TextBuffer.custom: Update for that, and also implement
InsertWithTagsByName
* sample/GtkDemo/DemoHyperText.cs:
* sample/GtkDemo/DemoTextView.cs: Remove kludges for broken
TextIter handling. Also fix the i18n demo bits by translating the
octal-encoded UTF-8 to hex-encoded UTF-16.
2004-12-03 Mike Kestner <mkestner@novell.com> 2004-12-03 Mike Kestner <mkestner@novell.com>
* gtk/Gtk.metadata : hide junk methods in Global. [Fixes #60895] * gtk/Gtk.metadata : hide junk methods in Global. [Fixes #60895]

View File

@ -1,3 +1,8 @@
2004-12-03 Dan Winship <danw@novell.com>
* en/Gtk/TextBuffer.xml:
* en/Gtk/TextView.xml: update for TextIter pass-by-ref changes
2004-12-02 Shane Landrum <epicene@pobox.com> 2004-12-02 Shane Landrum <epicene@pobox.com>
* en/Gtk/EntryCompletionMatchFunc.xml * en/Gtk/EntryCompletionMatchFunc.xml

View File

@ -36,12 +36,8 @@
</ReturnValue> </ReturnValue>
<Parameters /> <Parameters />
<Docs> <Docs>
<summary>Clears the contents in the current buffer</summary> <summary>Clears the contents of the buffer</summary>
<remarks> <remarks></remarks>
<para>
This is a convenience call to <see cref="M:Gtk.TextBuffer.Clear(Gtk.TextIter,Gtk.TextIter)" />.
</para>
</remarks>
</Docs> </Docs>
</Member> </Member>
<Member MemberName="DeleteMark"> <Member MemberName="DeleteMark">
@ -177,13 +173,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertChildAnchor"> <Member MemberName="InsertChildAnchor">
<MemberSignature Language="C#" Value="public void InsertChildAnchor (Gtk.TextIter iter, Gtk.TextChildAnchor anchor);" /> <MemberSignature Language="C#" Value="public void InsertChildAnchor (ref Gtk.TextIter iter, Gtk.TextChildAnchor anchor);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="anchor" Type="Gtk.TextChildAnchor" /> <Parameter Name="anchor" Type="Gtk.TextChildAnchor" />
</Parameters> </Parameters>
<Docs> <Docs>
@ -252,14 +248,14 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="PasteClipboard"> <Member MemberName="PasteClipboard">
<MemberSignature Language="C#" Value="public void PasteClipboard (Gtk.Clipboard clipboard, Gtk.TextIter override_location, bool default_editable);" /> <MemberSignature Language="C#" Value="public void PasteClipboard (Gtk.Clipboard clipboard, ref Gtk.TextIter override_location, bool default_editable);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="clipboard" Type="Gtk.Clipboard" /> <Parameter Name="clipboard" Type="Gtk.Clipboard" />
<Parameter Name="override_location" Type="Gtk.TextIter" /> <Parameter Name="override_location" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="default_editable" Type="System.Boolean" /> <Parameter Name="default_editable" Type="System.Boolean" />
</Parameters> </Parameters>
<Docs> <Docs>
@ -342,13 +338,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="CreateChildAnchor"> <Member MemberName="CreateChildAnchor">
<MemberSignature Language="C#" Value="public Gtk.TextChildAnchor CreateChildAnchor (Gtk.TextIter iter);" /> <MemberSignature Language="C#" Value="public Gtk.TextChildAnchor CreateChildAnchor (ref Gtk.TextIter iter);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>Gtk.TextChildAnchor</ReturnType> <ReturnType>Gtk.TextChildAnchor</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary> <summary>
@ -393,13 +389,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertRange"> <Member MemberName="InsertRange">
<MemberSignature Language="C#" Value="public void InsertRange (Gtk.TextIter iter, Gtk.TextIter start, Gtk.TextIter end);" /> <MemberSignature Language="C#" Value="public void InsertRange (ref Gtk.TextIter iter, Gtk.TextIter start, Gtk.TextIter end);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="start" Type="Gtk.TextIter" /> <Parameter Name="start" Type="Gtk.TextIter" />
<Parameter Name="end" Type="Gtk.TextIter" /> <Parameter Name="end" Type="Gtk.TextIter" />
</Parameters> </Parameters>
@ -477,14 +473,14 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="DeleteInteractive"> <Member MemberName="DeleteInteractive">
<MemberSignature Language="C#" Value="public bool DeleteInteractive (Gtk.TextIter start_iter, Gtk.TextIter end_iter, bool default_editable);" /> <MemberSignature Language="C#" Value="public bool DeleteInteractive (ref Gtk.TextIter start_iter, ref Gtk.TextIter end_iter, bool default_editable);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="start_iter" Type="Gtk.TextIter" /> <Parameter Name="start_iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="end_iter" Type="Gtk.TextIter" /> <Parameter Name="end_iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="default_editable" Type="System.Boolean" /> <Parameter Name="default_editable" Type="System.Boolean" />
</Parameters> </Parameters>
<Docs> <Docs>
@ -520,14 +516,14 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="Delete"> <Member MemberName="Delete">
<MemberSignature Language="C#" Value="public void Delete (Gtk.TextIter start, Gtk.TextIter end);" /> <MemberSignature Language="C#" Value="public void Delete (ref Gtk.TextIter start, ref Gtk.TextIter end);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="start" Type="Gtk.TextIter" /> <Parameter Name="start" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="end" Type="Gtk.TextIter" /> <Parameter Name="end" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary> <summary>
@ -542,8 +538,8 @@
actually fires off the <see cref="E:Gtk.TextBuffer.DeleteRange" /> event, and the default actually fires off the <see cref="E:Gtk.TextBuffer.DeleteRange" /> event, and the default
handler of that signal deletes the text. Because the handler of that signal deletes the text. Because the
buffer is modified, all outstanding iterators become buffer is modified, all outstanding iterators become
invalid after calling this function; however, the start invalid after calling this function; however, <paramref name="start" />
and end will be re-initialized to point to the location and <paramref name="end" /> will be re-initialized to point to the location
where text was deleted. where text was deleted.
</para> </para>
</remarks> </remarks>
@ -705,13 +701,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertRangeInteractive"> <Member MemberName="InsertRangeInteractive">
<MemberSignature Language="C#" Value="public bool InsertRangeInteractive (Gtk.TextIter iter, Gtk.TextIter start, Gtk.TextIter end, bool default_editable);" /> <MemberSignature Language="C#" Value="public bool InsertRangeInteractive (ref Gtk.TextIter iter, Gtk.TextIter start, Gtk.TextIter end, bool default_editable);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="start" Type="Gtk.TextIter" /> <Parameter Name="start" Type="Gtk.TextIter" />
<Parameter Name="end" Type="Gtk.TextIter" /> <Parameter Name="end" Type="Gtk.TextIter" />
<Parameter Name="default_editable" Type="System.Boolean" /> <Parameter Name="default_editable" Type="System.Boolean" />
@ -804,13 +800,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertPixbuf"> <Member MemberName="InsertPixbuf">
<MemberSignature Language="C#" Value="public void InsertPixbuf (Gtk.TextIter iter, Gdk.Pixbuf pixbuf);" /> <MemberSignature Language="C#" Value="public void InsertPixbuf (ref Gtk.TextIter iter, Gdk.Pixbuf pixbuf);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="pixbuf" Type="Gdk.Pixbuf" /> <Parameter Name="pixbuf" Type="Gdk.Pixbuf" />
</Parameters> </Parameters>
<Docs> <Docs>
@ -1231,13 +1227,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="Insert"> <Member MemberName="Insert">
<MemberSignature Language="C#" Value="public void Insert (Gtk.TextIter iter, string text);" /> <MemberSignature Language="C#" Value="public void Insert (ref Gtk.TextIter iter, string text);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="text" Type="System.String" /> <Parameter Name="text" Type="System.String" />
</Parameters> </Parameters>
<Docs> <Docs>
@ -1271,13 +1267,13 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertInteractive"> <Member MemberName="InsertInteractive">
<MemberSignature Language="C#" Value="public bool InsertInteractive (Gtk.TextIter iter, string text, bool default_editable);" /> <MemberSignature Language="C#" Value="public bool InsertInteractive (ref Gtk.TextIter iter, string text, bool default_editable);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="text" Type="System.String" /> <Parameter Name="text" Type="System.String" />
<Parameter Name="default_editable" Type="System.Boolean" /> <Parameter Name="default_editable" Type="System.Boolean" />
</Parameters> </Parameters>
@ -1646,21 +1642,40 @@
</Docs> </Docs>
</Member> </Member>
<Member MemberName="InsertWithTags"> <Member MemberName="InsertWithTags">
<MemberSignature Language="C#" Value="public void InsertWithTags (Gtk.TextIter iter, string text, Gtk.TextTag[] tags);" /> <MemberSignature Language="C#" Value="public void InsertWithTags (ref Gtk.TextIter iter, string text, Gtk.TextTag[] tags);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Void</ReturnType> <ReturnType>System.Void</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="text" Type="System.String" /> <Parameter Name="text" Type="System.String" />
<Parameter Name="tags" Type="Gtk.TextTag[]" /> <Parameter Name="tags" Type="Gtk.TextTag[]" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>Inserts <paramref name="text" /> into buffer at <paramref name="iter" />, applying the list of <paramref name="tags" /> to the newly-inserted text.</summary> <summary>Inserts <paramref name="text" /> into buffer at <paramref name="iter" />, applying the list of <paramref name="tags" /> to the newly-inserted text.</summary>
<param name="iter">a <see cref="T:Gtk.TextIter" /></param> <param name="iter">location to insert the text</param>
<param name="text">a <see cref="T:System.String" /></param> <param name="text">text to insert</param>
<param name="tags">a <see cref="T:Gtk.TextTag" /></param> <param name="tags">tags to apply to <paramref name="text" /></param>
<remarks>Equivalent to calling <see cref="M:Gtk.TextBuffer.Insert()" />, then <see cref="Gtk.TextBuffer.ApplyTag()" /> on the inserted text; It is just a convenience function.</remarks>
</Docs>
</Member>
<Member MemberName="InsertWithTagsByName">
<MemberSignature Language="C#" Value="public void InsertWithTagsByName (ref Gtk.TextIter iter, string text, string [] tagnames);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="text" Type="System.String" />
<Parameter Name="tagnames" Type="System.String[]" />
</Parameters>
<Docs>
<summary>Inserts <paramref name="text" /> into buffer at <paramref name="iter" />, applying the list of tags with names <paramref name="tagnamess" /> to the newly-inserted text.</summary>
<param name="iter">location to insert the text</param>
<param name="text">text to insert</param>
<param name="tagnames">names of the tags to apply to <paramref name="text" /></param>
<remarks>Equivalent to calling <see cref="M:Gtk.TextBuffer.Insert()" />, then <see cref="Gtk.TextBuffer.ApplyTag()" /> on the inserted text; It is just a convenience function.</remarks> <remarks>Equivalent to calling <see cref="M:Gtk.TextBuffer.Insert()" />, then <see cref="Gtk.TextBuffer.ApplyTag()" /> on the inserted text; It is just a convenience function.</remarks>
</Docs> </Docs>
</Member> </Member>

View File

@ -129,13 +129,13 @@ class TextViewSample
</Docs> </Docs>
</Member> </Member>
<Member MemberName="BackwardDisplayLine"> <Member MemberName="BackwardDisplayLine">
<MemberSignature Language="C#" Value="public bool BackwardDisplayLine (Gtk.TextIter iter);" /> <MemberSignature Language="C#" Value="public bool BackwardDisplayLine (ref Gtk.TextIter iter);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>Moves the given iter backward by one display (wrapped) line</summary> <summary>Moves the given iter backward by one display (wrapped) line</summary>
@ -227,13 +227,13 @@ class TextViewSample
</Docs> </Docs>
</Member> </Member>
<Member MemberName="ForwardDisplayLineEnd"> <Member MemberName="ForwardDisplayLineEnd">
<MemberSignature Language="C#" Value="public bool ForwardDisplayLineEnd (Gtk.TextIter iter);" /> <MemberSignature Language="C#" Value="public bool ForwardDisplayLineEnd (ref Gtk.TextIter iter);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>Moves <paramref name="iter" /> forward to the next display line end</summary> <summary>Moves <paramref name="iter" /> forward to the next display line end</summary>
@ -292,13 +292,13 @@ class TextViewSample
</Docs> </Docs>
</Member> </Member>
<Member MemberName="BackwardDisplayLineStart"> <Member MemberName="BackwardDisplayLineStart">
<MemberSignature Language="C#" Value="public bool BackwardDisplayLineStart (Gtk.TextIter iter);" /> <MemberSignature Language="C#" Value="public bool BackwardDisplayLineStart (ref Gtk.TextIter iter);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>Moves the given <paramref name="iter" /> backward to the next display line start</summary> <summary>Moves the given <paramref name="iter" /> backward to the next display line start</summary>
@ -320,13 +320,13 @@ class TextViewSample
</Docs> </Docs>
</Member> </Member>
<Member MemberName="ForwardDisplayLine"> <Member MemberName="ForwardDisplayLine">
<MemberSignature Language="C#" Value="public bool ForwardDisplayLine (Gtk.TextIter iter);" /> <MemberSignature Language="C#" Value="public bool ForwardDisplayLine (ref Gtk.TextIter iter);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
</Parameters> </Parameters>
<Docs> <Docs>
<summary>Moves the given <paramref name="iter" /> forward by one display (wrapped) line</summary> <summary>Moves the given <paramref name="iter" /> forward by one display (wrapped) line</summary>
@ -455,13 +455,13 @@ class TextViewSample
</Docs> </Docs>
</Member> </Member>
<Member MemberName="MoveVisually"> <Member MemberName="MoveVisually">
<MemberSignature Language="C#" Value="public bool MoveVisually (Gtk.TextIter iter, int count);" /> <MemberSignature Language="C#" Value="public bool MoveVisually (ref Gtk.TextIter iter, int count);" />
<MemberType>Method</MemberType> <MemberType>Method</MemberType>
<ReturnValue> <ReturnValue>
<ReturnType>System.Boolean</ReturnType> <ReturnType>System.Boolean</ReturnType>
</ReturnValue> </ReturnValue>
<Parameters> <Parameters>
<Parameter Name="iter" Type="Gtk.TextIter" /> <Parameter Name="iter" Type="Gtk.TextIter&amp;" RefType="ref" />
<Parameter Name="count" Type="System.Int32" /> <Parameter Name="count" Type="System.Int32" />
</Parameters> </Parameters>
<Docs> <Docs>

View File

@ -251,26 +251,29 @@
<attr path="/api/namespace/object[@cname='GtkTable']/method[@name='SetRowSpacings']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTable']/method[@name='SetRowSpacings']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/constructor[@cname='gtk_text_buffer_new']/*/*[@type='GtkTextTagTable*']" name="null_ok">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/constructor[@cname='gtk_text_buffer_new']/*/*[@type='GtkTextTagTable*']" name="null_ok">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/constructor[@cname='gtk_text_buffer_new']/*/*[@type='GtkTextTagTable*']" name="property_name">tag_table</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/constructor[@cname='gtk_text_buffer_new']/*/*[@type='GtkTextTagTable*']" name="property_name">tag_table</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='ApplyTagByName']" name="name">ApplyTag</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='ApplyTagByName']" name="name">ApplyTag</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='DeleteMarkByName']" name="name">DeleteMark</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='DeleteMarkByName']" name="name">DeleteMark</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetBounds']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetBounds']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetEndIter']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetEndIter']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetInsert']" name="name">GetInsertMark</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetInsert']" name="name">GetInsertMark</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtChildAnchor']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtChildAnchor']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLine']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLineIndex']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLineIndex']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLineOffset']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLineOffset']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtLine']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtMark']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtMark']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtOffset']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetIterAtOffset']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetSelectionBounds']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetSelectionBounds']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetStartIter']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='GetStartIter']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='Insert']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='Insert']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='SetText']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertAtCursor']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertInteractive']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertInteractive']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertInteractiveAtCursor']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertInteractiveAtCursor']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertAtCursor']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertWithTags']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='InsertWithTagsByName']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='MoveMarkByName']" name="name">MoveMark</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='MoveMarkByName']" name="name">MoveMark</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='RemoveTagByName']" name="name">RemoveTag</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='RemoveTagByName']" name="name">RemoveTag</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/method[@name='SetText']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='ApplyTag']" name="name">TagApplied</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='ApplyTag']" name="name">TagApplied</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='BeginUserAction']" name="name">UserActionBegun</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='BeginUserAction']" name="name">UserActionBegun</attr>
<attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='EndUserAction']" name="name">UserActionEnded</attr> <attr path="/api/namespace/object[@cname='GtkTextBuffer']/signal[@name='EndUserAction']" name="name">UserActionEnded</attr>
@ -285,9 +288,14 @@
<attr path="/api/namespace/object[@cname='GtkTextTag']/property[@name='Weight']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextTag']/property[@name='Weight']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextTag']/signal[@name='Event']" name="name">TextEvent</attr> <attr path="/api/namespace/object[@cname='GtkTextTag']/signal[@name='Event']" name="name">TextEvent</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/constructor[@cname='gtk_text_view_new_with_buffer']" name="hidden">1</attr> <attr path="/api/namespace/object[@cname='GtkTextView']/constructor[@cname='gtk_text_view_new_with_buffer']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='BackwardDisplayLine']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='BackwardDisplayLineStart']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='ForwardDisplayLine']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='ForwardDisplayLineEnd']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterAtLocation']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterAtLocation']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetLineAtY']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetLineAtY']/*/*[@type='GtkTextIter*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterLocation']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr> <attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetIterLocation']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='MoveVisually']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr> <attr path="/api/namespace/object[@cname='GtkTextView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkToggleAction']/method[@name='Toggled']" name="name">Toggle</attr> <attr path="/api/namespace/object[@cname='GtkToggleAction']/method[@name='Toggled']" name="name">Toggle</attr>
<attr path="/api/namespace/object[@cname='GtkToggleButton']/constructor[@cname='gtk_toggle_button_new_with_mnemonic']" name="preferred">1</attr> <attr path="/api/namespace/object[@cname='GtkToggleButton']/constructor[@cname='gtk_toggle_button_new_with_mnemonic']" name="preferred">1</attr>

View File

@ -33,7 +33,8 @@ public string Text {
public void Clear () public void Clear ()
{ {
Delete (StartIter, EndIter); Gtk.TextIter start = StartIter, end = EndIter;
Delete (ref start, ref end);
} }
// overload to paste clipboard contents at cursor editable by default. // overload to paste clipboard contents at cursor editable by default.
@ -48,16 +49,16 @@ public void PasteClipboard (Gtk.Clipboard clipboard)
[DllImport("libgtk-win32-2.0-0.dll")] [DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, string text, int len); static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, string text, int len);
public void Insert (Gtk.TextIter iter, string text) public void Insert (ref Gtk.TextIter iter, string text)
{ {
gtk_text_buffer_insert (Handle, ref iter, text, -1); gtk_text_buffer_insert (Handle, ref iter, text, -1);
} }
public void InsertWithTags (TextIter iter, string text, params TextTag[] tags) public void InsertWithTags (ref TextIter iter, string text, params TextTag[] tags)
{ {
TextIter start; TextIter start;
int offset = iter.Offset; int offset = iter.Offset;
Insert (iter, text); Insert (ref iter, text);
start = GetIterAtOffset (offset); start = GetIterAtOffset (offset);
iter = GetIterAtOffset (offset + text.Length); iter = GetIterAtOffset (offset + text.Length);
@ -66,6 +67,22 @@ public void InsertWithTags (TextIter iter, string text, params TextTag[] tags)
this.ApplyTag (t, start, iter); this.ApplyTag (t, start, iter);
} }
public void InsertWithTagsByName (ref TextIter iter, string text, params string[] tagnames)
{
TextIter start;
int offset = iter.Offset;
Insert (ref iter, text);
start = GetIterAtOffset (offset);
iter = GetIterAtOffset (offset + text.Length);
foreach (string tagname in tagnames) {
TextTag tag = TagTable.Lookup (tagname);
if (tag != null)
this.ApplyTag (tag, start, iter);
}
}
public void SetText (string text) public void SetText (string text)
{ {
gtk_text_buffer_set_text (Handle, text, -1); gtk_text_buffer_set_text (Handle, text, -1);
@ -74,7 +91,7 @@ public void SetText (string text)
[DllImport("libgtk-win32-2.0-0.dll")] [DllImport("libgtk-win32-2.0-0.dll")]
static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, string text, int len, bool default_editable); static extern bool gtk_text_buffer_insert_interactive(IntPtr raw, ref Gtk.TextIter iter, string text, int len, bool default_editable);
public bool InsertInteractive(Gtk.TextIter iter, string text, bool default_editable) public bool InsertInteractive(ref Gtk.TextIter iter, string text, bool default_editable)
{ {
return gtk_text_buffer_insert_interactive(Handle, ref iter, text, -1, default_editable); return gtk_text_buffer_insert_interactive(Handle, ref iter, text, -1, default_editable);
} }

View File

@ -13,7 +13,6 @@ namespace GtkDemo
{ {
bool hoveringOverLink = false; bool hoveringOverLink = false;
Gdk.Cursor handCursor, regularCursor; Gdk.Cursor handCursor, regularCursor;
TextIter lastIter;
public DemoHyperText () : base ("HyperText") public DemoHyperText () : base ("HyperText")
{ {
@ -48,7 +47,6 @@ namespace GtkDemo
view.MotionNotifyEvent += new MotionNotifyEventHandler (OnMotionNotify); view.MotionNotifyEvent += new MotionNotifyEventHandler (OnMotionNotify);
view.VisibilityNotifyEvent += new VisibilityNotifyEventHandler (OnVisibilityNotify); view.VisibilityNotifyEvent += new VisibilityNotifyEventHandler (OnVisibilityNotify);
view.ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonRelease); view.ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonRelease);
view.Buffer.InsertText += new InsertTextHandler (OnTextInserted);
ShowPage (view.Buffer, 1); ShowPage (view.Buffer, 1);
return view; return view;
@ -58,7 +56,7 @@ namespace GtkDemo
// appearance of a hyperlink in a web browser: blue and underlined. // appearance of a hyperlink in a web browser: blue and underlined.
// Additionally, attaches some data on the tag, to make it recognizable // Additionally, attaches some data on the tag, to make it recognizable
// as a link. // as a link.
void InsertLink (TextBuffer buffer, TextIter iter, string text, int page) void InsertLink (TextBuffer buffer, ref TextIter iter, string text, int page)
{ {
TextTag tag = new TextTag ("link"); TextTag tag = new TextTag ("link");
tag.Foreground = "blue"; tag.Foreground = "blue";
@ -66,7 +64,7 @@ namespace GtkDemo
tag.Data.Add ("page", page); tag.Data.Add ("page", page);
buffer.TagTable.Add (tag); buffer.TagTable.Add (tag);
buffer.InsertWithTags (iter, text, tag); buffer.InsertWithTags (ref iter, text, tag);
} }
// Fills the buffer with text and interspersed links. In any real // Fills the buffer with text and interspersed links. In any real
@ -78,32 +76,32 @@ namespace GtkDemo
if (page == 1) if (page == 1)
{ {
buffer.Insert (iter, "Some text to show that simple "); buffer.Insert (ref iter, "Some text to show that simple ");
InsertLink (buffer, lastIter, "hypertext", 3); InsertLink (buffer, ref iter, "hypertext", 3);
buffer.Insert (lastIter, " can easily be realized with "); buffer.Insert (ref iter, " can easily be realized with ");
InsertLink (buffer, lastIter, "tags", 2); InsertLink (buffer, ref iter, "tags", 2);
buffer.Insert (lastIter, "."); buffer.Insert (ref iter, ".");
} }
else if (page == 2) else if (page == 2)
{ {
buffer.Insert (iter, buffer.Insert (ref iter,
"A tag is an attribute that can be applied to some range of text. " + "A tag is an attribute that can be applied to some range of text. " +
"For example, a tag might be called \"bold\" and make the text inside " + "For example, a tag might be called \"bold\" and make the text inside " +
"the tag bold. However, the tag concept is more general than that; " + "the tag bold. However, the tag concept is more general than that; " +
"tags don't have to affect appearance. They can instead affect the " + "tags don't have to affect appearance. They can instead affect the " +
"behavior of mouse and key presses, \"lock\" a range of text so the " + "behavior of mouse and key presses, \"lock\" a range of text so the " +
"user can't edit it, or countless other things.\n"); "user can't edit it, or countless other things.\n");
InsertLink (buffer, lastIter, "Go back", 1); InsertLink (buffer, ref iter, "Go back", 1);
} }
else if (page == 3) else if (page == 3)
{ {
TextTag tag = new TextTag ("bold"); TextTag tag = new TextTag ("bold");
tag.Weight = Pango.Weight.Bold; tag.Weight = Pango.Weight.Bold;
buffer.InsertWithTags (iter, "hypertext:\n", tag); buffer.InsertWithTags (ref iter, "hypertext:\n", tag);
buffer.Insert (lastIter, buffer.Insert (ref iter,
"machine-readable text that is not sequential but is organized" + "machine-readable text that is not sequential but is organized" +
"so that related items of information are connected.\n"); "so that related items of information are connected.\n");
InsertLink (buffer, lastIter, "Go back", 1); InsertLink (buffer, ref iter, "Go back", 1);
} }
} }
@ -193,14 +191,6 @@ namespace GtkDemo
SetCursorIfAppropriate (view, x, y); SetCursorIfAppropriate (view, x, y);
} }
// When inserting text, iters are invalidated
// but the default handler provides us the iter
// at the end of inserted text
void OnTextInserted (object sender, InsertTextArgs a)
{
lastIter = a.Pos;
}
// Also update the cursor image if the window becomes visible // Also update the cursor image if the window becomes visible
// (e.g. when a window covering it got iconified). // (e.g. when a window covering it got iconified).
void OnVisibilityNotify (object sender, VisibilityNotifyEventArgs a) void OnVisibilityNotify (object sender, VisibilityNotifyEventArgs a)

View File

@ -264,139 +264,113 @@ namespace GtkDemo
TextIter insertIter; TextIter insertIter;
insertIter = buffer.GetIterAtOffset (0); insertIter = buffer.GetIterAtOffset (0);
buffer.Insert (insertIter, buffer.Insert (ref insertIter,
"The text widget can display text with all kinds of nifty attributes.It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n"); "The text widget can display text with all kinds of nifty attributes.It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n");
InsertWithTagsByName (buffer, "Font styles. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Font styles. ", "heading");
Insert (buffer, "For example, you can have "); buffer.Insert (ref insertIter, "For example, you can have ");
InsertWithTagsByName (buffer, "italic", new string[] {"italic"}); buffer.InsertWithTagsByName (ref insertIter, "italic", "italic");
Insert (buffer, ", "); buffer.Insert (ref insertIter, ", ");
InsertWithTagsByName (buffer, "bold", new string[] {"bold"}); buffer.InsertWithTagsByName (ref insertIter, "bold", "bold");
Insert (buffer, ", or "); buffer.Insert (ref insertIter, ", or ");
InsertWithTagsByName (buffer, "monospace (typewriter)", new string[] {"monospace"}); buffer.InsertWithTagsByName (ref insertIter, "monospace (typewriter)", "monospace");
Insert (buffer, ", or "); buffer.Insert (ref insertIter, ", or ");
InsertWithTagsByName (buffer, "big", new string[] {"big"}); buffer.InsertWithTagsByName (ref insertIter, "big", "big");
Insert (buffer, " text"); buffer.Insert (ref insertIter, " text");
Insert (buffer, buffer.Insert (ref insertIter,
"It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as "); "It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ");
InsertWithTagsByName (buffer, "xx-small", new string[] {"xx-small"}); buffer.InsertWithTagsByName (ref insertIter, "xx-small", "xx-small");
Insert (buffer, ", or"); buffer.Insert (ref insertIter, ", or");
InsertWithTagsByName (buffer, "x-large", new string[] {"x-large"}); buffer.InsertWithTagsByName (ref insertIter, "x-large", "x-large");
Insert (buffer, buffer.Insert (ref insertIter,
" to ensure that your program properly adapts if the user changes the default font size.\n\n"); " to ensure that your program properly adapts if the user changes the default font size.\n\n");
InsertWithTagsByName (buffer, "Colors such as", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Colors such as", "heading");
InsertWithTagsByName (buffer, "a blue foreground", new string[] {"blue_foreground"}); buffer.InsertWithTagsByName (ref insertIter, "a blue foreground", "blue_foreground");
Insert (buffer, ", or "); buffer.Insert (ref insertIter, ", or ");
InsertWithTagsByName (buffer, "a red background", new string[] {"red_background"}); buffer.InsertWithTagsByName (ref insertIter, "a red background", "red_background");
Insert (buffer, " or even "); buffer.Insert (ref insertIter, " or even ");
// Change InsertWithTagsByName to work with 2 and 3 args buffer.InsertWithTagsByName (ref insertIter, "a stippled red background",
// InsertWithTagsByName ("a stippled red background", "red_background",
// "red_background", "background_stipple");
// "background_stipple"); buffer.Insert (ref insertIter, ", or ");
//Insert (buffer, ", or "); buffer.InsertWithTagsByName (ref insertIter,
//InsertWithTagsByName ("a stippled red background", "a stippled blue foreground on solid red background",
// "a stippled blue foreground on solid red background", -1, "blue_foreground",
// "blue_foreground", "red_background",
// "red_background", "foreground_stipple");
// "foreground_stipple") buffer.Insert (ref insertIter, " (select that to read it) can be used.\n\n");
Insert (buffer, " (select that to read it) can be used.\n\n"); buffer.InsertWithTagsByName (ref insertIter, "Underline, strikethrough, and rise. ", "heading");
InsertWithTagsByName (buffer, "Underline, strikethrough, and rise. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Strikethrough", "strikethrough");
InsertWithTagsByName (buffer, "Strikethrough", new string[] {"strikethrough"}); buffer.Insert (ref insertIter, ", ");
Insert (buffer, ", "); buffer.InsertWithTagsByName (ref insertIter, "underline", "underline");
InsertWithTagsByName (buffer, "underline", new string[] {"underline"}); buffer.Insert (ref insertIter, ", ");
Insert (buffer, ", "); buffer.InsertWithTagsByName (ref insertIter, "double_underline", "double_underline");
InsertWithTagsByName (buffer, "double_underline", new string[] {"double_underline"}); buffer.Insert (ref insertIter, ", ");
Insert (buffer, ", "); buffer.InsertWithTagsByName (ref insertIter, "superscript", "superscript");
InsertWithTagsByName (buffer, "superscript", new string[] {"superscript"}); buffer.Insert (ref insertIter, ", and ");
Insert (buffer, ", and "); buffer.InsertWithTagsByName (ref insertIter, "subscript", "subscript");
InsertWithTagsByName (buffer, "subscript", new string[] {"subscript"}); buffer.Insert (ref insertIter, " are all supported.\n\n");
Insert (buffer," are all supported.\n\n"); buffer.InsertWithTagsByName (ref insertIter, "Images. ", "heading");
InsertWithTagsByName (buffer, "Images. ", new string[] {"heading"}); buffer.Insert (ref insertIter, "The buffer can have images in it: ");
Insert (buffer,"The buffer can have images in it: ");
insertIter = buffer.GetIterAtMark (buffer.InsertMark); insertIter = buffer.GetIterAtMark (buffer.InsertMark);
buffer.InsertPixbuf (insertIter, pixbuf); buffer.InsertPixbuf (ref insertIter, pixbuf);
insertIter = buffer.GetIterAtMark (buffer.InsertMark); insertIter = buffer.GetIterAtMark (buffer.InsertMark);
buffer.InsertPixbuf (insertIter, pixbuf); buffer.InsertPixbuf (ref insertIter, pixbuf);
insertIter = buffer.GetIterAtMark (buffer.InsertMark); insertIter = buffer.GetIterAtMark (buffer.InsertMark);
buffer.InsertPixbuf (insertIter, pixbuf); buffer.InsertPixbuf (ref insertIter, pixbuf);
Insert (buffer, " for example.\n\n"); buffer.Insert (ref insertIter, " for example.\n\n");
InsertWithTagsByName (buffer, "Spacing. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Spacing. ", "heading");
InsertWithTagsByName (buffer, "You can adjust the amount of space before each line.\n", new string[] {"big_gap_before_line", "wide_margins"}); buffer.InsertWithTagsByName (ref insertIter, "You can adjust the amount of space before each line.\n", "big_gap_before_line", "wide_margins");
InsertWithTagsByName (buffer, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", new string[] {"big_gap_after_line", "wide_margins"}); buffer.InsertWithTagsByName (ref insertIter, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", "big_gap_after_line", "wide_margins");
InsertWithTagsByName (buffer, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", new string[] {"double_spaced_line", "wide_margins"}); buffer.InsertWithTagsByName (ref insertIter, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", "double_spaced_line", "wide_margins");
Insert (buffer, "Also note that those lines have extra-wide margins.\n\n"); buffer.Insert (ref insertIter, "Also note that those lines have extra-wide margins.\n\n");
InsertWithTagsByName (buffer, "Editability. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Editability. ", "heading");
InsertWithTagsByName (buffer, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", new string[] {"not_editable"}); buffer.InsertWithTagsByName (ref insertIter, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", "not_editable");
InsertWithTagsByName (buffer, "Wrapping. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Wrapping. ", "heading");
Insert (buffer,"This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n"); buffer.Insert (ref insertIter, "This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n");
InsertWithTagsByName (buffer, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", new string[] {"char_wrap"}); buffer.InsertWithTagsByName (ref insertIter, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", "char_wrap");
InsertWithTagsByName (buffer, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", new string[] {"no_wrap"}); buffer.InsertWithTagsByName (ref insertIter, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", "no_wrap");
InsertWithTagsByName (buffer, "Justification. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Justification. ", "heading");
InsertWithTagsByName (buffer, "\nThis line has center justification.\n", new string[] {"center"}); buffer.InsertWithTagsByName (ref insertIter, "\nThis line has center justification.\n", "center");
InsertWithTagsByName (buffer, "This line has right justification.\n", new string[] {"right_justify"}); buffer.InsertWithTagsByName (ref insertIter, "This line has right justification.\n", "right_justify");
InsertWithTagsByName (buffer, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", new string[] {"wide_margins"}); buffer.InsertWithTagsByName (ref insertIter, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", "wide_margins");
InsertWithTagsByName (buffer, "Internationalization. ", new string[] {"heading"}); buffer.InsertWithTagsByName (ref insertIter, "Internationalization. ", "heading");
//Insert (buffer, "You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek (\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) \316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew \327\251\327\234\327\225\327\235\nJapanese (\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n"); buffer.Insert (ref insertIter, "You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\u00fcd) Gr\u00fc\u00df Gott\nGreek (\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac) \u0393\u03b5\u03b9\u03ac \u03c3\u03b1\u03c2\nHebrew \u05e9\u05dc\u05d5\u05dd\nJapanese (\u65e5\u672c\u8a9e)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n");
Insert (buffer, "Here's a word-wrapped quote in a right-to-left language:\n"); buffer.Insert (ref insertIter, "Here's a word-wrapped quote in a right-to-left language:\n");
//InsertWithTagsByName (buffer, "\331\210\331\202\330\257 \330\250\330\257\330\243 \330\253\331\204\330\247\330\253 \331\205\331\206 \330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \330\252\331\202\330\257\331\205\330\247 \331\201\331\212 \330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 \330\250\330\261\330\247\331\205\330\254\331\207\330\247 \331\203\331\205\331\206\330\270\331\205\330\247\330\252 \331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 \330\253\331\205 \330\252\330\255\331\210\331\204\330\252 \331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 \330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 \330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 \331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 \331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 \331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 \330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 \330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 \331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 \331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 \330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 \330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 \330\243\331\203\330\253\330\261 \331\207\330\260\331\207 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \331\206\330\254\330\247\330\255\330\247 \331\207\331\210 \302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 \331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", new string[] {"rtl_quote"}); buffer.InsertWithTagsByName (ref insertIter, "\u0648\u0642\u062f \u0628\u062f\u0623 \u062b\u0644\u0627\u062b \u0645\u0646 \u0623\u0643\u062b\u0631 \u0627\u0644\u0645\u0624\u0633\u0633\u0627\u062a \u062a\u0642\u062f\u0645\u0627 \u0641\u064a \u0634\u0628\u0643\u0629 \u0627\u0643\u0633\u064a\u0648\u0646 \u0628\u0631\u0627\u0645\u062c\u0647\u0627 \u0643\u0645\u0646\u0638\u0645\u0627\u062a \u0644\u0627 \u062a\u0633\u0639\u0649 \u0644\u0644\u0631\u0628\u062d\u060c \u062b\u0645 \u062a\u062d\u0648\u0644\u062a \u0641\u064a \u0627\u0644\u0633\u0646\u0648\u0627\u062a \u0627\u0644\u062e\u0645\u0633 \u0627\u0644\u0645\u0627\u0636\u064a\u0629 \u0625\u0644\u0649 \u0645\u0624\u0633\u0633\u0627\u062a \u0645\u0627\u0644\u064a\u0629 \u0645\u0646\u0638\u0645\u0629\u060c \u0648\u0628\u0627\u062a\u062a \u062c\u0632\u0621\u0627 \u0645\u0646 \u0627\u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0645\u0627\u0644\u064a \u0641\u064a \u0628\u0644\u062f\u0627\u0646\u0647\u0627\u060c \u0648\u0644\u0643\u0646\u0647\u0627 \u062a\u062a\u062e\u0635\u0635 \u0641\u064a \u062e\u062f\u0645\u0629 \u0642\u0637\u0627\u0639 \u0627\u0644\u0645\u0634\u0631\u0648\u0639\u0627\u062a \u0627\u0644\u0635\u063a\u064a\u0631\u0629\u002e \u0648\u0623\u062d\u062f \u0623\u0643\u062b\u0631 \u0647\u0630\u0647 \u0627\u0644\u0645\u0624\u0633\u0633\u0627\u062a \u0646\u062c\u0627\u062d\u0627 \u0647\u0648 \u00bb\u0628\u0627\u0646\u0643\u0648\u0633\u0648\u0644\u00ab \u0641\u064a \u0628\u0648\u0644\u064a\u0641\u064a\u0627.\n\n", "rtl_quote");
//InsertWithTagsByName (buffer, "\x2", new string[] {"rtl_quote"});
Insert (buffer, "You can put widgets in the buffer: Here's a button: "); buffer.Insert (ref insertIter, "You can put widgets in the buffer: Here's a button: ");
insertIter = buffer.GetIterAtMark(buffer.InsertMark); insertIter = buffer.GetIterAtMark(buffer.InsertMark);
buttonAnchor = buffer.CreateChildAnchor (insertIter); buttonAnchor = buffer.CreateChildAnchor (ref insertIter);
Insert (buffer, "and a menu"); buffer.Insert (ref insertIter, "and a menu");
insertIter = buffer.GetIterAtMark(buffer.InsertMark); insertIter = buffer.GetIterAtMark(buffer.InsertMark);
menuAnchor = buffer.CreateChildAnchor (insertIter); menuAnchor = buffer.CreateChildAnchor (ref insertIter);
Insert (buffer, "and a scale"); buffer.Insert (ref insertIter, "and a scale");
insertIter = buffer.GetIterAtMark(buffer.InsertMark); insertIter = buffer.GetIterAtMark(buffer.InsertMark);
scaleAnchor = buffer.CreateChildAnchor (insertIter); scaleAnchor = buffer.CreateChildAnchor (ref insertIter);
Insert (buffer, "and an animation"); buffer.Insert (ref insertIter, "and an animation");
insertIter = buffer.GetIterAtMark(buffer.InsertMark); insertIter = buffer.GetIterAtMark(buffer.InsertMark);
animationAnchor = buffer.CreateChildAnchor (insertIter); animationAnchor = buffer.CreateChildAnchor (ref insertIter);
Insert (buffer, " finally a text entry: "); buffer.Insert (ref insertIter, " finally a text entry: ");
insertIter = buffer.GetIterAtMark(buffer.InsertMark); insertIter = buffer.GetIterAtMark(buffer.InsertMark);
entryAnchor = buffer.CreateChildAnchor (insertIter); entryAnchor = buffer.CreateChildAnchor (ref insertIter);
Insert (buffer, "\n"); buffer.Insert (ref insertIter, "\n");
Insert (buffer, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text (doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such..."); buffer.Insert (ref insertIter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text (doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...");
//Insert (buffer,);
//InsertWithTagsByName (buffer, , new string[] {});
buffer.ApplyTag("word_wrap", buffer.StartIter, buffer.EndIter); buffer.ApplyTag("word_wrap", buffer.StartIter, buffer.EndIter);
} }
private void InsertWithTagsByName (TextBuffer buffer , string insertText, string[] fontName)
{
TextIter insertIter, beginIter, endIter;
int begin, end;
begin = buffer.CharCount;
insertIter = buffer.GetIterAtMark(buffer.InsertMark);
buffer.Insert (insertIter, insertText);
end = buffer.CharCount;
foreach (string fontItem in fontName) {
endIter = buffer.GetIterAtOffset (end);
beginIter = buffer.GetIterAtOffset (begin);
buffer.ApplyTag (fontItem, beginIter, endIter);
}
}
private void Insert (TextBuffer buffer , string insertText)
{
TextIter insertIter;
insertIter = buffer.GetIterAtMark (buffer.InsertMark);
buffer.Insert (insertIter, insertText);
}
private void WindowDelete (object o, DeleteEventArgs args) private void WindowDelete (object o, DeleteEventArgs args)
{ {
this.Hide (); this.Hide ();
@ -431,10 +405,10 @@ namespace GtkDemo
TextIter insertIter; TextIter insertIter;
TextBuffer bufferCB = new TextBuffer (null); TextBuffer bufferCB = new TextBuffer (null);
Insert (bufferCB, "This buffer is shared by a set of nested text views.\n Nested view:\n"); insertIter = bufferCB.GetIterAtOffset (0);
insertIter = bufferCB.GetIterAtMark(bufferCB.InsertMark); bufferCB.Insert (ref insertIter, "This buffer is shared by a set of nested text views.\n Nested view:\n");
TextChildAnchor anchor = bufferCB.CreateChildAnchor (insertIter); TextChildAnchor anchor = bufferCB.CreateChildAnchor (ref insertIter);
Insert (bufferCB, "\nDon't do this in real applications, please.\n"); bufferCB.Insert (ref insertIter, "\nDon't do this in real applications, please.\n");
TextView viewCB = new TextView (bufferCB); TextView viewCB = new TextView (bufferCB);
RecursiveAttach (0, viewCB, anchor); RecursiveAttach (0, viewCB, anchor);