Author: jluke
Date: 2005-03-23 23:32:49 -0500 (Wed, 23 Mar 2005)
New Revision: 42185
Modified:
trunk/gtk-sharp/sample/GtkDemo/DemoExpander.cs
trunk/gtk-sharp/sample/GtkDemo/DemoHyperText.cs
trunk/gtk-sharp/sample/GtkDemo/TODO
Log:
fix DemoHyperText
small sizing change for DemoExpander
Modified: trunk/gtk-sharp/sample/GtkDemo/DemoExpander.cs
===================================================================
--- trunk/gtk-sharp/sample/GtkDemo/DemoExpander.cs 2005-03-24 04:29:38 UTC
(rev 42184)
+++ trunk/gtk-sharp/sample/GtkDemo/DemoExpander.cs 2005-03-24 04:32:49 UTC
(rev 42185)
@@ -14,12 +14,17 @@
{
public DemoExpander () : base ("Demo Expander", null,
DialogFlags.DestroyWithParent)
{
+ this.Resizable = false;
this.BorderWidth = 10;
- this.VBox.PackStart (new Label ("Expander demo. Click
on the triangle for details."), false, true, 3);
+ VBox vbox = new VBox (false, 5);
+ this.VBox.PackStart (vbox, true, true, 0);
+ vbox.BorderWidth = 5;
+ vbox.PackStart (new Label ("Expander demo. Click on the
triangle for details."), false, false, 0);
+ // Create the expander
Expander expander = new Expander ("Details");
expander.Add (new Label ("Details can be shown or
hidden."));
- this.VBox.PackStart (expander, false, true, 3);
+ vbox.PackStart (expander, false, false, 0);
this.AddButton (Stock.Close, ResponseType.Close);
Modified: trunk/gtk-sharp/sample/GtkDemo/DemoHyperText.cs
===================================================================
--- trunk/gtk-sharp/sample/GtkDemo/DemoHyperText.cs 2005-03-24 04:29:38 UTC
(rev 42184)
+++ trunk/gtk-sharp/sample/GtkDemo/DemoHyperText.cs 2005-03-24 04:32:49 UTC
(rev 42185)
@@ -20,6 +20,8 @@
[Demo ("Hyper Text", "DemoHyperText.cs", "Text Widget")]
public class DemoHyperText : Gtk.Window
{
+ // FIXME: useless counter
+ int uid = 0;
bool hoveringOverLink = false;
Gdk.Cursor handCursor, regularCursor;
@@ -64,12 +66,11 @@
// as a link.
void InsertLink (TextBuffer buffer, ref TextIter iter, string
text, int page)
{
- TextTag tag = new TextTag ("link");
+ TextTag tag = new TextTag ("link" + uid++);
tag.Foreground = "blue";
tag.Underline = Pango.Underline.Single;
tag.PersistentData.Add ("page", page);
buffer.TagTable.Add (tag);
-
buffer.InsertWithTags (ref iter, text, tag);
}
@@ -101,8 +102,12 @@
}
else if (page == 3)
{
- TextTag tag = new TextTag ("bold");
- tag.Weight = Pango.Weight.Bold;
+ TextTag tag = buffer.TagTable.Lookup ("bold");
+ if (tag == null) {
+ tag = new TextTag ("bold");
+ tag.Weight = Pango.Weight.Bold;
+ buffer.TagTable.Add (tag);
+ }
buffer.InsertWithTags (ref iter,
"hypertext:\n", tag);
buffer.Insert (ref iter,
"machine-readable text that is not sequential
but is organized" +
@@ -127,7 +132,6 @@
// Looks at all tags covering the position (x, y) in the text
view,
// and if one of them is a link, change the cursor to the
"hands" cursor
// typically used by web browsers.
-
void SetCursorIfAppropriate (TextView view, int x, int y)
{
bool hovering = false;
@@ -135,8 +139,7 @@
foreach (TextTag tag in iter.Tags)
{
- int page = (int) tag.PersistentData ["page"];
- if (page != 0) {
+ if (tag.PersistentData ["page"] != null &&
((int) tag.PersistentData ["page"]) != 0) {
hovering = true;
break;
}
@@ -152,6 +155,7 @@
}
}
+ [GLib.ConnectBefore]
void OnButtonRelease (object sender, ButtonReleaseEventArgs a)
{
if (a.Event.Button != 1)
Modified: trunk/gtk-sharp/sample/GtkDemo/TODO
===================================================================
--- trunk/gtk-sharp/sample/GtkDemo/TODO 2005-03-24 04:29:38 UTC (rev 42184)
+++ trunk/gtk-sharp/sample/GtkDemo/TODO 2005-03-24 04:32:49 UTC (rev 42185)
@@ -11,10 +11,10 @@
- remove duplication in ListStore, and use DataFunc's
DemoHyperText
- - finish
+ - link tags are recreated too much and never removed
Future
------
-IconView
-RotatedText
+IconView - gtk 2.6
+RotatedText - pango 1.6
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches