BsEditorWidgetContainer.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "BsEditorPrerequisites.h"
  3. #include <boost/signal.hpp>
  4. namespace BansheeEditor
  5. {
  6. class EditorWidgetContainer
  7. {
  8. public:
  9. EditorWidgetContainer(BS::GUIWidget* parent, CM::RenderWindow* renderWindow);
  10. virtual ~EditorWidgetContainer();
  11. void add(EditorWidget& widget);
  12. void remove(EditorWidget& widget);
  13. void insert(CM::UINT32 idx, EditorWidget& widget);
  14. void setSize(CM::UINT32 width, CM::UINT32 height);
  15. void setPosition(CM::INT32 x, CM::INT32 y);
  16. CM::UINT32 getNumWidgets() const { return (CM::UINT32)mWidgets.size(); }
  17. BS::GUIWidget& getParentWidget() const { return *mParent; }
  18. void _notifyWidgetDestroyed(EditorWidget* widget);
  19. bool _isHandlingWidgetDragAndDrop() const { return mIsHandlingWidgetDragAndDrop; }
  20. void _addCallbackOnDraggedWidgetDropped(std::function<void()> callback);
  21. boost::signal<void()> onWidgetClosed;
  22. private:
  23. GUITabbedTitleBar* mTitleBar;
  24. BS::GUIWidget* mParent;
  25. CM::INT32 mX, mY;
  26. CM::UINT32 mWidth, mHeight;
  27. CM::Vector<EditorWidget*>::type mWidgets;
  28. CM::INT32 mActiveWidget;
  29. std::function<void()> mWidgetDroppedCallback;
  30. bool mIsHandlingWidgetDragAndDrop;
  31. static const CM::UINT32 TitleBarHeight;
  32. void setActiveWidget(CM::UINT32 idx);
  33. void tabActivated(CM::UINT32 idx);
  34. void tabClosed(CM::UINT32 idx);
  35. void tabDraggedOff(CM::UINT32 idx);
  36. void tabDraggedOn(CM::UINT32 idx);
  37. void tabDroppedCallback(bool wasDragProcessed);
  38. };
  39. }