YggdrasilWM  0.1.1
A tiny window manager coded in C++
TreeLayoutManager.hpp
Go to the documentation of this file.
1 
29 #ifndef YGGDRASILWM_TREELAYOUTMANAGER_HPP
30 #define YGGDRASILWM_TREELAYOUTMANAGER_HPP
31 #include "LayoutManager.hpp"
32 #include <iostream>
33 #include "Layouts/BinarySpace.hpp"
45 public:
61  TreeLayoutManager(Display* display,
62  Window root,
63  int sizeX,
64  int sizeY,
65  int posX,
66  int posY,
67  int borderSize,
68  int gap,
69  int barHeight);
73  ~TreeLayoutManager() override;
78  void updateGeometry(unsigned int sizeX, unsigned int sizeY, unsigned int posX, unsigned int posY) override;
79  void reSize(const Point &size, const Point &pos) override;
80  void recursiveResize(const Point &size, const Point &pos, BinarySpace *space);
88  BinarySpace *findSpace(Client* client);
97  BinarySpace *findSpace(int index);
106  void addClient(std::shared_ptr<Client> client) override;
113  void addClientRecursive(std::shared_ptr<Client> client, BinarySpace *space);
122  void placeClientInSpace(const std::shared_ptr<Client>& client, BinarySpace *space);
132  void splitSpace(const std::shared_ptr<Client>& client, BinarySpace *space, bool splitAlongX);
139  void removeClient(Client *client) override;
146  void removeClientRecursive(Client *client, BinarySpace* space);
153  void growSpace(Client *client, int inc);
154  void recursiveShrinkSiblingSpace(BinarySpace *space, int inc, bool vertical);
155 private:
156  std::unique_ptr<BinarySpace> rootSpace_;
157  void deleteSpace(BinarySpace *space);
158 };
159 #endif //YGGDRASILWM_TREELAYOUTMANAGER_HPP
BinarySpace class header.
LayoutManager class header.
BinarySpace class This class represents a space in the layout. it's designed like a binary tree,...
Definition: BinarySpace.hpp:41
The Client class is responsible for managing the client windows. It creates a frame around the client...
Definition: Client.hpp:47
LayoutManager class Interface for the layout managers.
Definition: LayoutManager.hpp:42
TreeLayoutManager class this class is a subclass of LayoutManager it handles the tree style layout Wh...
Definition: TreeLayoutManager.hpp:44
BinarySpace * findSpace(Client *client)
find the space containing the client it looks recursively for the space containing the client
Definition: TreeLayoutManager.cpp:75
void addClient(std::shared_ptr< Client > client) override
add a client to the layout it looks for the biggest space and splits it in two
Definition: TreeLayoutManager.cpp:110
TreeLayoutManager(Display *display, Window root, int sizeX, int sizeY, int posX, int posY, int borderSize, int gap, int barHeight)
Construct a new Tree Layout Manager object the size and position of the root space should take accoun...
Definition: TreeLayoutManager.cpp:29
void addClientRecursive(std::shared_ptr< Client > client, BinarySpace *space)
Definition: TreeLayoutManager.cpp:113
void removeClientRecursive(Client *client, BinarySpace *space)
recursive method to add a client to the layout
Definition: TreeLayoutManager.cpp:85
void recursiveShrinkSiblingSpace(BinarySpace *space, int inc, bool vertical)
Definition: TreeLayoutManager.cpp:201
void recursiveResize(const Point &size, const Point &pos, BinarySpace *space)
Definition: TreeLayoutManager.cpp:222
void deleteSpace(BinarySpace *space)
Definition: TreeLayoutManager.cpp:43
~TreeLayoutManager() override
Destroy the Tree Layout Manager object.
Definition: TreeLayoutManager.cpp:52
BinarySpace * findSpaceRecursive(Client *client, BinarySpace *space)
recursive method to find the space containing the client
Definition: TreeLayoutManager.cpp:56
void updateGeometry(unsigned int sizeX, unsigned int sizeY, unsigned int posX, unsigned int posY) override
update the geometry of the layout (resize)
Definition: TreeLayoutManager.cpp:53
void removeClient(Client *client) override
remove a client from the layout use the recursive method to remove the client
Definition: TreeLayoutManager.cpp:82
std::unique_ptr< BinarySpace > rootSpace_
Definition: TreeLayoutManager.hpp:156
void reSize(const Point &size, const Point &pos) override
Definition: TreeLayoutManager.cpp:214
void growSpace(Client *client, int inc)
grow the space of the client in the x axis
Definition: TreeLayoutManager.cpp:165
void splitSpace(const std::shared_ptr< Client > &client, BinarySpace *space, bool splitAlongX)
split a space in two Move the client to the left space and the old client to the right space increase...
Definition: TreeLayoutManager.cpp:139
void placeClientInSpace(const std::shared_ptr< Client > &client, BinarySpace *space)
place a client in a space moves and resizes the client window to fit the space restack the client win...
Definition: TreeLayoutManager.cpp:132
Point struct This struct represents a 2D point.
Definition: Point.hpp:8