mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
FileChooser: Hide chooser when it leaves scope on Windows
This commit is contained in:
parent
e813531d9b
commit
45409bb4e6
9 changed files with 105 additions and 95 deletions
|
|
@ -158,7 +158,7 @@ bool FileChooser::showDialog (const int flags, FilePreviewComponent* const previ
|
|||
{
|
||||
FocusRestorer focusRestorer;
|
||||
|
||||
pimpl.reset (createPimpl (flags, previewComp));
|
||||
pimpl = createPimpl (flags, previewComp);
|
||||
pimpl->runModally();
|
||||
|
||||
// ensure that the finished function was invoked
|
||||
|
|
@ -179,12 +179,12 @@ void FileChooser::launchAsync (int flags, std::function<void (const FileChooser&
|
|||
|
||||
asyncCallback = std::move (callback);
|
||||
|
||||
pimpl.reset (createPimpl (flags, previewComp));
|
||||
pimpl = createPimpl (flags, previewComp);
|
||||
pimpl->launch();
|
||||
}
|
||||
|
||||
|
||||
FileChooser::Pimpl* FileChooser::createPimpl (int flags, FilePreviewComponent* previewComp)
|
||||
std::unique_ptr<FileChooser::Pimpl> FileChooser::createPimpl (int flags, FilePreviewComponent* previewComp)
|
||||
{
|
||||
results.clear();
|
||||
|
||||
|
|
@ -214,10 +214,8 @@ FileChooser::Pimpl* FileChooser::createPimpl (int flags, FilePreviewComponent* p
|
|||
{
|
||||
return showPlatformDialog (*this, flags, previewComp);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new NonNative (*this, flags, previewComp);
|
||||
}
|
||||
|
||||
return std::make_unique<NonNative> (*this, flags, previewComp);
|
||||
}
|
||||
|
||||
Array<File> FileChooser::getResults() const noexcept
|
||||
|
|
|
|||
|
|
@ -325,12 +325,11 @@ private:
|
|||
virtual void runModally() = 0;
|
||||
};
|
||||
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
std::shared_ptr<Pimpl> pimpl;
|
||||
|
||||
//==============================================================================
|
||||
Pimpl* createPimpl (int, FilePreviewComponent*);
|
||||
static Pimpl* showPlatformDialog (FileChooser&, int,
|
||||
FilePreviewComponent*);
|
||||
std::unique_ptr<Pimpl> createPimpl (int, FilePreviewComponent*);
|
||||
static std::unique_ptr<Pimpl> showPlatformDialog (FileChooser&, int, FilePreviewComponent*);
|
||||
|
||||
class NonNative;
|
||||
friend class NonNative;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue