mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Tweaked the new LookAndFeel misuse detector to avoid bothering people who don't clear their global L+F before deleting it
This commit is contained in:
parent
d4c1daa448
commit
f2d8c4bc6b
1 changed files with 10 additions and 9 deletions
|
|
@ -59,14 +59,15 @@ LookAndFeel::~LookAndFeel()
|
|||
safe WeakReference to it, but it could cause some unexpected graphical behaviour,
|
||||
so it's advisable to clear up any references before destroying them!
|
||||
*/
|
||||
jassert (masterReference.getNumActiveWeakReferences() == 0);
|
||||
jassert (masterReference.getNumActiveWeakReferences() == 0
|
||||
|| masterReference.getNumActiveWeakReferences() == 1 && this == &getDefaultLookAndFeel());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Colour LookAndFeel::findColour (int colourID) const noexcept
|
||||
{
|
||||
const ColourSetting c = { colourID, Colour() };
|
||||
const int index = colours.indexOf (c);
|
||||
auto index = colours.indexOf (c);
|
||||
|
||||
if (index >= 0)
|
||||
return colours.getReference (index).colour;
|
||||
|
|
@ -78,7 +79,7 @@ Colour LookAndFeel::findColour (int colourID) const noexcept
|
|||
void LookAndFeel::setColour (int colourID, Colour newColour) noexcept
|
||||
{
|
||||
const ColourSetting c = { colourID, newColour };
|
||||
const int index = colours.indexOf (c);
|
||||
auto index = colours.indexOf (c);
|
||||
|
||||
if (index >= 0)
|
||||
colours.getReference (index).colour = newColour;
|
||||
|
|
@ -128,16 +129,16 @@ void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
|
|||
//==============================================================================
|
||||
MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
|
||||
{
|
||||
MouseCursor m (component.getMouseCursor());
|
||||
auto cursor = component.getMouseCursor();
|
||||
|
||||
Component* parent = component.getParentComponent();
|
||||
while (parent != nullptr && m == MouseCursor::ParentCursor)
|
||||
for (auto* parent = component.getParentComponent();
|
||||
parent != nullptr && cursor == MouseCursor::ParentCursor;
|
||||
parent = parent->getParentComponent())
|
||||
{
|
||||
m = parent->getMouseCursor();
|
||||
parent = parent->getParentComponent();
|
||||
cursor = parent->getMouseCursor();
|
||||
}
|
||||
|
||||
return m;
|
||||
return cursor;
|
||||
}
|
||||
|
||||
LowLevelGraphicsContext* LookAndFeel::createGraphicsContext (const Image& imageToRenderOn, const Point<int>& origin,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue