BsEditorWidgetContainer.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 refreshWidgetNames();
  26. void _notifyWidgetDestroyed(EditorWidgetBase* widget);
  27. Event<void()> onWidgetAdded;
  28. Event<void()> onWidgetClosed;
  29. private:
  30. EditorWindowBase* mParentWindow;
  31. GUITabbedTitleBar* mTitleBar;
  32. GUIPanel* mTitleBarPanel;
  33. GUIWidget* mParent;
  34. INT32 mX, mY;
  35. UINT32 mWidth, mHeight;
  36. UnorderedMap<UINT32, EditorWidgetBase*> mWidgets;
  37. INT32 mActiveWidget;
  38. static const UINT32 TitleBarHeight;
  39. void removeInternal(EditorWidgetBase& widget);
  40. void setActiveWidget(UINT32 idx);
  41. void tabActivated(UINT32 idx);
  42. void tabClosed(UINT32 idx);
  43. void tabDraggedOff(UINT32 idx);
  44. void tabDraggedOn(UINT32 idx);
  45. static void tabDroppedCallback(bool wasDragProcessed);
  46. };
  47. }