2005-06-22 Mike Kestner <mkestner@novell.com>

* sample/GtkDemo/DemoHyperText.cs : replace PersistentData usage that
	breaks on csc.
	* sample/GtkDemo/DemoTreeStore.cs : fix a 2.0 usage.

svn path=/trunk/gtk-sharp/; revision=46383
This commit is contained in:
Mike Kestner 2005-06-22 19:18:19 +00:00
parent 828f30b5a5
commit 3a6e5fa8e2
3 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2005-06-22 Mike Kestner <mkestner@novell.com>
* sample/GtkDemo/DemoHyperText.cs : replace PersistentData usage that
breaks on csc.
* sample/GtkDemo/DemoTreeStore.cs : fix a 2.0 usage.
2005-06-22 Mike Kestner <mkestner@novell.com> 2005-06-22 Mike Kestner <mkestner@novell.com>
* generator/ManagedCallString.cs : don't assume ref for structs. * generator/ManagedCallString.cs : don't assume ref for structs.

View file

@ -7,6 +7,7 @@
*/ */
using System; using System;
using System.Collections;
using Gtk; using Gtk;
namespace GtkDemo namespace GtkDemo
@ -40,6 +41,8 @@ namespace GtkDemo
ShowAll (); ShowAll ();
} }
Hashtable tag_pages = new Hashtable ();
// Inserts a piece of text into the buffer, giving it the usual // Inserts a piece of text into the buffer, giving it the usual
// 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
@ -49,7 +52,7 @@ namespace GtkDemo
TextTag tag = new TextTag (null); TextTag tag = new TextTag (null);
tag.Foreground = "blue"; tag.Foreground = "blue";
tag.Underline = Pango.Underline.Single; tag.Underline = Pango.Underline.Single;
tag.PersistentData.Add ("page", page); tag_pages [tag] = page;
buffer.TagTable.Add (tag); buffer.TagTable.Add (tag);
buffer.InsertWithTags (ref iter, text, tag); buffer.InsertWithTags (ref iter, text, tag);
} }
@ -97,7 +100,7 @@ namespace GtkDemo
void FollowIfLink (TextView view, TextIter iter) void FollowIfLink (TextView view, TextIter iter)
{ {
foreach (TextTag tag in iter.Tags) { foreach (TextTag tag in iter.Tags) {
object page = tag.PersistentData ["page"]; object page = tag_pages [tag];
if (page is int) if (page is int)
ShowPage (view.Buffer, (int)page); ShowPage (view.Buffer, (int)page);
} }
@ -112,7 +115,7 @@ namespace GtkDemo
TextIter iter = view.GetIterAtLocation (x, y); TextIter iter = view.GetIterAtLocation (x, y);
foreach (TextTag tag in iter.Tags) { foreach (TextTag tag in iter.Tags) {
if (tag.PersistentData ["page"] is int) { if (tag_pages [tag] is int) {
hovering = true; hovering = true;
break; break;
} }

View file

@ -46,7 +46,7 @@ namespace GtkDemo
sw.Add (treeView); sw.Add (treeView);
// expand all rows after the treeview widget has been realized // expand all rows after the treeview widget has been realized
treeView.Realized += ExpandRows; treeView.Realized += new EventHandler (ExpandRows);
SetDefaultSize (650, 400); SetDefaultSize (650, 400);
ShowAll (); ShowAll ();