mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Fix for ListBox::getRowNumberOfComponent
This commit is contained in:
parent
b51cc38718
commit
898080d187
1 changed files with 10 additions and 8 deletions
|
|
@ -174,7 +174,7 @@ public:
|
|||
|
||||
int getRowNumberOfComponent (Component* const rowComponent) const noexcept
|
||||
{
|
||||
const int index = getIndexOfChildComponent (rowComponent);
|
||||
const int index = getViewedComponent()->getIndexOfChildComponent (rowComponent);
|
||||
const int num = rows.size();
|
||||
|
||||
for (int i = num; --i >= 0;)
|
||||
|
|
@ -196,15 +196,16 @@ public:
|
|||
{
|
||||
hasUpdated = false;
|
||||
|
||||
const int newX = getViewedComponent()->getX();
|
||||
int newY = getViewedComponent()->getY();
|
||||
Component& content = *getViewedComponent();
|
||||
const int newX = content.getX();
|
||||
int newY = content.getY();
|
||||
const int newW = jmax (owner.minimumRowWidth, getMaximumVisibleWidth());
|
||||
const int newH = owner.totalItems * owner.getRowHeight();
|
||||
|
||||
if (newY + newH < getMaximumVisibleHeight() && newH > getMaximumVisibleHeight())
|
||||
newY = getMaximumVisibleHeight() - newH;
|
||||
|
||||
getViewedComponent()->setBounds (newX, newY, newW, newH);
|
||||
content.setBounds (newX, newY, newW, newH);
|
||||
|
||||
if (makeSureItUpdatesContent && ! hasUpdated)
|
||||
updateContents();
|
||||
|
|
@ -214,11 +215,12 @@ public:
|
|||
{
|
||||
hasUpdated = true;
|
||||
const int rowH = owner.getRowHeight();
|
||||
Component& content = *getViewedComponent();
|
||||
|
||||
if (rowH > 0)
|
||||
{
|
||||
const int y = getViewPositionY();
|
||||
const int w = getViewedComponent()->getWidth();
|
||||
const int w = content.getWidth();
|
||||
|
||||
const int numNeeded = 2 + getMaximumVisibleHeight() / rowH;
|
||||
rows.removeRange (numNeeded, rows.size());
|
||||
|
|
@ -227,7 +229,7 @@ public:
|
|||
{
|
||||
RowComponent* newRow = new RowComponent (owner);
|
||||
rows.add (newRow);
|
||||
getViewedComponent()->addAndMakeVisible (newRow);
|
||||
content.addAndMakeVisible (newRow);
|
||||
}
|
||||
|
||||
firstIndex = y / rowH;
|
||||
|
|
@ -247,10 +249,10 @@ public:
|
|||
}
|
||||
|
||||
if (owner.headerComponent != nullptr)
|
||||
owner.headerComponent->setBounds (owner.outlineThickness + getViewedComponent()->getX(),
|
||||
owner.headerComponent->setBounds (owner.outlineThickness + content.getX(),
|
||||
owner.outlineThickness,
|
||||
jmax (owner.getWidth() - owner.outlineThickness * 2,
|
||||
getViewedComponent()->getWidth()),
|
||||
content.getWidth()),
|
||||
owner.headerComponent->getHeight());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue