mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-05-02 13:06:31 +00:00
Apply patch from brian.nickel@gmail.com
svn path=/trunk/gtk-sharp/; revision=81523
This commit is contained in:
parent
2e3d324e3f
commit
508961405e
|
@ -9,7 +9,43 @@
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>This class sets up a filter to include or exclude particular
|
<summary>This class sets up a filter to include or exclude particular
|
||||||
kinds of files; useful in file selection dialogs.</summary>
|
kinds of files; useful in file selection dialogs.</summary>
|
||||||
<remarks />
|
<remarks>
|
||||||
|
<para> Simple example showing FileFilter within the FileChooserDialog example:
|
||||||
|
<example><code lang="C#">
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
</code></example></para>
|
||||||
|
</remarks>
|
||||||
<since version="Gtk# 2.4" />
|
<since version="Gtk# 2.4" />
|
||||||
</Docs>
|
</Docs>
|
||||||
<Base>
|
<Base>
|
||||||
|
|
|
@ -8,10 +8,60 @@
|
||||||
</AssemblyInfo>
|
</AssemblyInfo>
|
||||||
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
|
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
|
||||||
<Docs>
|
<Docs>
|
||||||
<summary>
|
<summary>This class stores formatted text for display in a <see cref="T:Gtk.TextView" />.
|
||||||
This is a store for formatted text for display in a <see cref="T:Gtk.TextView" />.
|
|
||||||
</summary>
|
</summary>
|
||||||
<remarks />
|
<remarks>
|
||||||
|
<para>The relationship between <see cref="T:Gtk.TextBuffer" /> and <see cref="T:Gtk.TextView" /> 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.</para>
|
||||||
|
<example>
|
||||||
|
<para>In the following example, a single <see cref="T:Gtk.TextBuffer" /> object is shared between two <see cref="T:Gtk.TextView" /> widgets.</para>
|
||||||
|
<code lang="C#">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 ();
|
||||||
|
}
|
||||||
|
}</code>
|
||||||
|
</example>
|
||||||
|
</remarks>
|
||||||
</Docs>
|
</Docs>
|
||||||
<Base>
|
<Base>
|
||||||
<BaseTypeName>GLib.Object</BaseTypeName>
|
<BaseTypeName>GLib.Object</BaseTypeName>
|
||||||
|
|
Loading…
Reference in a new issue