more work on gtk & code cleanup
This commit is contained in:
33
Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs
Normal file
33
Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Gtk;
|
||||
|
||||
namespace Pilz.UI.Gtk.Dialogs;
|
||||
|
||||
public partial class GtkDialogBase
|
||||
{
|
||||
private static GtkDialogBase CreateDialog<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = new GtkDialogBase
|
||||
{
|
||||
Title = title,
|
||||
};
|
||||
dialog.ContentArea.Add(content);
|
||||
content.Show();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
public static TContent Show<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = CreateDialog(content, title);
|
||||
dialog.Show();
|
||||
dialog.Destroy();
|
||||
return content;
|
||||
}
|
||||
|
||||
public static TContent ShowDialog<TContent>(TContent content, string title) where TContent : Widget
|
||||
{
|
||||
var dialog = CreateDialog(content, title);
|
||||
dialog.Run();
|
||||
dialog.Destroy();
|
||||
return content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user