From 3027f1a0c1f041ed26bebc51f691aa4d9aec0be2 Mon Sep 17 00:00:00 2001 From: John Luke Date: Wed, 28 Apr 2004 02:10:05 +0000 Subject: [PATCH] add DrawingArea example document TargetFlags svn path=/trunk/gtk-sharp/; revision=26093 --- doc/ChangeLog | 1 + doc/en/Gtk/DrawingArea.xml | 53 ++++++++++++++++++++++++++++++++++++-- doc/en/Gtk/TargetFlags.xml | 20 +++++++------- 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 7fd9ff5db..8a864f40e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,6 +1,7 @@ 2004-04-27 John Luke * en/Gdk/Threads.xml: document + * en/Gtk/TargetFlags.xml: document * en/Gtk/TreeSelection.xml: add example * en/Pango/Layout.xml: add example of drawing text to a Layout diff --git a/doc/en/Gtk/DrawingArea.xml b/doc/en/Gtk/DrawingArea.xml index 40334438e..66a87501d 100644 --- a/doc/en/Gtk/DrawingArea.xml +++ b/doc/en/Gtk/DrawingArea.xml @@ -10,7 +10,7 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - The GtkDrawingArea widget is used for creating custom user interface elements. + The widget is used for creating custom user interface elements. The widget is used for creating custom user interface elements. It's essentially a blank widget; you can draw on ->window. After creating a drawing area, the application may want to connect to: @@ -25,6 +25,55 @@ Expose events are normally delivered when a drawing area first comes onscreen, or when it's covered by another window and then uncovered (exposed). You can also force an expose event by adding to the "damage region" of the drawing area's window; and are equally good ways to do this. You'll then get an expose event for the invalid region. See also for drawing a . + + +using System; +using Gtk; +using Pango; + +class LayoutSample : DrawingArea +{ + Pango.Layout layout; + + static void Main () + { + Application.Init (); + new LayoutSample (); + Application.Run (); + } + + LayoutSample () + { + Window win = new Window ("Layout sample"); + win.SetDefaultSize (400, 300); + win.DeleteEvent += OnWinDelete; + this.Realized += OnRealized; + this.ExposeEvent += OnExposed; + + win.Add (this); + win.ShowAll (); + } + + void OnExposed (object o, ExposeEventArgs args) + { + this.GdkWindow.DrawLayout (this.Style.TextGC (StateType.Normal), 100, 150, layout); + } + + void OnRealized (object o, EventArgs args) + { + layout = new Pango.Layout (this.PangoContext); + layout.Wrap = Pango.WrapMode.Word; + layout.FontDescription = FontDescription.FromString ("Tahoma 16"); + layout.SetMarkup ("Hello Pango.Layout"); + } + + void OnWinDelete (object o, DeleteEventArgs args) + { + Application.Quit (); + } +} + + Gtk.Widget @@ -112,4 +161,4 @@ - \ No newline at end of file + diff --git a/doc/en/Gtk/TargetFlags.xml b/doc/en/Gtk/TargetFlags.xml index 56d48fce3..c0a2a82a7 100644 --- a/doc/en/Gtk/TargetFlags.xml +++ b/doc/en/Gtk/TargetFlags.xml @@ -1,5 +1,5 @@ - + gtk-sharp @@ -10,8 +10,8 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - To be added - To be added + The enumeration is used to specify constraints on an entry in a . + System.Enum @@ -37,8 +37,8 @@ - To be added - To be added + If this is set, the target will only be selected for drags within a single application. + @@ -49,8 +49,8 @@ - To be added - To be added + If this is set, the target will only be selected for drags within a single widget. + @@ -61,9 +61,9 @@ - To be added - To be added + + - \ No newline at end of file +