Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scene.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 #ifndef MIR_COMPOSITOR_SCENE_H_
20 #define MIR_COMPOSITOR_SCENE_H_
21 
22 #include "mir/geometry/forward.h"
24 
25 #include <memory>
26 #include <functional>
27 
28 namespace mir
29 {
30 namespace graphics { class Renderable; }
31 namespace compositor
32 {
33 
35 {
36 public:
37  virtual ~FilterForScene() {}
38 
39  virtual bool operator()(graphics::Renderable const&) = 0;
40 
41 protected:
42  FilterForScene() = default;
43  FilterForScene(const FilterForScene&) = delete;
44  FilterForScene& operator=(const FilterForScene&) = delete;
45 };
46 
48 {
49 public:
50  virtual ~OperatorForScene() {}
51 
52  virtual void operator()(graphics::Renderable const&) = 0;
53 
54 protected:
55  OperatorForScene() = default;
56  OperatorForScene(const OperatorForScene&) = delete;
58 
59 };
60 
61 class Scene
62 {
63 public:
64  virtual ~Scene() {}
65 
71 
72  // Back to front; normal rendering order
73  virtual void for_each_if(FilterForScene& filter, OperatorForScene& op) = 0;
74 
83  virtual void set_change_callback(std::function<void()> const& f) = 0;
84 
85  // Implement BasicLockable, to temporarily lock scene state:
86  virtual void lock() = 0;
87  virtual void unlock() = 0;
88 
89 protected:
90  Scene() = default;
91 
92 private:
93  Scene(Scene const&) = delete;
94  Scene& operator=(Scene const&) = delete;
95 };
96 
97 }
98 }
99 
100 #endif /* MIR_COMPOSITOR_SCENE_H_ */
OperatorForScene & operator=(const OperatorForScene &)=delete
virtual void for_each_if(FilterForScene &filter, OperatorForScene &op)=0
Definition: scene.h:34
virtual void operator()(graphics::Renderable const &)=0
Definition: scene.h:61
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
Definition: renderable.h:33
virtual void lock()=0
virtual ~Scene()
Definition: scene.h:64
FilterForScene & operator=(const FilterForScene &)=delete
virtual ~OperatorForScene()
Definition: scene.h:50
virtual ~FilterForScene()
Definition: scene.h:37
virtual graphics::RenderableList generate_renderable_list() const =0
Generate a valid list of renderables based on the current state of the Scene.
virtual bool operator()(graphics::Renderable const &)=0
Definition: scene.h:47
virtual void set_change_callback(std::function< void()> const &f)=0
Sets a callback to be called whenever the state of the Scene changes.
virtual void unlock()=0

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014