GuiEditorExplorerWindow.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. function GuiEditorExplorerWindow::onAdd(%this)
  2. {
  3. %this.scroller = new GuiScrollCtrl()
  4. {
  5. HorizSizing="width";
  6. VertSizing="height";
  7. Position="0 0";
  8. Extent="392 355";
  9. hScrollBar="alwaysOff";
  10. vScrollBar="alwaysOn";
  11. constantThumbHeight="0";
  12. showArrowButtons="1";
  13. scrollBarThickness="14";
  14. };
  15. ThemeManager.setProfile(%this.scroller, "emptyProfile");
  16. ThemeManager.setProfile(%this.scroller, "thumbProfile", "ThumbProfile");
  17. ThemeManager.setProfile(%this.scroller, "trackProfile", "TrackProfile");
  18. ThemeManager.setProfile(%this.scroller, "scrollArrowProfile", "ArrowProfile");
  19. %this.add(%this.scroller);
  20. %this.tree = new GuiTreeViewCtrl()
  21. {
  22. class="GuiEditorExplorerTree";
  23. HorizSizing="width";
  24. VertSizing="height";
  25. Position="0 0";
  26. Extent="228 355";
  27. BindToGuiEditor="1";
  28. };
  29. ThemeManager.setProfile(%this.tree, "treeViewProfile");
  30. %this.scroller.add(%this.tree);
  31. %this.tree.startListening(GuiEditor.inspectorWindow.inspector);
  32. }
  33. function GuiEditorExplorerWindow::inspect(%this, %object)
  34. {
  35. %this.tree.inspect(%object);
  36. }
  37. function GuiEditorExplorerWindow::onAlsoInspect(%this, %ctrl)
  38. {
  39. %this.tree.startRadioSilence();
  40. %index = %this.tree.findItemID(%ctrl.getID());
  41. if(%index != -1)
  42. {
  43. %this.tree.setSelected(%index, true);
  44. }
  45. %this.tree.endRadioSilence();
  46. }
  47. function GuiEditorExplorerWindow::onClearInspect(%this, %ctrl)
  48. {
  49. %this.tree.startRadioSilence();
  50. %index = %this.tree.findItemID(%ctrl.getID());
  51. if(%index != -1)
  52. {
  53. %this.tree.setSelected(%ctrl, false);
  54. }
  55. %this.tree.endRadioSilence();
  56. }
  57. function GuiEditorExplorerWindow::onClearInspectAll(%this)
  58. {
  59. %this.tree.startRadioSilence();
  60. %this.tree.clearSelection();
  61. %this.tree.endRadioSilence();
  62. }
  63. function GuiEditorExplorerWindow::onObjectRemoved(%this)
  64. {
  65. %this.tree.refresh();
  66. }
  67. function GuiEditorExplorerWindow::onAddControl(%this, %ctrl)
  68. {
  69. %this.tree.refresh();
  70. }
  71. function GuiEditorExplorerWindow::onParentChange(%this, %parent)
  72. {
  73. %index = %this.tree.findItemID(%parent);
  74. while(%index != -1)
  75. {
  76. %this.tree.setItemOpen(%index, true);
  77. %index = %this.tree.getItemParent(%index);
  78. }
  79. %this.tree.refresh();
  80. }