Mir
zone.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2019 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 2 or 3 as
6  * 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 
17 #ifndef MIRAL_ZONE_H
18 #define MIRAL_ZONE_H
19 
20 #include <mir_toolkit/common.h>
21 
22 #include <mir/geometry/rectangle.h>
23 #include <mir/int_wrapper.h>
24 
25 #include <memory>
26 
27 namespace miral
28 {
29 using namespace mir::geometry;
30 
31 /// A rectangular area of the display.
32 /// Not tied to a specific output.
33 class Zone
34 {
35 public:
36 
37  Zone(Rectangle const& extents); ///< Create a new zone with the given extents
38  Zone(Zone const& other); ///< Makes a copy of the underlying private data
39  Zone& operator=(Zone const& other); ///< Copies private data by value
40  ~Zone();
41 
42  /// Returns true only if all properties including IDs match
43  auto operator==(Zone const& other) const -> bool;
44 
45  /// Returns if true if zone IDs match, even if extents are different
46  auto is_same_zone(Zone const& other) const -> bool;
47 
48  /// The area of this zone in global display coordinates
49  auto extents() const -> Rectangle;
50 
51  /// Set the extents of this zone
52  /// Does not make this a different zone
53  void extents(Rectangle const& extents);
54 
55  /// An arbitrary number that uniquely identifies this zone, reguardless of how it is resized and moved
56  /// \remark Since MirAL 3.6
57  auto id() const -> int;
58 
59 private:
60  class Self;
61  std::unique_ptr<Self> self;
62 };
63 }
64 
65 #endif // MIRAL_ZONE_H

Copyright © 2012-2022 Canonical Ltd.
Generated on Thu Sep 8 12:37:23 UTC 2022
This documentation is licensed under the GPL version 2 or 3.