mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-06-05 01:58:29 +00:00
parent
8d94d831e8
commit
ce819aa39f
|
@ -72,6 +72,79 @@ namespace GtkDialogSample
|
|||
}
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</example>
|
||||
<para>
|
||||
You also can subclass the <see cref="T:Gtk.Dialog" /> when you want to use the same Dialog on several places in your application.
|
||||
</para>
|
||||
<example>
|
||||
<code lang="C#">
|
||||
using System;
|
||||
using Gtk;
|
||||
|
||||
namespace GtkDialogSample
|
||||
{
|
||||
|
||||
public class MyDialog:Dialog
|
||||
{
|
||||
|
||||
public MyDialog(Window w,DialogFlags f ):base("Sample", w, f)
|
||||
{
|
||||
this.Modal = true;
|
||||
this.AddButton ("Close", ResponseType.Close);
|
||||
}
|
||||
|
||||
protected override void OnResponse (ResponseType response_id){
|
||||
Console.WriteLine (response_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class GtkDialogSample
|
||||
{
|
||||
MyDialog dialog;
|
||||
Window win;
|
||||
|
||||
static void Main()
|
||||
{
|
||||
new GtkDialogSample ();
|
||||
}
|
||||
|
||||
GtkDialogSample ()
|
||||
{
|
||||
Application.Init ();
|
||||
win = new Window ("Test");
|
||||
win.SetDefaultSize (250, 250);
|
||||
win.DeleteEvent += new DeleteEventHandler (on_win_delete);
|
||||
|
||||
Button btn = new Button ("Show About");
|
||||
btn.Clicked += new EventHandler (on_btn_clicked);
|
||||
win.Add (btn);
|
||||
|
||||
win.ShowAll ();
|
||||
Application.Run ();
|
||||
}
|
||||
|
||||
void on_btn_clicked (object obj, EventArgs args)
|
||||
{
|
||||
dialog = new MyDialog(win, Gtk.DialogFlags.DestroyWithParent);
|
||||
dialog.Run ();
|
||||
dialog.Destroy ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void on_win_delete (object obj, DeleteEventArgs args)
|
||||
{
|
||||
Application.Quit ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</code>
|
||||
</example>
|
||||
</remarks>
|
||||
|
|
|
@ -221,6 +221,8 @@ public class TreeViewDemo {
|
|||
}
|
||||
</code>
|
||||
</example></para>
|
||||
<para>
|
||||
For a example how to handle selection events see <see cref="T:Gtk.TreeSelection" /></para>
|
||||
</remarks>
|
||||
</Docs>
|
||||
<Base>
|
||||
|
|
Loading…
Reference in a new issue