Mir
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  * Daniel d'Andradra <daniel.dandrada@canonical.com>
18  */
19 
20 #ifndef MIR_INPUT_INPUT_SCENE_H_
21 #define MIR_INPUT_INPUT_SCENE_H_
22 
24 
25 #include <memory>
26 
27 namespace mir
28 {
29 namespace scene
30 {
31 class Observer;
32 }
33 namespace graphics
34 {
35 class Renderable;
36 }
37 
38 namespace input
39 {
40 class Surface;
41 
42 class Scene
43 {
44 public:
45  virtual ~Scene() = default;
46 
47  virtual void for_each(std::function<void(std::shared_ptr<input::Surface> const&)> const& callback) = 0;
48 
49  virtual void add_observer(std::shared_ptr<scene::Observer> const& observer) = 0;
50  virtual void remove_observer(std::weak_ptr<scene::Observer> const& observer) = 0;
51 
52  // An interface which the input stack can use to add certain non interactive input visualizations
53  // in to the scene (i.e. cursors, touchspots). Overlay renderables will be rendered above all surfaces.
54  // Within the set of overlay renderables, rendering order is undefined.
55  virtual void add_input_visualization(std::shared_ptr<graphics::Renderable> const& overlay) = 0;
56  virtual void remove_input_visualization(std::weak_ptr<graphics::Renderable> const& overlay) = 0;
57 
58  // As input visualizations added through the overlay system will not use the standard SurfaceObserver
59  // mechanism, we require this method to trigger recomposition.
60  // TODO: How can something like SurfaceObserver be adapted to work with non surface renderables?
61  virtual void emit_scene_changed() = 0;
62 
63 protected:
64  Scene() = default;
65  Scene(Scene const&) = delete;
66  Scene& operator=(Scene const&) = delete;
67 };
68 
69 }
70 }
71 
72 #endif // MIR_INPUT_INPUT_SCENE
Definition: scene.h:42
Scene & operator=(Scene const &)=delete
All things Mir.
Definition: buffer_stream.h:37
virtual void remove_observer(std::weak_ptr< scene::Observer > const &observer)=0
virtual void add_observer(std::shared_ptr< scene::Observer > const &observer)=0
Definition: hwc_layers.h:45
virtual void emit_scene_changed()=0
virtual void add_input_visualization(std::shared_ptr< graphics::Renderable > const &overlay)=0
virtual ~Scene()=default
virtual void for_each(std::function< void(std::shared_ptr< input::Surface > const &)> const &callback)=0
virtual void remove_input_visualization(std::weak_ptr< graphics::Renderable > const &overlay)=0

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015