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

Refactoring of some glypharrangement code.

This commit is contained in:
jules 2013-06-15 19:27:34 +01:00
parent 49fd486c23
commit fc79df875f
8 changed files with 46 additions and 107 deletions

View file

@ -296,57 +296,6 @@ String RolloverHelpComp::findTip (Component* c)
return String::empty;
}
//==============================================================================
FloatingLabelComponent::FloatingLabelComponent()
: font (10.0f)
{
setInterceptsMouseClicks (false, false);
}
void FloatingLabelComponent::remove()
{
if (Component* p = getParentComponent())
p->removeChildComponent (this);
}
void FloatingLabelComponent::update (Component* parent, const String& text, const Colour& textColour,
int x, int y, bool toRight, bool below)
{
colour = textColour;
Rectangle<int> r;
if (text != getName())
{
setName (text);
glyphs.clear();
glyphs.addJustifiedText (font, text, 0, 0, 200.0f, Justification::left);
glyphs.justifyGlyphs (0, std::numeric_limits<int>::max(), 0, 0, 1000, 1000, Justification::topLeft);
r = glyphs.getBoundingBox (0, std::numeric_limits<int>::max(), false)
.getSmallestIntegerContainer().expanded (1, 1);
}
else
{
r = getLocalBounds();
}
r.setPosition (x + (toRight ? 3 : -(r.getWidth() + 3)), y + (below ? 2 : -(r.getHeight() + 2)));
setBounds (r);
parent->addAndMakeVisible (this);
}
void FloatingLabelComponent::paint (Graphics& g)
{
g.setFont (font);
g.setColour (Colours::white.withAlpha (0.5f));
g.fillRoundedRectangle (0, 0, (float) getWidth(), (float) getHeight(), 3);
g.setColour (colour);
glyphs.draw (g, AffineTransform::translation (1.0f, 1.0f));
}
//==============================================================================
class UTF8Component : public Component,
private TextEditorListener