logic/ui: added CompositeView for combining Views to one DockWidget
Added CompositView, which implements both View and ViewLayout, for combining Views to one Widget. The layout can be set to either horizontal or vertical. SearchView, RefreshView and UndoRedoView are combined to one DockWidget by the ComponentManager now. fortune cookie message = You'll get more secure and confident with your relationship with your co-workers.
This commit is contained in:
@@ -14,12 +14,12 @@ class View
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
static std::shared_ptr<T> create(ViewLayout* viewLayout);
|
||||
static std::shared_ptr<T> createInitAndAddToLayout(ViewLayout* viewLayout);
|
||||
|
||||
template<typename T>
|
||||
static std::shared_ptr<T> createAndDontAddToLayout(ViewLayout* viewLayout);
|
||||
static std::shared_ptr<T> createAndInit(ViewLayout* viewLayout);
|
||||
|
||||
View(ViewLayout* viewLayout, const Vec2i& minSize);
|
||||
View(ViewLayout* viewLayout);
|
||||
virtual ~View();
|
||||
|
||||
virtual std::string getName() const = 0;
|
||||
@@ -28,48 +28,43 @@ public:
|
||||
virtual void initView() = 0;
|
||||
virtual void refreshView() = 0;
|
||||
|
||||
void init();
|
||||
void addToLayout();
|
||||
|
||||
void setComponent(Component* component);
|
||||
|
||||
void setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper);
|
||||
ViewWidgetWrapper* getWidgetWrapper() const;
|
||||
|
||||
int getMinWidth() const;
|
||||
int getMinHeight() const;
|
||||
Vec2i getMinSize() const;
|
||||
|
||||
protected:
|
||||
template <typename ControllerType>
|
||||
ControllerType* getController();
|
||||
|
||||
ViewLayout* getViewLayout() const;
|
||||
|
||||
void setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper);
|
||||
|
||||
private:
|
||||
Component* m_component;
|
||||
ViewLayout* const m_viewLayout;
|
||||
std::shared_ptr<ViewWidgetWrapper> m_widgetWrapper;
|
||||
Vec2i m_minSize;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
std::shared_ptr<T> View::create(ViewLayout* viewLayout)
|
||||
std::shared_ptr<T> View::createInitAndAddToLayout(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<T> ptr = std::make_shared<T>(viewLayout);
|
||||
std::shared_ptr<T> ptr = View::createAndInit<T>(viewLayout);
|
||||
|
||||
ptr->createWidgetWrapper();
|
||||
ptr->initView();
|
||||
|
||||
viewLayout->addView(ptr.get());
|
||||
ptr->addToLayout();
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::shared_ptr<T> View::createAndDontAddToLayout(ViewLayout* viewLayout)
|
||||
std::shared_ptr<T> View::createAndInit(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<T> ptr = std::make_shared<T>(viewLayout);
|
||||
|
||||
ptr->createWidgetWrapper();
|
||||
ptr->initView();
|
||||
ptr->init();
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user