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 
59  bool has_name() const __attribute__((deprecated));
60  auto name() const -> std::string;
61  void name(std::string const& name);
62 
63  auto type() const -> MirSurfaceType;
64  void type(MirSurfaceType type);
65 
66  auto state() const -> MirSurfaceState;
67  void state(MirSurfaceState state);
68 
69  auto restore_rect() const -> mir::geometry::Rectangle;
70  void restore_rect(mir::geometry::Rectangle const& restore_rect);
71 
72  auto parent() const -> Window;
73  void parent(Window const& parent);
74 
75  auto children() const -> std::vector <Window> const&;
76  void add_child(Window const& child);
77  void remove_child(Window const& child);
78 
79  auto min_width() const -> mir::geometry::Width;
80  void min_width(mir::geometry::Width min_width);
81 
82  auto min_height() const -> mir::geometry::Height;
83  void min_height(mir::geometry::Height min_height);
84 
85  auto max_width() const -> mir::geometry::Width;
86  void max_width(mir::geometry::Width max_width);
87 
88  auto max_height() const -> mir::geometry::Height;
89  void max_height(mir::geometry::Height max_height);
90 
91  auto width_inc() const -> mir::geometry::DeltaX;
92  void width_inc(mir::geometry::DeltaX width_inc);
93 
94  auto height_inc() const -> mir::geometry::DeltaY;
95  void height_inc(mir::geometry::DeltaY height_inc);
96 
97  auto min_aspect() const -> AspectRatio;
98  void min_aspect(AspectRatio min_aspect);
99 
100  auto max_aspect() const -> AspectRatio;
101  void max_aspect(AspectRatio max_aspect);
102 
103  bool has_output_id() const;
104  auto output_id() const -> int;
105  void output_id(mir::optional_value<int> output_id);
106 
107  auto preferred_orientation() const -> MirOrientationMode;
108  void preferred_orientation(MirOrientationMode preferred_orientation);
109 
111  void confine_pointer(MirPointerConfinementState confinement);
112 
114  auto userdata() const -> std::shared_ptr<void>;
115  void userdata(std::shared_ptr<void> userdata);
116 
117  void swap(WindowInfo& rhs) { std::swap(self, rhs.self); }
118 private:
119  struct Self;
120  std::unique_ptr<Self> self;
121 };
122 }
123 
124 namespace std
125 {
126 template<> inline void swap(miral::WindowInfo& lhs, miral::WindowInfo& rhs) { lhs.swap(rhs); }
127 }
128 
129 #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:117
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
bool has_name() const __attribute__((deprecated))
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 Wed Nov 30 08:45:30 UTC 2016