YggdrasilWM  0.1.1
A tiny window manager coded in C++
MasterSpace.hpp
Go to the documentation of this file.
1 
28 #ifndef YGGDRASILWM_MASTERSPACE_HPP
29 #define YGGDRASILWM_MASTERSPACE_HPP
30 #include "Layouts/Point.hpp"
31 #include <memory>
32 #include <vector>
33 class Client;
34 class MasterSpace {
35 public:
36  MasterSpace(Point pos,
37  Point size,
38  int index,
39  bool master,
40  bool vertical,
41  MasterSpace* parent = nullptr);
43  const Point &getPos() const;
44  void setPos(const Point &pos);
45  const Point &getSize() const;
46  void setSize(const Point &size);
47  bool isMaster() const;
48  void setIsMaster(bool isMaster);
49  bool isVertical() const;
50  void setIsVertical(bool isVertical);
51  int getIndex() const;
52  void setIndex(int index);
53  int getSubspaceCount() const;
54  void setSubspaceCount(int subspaceCount);
55  MasterSpace *getParent() const;
56  void setParent(MasterSpace *parent);
57  MasterSpace *getMaster() const;
58  void setMaster(std::unique_ptr<MasterSpace>master);
59  const std::vector<std::unique_ptr<MasterSpace>> &getSlaves() const;
60  const std::weak_ptr<Client> &getClient() const;
61 
62  void setClient(const std::weak_ptr<Client> &client);
63 
64 private:
67  bool is_master_;
69  int index_;
72  std::unique_ptr<MasterSpace> master_;
73  std::vector<std::unique_ptr<MasterSpace>> slaves_;
74  std::weak_ptr<Client> client_;
75 };
76 #endif //YGGDRASILWM_MASTERSPACE_HPP
The Client class is responsible for managing the client windows. It creates a frame around the client...
Definition: Client.hpp:47
Definition: MasterSpace.hpp:34
Point size_
Definition: MasterSpace.hpp:66
bool is_vertical_
Definition: MasterSpace.hpp:68
const std::vector< std::unique_ptr< MasterSpace > > & getSlaves() const
Definition: MasterSpace.cpp:62
int getIndex() const
Definition: MasterSpace.cpp:54
const Point & getSize() const
Definition: MasterSpace.cpp:48
void setIsVertical(bool isVertical)
Definition: MasterSpace.cpp:53
MasterSpace * getParent() const
Definition: MasterSpace.cpp:58
MasterSpace * getMaster() const
Definition: MasterSpace.cpp:60
int subspace_count_
Definition: MasterSpace.hpp:70
Point pos_
Definition: MasterSpace.hpp:65
void setSubspaceCount(int subspaceCount)
Definition: MasterSpace.cpp:57
void setSize(const Point &size)
Definition: MasterSpace.cpp:49
MasterSpace * parent_
Definition: MasterSpace.hpp:71
int getSubspaceCount() const
Definition: MasterSpace.cpp:56
std::vector< std::unique_ptr< MasterSpace > > slaves_
Definition: MasterSpace.hpp:73
void setPos(const Point &pos)
Definition: MasterSpace.cpp:47
bool is_master_
Definition: MasterSpace.hpp:67
MasterSpace(Point pos, Point size, int index, bool master, bool vertical, MasterSpace *parent=nullptr)
Definition: MasterSpace.cpp:29
void setParent(MasterSpace *parent)
Definition: MasterSpace.cpp:59
const Point & getPos() const
Definition: MasterSpace.cpp:46
bool isVertical() const
Definition: MasterSpace.cpp:52
void setClient(const std::weak_ptr< Client > &client)
Definition: MasterSpace.cpp:64
std::weak_ptr< Client > client_
Definition: MasterSpace.hpp:74
int index_
Definition: MasterSpace.hpp:69
void setIsMaster(bool isMaster)
Definition: MasterSpace.cpp:51
std::unique_ptr< MasterSpace > master_
Definition: MasterSpace.hpp:72
bool isMaster() const
Definition: MasterSpace.cpp:50
const std::weak_ptr< Client > & getClient() const
Definition: MasterSpace.cpp:63
void setIndex(int index)
Definition: MasterSpace.cpp:55
void setMaster(std::unique_ptr< MasterSpace >master)
Definition: MasterSpace.cpp:61
Point struct This struct represents a 2D point.
Definition: Point.hpp:8