BsGUISceneTreeView.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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::GUIButton* 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::GUILayoutOptions& layoutOptions);
  31. static GUISceneTreeView* create(BS::GUIWidget& parent, const BS::GUILayoutOptions& layoutOptions,
  32. BS::GUIElementStyle* backgroundStyle = nullptr, BS::GUIElementStyle* elementBtnStyle = nullptr,
  33. BS::GUIElementStyle* foldoutBtnStyle = nullptr);
  34. void update();
  35. protected:
  36. virtual ~GUISceneTreeView();
  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. const BS::GUIElementStyle* mBackgroundStyle;
  44. const BS::GUIElementStyle* mElementBtnStyle;
  45. const BS::GUIElementStyle* mFoldoutBtnStyle;
  46. BS::GUITexture* mBackgroundImage;
  47. TreeElement mRootElement;
  48. CM::Vector<bool>::type mTempToDelete;
  49. GUISceneTreeView(BS::GUIWidget& parent, BS::GUIElementStyle* backgroundStyle, BS::GUIElementStyle* elementBtnStyle,
  50. BS::GUIElementStyle* foldoutBtnStyle, const BS::GUILayoutOptions& layoutOptions);
  51. virtual bool mouseEvent(const BS::GUIMouseEvent& ev);
  52. };
  53. }