void PaintElement::paint (Graphics& g)
{
    Rectangle<int> area (((PaintRoutineEditor*) getParentComponent())->getComponentArea());

    g.saveState();
    g.setOrigin (area.getPosition() - Component::getPosition());
    area.setPosition (0, 0);

    g.saveState();
    g.reduceClipRegion (0, 0, area.getWidth(), area.getHeight());

    draw (g, getDocument()->getComponentLayout(), area);

    g.restoreState();

    drawExtraEditorGraphics (g, area);
    g.restoreState();

    if (selected)
    {
        const BorderSize<int> borderSize (border->getBorderThickness());

        drawResizableBorder (g, getWidth(), getHeight(), borderSize,
                             (isMouseOverOrDragging() || border->isMouseOverOrDragging()));
    }
    else if (isMouseOverOrDragging())
    {
        drawMouseOverCorners (g, getWidth(), getHeight());
    }
}
void ComponentOverlayComponent::paint (Graphics& g)
{
    jassert (target != nullptr);

    if (selected)
    {
        const BorderSize<int> borderSize (border->getBorderThickness());

        drawResizableBorder (g, getWidth(), getHeight(), borderSize, (isMouseOverOrDragging() || border->isMouseOverOrDragging()));
    }
    else if (isMouseOverOrDragging())
    {
        drawMouseOverCorners (g, getWidth(), getHeight());
    }
}
//==============================================================================
void GraphLinkComponent::paint (Graphics& g)
{
    Colour wireColour = Colours::black;
    if ((to != 0 && from != 0))
    {
        GraphNodeComponent* node = to->getParentGraphComponent ();
        wireColour = node->getConnectorColour (to, isMouseOverOrDragging());
    }
    else
    {
        if (to)
        {
            GraphNodeComponent* node = to->getParentGraphComponent ();
            wireColour = node->getConnectorColour (to, true);
        }
        else if (from)
        {
            GraphNodeComponent* node = from->getParentGraphComponent ();
            wireColour = node->getConnectorColour (from, true);
        }
    }

    g.setColour (wireColour);
    g.strokePath (path, PathStrokeType (lineThickness));
//==============================================================================
void ResizableCornerComponent::paint (Graphics& g)
{
    getLookAndFeel()
        .drawCornerResizer (g, getWidth(), getHeight(),
                            isMouseOverOrDragging(),
                            isMouseButtonDown());
}
        void paint (Graphics& g) override
        {
            g.setColour (Colours::white.withAlpha (isMouseOverOrDragging() ? 0.9f : 0.5f));
            g.fillEllipse (getLocalBounds().reduced (3).toFloat());

            g.setColour (Colours::darkgreen);
            g.drawEllipse (getLocalBounds().reduced (3).toFloat(), 2.0f);
        }
 void paint (Graphics& g)
 {
     if (ToolbarItemComponent* const tc = getToolbarItemComponent())
     {
         if (isMouseOverOrDragging()
               && tc->getEditingMode() == ToolbarItemComponent::editableOnToolbar)
         {
             g.setColour (findColour (Toolbar::editingModeOutlineColourId, true));
             g.drawRect (0, 0, getWidth(), getHeight(),
                         jmin (2, (getWidth() - 1) / 2, (getHeight() - 1) / 2));
         }
     }
 }
void PathPointComponent::paint (Graphics& g)
{
    if (isMouseOverOrDragging())
        g.fillAll (Colours::red);

    if (selected)
    {
        g.setColour (Colours::red);
        g.drawRect (getLocalBounds());
    }

    g.setColour (Colours::white);
    g.fillRect (getWidth() / 2 - 3, getHeight() / 2 - 3, 7, 7);

    g.setColour (Colours::black);

    if (pointNumber < path->getPoint (index)->getNumPoints() - 1)
        g.drawRect (getWidth() / 2 - 2, getHeight() / 2 - 2, 5, 5);
    else
        g.fillRect (getWidth() / 2 - 2, getHeight() / 2 - 2, 5, 5);
}