MirAL
window_info.h
Go to the documentation of this file.
1 /*
2  * Copyright © 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_INFO_H
20 #define MIRAL_WINDOW_INFO_H
21 
22 #include "miral/window.h"
24 
25 #include <mir/geometry/rectangles.h>
26 #include <mir/optional_value.h>
27 
28 #include <algorithm>
29 
30 namespace miral
31 {
32 struct WindowInfo
33 {
35 
36  WindowInfo();
37  WindowInfo(Window const& window, WindowSpecification const& params);
38  ~WindowInfo();
39  explicit WindowInfo(WindowInfo const& that);
40  WindowInfo& operator=(WindowInfo const& that);
41 
42  bool can_be_active() const;
43 
44  bool can_morph_to(MirSurfaceType new_type) const;
45 
46  bool must_have_parent() const;
47 
48  bool must_not_have_parent() const;
49 
50  bool is_visible() const;
51 
52  static bool needs_titlebar(MirSurfaceType type);
53 
54  void constrain_resize(mir::geometry::Point& requested_pos, mir::geometry::Size& requested_size) const;
55 
56  auto window() const -> Window&;
57 
58  auto name() const -> std::string;
59  void name(std::string const& name);
60 
61  auto type() const -> MirSurfaceType;
62  void type(MirSurfaceType type);
63 
64  auto state() const -> MirSurfaceState;
65  void state(MirSurfaceState state);
66 
67  auto restore_rect() const -> mir::geometry::Rectangle;
68  void restore_rect(mir::geometry::Rectangle const& restore_rect);
69 
70  auto parent() const -> Window;
71  void parent(Window const& parent);
72 
73  auto children() const -> std::vector <Window> const&;
74  void add_child(Window const& child);
75  void remove_child(Window const& child);
76 
77  auto min_width() const -> mir::geometry::Width;
78  void min_width(mir::geometry::Width min_width);
79 
80  auto min_height() const -> mir::geometry::Height;
81  void min_height(mir::geometry::Height min_height);
82 
83  auto max_width() const -> mir::geometry::Width;
84  void max_width(mir::geometry::Width max_width);
85 
86  auto max_height() const -> mir::geometry::Height;
87  void max_height(mir::geometry::Height max_height);
88 
89  auto width_inc() const -> mir::geometry::DeltaX;
90  void width_inc(mir::geometry::DeltaX width_inc);
91 
92  auto height_inc() const -> mir::geometry::DeltaY;
93  void height_inc(mir::geometry::DeltaY height_inc);
94 
95  auto min_aspect() const -> AspectRatio;
96  void min_aspect(AspectRatio min_aspect);
97 
98  auto max_aspect() const -> AspectRatio;
99  void max_aspect(AspectRatio max_aspect);
100 
101  bool has_output_id() const;
102  auto output_id() const -> int;
103  void output_id(mir::optional_value<int> output_id);
104 
105  auto preferred_orientation() const -> MirOrientationMode;
106  void preferred_orientation(MirOrientationMode preferred_orientation);
107 
109  void confine_pointer(MirPointerConfinementState confinement);
110 
112  auto userdata() const -> std::shared_ptr<void>;
113  void userdata(std::shared_ptr<void> userdata);
114 
115  void swap(WindowInfo& rhs) { std::swap(self, rhs.self); }
116 private:
117  struct Self;
118  std::unique_ptr<Self> self;
119 };
120 }
121 
122 namespace std
123 {
124 template<> inline void swap(miral::WindowInfo& lhs, miral::WindowInfo& rhs) { lhs.swap(rhs); }
125 }
126 
127 #endif //MIRAL_WINDOW_INFO_H
Definition: active_outputs.h:25
auto max_height() const -> mir::geometry::Height
void constrain_resize(mir::geometry::Point &requested_pos, mir::geometry::Size &requested_size) const
auto preferred_orientation() const -> MirOrientationMode
auto max_width() const -> mir::geometry::Width
bool must_not_have_parent() const
bool can_morph_to(MirSurfaceType new_type) const
auto confine_pointer() const -> MirPointerConfinementState
auto window() const -> Window &
auto output_id() const -> int
STL namespace.
void remove_child(Window const &child)
bool can_be_active() const
void swap(WindowInfo &rhs)
Definition: window_info.h:115
Definition: window_specification.h:63
auto max_aspect() const -> AspectRatio
MirPointerConfinementState
Definition: mir_forward_compatibility.h:123
Definition: window_info.h:32
auto type() const -> MirSurfaceType
Definition: window_specification.h:45
static bool needs_titlebar(MirSurfaceType type)
auto state() const -> MirSurfaceState
Handle class to manage a Mir surface. It may be null (e.g. default initialized)
Definition: window.h:37
auto min_width() const -> mir::geometry::Width
auto width_inc() const -> mir::geometry::DeltaX
bool has_output_id() const
auto restore_rect() const -> mir::geometry::Rectangle
bool is_visible() const
auto min_aspect() const -> AspectRatio
auto height_inc() const -> mir::geometry::DeltaY
bool must_have_parent() const
auto parent() const -> Window
WindowInfo & operator=(WindowInfo const &that)
auto children() const -> std::vector< Window > const &
auto min_height() const -> mir::geometry::Height
auto userdata() const -> std::shared_ptr< void >
This can be used by client code to store window manager specific information.
auto name() const -> std::string
Mir Abstraction Layer.
Definition: active_outputs.h:27
void add_child(Window const &child)

Copyright © 2016 Canonical Ltd.
Generated on Tue Dec 20 16:03:55 UTC 2016