1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-13 00:04:19 +00:00

Projucer: Resize PropertyComponent items in PropertyGroupComponent to be centred with preferred height

This commit is contained in:
ed 2017-05-15 15:29:31 +01:00
parent 50fdeba363
commit 180399008c

View file

@ -156,7 +156,7 @@ public:
pp->setBounds (40, height, width - 50, propertyHeight);
resizeContentIfChoicePropertyComponent (pp);
resizePropertyComponent (pp);
height += pp->getHeight() + 10;
}
@ -184,14 +184,13 @@ public:
return static_cast<int> (nameWidth / availableTextWidth);
}
void resizeContentIfChoicePropertyComponent (PropertyComponent* pp)
void resizePropertyComponent (PropertyComponent* pp)
{
if (auto* choiceComp = dynamic_cast<ChoicePropertyComponent*> (pp))
if (auto* propertyChild = pp->getChildComponent (0))
{
auto* box = choiceComp->getChildComponent (0);
auto bounds = box->getBounds();
auto bounds = propertyChild->getBounds();
box->setBounds (bounds.withSizeKeepingCentre (box->getWidth(), pp->getPreferredHeight()));
propertyChild->setBounds (bounds.withSizeKeepingCentre (propertyChild->getWidth(), pp->getPreferredHeight()));
}
}