Browse Source

tags/2021-05-28
jules 18 years ago
parent
commit
be853459f0
4 changed files with 63 additions and 8 deletions
  1. +28
    -7
      src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp
  2. +17
    -0
      src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp
  3. +13
    -0
      src/juce_appframework/gui/graphics/contexts/juce_Graphics.h
  4. +5
    -1
      src/juce_core/text/juce_String.cpp

+ 28
- 7
src/juce_appframework/gui/components/layout/juce_StretchableLayoutManager.cpp 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());
}
}
}


+ 17
- 0
src/juce_appframework/gui/graphics/contexts/juce_Graphics.cpp 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()
{


+ 13
- 0
src/juce_appframework/gui/graphics/contexts/juce_Graphics.h 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


+ 5
- 1
src/juce_core/text/juce_String.cpp 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;
}


Loading…
Cancel
Save