BsGUISceneTreeView.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUITreeView.h"
  4. #include "BsEvent.h"
  5. #include "BsServiceLocator.h"
  6. namespace BansheeEngine
  7. {
  8. struct DraggedSceneObjects
  9. {
  10. DraggedSceneObjects(UINT32 numObjects);
  11. ~DraggedSceneObjects();
  12. UINT32 numObjects;
  13. HSceneObject* objects;
  14. };
  15. class GUISceneTreeView : public GUITreeView
  16. {
  17. struct SceneTreeElement : public GUITreeView::TreeElement
  18. {
  19. SceneTreeElement()
  20. :mId(0)
  21. { }
  22. HSceneObject mSceneObject;
  23. UINT64 mId;
  24. };
  25. public:
  26. static const String& getGUITypeName();
  27. static GUISceneTreeView* create(
  28. const String& backgroundStyle = StringUtil::BLANK, const String& elementBtnStyle = StringUtil::BLANK,
  29. const String& foldoutBtnStyle = StringUtil::BLANK, const String& selectionBackgroundStyle = StringUtil::BLANK,
  30. const String& editBoxStyle = StringUtil::BLANK, const String& dragHighlightStyle = StringUtil::BLANK,
  31. const String& dragSepHighlightStyle = StringUtil::BLANK);
  32. static GUISceneTreeView* create(const GUIOptions& options,
  33. const String& backgroundStyle = StringUtil::BLANK, const String& elementBtnStyle = StringUtil::BLANK,
  34. const String& foldoutBtnStyle = StringUtil::BLANK, const String& selectionBackgroundStyle = StringUtil::BLANK,
  35. const String& editBoxStyle = StringUtil::BLANK, const String& dragHighlightStyle = StringUtil::BLANK,
  36. const String& dragSepHighlightStyle = StringUtil::BLANK);
  37. Vector<HSceneObject> getSelection() const;
  38. void setSelection(const Vector<HSceneObject>& objects);
  39. Event<void()> onSelectionChanged;
  40. static const MessageId SELECTION_CHANGED_MSG;
  41. protected:
  42. virtual ~GUISceneTreeView();
  43. protected:
  44. SceneTreeElement mRootElement;
  45. GUISceneTreeView(const String& backgroundStyle, const String& elementBtnStyle,
  46. const String& foldoutBtnStyle, const String& selectionBackgroundStyle, const String& editBoxStyle,
  47. const String& dragHighlightStyle, const String& dragSepHighlightStyle, const GUILayoutOptions& layoutOptions);
  48. void updateTreeElement(SceneTreeElement* element);
  49. virtual TreeElement& getRootElement() { return mRootElement; }
  50. virtual const TreeElement& getRootElementConst() const { return mRootElement; }
  51. virtual void updateTreeElementHierarchy();
  52. virtual void renameTreeElement(TreeElement* element, const WString& name);
  53. virtual void deleteTreeElement(TreeElement* element);
  54. virtual bool acceptDragAndDrop() const;
  55. virtual void dragAndDropStart();
  56. virtual void dragAndDropEnded(TreeElement* overTreeElement);
  57. virtual void dragAndDropFinalize();
  58. virtual bool _acceptDragAndDrop(const Vector2I position, UINT32 typeId) const;
  59. virtual void selectionChanged();
  60. void deleteTreeElementInternal(TreeElement* element);
  61. };
  62. typedef ServiceLocator<GUISceneTreeView> SceneTreeViewLocator;
  63. }