BsEditorWidgetContainer.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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>::type getDraggableAreas() const;
  23. void _notifyWidgetDestroyed(EditorWidgetBase* widget);
  24. Event<void()> onWidgetClosed;
  25. private:
  26. EditorWindow* mParentWindow;
  27. GUITabbedTitleBar* mTitleBar;
  28. GUIArea* mTitleBarArea;
  29. GUIWidget* mParent;
  30. INT32 mX, mY;
  31. UINT32 mWidth, mHeight;
  32. UnorderedMap<UINT32, EditorWidgetBase*>::type mWidgets;
  33. INT32 mActiveWidget;
  34. static const UINT32 TitleBarHeight;
  35. void removeInternal(EditorWidgetBase& widget);
  36. void setActiveWidget(UINT32 idx);
  37. void tabActivated(UINT32 idx);
  38. void tabClosed(UINT32 idx);
  39. void tabDraggedOff(UINT32 idx);
  40. void tabDraggedOn(UINT32 idx);
  41. static void tabDroppedCallback(bool wasDragProcessed);
  42. };
  43. }