GtkInputDialog.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Gtk;
  2. namespace Ryujinx.Ui.Widgets
  3. {
  4. public class GtkInputDialog : MessageDialog
  5. {
  6. public Entry InputEntry { get; }
  7. public GtkInputDialog(Window parent, string title, string mainText, uint inputMax) : base(parent, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.OkCancel, null)
  8. {
  9. SetDefaultSize(300, 0);
  10. Title = title;
  11. Label mainTextLabel = new Label
  12. {
  13. Text = mainText
  14. };
  15. InputEntry = new Entry
  16. {
  17. MaxLength = (int)inputMax
  18. };
  19. Label inputMaxTextLabel = new Label
  20. {
  21. Text = $"(Max length: {inputMax})"
  22. };
  23. ((Box)MessageArea).PackStart(mainTextLabel, true, true, 0);
  24. ((Box)MessageArea).PackStart(InputEntry, true, true, 5);
  25. ((Box)MessageArea).PackStart(inputMaxTextLabel, true, true, 0);
  26. ShowAll();
  27. }
  28. }
  29. }