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

Use lambda callbacks instead of listeners with Slider, Button, Label, ComboBox and TextEditor classes

This commit is contained in:
Noah Dayan 2018-01-18 15:23:23 +00:00
parent 6d8d90e9d8
commit e690350df3
30 changed files with 114 additions and 258 deletions

View file

@ -99,7 +99,14 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
filenameBox.setMultiLine (false);
filenameBox.setSelectAllWhenFocused (true);
filenameBox.setText (filename, false);
filenameBox.addListener (this);
filenameBox.onTextChange = [this] { sendListenerChangeMessage(); };
filenameBox.onReturnKey = [this] { changeFilename(); };
filenameBox.onFocusLost = [this]
{
if (! isSaveMode())
selectionChanged();
};
filenameBox.setReadOnly ((flags & (filenameBoxIsReadOnly | canSelectMultipleItems)) != 0);
addAndMakeVisible (fileLabel);
@ -439,12 +446,7 @@ bool FileBrowserComponent::keyPressed (const KeyPress& key)
}
//==============================================================================
void FileBrowserComponent::textEditorTextChanged (TextEditor&)
{
sendListenerChangeMessage();
}
void FileBrowserComponent::textEditorReturnKeyPressed (TextEditor&)
void FileBrowserComponent::changeFilename()
{
if (filenameBox.getText().containsChar (File::getSeparatorChar()))
{
@ -472,16 +474,6 @@ void FileBrowserComponent::textEditorReturnKeyPressed (TextEditor&)
}
}
void FileBrowserComponent::textEditorEscapeKeyPressed (TextEditor&)
{
}
void FileBrowserComponent::textEditorFocusLost (TextEditor&)
{
if (! isSaveMode())
selectionChanged();
}
//==============================================================================
void FileBrowserComponent::updateSelectedPath()
{