Ejemplo n.º 1
0
void CtrlrComponentResizableBorder::drawResizableFrame (Graphics& g, int w, int h, const BorderSize<int> &borderSize)
{
	g.setColour (Colours::orange.withAlpha (0.4f));
	g.fillRect (0, 0, w, borderSize.getTop());
	g.fillRect (0, 0, borderSize.getLeft(), h);
	g.fillRect (0, h - borderSize.getBottom(), w, borderSize.getBottom());
	g.fillRect (w - borderSize.getRight(), 0, borderSize.getRight(), h);
	g.drawRect (borderSize.getLeft() - 1, borderSize.getTop() - 1,
				w - borderSize.getRight() - borderSize.getLeft() + 2,
				h - borderSize.getTop() - borderSize.getBottom() + 2);
}
Ejemplo n.º 2
0
//==============================================================================
void drawResizableBorder (Graphics& g,
                          int w, int h,
                          const BorderSize<int> borderSize,
                          const bool isMouseOver)
{
    g.setColour (Colours::orange.withAlpha (isMouseOver ? 0.4f : 0.3f));

    g.fillRect (0, 0, w, borderSize.getTop());
    g.fillRect (0, 0, borderSize.getLeft(), h);
    g.fillRect (0, h - borderSize.getBottom(), w, borderSize.getBottom());
    g.fillRect (w - borderSize.getRight(), 0, borderSize.getRight(), h);

    g.drawRect (borderSize.getLeft() - 1, borderSize.getTop() - 1,
                w - borderSize.getRight() - borderSize.getLeft() + 2,
                h - borderSize.getTop() - borderSize.getBottom() + 2);
}
const ResizableBorderComponent::Zone ResizableBorderComponent::Zone::fromPositionOnBorder (const Rectangle<int>& totalSize,
                                                                                           const BorderSize<int>& border,
                                                                                           const Point<int>& position)
{
    int z = 0;

    if (totalSize.contains (position)
         && ! border.subtractedFrom (totalSize).contains (position))
    {
        const int minW = jmax (totalSize.getWidth() / 10, jmin (10, totalSize.getWidth() / 3));
        if (position.x < jmax (border.getLeft(), minW) && border.getLeft() > 0)
            z |= left;
        else if (position.x >= totalSize.getWidth() - jmax (border.getRight(), minW) && border.getRight() > 0)
            z |= right;

        const int minH = jmax (totalSize.getHeight() / 10, jmin (10, totalSize.getHeight() / 3));
        if (position.y < jmax (border.getTop(), minH) && border.getTop() > 0)
            z |= top;
        else if (position.y >= totalSize.getHeight() - jmax (border.getBottom(), minH) && border.getBottom() > 0)
            z |= bottom;
    }

    return Zone (z);
}