aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx/Ui/Widgets/GtkInputDialog.cs
blob: e4fb5aa172d80868692dcfc2c421e8beb20b48a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Gtk;

namespace Ryujinx.Ui.Widgets
{
    public class GtkInputDialog : MessageDialog
    {
        public Entry InputEntry { get; }

        public GtkInputDialog(Window parent, string title, string mainText, uint inputMax) : base(parent, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.OkCancel, null)
        {
            SetDefaultSize(300, 0);

            Title = title;

            Label mainTextLabel = new()
            {
                Text = mainText,
            };

            InputEntry = new Entry
            {
                MaxLength = (int)inputMax,
            };

            Label inputMaxTextLabel = new()
            {
                Text = $"(Max length: {inputMax})",
            };

            ((Box)MessageArea).PackStart(mainTextLabel, true, true, 0);
            ((Box)MessageArea).PackStart(InputEntry, true, true, 5);
            ((Box)MessageArea).PackStart(inputMaxTextLabel, true, true, 0);

            ShowAll();
        }
    }
}