BsGUISceneTreeView.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsGUIElementContainer.h"
  4. #include <boost/signal.hpp>
  5. namespace BansheeEditor
  6. {
  7. class GUISceneTreeView : public BS::GUIElementContainer
  8. {
  9. struct TreeElement
  10. {
  11. TreeElement();
  12. ~TreeElement();
  13. TreeElement* mParent;
  14. CM::Vector<TreeElement*>::type mChildren;
  15. BS::GUIToggle* mFoldoutBtn;
  16. BS::GUILabel* mElement;
  17. CM::HSceneObject mSceneObject;
  18. CM::String mName;
  19. CM::UINT32 mId;
  20. CM::UINT32 mSortedIdx;
  21. bool mIsExpanded;
  22. bool mIsDirty;
  23. bool mIsVisible;
  24. };
  25. public:
  26. static const CM::String& getGUITypeName();
  27. static GUISceneTreeView* create(BS::GUIWidget& parent,
  28. BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr,
  29. BS::GUIElementStyle* foldoutBtnStyle = nullptr);
  30. static GUISceneTreeView* create(BS::GUIWidget& parent, const BS::GUIOptions& options,
  31. BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr,
  32. BS::GUIElementStyle* foldoutBtnStyle = nullptr);
  33. void update();
  34. protected:
  35. virtual ~GUISceneTreeView();
  36. CM::Vector2I _getOptimalSize() const;
  37. void updateClippedBounds();
  38. void _updateLayoutInternal(CM::INT32 x, CM::INT32 y, CM::UINT32 width, CM::UINT32 height,
  39. CM::RectI clipRect, CM::UINT8 widgetDepth, CM::UINT16 areaDepth);
  40. protected:
  41. static const CM::UINT32 ELEMENT_EXTRA_SPACING;
  42. static const CM::UINT32 INDENT_SIZE;
  43. static const CM::UINT32 INITIAL_INDENT_OFFSET;
  44. const BS::GUIElementStyle* mBackgroundStyle;
  45. const BS::GUIElementStyle* mElementBtnStyle;
  46. const BS::GUIElementStyle* mFoldoutBtnStyle;
  47. BS::GUITexture* mBackgroundImage;
  48. TreeElement mRootElement;
  49. CM::Vector<bool>::type mTempToDelete;
  50. GUISceneTreeView(BS::GUIWidget& parent, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle,
  51. BS::GUIElementStyle* foldoutBtnStyle, const BS::GUILayoutOptions& layoutOptions);
  52. virtual bool mouseEvent(const BS::GUIMouseEvent& ev);
  53. void elementToggled(TreeElement* element, bool toggled);
  54. };
  55. }