Files
Sourcetrail/src/lib/component/controller/helper/ListLayouter.h
T
Eberhard Graether 4dd032dcff ui: Multi-column layout within access nodes if no child node has edges
* use multiple columns for access nodes if no child has edges
* try to layout close to a square
* layout neighboring accesses to the width of the largest
* increase threshold to hide children on parent activation to 100
* use square layouting in inheritance trees as well
2019-04-16 16:24:38 +02:00

31 lines
1.1 KiB
C++

#ifndef LIST_LAYOUTER_H
#define LIST_LAYOUTER_H
#include <memory>
#include <vector>
#include "Vector2.h"
#include "Vector4.h"
struct DummyNode;
class ListLayouter
{
public:
static void layoutRow(std::vector<std::shared_ptr<DummyNode>>* nodes, int gap);
static void layoutColumn(std::vector<std::shared_ptr<DummyNode>>* nodes, int gap);
static void layoutMultiColumn(Vec2i viewSize, std::vector<std::shared_ptr<DummyNode>>* nodes);
static void layoutSquare(std::vector<std::shared_ptr<DummyNode>>* nodes, int maxWidth);
static void layoutSkewed(std::vector<std::shared_ptr<DummyNode>>* nodes, int gapX, int gapY, int maxWidth);
static Vec4i boundingRect(const std::vector<std::shared_ptr<DummyNode>>& nodes);
static Vec2i offsetNodes(std::vector<std::shared_ptr<DummyNode>> nodes, int top, int left);
private:
static void layoutSimple(std::vector<std::shared_ptr<DummyNode>>* nodes, int gapX, int gapY, bool horizontal);
static bool layoutSquareInternal(std::vector<std::shared_ptr<DummyNode>>& visibleNodes, const Vec2i& maxSize, const Vec2i& gap);
};
#endif // LIST_LAYOUTER_H