saveChangesMBDlg.ed.gui 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //--- OBJECT WRITE BEGIN ---
  2. %guiContent = new GuiControl(MessageBoxSaveChangesDlg, EditorGuiGroup) {
  3. canSaveDynamicFields = "0";
  4. Profile = "ToolsGuiDefaultProfile";
  5. HorizSizing = "width";
  6. VertSizing = "height";
  7. position = "0 0";
  8. Extent = "1024 768";
  9. MinExtent = "8 8";
  10. canSave = "1";
  11. Visible = "1";
  12. hovertime = "1000";
  13. new GuiWindowCtrl(MBSaveChangesFrame) {
  14. canSaveDynamicFields = "0";
  15. Profile = "ToolsGuiWindowProfile";
  16. HorizSizing = "center";
  17. VertSizing = "center";
  18. position = "362 274";
  19. Extent = "340 164";
  20. MinExtent = "48 92";
  21. canSave = "1";
  22. Visible = "1";
  23. hovertime = "1000";
  24. text = "Save Changes";
  25. maxLength = "255";
  26. resizeWidth = "1";
  27. resizeHeight = "1";
  28. canMove = "1";
  29. canClose = "0";
  30. canMinimize = "0";
  31. canMaximize = "0";
  32. minSize = "50 50";
  33. new GuiIconButtonCtrl(mbSaveDlgSaveButton) {
  34. canSaveDynamicFields = "0";
  35. Profile = "ToolsGuiButtonProfile";
  36. HorizSizing = "right";
  37. VertSizing = "bottom";
  38. position = "240 117";
  39. Extent = "83 25";
  40. MinExtent = "8 2";
  41. canSave = "1";
  42. Visible = "1";
  43. hovertime = "1000";
  44. text = "Save";
  45. groupNum = "-1";
  46. buttonType = "PushButton";
  47. iconBitmap = "~/levelEditor/gui/images/iconAccept.png";
  48. sizeIconToButton = "0";
  49. textLocation = "Center";
  50. textMargin = "4";
  51. buttonMargin = "4 4";
  52. };
  53. new GuiIconButtonCtrl(mbSaveDlgCancelButton) {
  54. canSaveDynamicFields = "0";
  55. Profile = "ToolsGuiButtonProfile";
  56. HorizSizing = "right";
  57. VertSizing = "bottom";
  58. position = "158 117";
  59. Extent = "83 25";
  60. MinExtent = "8 2";
  61. canSave = "1";
  62. Visible = "1";
  63. hovertime = "1000";
  64. text = "Cancel";
  65. groupNum = "-1";
  66. buttonType = "PushButton";
  67. iconBitmap = "~/levelEditor/gui/images/iconCancel.png";
  68. sizeIconToButton = "0";
  69. textLocation = "Center";
  70. textMargin = "4";
  71. buttonMargin = "4 4";
  72. };
  73. new GuiIconButtonCtrl(mbSaveDlgDontButton) {
  74. canSaveDynamicFields = "0";
  75. Profile = "ToolsGuiButtonProfile";
  76. HorizSizing = "right";
  77. VertSizing = "bottom";
  78. position = "14 117";
  79. Extent = "124 25";
  80. MinExtent = "8 2";
  81. canSave = "1";
  82. Visible = "1";
  83. hovertime = "1000";
  84. text = "Don\'t Save";
  85. groupNum = "-1";
  86. buttonType = "PushButton";
  87. sizeIconToButton = "0";
  88. textLocation = "Center";
  89. textMargin = "4";
  90. buttonMargin = "4 4";
  91. };
  92. new GuiControl() {
  93. canSaveDynamicFields = "0";
  94. Profile = "ToolsGuiDefaultProfile";
  95. HorizSizing = "right";
  96. VertSizing = "bottom";
  97. position = "13 31";
  98. Extent = "310 73";
  99. MinExtent = "8 2";
  100. canSave = "1";
  101. Visible = "1";
  102. hovertime = "1000";
  103. new GuiTextCtrl() {
  104. canSaveDynamicFields = "0";
  105. Profile = "EditorTextHLBoldLeft";
  106. HorizSizing = "right";
  107. VertSizing = "bottom";
  108. position = "15 9";
  109. Extent = "281 26";
  110. MinExtent = "8 2";
  111. canSave = "1";
  112. Visible = "1";
  113. hovertime = "1000";
  114. text = "Do you want to save changes to this document?";
  115. maxLength = "1024";
  116. };
  117. new GuiTextCtrl() {
  118. canSaveDynamicFields = "0";
  119. Profile = "ToolsGuiDefaultProfile";
  120. HorizSizing = "right";
  121. VertSizing = "bottom";
  122. position = "15 38";
  123. Extent = "258 21";
  124. MinExtent = "8 2";
  125. canSave = "1";
  126. Visible = "1";
  127. hovertime = "1000";
  128. text = "If you don\'t save, your changes may be lost.";
  129. maxLength = "1024";
  130. };
  131. };
  132. };
  133. };
  134. //--- OBJECT WRITE END ---
  135. function MessageBoxSaveChangesDlg::onWake( %this )
  136. {
  137. MBSaveChangesFrame.setText( %this.Data );
  138. }
  139. function mbSaveDlgSaveButton::onClick( %this )
  140. {
  141. if( MessageBoxSaveChangesDlg.SaveCallback !$= "" )
  142. eval( MessageBoxSaveChangesDlg.SaveCallback @ "(" @ MessageBoxSaveChangesDlg.Data @ ");" );
  143. Canvas.popDialog( MessageBoxSaveChangesDlg );
  144. }
  145. function mbSaveDlgCancelButton::onClick( %this )
  146. {
  147. Canvas.popDialog( MessageBoxSaveChangesDlg );
  148. }
  149. function mbSaveDlgDontButton::onClick( %this )
  150. {
  151. if( MessageBoxSaveChangesDlg.DontSaveCallback !$= "" )
  152. eval( MessageBoxSaveChangesDlg.DontSaveCallback @ "(" @ MessageBoxSaveChangesDlg.Data @ ");" );
  153. Canvas.popDialog( MessageBoxSaveChangesDlg );
  154. }
  155. // Deprecated when platform layers are all sufficient
  156. function checkSaveChangesOld( %data, %saveCallback, %dontSaveCallback )
  157. {
  158. // Sanity Check
  159. if( MessageBoxSaveChangesDlg.isAwake() )
  160. {
  161. warn("Save Changes Dialog already Awake, NOT creating second instance.");
  162. return;
  163. }
  164. // Set Proper State
  165. MessageBoxSaveChangesDlg.SaveCallback = %saveCallback;
  166. MessageBoxSaveChangesDlg.DontSaveCallback = %dontSaveCallback;
  167. MessageBoxSaveChangesDlg.Data = %data;
  168. // Show Dialog
  169. Canvas.pushDialog( MessageBoxSaveChangesDlg );
  170. }