Browse Source

AlertWindow layout fix.

tags/2021-05-28
jules 13 years ago
parent
commit
daa4d832b4
2 changed files with 10 additions and 12 deletions
  1. +10
    -10
      modules/juce_gui_basics/windows/juce_AlertWindow.cpp
  2. +0
    -2
      modules/juce_gui_basics/windows/juce_AlertWindow.h

+ 10
- 10
modules/juce_gui_basics/windows/juce_AlertWindow.cpp 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)


+ 0
- 2
modules/juce_gui_basics/windows/juce_AlertWindow.h 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;


Loading…
Cancel
Save