Browse Source

Added a showMenuAsync() method to PopupMenu that takes a std::function

tags/2021-05-28
ed 7 years ago
parent
commit
9046453701
2 changed files with 9 additions and 0 deletions
  1. +5
    -0
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp
  2. +4
    -0
      modules/juce_gui_basics/menus/juce_PopupMenu.h

+ 5
- 0
modules/juce_gui_basics/menus/juce_PopupMenu.cpp View File

@@ -1677,6 +1677,11 @@ void PopupMenu::showMenuAsync (const Options& options, ModalComponentManager::Ca
showWithOptionalCallback (options, userCallback, false);
}
void PopupMenu::showMenuAsync (const Options& options, std::function<void(int)> userCallback)
{
showWithOptionalCallback (options, ModalCallbackFunction::create (userCallback), false);
}
//==============================================================================
#if JUCE_MODAL_LOOPS_PERMITTED
int PopupMenu::show (int itemIDThatMustBeVisible, int minimumWidth,


+ 4
- 0
modules/juce_gui_basics/menus/juce_PopupMenu.h View File

@@ -502,6 +502,10 @@ public:
void showMenuAsync (const Options& options,
ModalComponentManager::Callback* callback);
/** Runs the menu asynchronously, with a user-provided callback that will receive the result. */
void showMenuAsync (const Options& options,
std::function<void(int)> callback);
//==============================================================================
/** Closes any menus that are currently open.


Loading…
Cancel
Save