Skip to content

Commit 5f7c1b9

Browse files
authored
Add reassign method to ListView (#164)
so we can reset external selection for instance
1 parent 1ff53de commit 5f7c1b9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/sst/jucegui/components/ListView.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ struct ListView : public juce::Component,
8080
void rowSelected(uint32_t r, bool select, const juce::ModifierKeys &mods);
8181
static SelectionAddAction selectionAddActionForModifier(const juce::ModifierKeys &);
8282

83+
void reassignAllComponents();
84+
8385
std::function<uint32_t()> getRowCount{nullptr};
8486
std::function<uint32_t()> getRowHeight{nullptr};
8587
std::function<std::unique_ptr<juce::Component>()> makeRowComponent{nullptr};

src/sst/jucegui/components/ListView.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ void ListView::refresh()
9696
repaint();
9797
}
9898

99+
void ListView::reassignAllComponents()
100+
{
101+
uint32_t idx{0};
102+
for (const auto &c : innards->components)
103+
{
104+
assignComponentToRow(c, idx);
105+
idx++;
106+
}
107+
}
108+
99109
void ListView::rowSelected(uint32_t r, bool b, const juce::ModifierKeys &mods)
100110
{
101111
if (mods.isShiftDown())

0 commit comments

Comments
 (0)