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

ComponentPeer: Add isShowing() member, which more closely matches expected behaviour of Component::isShowing

This commit is contained in:
reuk 2024-09-11 13:50:44 +01:00
parent 68d0ea9dfb
commit 555b667d22
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
8 changed files with 26 additions and 1 deletions

View file

@ -273,6 +273,7 @@ private:
//============================================================================== //==============================================================================
void setMinimised (bool) override {} void setMinimised (bool) override {}
bool isMinimised() const override { return false; } bool isMinimised() const override { return false; }
bool isShowing() const override { return true; }
void setFullScreen (bool) override {} void setFullScreen (bool) override {}
bool isFullScreen() const override { return false; } bool isFullScreen() const override { return false; }
bool setAlwaysOnTop (bool) override { return false; } bool setAlwaysOnTop (bool) override { return false; }

View file

@ -343,7 +343,7 @@ bool Component::isShowing() const
return parentComponent->isShowing(); return parentComponent->isShowing();
if (auto* peer = getPeer()) if (auto* peer = getPeer())
return ! peer->isMinimised(); return peer->isShowing();
return false; return false;
} }

View file

@ -465,6 +465,11 @@ public:
return [window isMiniaturized]; return [window isMiniaturized];
} }
bool isShowing() const override
{
return [window isVisible] && ! isMinimised();
}
NSWindowCollectionBehavior getCollectionBehavior (bool forceFullScreen) const NSWindowCollectionBehavior getCollectionBehavior (bool forceFullScreen) const
{ {
if (forceFullScreen) if (forceFullScreen)

View file

@ -408,6 +408,7 @@ public:
void setAlpha (float newAlpha) override; void setAlpha (float newAlpha) override;
void setMinimised (bool) override {} void setMinimised (bool) override {}
bool isMinimised() const override { return false; } bool isMinimised() const override { return false; }
bool isShowing() const override { return true; }
void setFullScreen (bool shouldBeFullScreen) override; void setFullScreen (bool shouldBeFullScreen) override;
bool isFullScreen() const override { return fullScreen; } bool isFullScreen() const override { return fullScreen; }
bool contains (Point<int> localPos, bool trueIfInAChildWindow) const override; bool contains (Point<int> localPos, bool trueIfInAChildWindow) const override;

View file

@ -1462,6 +1462,11 @@ public:
return false; return false;
} }
bool isShowing() const override
{
return true;
}
void setFullScreen (bool shouldBeFullScreen) override void setFullScreen (bool shouldBeFullScreen) override
{ {
if (shouldNavBarsBeHidden (shouldBeFullScreen)) if (shouldNavBarsBeHidden (shouldBeFullScreen))

View file

@ -204,6 +204,11 @@ public:
return XWindowSystem::getInstance()->isMinimised (windowH); return XWindowSystem::getInstance()->isMinimised (windowH);
} }
bool isShowing() const override
{
return XWindowSystem::getInstance()->isMinimised (windowH);
}
void setFullScreen (bool shouldBeFullScreen) override void setFullScreen (bool shouldBeFullScreen) override
{ {
auto r = lastNonFullscreenBounds; // (get a copy of this before de-minimising) auto r = lastNonFullscreenBounds; // (get a copy of this before de-minimising)

View file

@ -1720,6 +1720,11 @@ public:
return wp.showCmd == SW_SHOWMINIMIZED; return wp.showCmd == SW_SHOWMINIMIZED;
} }
bool isShowing() const override
{
return IsWindowVisible (hwnd) && ! isMinimised();
}
void setFullScreen (bool shouldBeFullScreen) override void setFullScreen (bool shouldBeFullScreen) override
{ {
const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true); const ScopedValueSetter<bool> scope (shouldIgnoreModalDismiss, true);

View file

@ -244,6 +244,9 @@ public:
/** True if the window is currently minimised. */ /** True if the window is currently minimised. */
virtual bool isMinimised() const = 0; virtual bool isMinimised() const = 0;
/** True if the window is being displayed on-screen. */
virtual bool isShowing() const = 0;
/** Enable/disable fullscreen mode for the window. */ /** Enable/disable fullscreen mode for the window. */
virtual void setFullScreen (bool shouldBeFullScreen) = 0; virtual void setFullScreen (bool shouldBeFullScreen) = 0;