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:
@@ -18,11 +18,11 @@ std::shared_ptr<Application> Application::create(ViewFactory* viewFactory)
|
||||
ptr->m_graphAccessProxy = std::make_shared<GraphAccessProxy>();
|
||||
ptr->m_locationAccessProxy = std::make_shared<LocationAccessProxy>();
|
||||
|
||||
ptr->m_mainView = viewFactory->createMainView();
|
||||
ptr->m_componentManager = ComponentManager::create(
|
||||
viewFactory, ptr->m_mainView.get(), ptr->m_graphAccessProxy.get(), ptr->m_locationAccessProxy.get());
|
||||
viewFactory, ptr->m_graphAccessProxy.get(), ptr->m_locationAccessProxy.get());
|
||||
|
||||
ptr->m_componentManager->setup();
|
||||
ptr->m_mainView = viewFactory->createMainView();
|
||||
ptr->m_componentManager->setup(ptr->m_mainView.get());
|
||||
ptr->m_mainView->loadLayout();
|
||||
|
||||
MessageLoadProject("data/ProjectSettings.xml").dispatch();
|
||||
|
||||
@@ -48,6 +48,8 @@ add_files(
|
||||
|
||||
component/view/CodeView.cpp
|
||||
component/view/CodeView.h
|
||||
component/view/CompositeView.cpp
|
||||
component/view/CompositeView.h
|
||||
component/view/GraphView.cpp
|
||||
component/view/GraphView.h
|
||||
component/view/MainView.cpp
|
||||
|
||||
@@ -36,5 +36,4 @@ ViewType* Component::getView() const
|
||||
return dynamic_cast<ViewType*>(m_view.get());
|
||||
}
|
||||
|
||||
|
||||
#endif // COMPONENT_H
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
#include "component/view/StatusBarView.h"
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
#include "component/view/ViewLayout.h"
|
||||
|
||||
std::shared_ptr<ComponentFactory> ComponentFactory::create(
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
){
|
||||
std::shared_ptr<ComponentFactory> ptr(new ComponentFactory());
|
||||
|
||||
ptr->m_viewFactory = viewFactory;
|
||||
ptr->m_viewLayout = viewLayout;
|
||||
ptr->m_graphAccess = graphAccess;
|
||||
ptr->m_locationAccess = locationAccess;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -31,61 +31,59 @@ ComponentFactory::~ComponentFactory()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createCodeComponent()
|
||||
ViewFactory* ComponentFactory::getViewFactory() const
|
||||
{
|
||||
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(m_viewLayout);
|
||||
return m_viewFactory;
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createCodeComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<CodeView> view = m_viewFactory->createCodeView(viewLayout);
|
||||
std::shared_ptr<CodeController> controller = std::make_shared<CodeController>(m_graphAccess, m_locationAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createGraphComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createGraphComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<View> view = m_viewFactory->createGraphView(m_viewLayout);
|
||||
std::shared_ptr<View> view = m_viewFactory->createGraphView(viewLayout);
|
||||
std::shared_ptr<GraphController> controller = std::make_shared<GraphController>(m_graphAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createRefreshComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createRefreshComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<View> view = m_viewFactory->createRefreshView(m_viewLayout);
|
||||
std::shared_ptr<View> view = m_viewFactory->createRefreshView(viewLayout);
|
||||
std::shared_ptr<RefreshController> controller = std::make_shared<RefreshController>();
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createSearchComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createSearchComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<SearchView> view = m_viewFactory->createSearchView(m_viewLayout);
|
||||
std::shared_ptr<SearchView> view = m_viewFactory->createSearchView(viewLayout);
|
||||
std::shared_ptr<SearchController> controller = std::make_shared<SearchController>(m_graphAccess);
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createUndoRedoComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createUndoRedoComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<UndoRedoView> view = m_viewFactory->createUndoRedoView(m_viewLayout);
|
||||
std::shared_ptr<UndoRedoView> view = m_viewFactory->createUndoRedoView(viewLayout);
|
||||
std::shared_ptr<UndoRedoController> controller = std::make_shared<UndoRedoController>();
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view, controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
std::shared_ptr<Component> ComponentFactory::createStatusBarComponent()
|
||||
std::shared_ptr<Component> ComponentFactory::createStatusBarComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<StatusBarView> view = m_viewFactory->createStatusBarView(m_viewLayout);
|
||||
std::shared_ptr<StatusBarView> view = m_viewFactory->createStatusBarView(viewLayout);
|
||||
std::shared_ptr<StatusBarController> controller = std::make_shared<StatusBarController>();
|
||||
|
||||
std::shared_ptr<Component> component = std::make_shared<Component>(view,controller);
|
||||
return component;
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
ComponentFactory::ComponentFactory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,28 +14,28 @@ class ComponentFactory
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<ComponentFactory> create(
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
);
|
||||
|
||||
~ComponentFactory();
|
||||
|
||||
std::shared_ptr<Component> createCodeComponent();
|
||||
std::shared_ptr<Component> createGraphComponent();
|
||||
std::shared_ptr<Component> createRefreshComponent();
|
||||
std::shared_ptr<Component> createSearchComponent();
|
||||
std::shared_ptr<Component> createStatusBarComponent();
|
||||
std::shared_ptr<Component> createUndoRedoComponent();
|
||||
ViewFactory* getViewFactory() const;
|
||||
|
||||
std::shared_ptr<Component> createCodeComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createGraphComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createRefreshComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createSearchComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createStatusBarComponent(ViewLayout* viewLayout);
|
||||
std::shared_ptr<Component> createUndoRedoComponent(ViewLayout* viewLayout);
|
||||
|
||||
private:
|
||||
ComponentFactory();
|
||||
ComponentFactory(const ComponentFactory&);
|
||||
|
||||
ViewFactory* m_viewFactory;
|
||||
ViewLayout* m_viewLayout;
|
||||
|
||||
GraphAccess* m_graphAccess;
|
||||
LocationAccess* m_locationAccess;
|
||||
};
|
||||
|
||||
|
||||
#endif // COMPONENT_FACTORY_H
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
#include "component/ComponentManager.h"
|
||||
|
||||
#include "component/view/CodeView.h"
|
||||
#include "component/view/CompositeView.h"
|
||||
#include "component/view/GraphView.h"
|
||||
#include "component/view/RefreshView.h"
|
||||
#include "component/view/SearchView.h"
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
std::shared_ptr<ComponentManager> ComponentManager::create(
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
){
|
||||
std::shared_ptr<ComponentManager> ptr(new ComponentManager());
|
||||
ptr->m_componentFactory = ComponentFactory::create(viewFactory, viewLayout, graphAccess, locationAccess);
|
||||
|
||||
ptr->m_componentFactory = ComponentFactory::create(viewFactory, graphAccess, locationAccess);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
@@ -16,24 +22,28 @@ ComponentManager::~ComponentManager()
|
||||
{
|
||||
}
|
||||
|
||||
void ComponentManager::setup()
|
||||
void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<Component> graphComponent = m_componentFactory->createGraphComponent();
|
||||
std::shared_ptr<Component> graphComponent = m_componentFactory->createGraphComponent(viewLayout);
|
||||
m_components.push_back(graphComponent);
|
||||
|
||||
std::shared_ptr<Component> codeComponent = m_componentFactory->createCodeComponent();
|
||||
std::shared_ptr<Component> codeComponent = m_componentFactory->createCodeComponent(viewLayout);
|
||||
m_components.push_back(codeComponent);
|
||||
|
||||
std::shared_ptr<Component> undoRedoComponent = m_componentFactory->createUndoRedoComponent();
|
||||
std::shared_ptr<CompositeView> compositeView =
|
||||
m_componentFactory->getViewFactory()->createCompositeView(viewLayout, CompositeView::DIRECTION_HORIZONTAL);
|
||||
m_views.push_back(compositeView);
|
||||
|
||||
std::shared_ptr<Component> undoRedoComponent = m_componentFactory->createUndoRedoComponent(compositeView.get());
|
||||
m_components.push_back(undoRedoComponent);
|
||||
|
||||
std::shared_ptr<Component> refreshComponent = m_componentFactory->createRefreshComponent();
|
||||
std::shared_ptr<Component> refreshComponent = m_componentFactory->createRefreshComponent(compositeView.get());
|
||||
m_components.push_back(refreshComponent);
|
||||
|
||||
std::shared_ptr<Component> searchComponent = m_componentFactory->createSearchComponent();
|
||||
std::shared_ptr<Component> searchComponent = m_componentFactory->createSearchComponent(compositeView.get());
|
||||
m_components.push_back(searchComponent);
|
||||
|
||||
std::shared_ptr<Component> statusBarComponent = m_componentFactory->createStatusBarComponent();
|
||||
std::shared_ptr<Component> statusBarComponent = m_componentFactory->createStatusBarComponent(viewLayout);
|
||||
m_components.push_back(statusBarComponent);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "data/access/LocationAccess.h"
|
||||
#include "data/access/GraphAccess.h"
|
||||
|
||||
class View;
|
||||
class ViewFactory;
|
||||
class ViewLayout;
|
||||
|
||||
@@ -16,12 +17,12 @@ class ComponentManager
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<ComponentManager> create(
|
||||
ViewFactory* viewFactory, ViewLayout* viewLayout, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
ViewFactory* viewFactory, GraphAccess* graphAccess, LocationAccess* locationAccess
|
||||
);
|
||||
|
||||
~ComponentManager();
|
||||
|
||||
void setup();
|
||||
void setup(ViewLayout* viewLayout);
|
||||
|
||||
private:
|
||||
ComponentManager();
|
||||
@@ -29,7 +30,8 @@ private:
|
||||
|
||||
std::shared_ptr<ComponentFactory> m_componentFactory;
|
||||
|
||||
std::vector<std::shared_ptr<Component> > m_components;
|
||||
std::vector<std::shared_ptr<Component>> m_components;
|
||||
std::vector<std::shared_ptr<View>> m_views;
|
||||
};
|
||||
|
||||
#endif // COMPONENT_MANAGER_H
|
||||
|
||||
@@ -62,7 +62,7 @@ bool CodeView::CodeSnippetParams::sort(const CodeSnippetParams& a, const CodeSni
|
||||
}
|
||||
|
||||
CodeView::CodeView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100, 100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "component/view/CompositeView.h"
|
||||
|
||||
CompositeView::CompositeView(ViewLayout* viewLayout, CompositeDirection direction)
|
||||
: View(viewLayout)
|
||||
, m_direction(direction)
|
||||
{
|
||||
}
|
||||
|
||||
CompositeView::~CompositeView()
|
||||
{
|
||||
}
|
||||
|
||||
CompositeView::CompositeDirection CompositeView::getDirection() const
|
||||
{
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
const std::vector<View*>& CompositeView::getViews() const
|
||||
{
|
||||
return m_views;
|
||||
}
|
||||
|
||||
std::string CompositeView::getName() const
|
||||
{
|
||||
return "CompositeView";
|
||||
}
|
||||
|
||||
void CompositeView::addView(View* view)
|
||||
{
|
||||
m_views.push_back(view);
|
||||
|
||||
addViewWidget(view);
|
||||
}
|
||||
|
||||
void CompositeView::removeView(View* view)
|
||||
{
|
||||
std::vector<View*>::iterator it = std::find(m_views.begin(), m_views.end(), view);
|
||||
if (it == m_views.end())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_views.erase(it);
|
||||
}
|
||||
|
||||
void CompositeView::showView(View* view)
|
||||
{
|
||||
getViewLayout()->showView(view);
|
||||
}
|
||||
|
||||
void CompositeView::hideView(View* view)
|
||||
{
|
||||
getViewLayout()->hideView(view);
|
||||
}
|
||||
|
||||
void CompositeView::loadLayout()
|
||||
{
|
||||
getViewLayout()->loadLayout();
|
||||
}
|
||||
|
||||
void CompositeView::saveLayout()
|
||||
{
|
||||
getViewLayout()->saveLayout();
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
#ifndef COMPOSITE_VIEW_H
|
||||
#define COMPOSITE_VIEW_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "component/view/View.h"
|
||||
#include "component/view/ViewLayout.h"
|
||||
|
||||
class CompositeView
|
||||
: public View
|
||||
, public ViewLayout
|
||||
{
|
||||
public:
|
||||
enum CompositeDirection
|
||||
{
|
||||
DIRECTION_HORIZONTAL,
|
||||
DIRECTION_VERTICAL
|
||||
};
|
||||
|
||||
CompositeView(ViewLayout* viewLayout, CompositeDirection direction);
|
||||
virtual ~CompositeView();
|
||||
|
||||
CompositeDirection getDirection() const;
|
||||
const std::vector<View*>& getViews() const;
|
||||
|
||||
virtual void addViewWidget(View* view) = 0;
|
||||
|
||||
// View implementation
|
||||
virtual std::string getName() const;
|
||||
|
||||
// ViewLayout implementation
|
||||
virtual void addView(View* view);
|
||||
virtual void removeView(View* view);
|
||||
|
||||
virtual void showView(View* view);
|
||||
virtual void hideView(View* view);
|
||||
|
||||
virtual void loadLayout();
|
||||
virtual void saveLayout();
|
||||
|
||||
private:
|
||||
std::vector<View*> m_views;
|
||||
CompositeDirection m_direction;
|
||||
};
|
||||
|
||||
#endif // COMPOSITE_VIEW_H
|
||||
@@ -10,7 +10,7 @@ GraphView::Metrics::Metrics()
|
||||
}
|
||||
|
||||
GraphView::GraphView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100, 100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "component/controller/RefreshController.h"
|
||||
|
||||
RefreshView::RefreshView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100, 100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "component/controller/SearchController.h"
|
||||
|
||||
SearchView::SearchView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100, 100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "component/controller/StatusBarController.h"
|
||||
|
||||
StatusBarView::StatusBarView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100,100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "component/controller/UndoRedoController.h"
|
||||
|
||||
UndoRedoView::UndoRedoView(ViewLayout* viewLayout)
|
||||
: View(viewLayout, Vec2i(100,100))
|
||||
: View(viewLayout)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#include "component/view/ViewWidgetWrapper.h"
|
||||
|
||||
View::View(ViewLayout* viewLayout, const Vec2i& minSize)
|
||||
View::View(ViewLayout* viewLayout)
|
||||
: m_viewLayout(viewLayout)
|
||||
, m_widgetWrapper(nullptr)
|
||||
, m_minSize(minSize)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -14,9 +13,16 @@ View::~View()
|
||||
m_viewLayout->removeView(this);
|
||||
}
|
||||
|
||||
void View::setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper)
|
||||
void View::init()
|
||||
{
|
||||
m_widgetWrapper = widgetWrapper;
|
||||
createWidgetWrapper();
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
void View::addToLayout()
|
||||
{
|
||||
m_viewLayout->addView(this);
|
||||
}
|
||||
|
||||
ViewWidgetWrapper* View::getWidgetWrapper() const
|
||||
@@ -29,22 +35,12 @@ void View::setComponent(Component* component)
|
||||
m_component = component;
|
||||
}
|
||||
|
||||
int View::getMinWidth() const
|
||||
{
|
||||
return m_minSize.x;
|
||||
}
|
||||
|
||||
int View::getMinHeight() const
|
||||
{
|
||||
return m_minSize.y;
|
||||
}
|
||||
|
||||
Vec2i View::getMinSize() const
|
||||
{
|
||||
return m_minSize;
|
||||
}
|
||||
|
||||
ViewLayout* View::getViewLayout() const
|
||||
{
|
||||
return m_viewLayout;
|
||||
}
|
||||
|
||||
void View::setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper)
|
||||
{
|
||||
m_widgetWrapper = widgetWrapper;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "component/view/CompositeView.h"
|
||||
|
||||
class CodeView;
|
||||
class GraphView;
|
||||
class MainView;
|
||||
@@ -19,6 +21,9 @@ public:
|
||||
virtual ~ViewFactory();
|
||||
|
||||
virtual std::shared_ptr<MainView> createMainView() const = 0;
|
||||
virtual std::shared_ptr<CompositeView> createCompositeView(
|
||||
ViewLayout* viewLayout, CompositeView::CompositeDirection direction) const = 0;
|
||||
|
||||
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const = 0;
|
||||
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const = 0;
|
||||
virtual std::shared_ptr<RefreshView> createRefreshView(ViewLayout* viewLayout) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user