UserProfilesManagerWindow.Designer.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. Halign = Align.Start
  51. };
  52. _selectedLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
  53. //
  54. // _viewBox
  55. //
  56. _usersTreeViewBox = new Box(Orientation.Vertical, 0);
  57. //
  58. // _SelectedUserBox
  59. //
  60. _selectedUserBox = new Box(Orientation.Horizontal, 0)
  61. {
  62. MarginLeft = 30
  63. };
  64. //
  65. // _selectedUserImage
  66. //
  67. _selectedUserImage = new Image();
  68. //
  69. // _selectedUserInfoBox
  70. //
  71. _selectedUserInfoBox = new VBox(true, 0);
  72. //
  73. // _selectedUserNameEntry
  74. //
  75. _selectedUserNameEntry = new Entry("")
  76. {
  77. MarginLeft = 15,
  78. MaxLength = (int)MaxProfileNameLength
  79. };
  80. _selectedUserNameEntry.KeyReleaseEvent += SelectedUserNameEntry_KeyReleaseEvent;
  81. //
  82. // _selectedUserIdLabel
  83. //
  84. _selectedUserIdLabel = new Label("")
  85. {
  86. MarginTop = 15,
  87. MarginLeft = 15
  88. };
  89. //
  90. // _selectedUserButtonsBox
  91. //
  92. _selectedUserButtonsBox = new VBox()
  93. {
  94. MarginRight = 30
  95. };
  96. //
  97. // _saveProfileNameButton
  98. //
  99. _saveProfileNameButton = new Button()
  100. {
  101. Label = "Save Profile Name",
  102. CanFocus = true,
  103. ReceivesDefault = true,
  104. Sensitive = false
  105. };
  106. _saveProfileNameButton.Clicked += EditProfileNameButton_Pressed;
  107. //
  108. // _changeProfileImageButton
  109. //
  110. _changeProfileImageButton = new Button()
  111. {
  112. Label = "Change Profile Image",
  113. CanFocus = true,
  114. ReceivesDefault = true,
  115. MarginTop = 10
  116. };
  117. _changeProfileImageButton.Clicked += ChangeProfileImageButton_Pressed;
  118. //
  119. // _availableUsersLabel
  120. //
  121. _availableUsersLabel = new Label("Available User Profiles:")
  122. {
  123. Margin = 15,
  124. Attributes = new AttrList(),
  125. Halign = Align.Start
  126. };
  127. _availableUsersLabel.Attributes.Insert(new Pango.AttrWeight(Weight.Bold));
  128. //
  129. // _usersTreeViewWindow
  130. //
  131. _usersTreeViewWindow = new ScrolledWindow()
  132. {
  133. ShadowType = ShadowType.In,
  134. CanFocus = true,
  135. Expand = true,
  136. MarginLeft = 30,
  137. MarginRight = 30,
  138. MarginBottom = 15
  139. };
  140. //
  141. // _tableStore
  142. //
  143. _tableStore = new ListStore(typeof(bool), typeof(Gdk.Pixbuf), typeof(string), typeof(Gdk.RGBA));
  144. //
  145. // _usersTreeView
  146. //
  147. _usersTreeView = new TreeView(_tableStore)
  148. {
  149. HoverSelection = true,
  150. HeadersVisible = false,
  151. };
  152. _usersTreeView.RowActivated += UsersTreeView_Activated;
  153. //
  154. // _bottomBox
  155. //
  156. _bottomBox = new Box(Orientation.Horizontal, 0)
  157. {
  158. MarginLeft = 30,
  159. MarginRight = 30,
  160. MarginBottom = 15
  161. };
  162. //
  163. // _addButton
  164. //
  165. _addButton = new Button()
  166. {
  167. Label = "Add New Profile",
  168. CanFocus = true,
  169. ReceivesDefault = true,
  170. HeightRequest = 35
  171. };
  172. _addButton.Clicked += AddButton_Pressed;
  173. //
  174. // _deleteButton
  175. //
  176. _deleteButton = new Button()
  177. {
  178. Label = "Delete Selected Profile",
  179. CanFocus = true,
  180. ReceivesDefault = true,
  181. HeightRequest = 35,
  182. MarginLeft = 10
  183. };
  184. _deleteButton.Clicked += DeleteButton_Pressed;
  185. //
  186. // _closeButton
  187. //
  188. _closeButton = new Button()
  189. {
  190. Label = "Close",
  191. CanFocus = true,
  192. ReceivesDefault = true,
  193. HeightRequest = 35,
  194. WidthRequest = 80
  195. };
  196. _closeButton.Clicked += CloseButton_Pressed;
  197. #pragma warning restore CS0612
  198. ShowComponent();
  199. }
  200. private void ShowComponent()
  201. {
  202. _usersTreeViewWindow.Add(_usersTreeView);
  203. _usersTreeViewBox.Add(_usersTreeViewWindow);
  204. _bottomBox.PackStart(_addButton, false, false, 0);
  205. _bottomBox.PackStart(_deleteButton, false, false, 0);
  206. _bottomBox.PackEnd(_closeButton, false, false, 0);
  207. _selectedUserInfoBox.Add(_selectedUserNameEntry);
  208. _selectedUserInfoBox.Add(_selectedUserIdLabel);
  209. _selectedUserButtonsBox.Add(_saveProfileNameButton);
  210. _selectedUserButtonsBox.Add(_changeProfileImageButton);
  211. _selectedUserBox.Add(_selectedUserImage);
  212. _selectedUserBox.PackStart(_selectedUserInfoBox, false, false, 0);
  213. _selectedUserBox.PackEnd(_selectedUserButtonsBox, false, false, 0);
  214. _mainBox.PackStart(_selectedLabel, false, false, 0);
  215. _mainBox.PackStart(_selectedUserBox, false, true, 0);
  216. _mainBox.PackStart(_availableUsersLabel, false, false, 0);
  217. _mainBox.Add(_usersTreeViewBox);
  218. _mainBox.Add(_bottomBox);
  219. Add(_mainBox);
  220. ShowAll();
  221. }
  222. }
  223. }