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

GUI: Ensure components refresh correctly when their look and feel changes

This commit is contained in:
reuk 2020-06-12 15:24:20 +01:00
parent 68e0e0e329
commit 39b5c22a29
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11
10 changed files with 48 additions and 14 deletions

View file

@ -105,16 +105,15 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
addAndMakeVisible (fileLabel);
fileLabel.attachToComponent (&filenameBox, true);
goUpButton.reset (getLookAndFeel().createFileBrowserGoUpButton());
addAndMakeVisible (goUpButton.get());
goUpButton->onClick = [this] { goUp(); };
goUpButton->setTooltip (TRANS ("Go up to parent directory"));
if (previewComp != nullptr)
addAndMakeVisible (previewComp);
lookAndFeelChanged();
addAndMakeVisible (goUpButton.get());
goUpButton->onClick = [this] { goUp(); };
goUpButton->setTooltip (TRANS ("Go up to parent directory"));
setRoot (currentRoot);
if (filename.isNotEmpty())
@ -351,12 +350,17 @@ void FileBrowserComponent::resized()
//==============================================================================
void FileBrowserComponent::lookAndFeelChanged()
{
goUpButton.reset (getLookAndFeel().createFileBrowserGoUpButton());
currentPathBox.setColour (ComboBox::backgroundColourId, findColour (currentPathBoxBackgroundColourId));
currentPathBox.setColour (ComboBox::textColourId, findColour (currentPathBoxTextColourId));
currentPathBox.setColour (ComboBox::arrowColourId, findColour (currentPathBoxArrowColourId));
filenameBox.setColour (TextEditor::backgroundColourId, findColour (filenameBoxBackgroundColourId));
filenameBox.setColour (TextEditor::textColourId, findColour (filenameBoxTextColourId));
resized();
repaint();
}
//==============================================================================