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

Used Button::onClick to simplify a bunch of library classes and demo code

This commit is contained in:
jules 2018-01-03 10:45:13 +00:00
parent be5f2d62c4
commit ce8b2d865a
52 changed files with 557 additions and 954 deletions

View file

@ -29,17 +29,15 @@ namespace juce
FilenameComponent::FilenameComponent (const String& name,
const File& currentFile,
const bool canEditFilename,
const bool isDirectory,
const bool isForSaving,
bool canEditFilename,
bool isDirectory,
bool isForSaving,
const String& fileBrowserWildcard,
const String& suffix,
const String& textWhenNothingSelected)
: Component (name),
maxRecentFiles (30),
isDir (isDirectory),
isSaving (isForSaving),
isFileDragOver (false),
wildcard (fileBrowserWildcard),
enforcedSuffix (suffix)
{
@ -92,9 +90,8 @@ void FilenameComponent::lookAndFeelChanged()
addAndMakeVisible (browseButton = getLookAndFeel().createFilenameComponentBrowseButton (browseButtonText));
browseButton->setConnectedEdges (Button::ConnectedOnLeft);
browseButton->onClick = [this]() { showChooser(); };
resized();
browseButton->addListener (this);
}
void FilenameComponent::setTooltip (const String& newTooltip)
@ -114,7 +111,7 @@ File FilenameComponent::getLocationToBrowse()
: getCurrentFile();
}
void FilenameComponent::buttonClicked (Button*)
void FilenameComponent::showChooser()
{
#if JUCE_MODAL_LOOPS_PERMITTED
FileChooser fc (isDir ? TRANS ("Choose a new directory")