aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Gtk3/UI/Widgets/GtkInputDialog.cs
blob: fd85248b72ad5d8dc8aef7c66a9fbd1719cc032c (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();
        }
    }
}