Replace Old Widgets

This commit is contained in:
IlyaShurupov 2024-10-18 10:56:42 +03:00
parent cce8f0e1bc
commit fcd5eb2d2a
81 changed files with 388 additions and 278 deletions

View file

@ -1,39 +0,0 @@
#pragma once
#include "Layout.hpp"
#include "DebugManager.hpp"
#include <map>
#include <vector>
namespace tp {
class LayoutManager {
friend DebugManager;
struct DepNode {
std::vector<Widget*> depends;
int references = 0;
int depth = 0;
};
public:
LayoutManager() = default;
void adjust(Widget* root);
private:
void findDependencies(Widget* root);
void topologicalSort(Widget* root, int depth = 0);
void adjustLayouts();
private:
int getLayoutOrder(WidgetLayout* parent, WidgetLayout* child) const;
private:
std::map<Widget*, DepNode> mDepGraph;
std::vector<Widget*> mRoots;
std::vector<std::pair<Widget*, int>> mLayOrder;
bool mVertical = false;
};
}