BsEditorWidgetContainer.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include "BsEvent.h"
  4. namespace BansheeEngine
  5. {
  6. class BS_ED_EXPORT EditorWidgetContainer
  7. {
  8. public:
  9. EditorWidgetContainer(GUIWidget* parent, RenderWindow* renderWindow, EditorWindow* parentEditorWindow);
  10. virtual ~EditorWidgetContainer();
  11. void add(EditorWidgetBase& widget);
  12. void remove(EditorWidgetBase& widget);
  13. void insert(UINT32 idx, EditorWidgetBase& widget);
  14. bool contains(EditorWidgetBase& widget);
  15. void setSize(UINT32 width, UINT32 height);
  16. void setPosition(INT32 x, INT32 y);
  17. UINT32 getNumWidgets() const { return (UINT32)mWidgets.size(); }
  18. EditorWidgetBase* getWidget(UINT32 idx) const;
  19. GUIWidget& getParentWidget() const { return *mParent; }
  20. EditorWindow* getParentWindow() const { return mParentWindow; }
  21. RectI getContentBounds() const;
  22. Vector<RectI> getDraggableAreas() const;
  23. void _update();
  24. void _notifyWidgetDestroyed(EditorWidgetBase* widget);
  25. Event<void()> onWidgetClosed;
  26. private:
  27. EditorWindow* mParentWindow;
  28. GUITabbedTitleBar* mTitleBar;
  29. GUIArea* mTitleBarArea;
  30. GUIWidget* mParent;
  31. INT32 mX, mY;
  32. UINT32 mWidth, mHeight;
  33. UnorderedMap<UINT32, EditorWidgetBase*> mWidgets;
  34. INT32 mActiveWidget;
  35. static const UINT32 TitleBarHeight;
  36. void removeInternal(EditorWidgetBase& widget);
  37. void setActiveWidget(UINT32 idx);
  38. void tabActivated(UINT32 idx);
  39. void tabClosed(UINT32 idx);
  40. void tabDraggedOff(UINT32 idx);
  41. void tabDraggedOn(UINT32 idx);
  42. static void tabDroppedCallback(bool wasDragProcessed);
  43. };
  44. }