BsGUISceneTreeView.h 2.7 KB

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