BsEditorWidgetContainer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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, EditorWindowBase* 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. EditorWidgetBase* getActiveWidget() const;
  20. GUIWidget& getParentWidget() const { return *mParent; }
  21. EditorWindowBase* getParentWindow() const { return mParentWindow; }
  22. Rect2I getContentBounds() const;
  23. Vector<Rect2I> getDraggableAreas() const;
  24. void update();
  25. void _notifyWidgetDestroyed(EditorWidgetBase* widget);
  26. Event<void()> onWidgetClosed;
  27. private:
  28. EditorWindowBase* mParentWindow;
  29. GUITabbedTitleBar* mTitleBar;
  30. GUIPanel* mTitleBarPanel;
  31. GUIWidget* mParent;
  32. INT32 mX, mY;
  33. UINT32 mWidth, mHeight;
  34. UnorderedMap<UINT32, EditorWidgetBase*> mWidgets;
  35. INT32 mActiveWidget;
  36. static const UINT32 TitleBarHeight;
  37. void removeInternal(EditorWidgetBase& widget);
  38. void setActiveWidget(UINT32 idx);
  39. void tabActivated(UINT32 idx);
  40. void tabClosed(UINT32 idx);
  41. void tabDraggedOff(UINT32 idx);
  42. void tabDraggedOn(UINT32 idx);
  43. static void tabDroppedCallback(bool wasDragProcessed);
  44. };
  45. }