1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00
This commit is contained in:
jules 2008-05-12 10:36:01 +00:00
parent e3bc180e02
commit be853459f0
4 changed files with 63 additions and 8 deletions

View file

@ -187,19 +187,40 @@ void StretchableLayoutManager::layOutComponents (Component** const components,
if (c != 0)
{
if (resizeOtherDimension)
if (i == numComponents - 1)
{
if (vertically)
c->setBounds (x, pos, w, layout->currentSize);
// if it's the last item, crop it to exactly fit the available space..
if (resizeOtherDimension)
{
if (vertically)
c->setBounds (x, pos, w, jmax (layout->currentSize, h - pos));
else
c->setBounds (pos, y, jmax (layout->currentSize, w - pos), h);
}
else
c->setBounds (pos, y, layout->currentSize, h);
{
if (vertically)
c->setBounds (c->getX(), pos, c->getWidth(), jmax (layout->currentSize, h - pos));
else
c->setBounds (pos, c->getY(), jmax (layout->currentSize, w - pos), c->getHeight());
}
}
else
{
if (vertically)
c->setBounds (c->getX(), pos, c->getWidth(), layout->currentSize);
if (resizeOtherDimension)
{
if (vertically)
c->setBounds (x, pos, w, layout->currentSize);
else
c->setBounds (pos, y, layout->currentSize, h);
}
else
c->setBounds (pos, c->getY(), layout->currentSize, c->getHeight());
{
if (vertically)
c->setBounds (c->getX(), pos, c->getWidth(), layout->currentSize);
else
c->setBounds (pos, c->getY(), layout->currentSize, c->getHeight());
}
}
}

View file

@ -455,6 +455,23 @@ void Graphics::drawRect (const int x,
b.paintRectangle (*context, x, y + height - lineThickness, width, lineThickness);
}
void Graphics::drawRect (const float x,
const float y,
const float width,
const float height,
const float lineThickness) const throw()
{
// passing in a silly number can cause maths problems in rendering!
ASSERT_COORDS_ARE_SENSIBLE_NUMBERS (x, y, width, height);
Path p;
p.addRectangle (x, y, width, lineThickness);
p.addRectangle (x, y + lineThickness, lineThickness, height - lineThickness * 2.0f);
p.addRectangle (x + width - lineThickness, y + lineThickness, lineThickness, height - lineThickness * 2.0f);
p.addRectangle (x, y + height - lineThickness, width, lineThickness);
fillPath (p);
}
void Graphics::drawRect (const Rectangle& r,
const int lineThickness) const throw()
{

View file

@ -304,6 +304,19 @@ public:
const int height,
const int lineThickness = 1) const throw();
/** Draws four lines to form a rectangular outline, using the current colour or brush.
The lines are drawn inside the given rectangle, and greater line thicknesses
extend inwards.
@see fillRect
*/
void drawRect (const float x,
const float y,
const float width,
const float height,
const float lineThickness = 1.0f) const throw();
/** Draws four lines to form a rectangular outline, using the current colour or brush.
The lines are drawn inside the given rectangle, and greater line thicknesses

View file

@ -993,9 +993,13 @@ int String::indexOfAnyOf (const tchar* const charactersToLookFor,
const tchar* t = text->text + jmax (0, startIndex);
while (*t != 0)
if (CharacterFunctions::indexOfChar (charactersToLookFor, *t++, ignoreCase) >= 0)
{
if (CharacterFunctions::indexOfChar (charactersToLookFor, *t, ignoreCase) >= 0)
return (int) (t - text->text);
++t;
}
return -1;
}