neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
controller.hpp
Go to the documentation of this file.
1// controller.hpp
2/*
3neogfx C++ App/Game Engine
4Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6This program is free software: you can redistribute it and / or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
23#include <neogfx/core/event.hpp>
25
26namespace neogfx::mvc
27{
28 class controller : public i_controller
29 {
30 public:
31 define_declared_event(ViewAdded, view_added, i_view&)
33 public:
34 controller(i_model& aModel, i_view_container& aContainer);
35 public:
36 virtual const i_model& model() const;
37 virtual i_model& model();
38 public:
39 virtual void add_view(i_view& aView);
40 virtual void add_view(std::shared_ptr<i_view> aView);
41 virtual void remove_view(i_view& aView);
42 virtual bool only_weak_views() const;
43 public:
44 virtual const i_view_container& container() const;
46 private:
47 i_model& iModel;
48 i_view_container& iContainer;
49 std::vector<std::shared_ptr<i_view>> iViews;
50 };
51}
virtual bool only_weak_views() const
virtual void add_view(i_view &aView)
define_declared_event(ViewAdded, view_added, i_view &) define_declared_event(ViewRemoved
virtual void remove_view(i_view &aView)
virtual const i_view_container & container() const
Definition plf_hive.h:79
#define define_declared_event(name, declName,...)
Definition event.hpp:195