1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

AlertWindow layout fix.

This commit is contained in:
jules 2012-02-08 11:33:12 +00:00
parent a8a7630635
commit daa4d832b4
2 changed files with 10 additions and 12 deletions

View file

@ -114,14 +114,6 @@ void AlertWindow::setMessage (const String& message)
if (text != newMessage)
{
text = newMessage;
font = getLookAndFeel().getAlertWindowMessageFont();
AttributedString newText;
newText.append (getName() + "\n\n", Font (font.getHeight() * 1.1f, Font::bold));
newText.append (text, font);
attributedText = newText;
updateLayout (true);
repaint();
}
@ -191,7 +183,7 @@ void AlertWindow::addTextEditor (const String& name,
allComps.add (tc);
tc->setColour (TextEditor::outlineColourId, findColour (ComboBox::outlineColourId));
tc->setFont (font);
tc->setFont (getLookAndFeel().getAlertWindowMessageFont());
tc->setText (initialContents);
tc->setCaretPosition (initialContents.length());
addAndMakeVisible (tc);
@ -288,7 +280,7 @@ private:
void AlertWindow::addTextBlock (const String& textBlock)
{
AlertTextComp* const c = new AlertTextComp (textBlock, font);
AlertTextComp* const c = new AlertTextComp (textBlock, getLookAndFeel().getAlertWindowMessageFont());
textBlocks.add (c);
allComps.add (c);
@ -391,6 +383,8 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
const int titleH = 24;
const int iconWidth = 80;
const Font font (getLookAndFeel().getAlertWindowMessageFont());
const int wid = jmax (font.getStringWidth (text),
font.getStringWidth (getName()));
@ -400,6 +394,12 @@ void AlertWindow::updateLayout (const bool onlyIncreaseSize)
const int labelHeight = 18;
int iconSpace = 0;
AttributedString attributedText;
attributedText.append (getName(), Font (font.getHeight() * 1.1f, Font::bold));
if (text.isNotEmpty())
attributedText.append ("\n\n" + text, font);
attributedText.setColour (findColour (textColourId));
if (alertIconType == NoIcon)

View file

@ -446,7 +446,6 @@ protected:
private:
//==============================================================================
String text;
AttributedString attributedText;
TextLayout textLayout;
AlertIconType alertIconType;
ComponentBoundsConstrainer constrainer;
@ -460,7 +459,6 @@ private:
OwnedArray<Component> textBlocks;
Array<Component*> allComps;
StringArray textboxNames, comboBoxNames;
Font font;
Component* associatedComponent;
bool escapeKeyCancels;