iPlug2 - C++ Audio Plug-in Framework
Loading...
Searching...
No Matches
IGraphicsFlexBox.h
1/*
2 ==============================================================================
3
4 This file is part of the iPlug 2 library. Copyright (C) the iPlug 2 developers.
5
6 See LICENSE.txt for more info.
7
8 ==============================================================================
9*/
10
11#pragma once
12
13#include "Yoga.h"
14#include "IGraphicsStructs.h"
15
16BEGIN_IPLUG_NAMESPACE
17BEGIN_IGRAPHICS_NAMESPACE
18
22{
23public:
24 IFlexBox();
25
26 ~IFlexBox();
27
35 void Init(const IRECT& r, YGFlexDirection direction = YGFlexDirectionRow, YGJustify justify = YGJustifyFlexStart, YGWrap wrap = YGWrapNoWrap, float padding = 0.f, float margin = 0.f);
36
45 YGNodeRef AddItem(float width, float height, YGAlign alignSelf = YGAlignAuto, float grow = 0.f, float shrink = 1.f, float margin = 0.f);
46
49 void AddItem(YGNodeRef item);
50
53 void CalcLayout(YGDirection direction = YGDirectionLTR);
54
56 IRECT GetRootBounds() const;
57
59 IRECT GetItemBounds(int nodeIndex) const;
60
61private:
62 int mNodeCounter = 0;
63 YGConfigRef mConfigRef;
64 YGNodeRef mRootNodeRef;
65};
66
67END_IPLUG_NAMESPACE
68END_IGRAPHICS_NAMESPACE
IFlexBox is a basic C++ helper for Yoga https://yogalayout.com.
YGNodeRef AddItem(float width, float height, YGAlign alignSelf=YGAlignAuto, float grow=0.f, float shrink=1.f, float margin=0.f)
Add a flex item, with some parameters.
void CalcLayout(YGDirection direction=YGDirectionLTR)
Calculate the layout, call after add all items.
IRECT GetItemBounds(int nodeIndex) const
Get the bounds for a particular flex item.
void Init(const IRECT &r, YGFlexDirection direction=YGFlexDirectionRow, YGJustify justify=YGJustifyFlexStart, YGWrap wrap=YGWrapNoWrap, float padding=0.f, float margin=0.f)
Initialize the IFlexBox flex container.
IRECT GetRootBounds() const
Get an IRECT of the root node bounds.
Used to manage a rectangular area, independent of draw class/platform.