mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-12 11:15:40 +00:00
fix DemoHyperText
small sizing change for DemoExpander svn path=/trunk/gtk-sharp/; revision=42185
This commit is contained in:
parent
c14d107865
commit
d9d19a3450
|
@ -14,12 +14,17 @@ namespace GtkDemo
|
||||||
{
|
{
|
||||||
public DemoExpander () : base ("Demo Expander", null, DialogFlags.DestroyWithParent)
|
public DemoExpander () : base ("Demo Expander", null, DialogFlags.DestroyWithParent)
|
||||||
{
|
{
|
||||||
|
this.Resizable = false;
|
||||||
this.BorderWidth = 10;
|
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 expander = new Expander ("Details");
|
||||||
expander.Add (new Label ("Details can be shown or hidden."));
|
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);
|
this.AddButton (Stock.Close, ResponseType.Close);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ namespace GtkDemo
|
||||||
[Demo ("Hyper Text", "DemoHyperText.cs", "Text Widget")]
|
[Demo ("Hyper Text", "DemoHyperText.cs", "Text Widget")]
|
||||||
public class DemoHyperText : Gtk.Window
|
public class DemoHyperText : Gtk.Window
|
||||||
{
|
{
|
||||||
|
// FIXME: useless counter
|
||||||
|
int uid = 0;
|
||||||
bool hoveringOverLink = false;
|
bool hoveringOverLink = false;
|
||||||
Gdk.Cursor handCursor, regularCursor;
|
Gdk.Cursor handCursor, regularCursor;
|
||||||
|
|
||||||
|
@ -64,12 +66,11 @@ namespace GtkDemo
|
||||||
// as a link.
|
// as a link.
|
||||||
void InsertLink (TextBuffer buffer, ref 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" + uid++);
|
||||||
tag.Foreground = "blue";
|
tag.Foreground = "blue";
|
||||||
tag.Underline = Pango.Underline.Single;
|
tag.Underline = Pango.Underline.Single;
|
||||||
tag.PersistentData.Add ("page", page);
|
tag.PersistentData.Add ("page", page);
|
||||||
buffer.TagTable.Add (tag);
|
buffer.TagTable.Add (tag);
|
||||||
|
|
||||||
buffer.InsertWithTags (ref iter, text, tag);
|
buffer.InsertWithTags (ref iter, text, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +102,12 @@ namespace GtkDemo
|
||||||
}
|
}
|
||||||
else if (page == 3)
|
else if (page == 3)
|
||||||
{
|
{
|
||||||
TextTag tag = new TextTag ("bold");
|
TextTag tag = buffer.TagTable.Lookup ("bold");
|
||||||
tag.Weight = Pango.Weight.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.InsertWithTags (ref iter, "hypertext:\n", tag);
|
||||||
buffer.Insert (ref iter,
|
buffer.Insert (ref iter,
|
||||||
"machine-readable text that is not sequential but is organized" +
|
"machine-readable text that is not sequential but is organized" +
|
||||||
|
@ -127,7 +132,6 @@ namespace GtkDemo
|
||||||
// Looks at all tags covering the position (x, y) in the text view,
|
// 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
|
// and if one of them is a link, change the cursor to the "hands" cursor
|
||||||
// typically used by web browsers.
|
// typically used by web browsers.
|
||||||
|
|
||||||
void SetCursorIfAppropriate (TextView view, int x, int y)
|
void SetCursorIfAppropriate (TextView view, int x, int y)
|
||||||
{
|
{
|
||||||
bool hovering = false;
|
bool hovering = false;
|
||||||
|
@ -135,8 +139,7 @@ namespace GtkDemo
|
||||||
|
|
||||||
foreach (TextTag tag in iter.Tags)
|
foreach (TextTag tag in iter.Tags)
|
||||||
{
|
{
|
||||||
int page = (int) tag.PersistentData ["page"];
|
if (tag.PersistentData ["page"] != null && ((int) tag.PersistentData ["page"]) != 0) {
|
||||||
if (page != 0) {
|
|
||||||
hovering = true;
|
hovering = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +155,7 @@ namespace GtkDemo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[GLib.ConnectBefore]
|
||||||
void OnButtonRelease (object sender, ButtonReleaseEventArgs a)
|
void OnButtonRelease (object sender, ButtonReleaseEventArgs a)
|
||||||
{
|
{
|
||||||
if (a.Event.Button != 1)
|
if (a.Event.Button != 1)
|
||||||
|
|
|
@ -11,10 +11,10 @@ DemoStockBrowser
|
||||||
- remove duplication in ListStore, and use DataFunc's
|
- remove duplication in ListStore, and use DataFunc's
|
||||||
|
|
||||||
DemoHyperText
|
DemoHyperText
|
||||||
- finish
|
- link tags are recreated too much and never removed
|
||||||
|
|
||||||
Future
|
Future
|
||||||
------
|
------
|
||||||
IconView
|
IconView - gtk 2.6
|
||||||
RotatedText
|
RotatedText - pango 1.6
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue