#include "LuaListComponent.h" LuaListComponent::LuaListComponent(int sliderNum) { juce::String sliderName = ""; sliderNum++; while (sliderNum > 0) { int mod = (sliderNum - 1) % 26; sliderName = (char)(mod + 'A') + sliderName; sliderNum = (sliderNum - mod) / 26; } effectComponent = std::make_shared(0.0, 1.0, 0.01, 0, "Lua " + sliderName, "lua" + sliderName); effectComponent->setHideCheckbox(true); addAndMakeVisible(*effectComponent); } LuaListComponent::~LuaListComponent() {} void LuaListComponent::resized() { effectComponent->setBounds(getLocalBounds()); } void paintListBoxItem(int sliderNum, juce::Graphics& g, int width, int height, bool rowIsSelected) {} int LuaListBoxModel::getNumRows() { return numSliders + 1; } void LuaListBoxModel::paintListBoxItem(int rowNumber, juce::Graphics& g, int width, int height, bool rowIsSelected) {} juce::Component* LuaListBoxModel::refreshComponentForRow(int sliderNum, bool isRowSelected, juce::Component *existingComponentToUpdate) { if (sliderNum < getNumRows() - 1) { std::unique_ptr item(dynamic_cast(existingComponentToUpdate)); if (juce::isPositiveAndBelow(sliderNum, getNumRows())) { item = std::make_unique(sliderNum); } return item.release(); } else { std::unique_ptr item(dynamic_cast(existingComponentToUpdate)); item = std::make_unique("Add"); item->onClick = [this]() { numSliders++; listBox.updateContent(); }; return item.release(); } }