text
stringlengths 0
2.2M
|
---|
==============================================================================
|
*/
|
#include <JuceHeader.h>
|
#include "../UI/GraphEditorPanel.h"
|
#include "InternalPlugins.h"
|
#include "../UI/MainHostWindow.h"
|
#include "IOConfigurationWindow.h"
|
//==============================================================================
|
struct NumberedBoxes : public TableListBox,
|
private TableListBoxModel,
|
private Button::Listener
|
{
|
struct Listener
|
{
|
virtual ~Listener() {}
|
virtual void addColumn() = 0;
|
virtual void removeColumn() = 0;
|
virtual void columnSelected (int columnId) = 0;
|
};
|
enum
|
{
|
plusButtonColumnId = 128,
|
minusButtonColumnId = 129
|
};
|
//==============================================================================
|
NumberedBoxes (Listener& listenerToUse, bool canCurrentlyAddColumn, bool canCurrentlyRemoveColumn)
|
: TableListBox ("NumberedBoxes", this),
|
listener (listenerToUse),
|
canAddColumn (canCurrentlyAddColumn),
|
canRemoveColumn (canCurrentlyRemoveColumn)
|
{
|
auto& tableHeader = getHeader();
|
for (int i = 0; i < 16; ++i)
|
tableHeader.addColumn (String (i + 1), i + 1, 40);
|
setHeaderHeight (0);
|
setRowHeight (40);
|
getHorizontalScrollBar().setAutoHide (false);
|
}
|
void setSelected (int columnId)
|
{
|
if (auto* button = dynamic_cast<TextButton*> (getCellComponent (columnId, 0)))
|
button->setToggleState (true, NotificationType::dontSendNotification);
|
}
|
void setCanAddColumn (bool canCurrentlyAdd)
|
{
|
if (canCurrentlyAdd != canAddColumn)
|
{
|
canAddColumn = canCurrentlyAdd;
|
if (auto* button = dynamic_cast<TextButton*> (getCellComponent (plusButtonColumnId, 0)))
|
button->setEnabled (true);
|
}
|
}
|
void setCanRemoveColumn (bool canCurrentlyRemove)
|
{
|
if (canCurrentlyRemove != canRemoveColumn)
|
{
|
canRemoveColumn = canCurrentlyRemove;
|
if (auto* button = dynamic_cast<TextButton*> (getCellComponent (minusButtonColumnId, 0)))
|
button->setEnabled (true);
|
}
|
}
|
private:
|
//==============================================================================
|
Listener& listener;
|
bool canAddColumn, canRemoveColumn;
|
//==============================================================================
|
int getNumRows() override { return 1; }
|
void paintCell (Graphics&, int, int, int, int, bool) override {}
|
void paintRowBackground (Graphics& g, int, int, int, bool) override { g.fillAll (Colours::grey); }
|
Component* refreshComponentForCell (int, int columnId, bool,
|
Component* existingComponentToUpdate) override
|
{
|
auto* textButton = dynamic_cast<TextButton*> (existingComponentToUpdate);
|
if (textButton == nullptr)
|
textButton = new TextButton();
|
textButton->setButtonText (getButtonName (columnId));
|
textButton->setConnectedEdges (Button::ConnectedOnLeft | Button::ConnectedOnRight |
|
Button::ConnectedOnTop | Button::ConnectedOnBottom);
|
const bool isPlusMinusButton = (columnId == plusButtonColumnId || columnId == minusButtonColumnId);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.