aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx/Ui/Windows/UserProfilesManagerWindow.Designer.cs
blob: 804bd3fb0d8cbee1872615e3676e950670fb63fd (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
using Gtk;
using Pango;
using System;

namespace Ryujinx.Ui.Windows
{
    public partial class UserProfilesManagerWindow : Window
    {
        private Box _mainBox;
        private Label _selectedLabel;
        private Box _selectedUserBox;
        private Image _selectedUserImage;
        private Box _selectedUserInfoBox;
        private Entry _selectedUserNameEntry;
        private Label _selectedUserIdLabel;
        private Box _selectedUserButtonsBox;
        private Button _saveProfileNameButton;
        private Button _changeProfileImageButton;
        private Box _usersTreeViewBox;
        private Label _availableUsersLabel;
        private ScrolledWindow _usersTreeViewWindow;
        private ListStore _tableStore;
        private TreeView _usersTreeView;
        private Box _bottomBox;
        private Button _addButton;
        private Button _deleteButton;
        private Button _closeButton;

        private void InitializeComponent()
        {
            //
            // UserProfilesManagerWindow
            //
            CanFocus = false;
            Resizable = false;
            Modal = true;
            WindowPosition = WindowPosition.Center;
            DefaultWidth = 620;
            DefaultHeight = 548;
            TypeHint = Gdk.WindowTypeHint.Dialog;

            //
            // _mainBox
            //
            _mainBox = new Box(Orientation.Vertical, 0);

            //
            // _selectedLabel
            //
            _selectedLabel = new Label("Selected User Profile:")
            {
                Margin = 15,
                Attributes = new AttrList(),
                Halign = Align.Start,
            };
            _selectedLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));

            //
            // _viewBox
            //
            _usersTreeViewBox = new Box(Orientation.Vertical, 0);

            //
            // _SelectedUserBox
            //
            _selectedUserBox = new Box(Orientation.Horizontal, 0)
            {
                MarginStart = 30,
            };

            //
            // _selectedUserImage
            //
            _selectedUserImage = new Image();

            //
            // _selectedUserInfoBox
            //
            _selectedUserInfoBox = new Box(Orientation.Vertical, 0)
            {
                Homogeneous = true,
            };

            //
            // _selectedUserNameEntry
            //
            _selectedUserNameEntry = new Entry("")
            {
                MarginStart = 15,
                MaxLength = (int)MaxProfileNameLength,
            };
            _selectedUserNameEntry.KeyReleaseEvent += SelectedUserNameEntry_KeyReleaseEvent;

            //
            // _selectedUserIdLabel
            //
            _selectedUserIdLabel = new Label("")
            {
                MarginTop = 15,
                MarginStart = 15,
            };

            //
            // _selectedUserButtonsBox
            //
            _selectedUserButtonsBox = new Box(Orientation.Vertical, 0)
            {
                MarginEnd = 30,
            };

            //
            // _saveProfileNameButton
            //
            _saveProfileNameButton = new Button()
            {
                Label = "Save Profile Name",
                CanFocus = true,
                ReceivesDefault = true,
                Sensitive = false,
            };
            _saveProfileNameButton.Clicked += EditProfileNameButton_Pressed;

            //
            // _changeProfileImageButton
            //
            _changeProfileImageButton = new Button()
            {
                Label = "Change Profile Image",
                CanFocus = true,
                ReceivesDefault = true,
                MarginTop = 10,
            };
            _changeProfileImageButton.Clicked += ChangeProfileImageButton_Pressed;

            //
            // _availableUsersLabel
            //
            _availableUsersLabel = new Label("Available User Profiles:")
            {
                Margin = 15,
                Attributes = new AttrList(),
                Halign = Align.Start,
            };
            _availableUsersLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));

            //
            // _usersTreeViewWindow
            //
            _usersTreeViewWindow = new ScrolledWindow()
            {
                ShadowType = ShadowType.In,
                CanFocus = true,
                Expand = true,
                MarginStart = 30,
                MarginEnd = 30,
                MarginBottom = 15,
            };

            //
            // _tableStore
            //
            _tableStore = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(Gdk.RGBA));

            //
            // _usersTreeView
            //
            _usersTreeView = new TreeView(_tableStore)
            {
                HoverSelection = true,
                HeadersVisible = false,
            };
            _usersTreeView.RowActivated += UsersTreeView_Activated;

            //
            // _bottomBox
            //
            _bottomBox = new Box(Orientation.Horizontal, 0)
            {
                MarginStart = 30,
                MarginEnd = 30,
                MarginBottom = 15,
            };

            //
            // _addButton
            //
            _addButton = new Button()
            {
                Label = "Add New Profile",
                CanFocus = true,
                ReceivesDefault = true,
                HeightRequest = 35,
            };
            _addButton.Clicked += AddButton_Pressed;

            //
            // _deleteButton
            //
            _deleteButton = new Button()
            {
                Label = "Delete Selected Profile",
                CanFocus = true,
                ReceivesDefault = true,
                HeightRequest = 35,
                MarginStart = 10,
            };
            _deleteButton.Clicked += DeleteButton_Pressed;

            //
            // _closeButton
            //
            _closeButton = new Button()
            {
                Label = "Close",
                CanFocus = true,
                ReceivesDefault = true,
                HeightRequest = 35,
                WidthRequest = 80,
            };
            _closeButton.Clicked += CloseButton_Pressed;

            ShowComponent();
        }

        private void ShowComponent()
        {
            _usersTreeViewWindow.Add(_usersTreeView);

            _usersTreeViewBox.Add(_usersTreeViewWindow);
            _bottomBox.PackStart(_addButton, false, false, 0);
            _bottomBox.PackStart(_deleteButton, false, false, 0);
            _bottomBox.PackEnd(_closeButton, false, false, 0);

            _selectedUserInfoBox.Add(_selectedUserNameEntry);
            _selectedUserInfoBox.Add(_selectedUserIdLabel);

            _selectedUserButtonsBox.Add(_saveProfileNameButton);
            _selectedUserButtonsBox.Add(_changeProfileImageButton);

            _selectedUserBox.Add(_selectedUserImage);
            _selectedUserBox.PackStart(_selectedUserInfoBox, false, false, 0);
            _selectedUserBox.PackEnd(_selectedUserButtonsBox, false, false, 0);

            _mainBox.PackStart(_selectedLabel, false, false, 0);
            _mainBox.PackStart(_selectedUserBox, false, true, 0);
            _mainBox.PackStart(_availableUsersLabel, false, false, 0);
            _mainBox.Add(_usersTreeViewBox);
            _mainBox.Add(_bottomBox);

            Add(_mainBox);

            ShowAll();
        }
    }
}