void CabbageIDELookAndFeel::drawAlertBox (Graphics& g, AlertWindow& alert, const Rectangle<int>& textArea, TextLayout& textLayout) { g.fillAll (CabbageSettings::getColourFromValueTree (colourTree, CabbageColourIds::alertWindowBackground, Colour (Colour::fromString("2ff52636a")))); int iconSpaceUsed = 160; if (alert.getAlertType() != AlertWindow::NoIcon) { Path icon; if (alert.getAlertType() == AlertWindow::WarningIcon) { Rectangle<float> rect (alert.getLocalBounds().removeFromLeft (iconSpaceUsed).toFloat()); const Image warningImage = ImageCache::getFromMemory (CabbageBinaryData::WarningIcon_png, CabbageBinaryData::WarningIcon_pngSize); //g.drawImage(warningImage, rect.reduced(20)); } if (alert.getAlertType() == AlertWindow::QuestionIcon) { Rectangle<float> rect (alert.getLocalBounds().removeFromLeft (iconSpaceUsed - 20).toFloat()); const Image warningImage = ImageCache::getFromMemory (CabbageBinaryData::WarningIcon_png, CabbageBinaryData::WarningIcon_pngSize); //g.drawImage(warningImage, rect.reduced(25)); } MemoryInputStream svgStream (CabbageBinaryData::processstop_svg, CabbageBinaryData::processstop_svgSize, false); ScopedPointer<XmlElement> svg (XmlDocument::parse (svgStream.readString())); if (svg == nullptr) jassert (false); ScopedPointer<Drawable> drawable; if (svg != nullptr) { drawable = Drawable::createFromSVG (*svg); Rectangle<float> rect (20, 20, 80, 80);//alert.getLocalBounds().removeFromLeft (iconSpaceUsed - 20).withHeight(130).toFloat()); drawable->setTransformToFit (rect, RectanglePlacement::stretchToFit); drawable->draw (g, 1.f, AffineTransform()); } } g.setColour (alert.findColour (AlertWindow::textColourId)); textLayout.draw (g, Rectangle<int> (textArea.getX() + iconSpaceUsed - 50, textArea.getY(), textArea.getWidth() - iconSpaceUsed - 40, textArea.getHeight()).toFloat()); g.setColour (alert.findColour (AlertWindow::outlineColourId)); g.drawRect (0, 0, alert.getWidth(), alert.getHeight()); }
AlertTextComp (AlertWindow& owner, const String& message, const Font& font) { setReadOnly (true); setMultiLine (true, true); setCaretVisible (false); setScrollbarsShown (true); lookAndFeelChanged(); setWantsKeyboardFocus (false); setFont (font); setText (message, false); bestWidth = 2 * (int) std::sqrt (font.getHeight() * font.getStringWidth (message)); if (owner.isColourSpecified (AlertWindow::textColourId)) setColour (TextEditor::textColourId, owner.findColour (AlertWindow::textColourId)); setColour (TextEditor::backgroundColourId, Colours::transparentBlack); setColour (TextEditor::outlineColourId, Colours::transparentBlack); setColour (TextEditor::shadowColourId, Colours::transparentBlack); }