Created
January 22, 2015 07:21
-
-
Save adamski/9fac24ed90de412396a1 to your computer and use it in GitHub Desktop.
Custom class derived from CallOutBox for removing arrow (JUCE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "CustomCallOutBox.h" | |
CustomCallOutBox::CustomCallOutBox (Component &contentComponent, | |
const Rectangle< int > &areaToPointTo, | |
Component *parentComponent, | |
bool drawArrow) | |
: CallOutBox (contentComponent, areaToPointTo, parentComponent), drawArrow (drawArrow) | |
{ | |
} | |
class CustomCallOutBoxCallback : public ModalComponentManager::Callback, | |
private Timer | |
{ | |
public: | |
CustomCallOutBoxCallback (Component* c, const Rectangle<int>& area, Component* parent, bool arrow) | |
: content (c), callout (*c, area, parent, arrow) | |
{ | |
callout.setVisible (true); | |
callout.enterModalState (true, this); | |
startTimer (200); | |
} | |
void modalStateFinished (int) override {} | |
void timerCallback() override | |
{ | |
if (! Process::isForegroundProcess()) | |
callout.dismiss(); | |
} | |
ScopedPointer<Component> content; | |
CustomCallOutBox callout; | |
JUCE_DECLARE_NON_COPYABLE (CustomCallOutBoxCallback) | |
}; | |
CustomCallOutBox& CustomCallOutBox::launchAsynchronously (Component* content, const Rectangle<int>& area, Component* parent, bool arrow) | |
{ | |
jassert (content != nullptr); // must be a valid content component! | |
return (new CustomCallOutBoxCallback (content, area, parent, arrow))->callout; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef CUSTOMCALLOUTBOX_H_INCLUDED | |
#define CUSTOMCALLOUTBOX_H_INCLUDED | |
#include "JuceHeader.h" | |
class CustomCallOutBox : public CallOutBox | |
{ | |
public: | |
CustomCallOutBox (Component &contentComponent, const Rectangle< int > &areaToPointTo, Component *parentComponent, bool drawArrow); | |
static CustomCallOutBox& launchAsynchronously (Component* content, const Rectangle<int>& area, Component* parent, bool drawArrow); | |
private: | |
bool drawArrow; | |
}; | |
#endif // CUSTOMCALLOUTBOX_H_INCLUDED |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment