From 508961405e7bc840b42d3fa6719bf1744c677a2e Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Fri, 6 Jul 2007 22:11:58 +0000 Subject: [PATCH] Apply patch from brian.nickel@gmail.com svn path=/trunk/gtk-sharp/; revision=81523 --- doc/en/Gtk/FileFilter.xml | 40 +++++++++++++++++++++++++-- doc/en/Gtk/TextBuffer.xml | 58 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 92 insertions(+), 6 deletions(-) diff --git a/doc/en/Gtk/FileFilter.xml b/doc/en/Gtk/FileFilter.xml index 95c8f97ca..06b50c16f 100644 --- a/doc/en/Gtk/FileFilter.xml +++ b/doc/en/Gtk/FileFilter.xml @@ -9,7 +9,43 @@ This class sets up a filter to include or exclude particular kinds of files; useful in file selection dialogs. - + + Simple example showing FileFilter within the FileChooserDialog example: + +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, + Gtk.Stock.Cancel,ResponseType.Cancel, + Gtk.Stock.Open,ResponseType.Accept); + //filter begins here... + FileFilter filter = new FileFilter(); + filter.Name = "PNG and JPEG images"; + filter.AddMimeType("image/png"); + filter.AddPattern("*.png"); + filter.AddMimeType("image/jpeg"); + filter.AddPattern("*.jpg"); + fc.AddFilter(filter); + //second filter + filter = new FileFilter(); + filter.Name = "PNG Images (*.png)"; + filter.AddMimeType("image/png"); + filter.AddPattern("*.png"); + fc.AddFilter(filter); + //end filter code + if (fc.Run() == (int)ResponseType.Accept) + { + System.Console.WriteLine + } + //Don't forget to call Destroy() or the FileChooserDialog window won't get closed. + fc.Destroy(); + } + + @@ -203,4 +239,4 @@ - + \ No newline at end of file diff --git a/doc/en/Gtk/TextBuffer.xml b/doc/en/Gtk/TextBuffer.xml index 2c1c628ee..9b66d3f8e 100644 --- a/doc/en/Gtk/TextBuffer.xml +++ b/doc/en/Gtk/TextBuffer.xml @@ -8,10 +8,60 @@ Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. - - This is a store for formatted text for display in a . + This class stores formatted text for display in a . - + + The relationship between and objects is not necessarily one-to-one. All views must contain a buffer, but a buffer does not have to be assigned a view, and one buffer may be used by multiple views. + + In the following example, a single object is shared between two widgets. + using Gtk; + +public class TextBufferExample +{ + public static void Main () + { + // Initialize GTK. + Application.Init (); + + // Create a containing window. + Window window = new Window ("TextBuffer Example"); + window.DeleteEvent += OnDelete; + window.SetDefaultSize (400, 300); + + // Create a buffer and vertical panes for the views. + TextBuffer buffer = new TextBuffer (new TextTagTable ()); + VPaned paned = new VPaned (); + + // Create a text view for the buffer, make it scrollable, and + // add it to the first pane. + TextView view1 = new TextView (buffer); + ScrolledWindow scrolled_window1 = new ScrolledWindow (); + scrolled_window1.Add (view1); + paned.Add1 (scrolled_window1); + + // Create a second text view for the buffer, make it scrollable, + // and add it to the second pane. + TextView view2 = new TextView (buffer); + ScrolledWindow scrolled_window2 = new ScrolledWindow (); + scrolled_window2.Add (view2); + paned.Add2 (scrolled_window2); + + // Add the panes to the window and show it. + window.Add (paned); + window.ShowAll (); + + // Run the application. + Application.Run (); + } + + // Quit when the window is closed. + static void OnDelete (object o, DeleteEventArgs e) + { + Application.Quit (); + } +} + + GLib.Object @@ -2170,4 +2220,4 @@ - + \ No newline at end of file