1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

macOS: Fixed some spurious dynamic_cast warnings when loading dynamic libraries

This commit is contained in:
ed 2020-01-14 12:21:00 +00:00
parent 0eed5f0e33
commit c8bceee365

View file

@ -55,10 +55,7 @@ struct HeaderItemComponent : public PopupMenu::CustomComponent
setName (name);
}
void paint (Graphics& g) override
{
getLookAndFeel().drawPopupMenuSectionHeader (g, getLocalBounds(), getName());
}
void paint (Graphics& g) override;
void getIdealSize (int& idealWidth, int& idealHeight) override
{
@ -97,13 +94,7 @@ struct ItemComponent : public Component
addMouseListener (&parent, false);
}
~ItemComponent() override
{
if (customComp != nullptr)
setItem (*customComp, nullptr);
removeChildComponent (customComp.get());
}
~ItemComponent() override;
void getIdealSize (int& idealWidth, int& idealHeight, const int standardItemHeight)
{
@ -273,13 +264,7 @@ struct MenuWindow : public Component
getMouseState (Desktop::getInstance().getMainMouseSource()); // forces creation of a mouse source watcher for the main mouse
}
~MenuWindow() override
{
getActiveWindows().removeFirstMatchingValue (this);
Desktop::getInstance().removeGlobalMouseListener (this);
activeSubMenu.reset();
items.clear();
}
~MenuWindow() override;
//==============================================================================
void paint (Graphics& g) override
@ -1013,14 +998,7 @@ public:
startTimerHz (20);
}
void handleMouseEvent (const MouseEvent& e)
{
if (! window.windowIsStillValid())
return;
startTimerHz (20);
handleMousePosition (e.getScreenPosition());
}
void handleMouseEvent (const MouseEvent& e);
void timerCallback() override
{
@ -1250,11 +1228,7 @@ struct NormalComponentWrapper : public PopupMenu::CustomComponent
addAndMakeVisible (comp);
}
void getIdealSize (int& idealWidth, int& idealHeight) override
{
idealWidth = width;
idealHeight = height;
}
void getIdealSize (int& idealWidth, int& idealHeight) override;
void resized() override
{
@ -1269,6 +1243,44 @@ struct NormalComponentWrapper : public PopupMenu::CustomComponent
};
// The following implementations are outside of the class definitions to avoid spurious
// warning messages when dynamically loading libraries at runtime on macOS
void PopupMenu::HelperClasses::HeaderItemComponent::paint (Graphics& g)
{
getLookAndFeel().drawPopupMenuSectionHeader (g, getLocalBounds(), getName());
}
PopupMenu::HelperClasses::ItemComponent::~ItemComponent()
{
if (customComp != nullptr)
setItem (*customComp, nullptr);
removeChildComponent (customComp.get());
}
PopupMenu::HelperClasses::MenuWindow::~MenuWindow()
{
getActiveWindows().removeFirstMatchingValue (this);
Desktop::getInstance().removeGlobalMouseListener (this);
activeSubMenu.reset();
items.clear();
}
void PopupMenu::HelperClasses::MouseSourceState::handleMouseEvent (const MouseEvent& e)
{
if (! window.windowIsStillValid())
return;
startTimerHz (20);
handleMousePosition (e.getScreenPosition());
}
void PopupMenu::HelperClasses::NormalComponentWrapper::getIdealSize (int& idealWidth, int& idealHeight)
{
idealWidth = width;
idealHeight = height;
}
//==============================================================================
PopupMenu::PopupMenu()
{