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

Added a method CallOutBox::dismiss()

This commit is contained in:
jules 2014-03-08 14:18:51 +00:00
parent 902a47d1ad
commit 5956d5bce0
2 changed files with 14 additions and 4 deletions

View file

@ -48,8 +48,6 @@ CallOutBox::~CallOutBox()
{
}
enum { callOutBoxDismissCommandId = 0x4f83a04b };
//==============================================================================
class CallOutBoxCallback : public ModalComponentManager::Callback,
private Timer
@ -68,7 +66,7 @@ public:
void timerCallback() override
{
if (! Process::isForegroundProcess())
callout.postCommandMessage (callOutBoxDismissCommandId);
callout.dismiss();
}
ScopedPointer<Component> content;
@ -127,7 +125,7 @@ void CallOutBox::inputAttemptWhenModal()
// if you click on the area that originally popped-up the callout, you expect it
// to get rid of the box, but deleting the box here allows the click to pass through and
// probably re-trigger it, so we need to dismiss the box asynchronously to consume the click..
postCommandMessage (callOutBoxDismissCommandId);
dismiss();
}
else
{
@ -136,6 +134,8 @@ void CallOutBox::inputAttemptWhenModal()
}
}
enum { callOutBoxDismissCommandId = 0x4f83a04b };
void CallOutBox::handleCommandMessage (int commandId)
{
Component::handleCommandMessage (commandId);
@ -147,6 +147,11 @@ void CallOutBox::handleCommandMessage (int commandId)
}
}
void CallOutBox::dismiss()
{
postCommandMessage (callOutBoxDismissCommandId);
}
bool CallOutBox::keyPressed (const KeyPress& key)
{
if (key.isKeyCode (KeyPress::escapeKey))

View file

@ -118,6 +118,11 @@ public:
const Rectangle<int>& areaToPointTo,
Component* parentComponent);
/** Posts a message which will dismiss the callout box asynchronously.
NB: it's safe to call this method from any thread.
*/
void dismiss();
//==============================================================================
/** This abstract base class is implemented by LookAndFeel classes. */
struct JUCE_API LookAndFeelMethods