Browse Source

Added some lambda callbacks to SidePanel

tags/2021-05-28
ed 8 years ago
parent
commit
26734f7f85
2 changed files with 17 additions and 0 deletions
  1. +9
    -0
      modules/juce_gui_basics/layout/juce_SidePanel.cpp
  2. +8
    -0
      modules/juce_gui_basics/layout/juce_SidePanel.h

+ 9
- 0
modules/juce_gui_basics/layout/juce_SidePanel.cpp View File

@@ -77,9 +77,18 @@ void SidePanel::showOrHide (bool show)
Desktop::getInstance().getAnimator().animateComponent (this, calculateBoundsInParent (*parent),
1.0f, 250, true, 1.0, 0.0);
if (onPanelShowHide != nullptr)
onPanelShowHide (isShowing);
}
}
void SidePanel::moved()
{
if (onPanelMove != nullptr)
onPanelMove();
}
void SidePanel::resized()
{
auto bounds = getLocalBounds();


+ 8
- 0
modules/juce_gui_basics/layout/juce_SidePanel.h View File

@@ -112,6 +112,7 @@ public:
void setTitleBarHeight (int newHeight) noexcept { titleBarHeight = newHeight; }
//==============================================================================
void moved() override;
void resized() override;
void paint (Graphics& g) override;
@@ -150,6 +151,13 @@ public:
dismissButtonDownColour = 0x100f005
};
//==============================================================================
/** You can assign a lambda to this callback object and it will be called when the panel is moved. */
std::function<void()> onPanelMove;
/** You can assign a lambda to this callback object and it will be called when the panel is shown or hidden. */
std::function<void(bool)> onPanelShowHide;
private:
//==========================================================================
Component* parent = nullptr;


Loading…
Cancel
Save