Hi,
i was just in need for changing the order of some IControls corresponding to a changing signal flow (e.g. FX chain). So i created an ISwapControl which changes control positions by drag and drop on a vertical or horizontal axis. Maybe it’s useful for you. Here’s a gist…
Attach ISwapControl
// Attaching an ISwapControl with initializer list
IRECT Handles = IRECT(0, 20, 0, 0);
pGraphics->AttachControl(MySwapControl1 = new IControlSwap({ctrl1, ctrl2 ctrl3, ctrl4, ctrl5}, Handles, [=](IControl* pControl){
std::cout << "New Order: ";
for(int i = 0; i < MySwapControl1->GetSize(); ++i){
std::cout << MySwapControl1->GetIdxAt(i) << " ";
}
std::cout << "\n";
}));
This file has been truncated. show original
ISwapControl
static constexpr int SLIDE_MS = 200;
static constexpr float HANDLESIZE = 25.f;
class IControlSwap : public IControl
{
public:
IControlSwap(const IRECT& handles = IRECT(), IActionFunction aF = nullptr, EDirection direction = EDirection::Horizontal)
: IControl(IRECT()), mHorizontal(direction == EDirection::Horizontal)
{
SetActionFunction(aF);
This file has been truncated. show original
1 Like