MirAL
window_management_options.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014-2016 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIRAL_WINDOW_MANAGEMENT_OPTIONS_H_
20 #define MIRAL_WINDOW_MANAGEMENT_OPTIONS_H_
21 
22 #include <functional>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 namespace mir
28 {
29 class Server;
30 }
31 
32 namespace miral
33 {
34 class WindowManagerTools;
35 class WindowManagementPolicy;
36 
38  std::function<std::unique_ptr<miral::WindowManagementPolicy>(WindowManagerTools const& tools)>;
39 
41 {
42  std::string const name;
44 };
45 
46 template<typename Policy, typename ...Args>
47 inline auto add_window_manager_policy(std::string const& name, Args&... args) -> WindowManagerOption
48 {
49  return {name, [&args...](WindowManagerTools const& tools) -> std::unique_ptr<miral::WindowManagementPolicy>
50  { return std::make_unique<Policy>(tools, args...); }};
51 }
52 
54 {
55 public:
56  WindowManagerOptions() = default;
57  explicit WindowManagerOptions(std::initializer_list<WindowManagerOption> const& policies) : policies(policies) {}
58 
59  void operator()(mir::Server& server) const;
60 
61  std::vector<WindowManagerOption> const policies;
62 };
63 }
64 
65 #endif // MIRAL_WINDOW_MANAGEMENT_OPTIONS_H_
Definition: window_management_options.h:40
Definition: blob.h:26
std::vector< WindowManagerOption > const policies
Definition: window_management_options.h:61
std::string const name
Definition: window_management_options.h:42
Window management functions for querying and updating MirAL&#39;s model.
Definition: window_manager_tools.h:58
Definition: window_management_options.h:53
WindowManagementPolicyBuilder const build
Definition: window_management_options.h:43
std::function< std::unique_ptr< miral::WindowManagementPolicy >(WindowManagerTools const &tools)> WindowManagementPolicyBuilder
Definition: window_management_options.h:38
WindowManagerOptions(std::initializer_list< WindowManagerOption > const &policies)
Definition: window_management_options.h:57
auto add_window_manager_policy(std::string const &name, Args &... args) -> WindowManagerOption
Definition: window_management_options.h:47
Mir Abstraction Layer.
Definition: active_outputs.h:27

Copyright © 2016 Canonical Ltd.
Generated on Thu Mar 30 14:25:04 UTC 2017