From 66c4025593548c646c33ce30c4f8b5d7c9c069f8 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 26 Jul 2006 17:18:12 +0000 Subject: [PATCH] Documentation contributions from kevin.eeckman@gmail.com svn path=/trunk/gtk-sharp/; revision=63005 --- doc/en/Gtk/Button.xml | 9 +++-- doc/en/Gtk/FileChooserDialog.xml | 60 ++++++++++++++------------------ doc/en/Gtk/Label.xml | 58 ++++++++++++++++++++++++++---- 3 files changed, 83 insertions(+), 44 deletions(-) diff --git a/doc/en/Gtk/Button.xml b/doc/en/Gtk/Button.xml index 8b51f0c66..2d65ae1ef 100644 --- a/doc/en/Gtk/Button.xml +++ b/doc/en/Gtk/Button.xml @@ -387,16 +387,15 @@ public class ButtonApp { Creates a new containing the image and text from a stock item. a - The valid names of Stock items can be found in the class. + The valid names of Stock items can be found in the class. If is unknown, then it will be treated as a simple label. -This for example creates a stock OK button: +This for example creates a stock OK button. It sets a localized label, a standard icon (choosed from your GTK theme), and the appropriate keyboard accelerator: Button b = new Button (Stock.Ok); - - + @@ -671,4 +670,4 @@ This for example creates a stock OK button: - + \ No newline at end of file diff --git a/doc/en/Gtk/FileChooserDialog.xml b/doc/en/Gtk/FileChooserDialog.xml index 60328d334..0912e87da 100644 --- a/doc/en/Gtk/FileChooserDialog.xml +++ b/doc/en/Gtk/FileChooserDialog.xml @@ -7,40 +7,34 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - A dialog box for choosing files. + + is a dialog box suitable for use with "File/Open" or "File/Save as" commands. This widget works by putting a inside a . It exposes the interface, so you can use all of the functions on the file chooser dialog as well as those for . Similar to but in a dialog. - - -static string Open (FileChooserAction action) -{ - string title = Catalog.GetString ("Open"); - if (action == FileChooserAction.SelectFolder) - title = Catalog.GetString ("Select Folder"); + Typical usage. In the simplest of cases, you can use the following code to select a file for opening: + + +public class MainWindow: Gtk.Window { + + protected virtual void OnBtnLoadFileClicked(object sender, System.EventArgs e) + { + Gtk.FileChooserDialog fc= + new Gtk.FileChooserDialog("Choose the file to open", + this, + FileChooserAction.Open, + "Cancel",ResponseType.Cancel, + "Open",ResponseType.Accept); - FileChooserDialog chooser = new FileChooserDialog (title, - window, - action); - - chooser.AddButton (Stock.Cancel, ResponseType.Cancel); - chooser.AddButton (Stock.Open, ResponseType.Ok); - - chooser.SetUri (uri.ToString ()); - int response = chooser.Run (); - - string ret = null; - - if ((ResponseType) response == ResponseType.Ok) { - ret = chooser.Uri; - } - - chooser.Destroy (); - return ret; -} - - - + if (fc.Run() == (int)ResponseType.Accept) + { + System.IO.FileStream file=System.IO.File.OpenRead(fc.Filename); + file.Close(); + } + //Don't forget to call Destroy() or the FileChooserDialog window won't get closed. + fc.Destroy(); + } + @@ -1001,10 +995,10 @@ static string Open (FileChooserAction action) Creates a file chooser dialog. a title - a parent for the dialog, or . + a parent for the dialog, or . See . an action, for example save or open. - a list of button text/response pairs for buttons to be added to the dialog, if desired. - + a list of button text/response pairs for buttons to be added to the dialog, if desired. The pair format is , (see an example in overview section of ) + By default, a comes with no buttons, so you'd better provide at least the most basics one (Save/Cancel or Open/Cancel) or your user won't be able to do anything apart from closing the dialog ( closing the dialog returns .None ) diff --git a/doc/en/Gtk/Label.xml b/doc/en/Gtk/Label.xml index a958396f1..1d9d12e96 100644 --- a/doc/en/Gtk/Label.xml +++ b/doc/en/Gtk/Label.xml @@ -335,8 +335,7 @@ The text from a label widget including any embedded underlines indicating mnemonics and Pango markup. The text of the label widget. - - + You can include markup tags to change your text appearance. See for more information. @@ -437,9 +436,56 @@ - Whether the label's text is interpreted as marked up with the Pango text markup language. - - + Whether the label's text is interpreted as marked up with the Pango text markup language ( more information at http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html ). + + if the label's text should be parsed for markup + Here are a few examples of the markup you can use: + + + Tag + Description + + + <b> + Bold + + + <big> + Makes font relatively larger + + + <i> + Italic + + + <s> + Strikethrough + + + <sub> + Subscript + + + <sup> + Superscript + + + <small> + Makes font relatively smaller + + + <tt> + Monospace font + + + <u> + Underline + + + Gtk.Label label = new Gtk.Label(); + label.LabelProp = "The brown <u>fox</u> etc. and the <big>lazy</big> dog"; + label.UseMarkup = true; + @@ -806,4 +852,4 @@ - + \ No newline at end of file