UserProfilesManagerWindow.Designer.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. using Gtk;
  2. using Pango;
  3. namespace Ryujinx.Ui.Windows
  4. {
  5. public partial class UserProfilesManagerWindow : Window
  6. {
  7. private Box _mainBox;
  8. private Label _selectedLabel;
  9. private Box _selectedUserBox;
  10. private Image _selectedUserImage;
  11. private VBox _selectedUserInfoBox;
  12. private Entry _selectedUserNameEntry;
  13. private Label _selectedUserIdLabel;
  14. private VBox _selectedUserButtonsBox;
  15. private Button _saveProfileNameButton;
  16. private Button _changeProfileImageButton;
  17. private Box _usersTreeViewBox;
  18. private Label _availableUsersLabel;
  19. private ScrolledWindow _usersTreeViewWindow;
  20. private ListStore _tableStore;
  21. private TreeView _usersTreeView;
  22. private Box _bottomBox;
  23. private Button _addButton;
  24. private Button _deleteButton;
  25. private Button _closeButton;
  26. private void InitializeComponent()
  27. {
  28. #pragma warning disable CS0612
  29. //
  30. // UserProfilesManagerWindow
  31. //
  32. CanFocus = false;
  33. Resizable = false;
  34. Modal = true;
  35. WindowPosition = WindowPosition.Center;
  36. DefaultWidth = 620;
  37. DefaultHeight = 548;
  38. TypeHint = Gdk.WindowTypeHint.Dialog;
  39. //
  40. // _mainBox
  41. //
  42. _mainBox = new Box(Orientation.Vertical, 0);
  43. //
  44. // _selectedLabel
  45. //
  46. _selectedLabel = new Label("Selected User Profile:")
  47. {
  48. Margin = 15,
  49. Attributes = new AttrList()
  50. };
  51. _selectedLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
  52. //
  53. // _viewBox
  54. //
  55. _usersTreeViewBox = new Box(Orientation.Vertical, 0);
  56. //
  57. // _SelectedUserBox
  58. //
  59. _selectedUserBox = new Box(Orientation.Horizontal, 0)
  60. {
  61. MarginLeft = 30
  62. };
  63. //
  64. // _selectedUserImage
  65. //
  66. _selectedUserImage = new Image();
  67. //
  68. // _selectedUserInfoBox
  69. //
  70. _selectedUserInfoBox = new VBox(true, 0);
  71. //
  72. // _selectedUserNameEntry
  73. //
  74. _selectedUserNameEntry = new Entry("")
  75. {
  76. MarginLeft = 15,
  77. MaxLength = (int)MaxProfileNameLength
  78. };
  79. _selectedUserNameEntry.KeyReleaseEvent += SelectedUserNameEntry_KeyReleaseEvent;
  80. //
  81. // _selectedUserIdLabel
  82. //
  83. _selectedUserIdLabel = new Label("")
  84. {
  85. MarginTop = 15,
  86. MarginLeft = 15
  87. };
  88. //
  89. // _selectedUserButtonsBox
  90. //
  91. _selectedUserButtonsBox = new VBox()
  92. {
  93. MarginRight = 30
  94. };
  95. //
  96. // _saveProfileNameButton
  97. //
  98. _saveProfileNameButton = new Button()
  99. {
  100. Label = "Save Profile Name",
  101. CanFocus = true,
  102. ReceivesDefault = true,
  103. Sensitive = false
  104. };
  105. _saveProfileNameButton.Clicked += EditProfileNameButton_Pressed;
  106. //
  107. // _changeProfileImageButton
  108. //
  109. _changeProfileImageButton = new Button()
  110. {
  111. Label = "Change Profile Image",
  112. CanFocus = true,
  113. ReceivesDefault = true,
  114. MarginTop = 10
  115. };
  116. _changeProfileImageButton.Clicked += ChangeProfileImageButton_Pressed;
  117. //
  118. // _availableUsersLabel
  119. //
  120. _availableUsersLabel = new Label("Available User Profiles:")
  121. {
  122. Margin = 15,
  123. Attributes = new AttrList()
  124. };
  125. _availableUsersLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
  126. //
  127. // _usersTreeViewWindow
  128. //
  129. _usersTreeViewWindow = new ScrolledWindow()
  130. {
  131. ShadowType = ShadowType.In,
  132. CanFocus = true,
  133. Expand = true,
  134. MarginLeft = 30,
  135. MarginRight = 30,
  136. MarginBottom = 15
  137. };
  138. //
  139. // _tableStore
  140. //
  141. _tableStore = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(Gdk.RGBA));
  142. //
  143. // _usersTreeView
  144. //
  145. _usersTreeView = new TreeView(_tableStore)
  146. {
  147. HoverSelection = true,
  148. HeadersVisible = false,
  149. };
  150. _usersTreeView.RowActivated += UsersTreeView_Activated;
  151. //
  152. // _bottomBox
  153. //
  154. _bottomBox = new Box(Orientation.Horizontal, 0)
  155. {
  156. MarginLeft = 30,
  157. MarginRight = 30,
  158. MarginBottom = 15
  159. };
  160. //
  161. // _addButton
  162. //
  163. _addButton = new Button()
  164. {
  165. Label = "Add New Profile",
  166. CanFocus = true,
  167. ReceivesDefault = true,
  168. HeightRequest = 35
  169. };
  170. _addButton.Clicked += AddButton_Pressed;
  171. //
  172. // _deleteButton
  173. //
  174. _deleteButton = new Button()
  175. {
  176. Label = "Delete Selected Profile",
  177. CanFocus = true,
  178. ReceivesDefault = true,
  179. HeightRequest = 35,
  180. MarginLeft = 10
  181. };
  182. _deleteButton.Clicked += DeleteButton_Pressed;
  183. //
  184. // _closeButton
  185. //
  186. _closeButton = new Button()
  187. {
  188. Label = "Close",
  189. CanFocus = true,
  190. ReceivesDefault = true,
  191. HeightRequest = 35,
  192. WidthRequest = 80
  193. };
  194. _closeButton.Clicked += CloseButton_Pressed;
  195. #pragma warning restore CS0612
  196. ShowComponent();
  197. }
  198. private void ShowComponent()
  199. {
  200. _usersTreeViewWindow.Add(_usersTreeView);
  201. _usersTreeViewBox.Add(_usersTreeViewWindow);
  202. _bottomBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _addButton }, false, false, 0);
  203. _bottomBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _deleteButton }, false, false, 0);
  204. _bottomBox.PackEnd(new Gtk.Alignment(1, 0, 0, 0) { _closeButton }, false, false, 0);
  205. _selectedUserInfoBox.Add(_selectedUserNameEntry);
  206. _selectedUserInfoBox.Add(_selectedUserIdLabel);
  207. _selectedUserButtonsBox.Add(_saveProfileNameButton);
  208. _selectedUserButtonsBox.Add(_changeProfileImageButton);
  209. _selectedUserBox.Add(_selectedUserImage);
  210. _selectedUserBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _selectedUserInfoBox }, true, true, 0);
  211. _selectedUserBox.Add(_selectedUserButtonsBox);
  212. _mainBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _selectedLabel }, false, false, 0);
  213. _mainBox.PackStart(_selectedUserBox, false, true, 0);
  214. _mainBox.PackStart(new Gtk.Alignment(-1, 0, 0, 0) { _availableUsersLabel }, false, false, 0);
  215. _mainBox.Add(_usersTreeViewBox);
  216. _mainBox.Add(_bottomBox);
  217. Add(_mainBox);
  218. ShowAll();
  219. }
  220. }
  221. }