YggdrasilWM  0.1.1
A tiny window manager coded in C++
BinarySpace.hpp
Go to the documentation of this file.
1 
28 #include <memory>
29 #include <stdexcept>
30 #include "Layouts/Point.hpp"
31 class Client;
41 class BinarySpace {
42 private:
45  int index_;
48  std::unique_ptr<BinarySpace> right_;
49  std::unique_ptr<BinarySpace> left_;
50  std::weak_ptr<Client> client_;
51 public:
60  BinarySpace(Point pos, Point size, int index, BinarySpace* parent = nullptr);
61  ~BinarySpace() = default;
66  const Point &getPos() const;
72  void setPos(const Point &pos);
78  const Point &getSize() const;
85  void setSize(const Point &size);
90  int getSubspaceCount() const;
96  int getIndex() const;
102  void setIndex(int index);
108  BinarySpace *getParent() const;
114  void setParent(BinarySpace *parent);
120  const std::unique_ptr<BinarySpace> &getRight() const;
126  void setRight(std::unique_ptr<BinarySpace> right);
132  const std::unique_ptr<BinarySpace> &getLeft() const;
138  void setLeft(std::unique_ptr<BinarySpace> left);
144  std::shared_ptr<Client> getClient() const;
150  void setClient(std::shared_ptr<Client> client);
155  void incSubSpaceCount();
156 };
BinarySpace class This class represents a space in the layout. it's designed like a binary tree,...
Definition: BinarySpace.hpp:41
std::unique_ptr< BinarySpace > right_
Definition: BinarySpace.hpp:48
std::shared_ptr< Client > getClient() const
Definition: BinarySpace.cpp:28
const std::unique_ptr< BinarySpace > & getRight() const
Definition: BinarySpace.cpp:24
int index_
Definition: BinarySpace.hpp:45
BinarySpace * getParent() const
Definition: BinarySpace.cpp:22
void setIndex(int index)
Definition: BinarySpace.cpp:21
void setLeft(std::unique_ptr< BinarySpace > left)
Definition: BinarySpace.cpp:27
const Point & getSize() const
Definition: BinarySpace.cpp:18
void incSubSpaceCount()
Definition: BinarySpace.cpp:16
std::unique_ptr< BinarySpace > left_
Definition: BinarySpace.hpp:49
int getSubspaceCount() const
Definition: BinarySpace.cpp:36
BinarySpace(Point pos, Point size, int index, BinarySpace *parent=nullptr)
Construct a new BinarySpace object.
Definition: BinarySpace.cpp:4
void setPos(const Point &pos)
Definition: BinarySpace.cpp:17
const Point & getPos() const
Definition: BinarySpace.cpp:15
std::weak_ptr< Client > client_
Definition: BinarySpace.hpp:50
int subspace_count_
Definition: BinarySpace.hpp:46
void setClient(std::shared_ptr< Client > client)
Definition: BinarySpace.cpp:35
const std::unique_ptr< BinarySpace > & getLeft() const
Definition: BinarySpace.cpp:26
int getIndex() const
Definition: BinarySpace.cpp:20
BinarySpace * parent_
Definition: BinarySpace.hpp:47
void setRight(std::unique_ptr< BinarySpace > right)
Definition: BinarySpace.cpp:25
Point pos_
Definition: BinarySpace.hpp:43
void setParent(BinarySpace *parent)
Definition: BinarySpace.cpp:23
void setSize(const Point &size)
Definition: BinarySpace.cpp:19
Point size_
Definition: BinarySpace.hpp:44
~BinarySpace()=default
The Client class is responsible for managing the client windows. It creates a frame around the client...
Definition: Client.hpp:47
Point struct This struct represents a 2D point.
Definition: Point.hpp:8