Browse Source

Added some colourIds to FileBrowserComponent to control current path ComboBox and filename TextEditor colours

tags/2021-05-28
ed 8 years ago
parent
commit
98f8ee9e04
4 changed files with 43 additions and 5 deletions
  1. +13
    -0
      modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp
  2. +18
    -0
      modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h
  3. +6
    -0
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp
  4. +6
    -5
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp

+ 13
- 0
modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp View File

@@ -112,6 +112,8 @@ FileBrowserComponent::FileBrowserComponent (int flags_,
if (previewComp != nullptr)
addAndMakeVisible (previewComp);
lookAndFeelChanged();
setRoot (currentRoot);
thread.startThread (4);
@@ -342,6 +344,17 @@ void FileBrowserComponent::resized()
&currentPathBox, &filenameBox, goUpButton);
}
//==============================================================================
void FileBrowserComponent::lookAndFeelChanged()
{
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));
}
//==============================================================================
void FileBrowserComponent::sendListenerChangeMessage()
{


+ 18
- 0
modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h View File

@@ -215,10 +215,28 @@ public:
Button* goUpButton) = 0;
};
/** A set of colour IDs to use to change the colour of various aspects of the FileBrowserComponent.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
currentPathBoxBackgroundColourId = 0x1000640, /**< The colour to use to fill the background of the current path ComboBox. */
currentPathBoxTextColourId = 0x1000641, /**< The colour to use for the text of the current path ComboBox. */
currentPathBoxArrowColourId = 0x1000642, /**< The colour to use to draw the arrow of the current path ComboBox. */
filenameBoxBackgroundColourId = 0x1000643, /**< The colour to use to fill the background of the filename TextEditor. */
filenameBoxTextColourId = 0x1000644 /**< The colour to use for the text of the filename TextEditor. */
};
//==============================================================================
/** @internal */
void resized() override;
/** @internal */
void lookAndFeelChanged() override;
/** @internal */
void buttonClicked (Button*) override;
/** @internal */
void comboBoxChanged (ComboBox*) override;


+ 6
- 0
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp View File

@@ -221,6 +221,12 @@ LookAndFeel_V2::LookAndFeel_V2()
SidePanel::dismissButtonNormalColour, textButtonColour,
SidePanel::dismissButtonOverColour, textButtonColour,
SidePanel::dismissButtonDownColour, 0xff4444ff,
FileBrowserComponent::currentPathBoxBackgroundColourId, 0xffffffff,
FileBrowserComponent::currentPathBoxTextColourId, 0xff000000,
FileBrowserComponent::currentPathBoxArrowColourId, 0x99000000,
FileBrowserComponent::filenameBoxBackgroundColourId, 0xffffffff,
FileBrowserComponent::filenameBoxTextColourId, 0xff000000,
};
for (int i = 0; i < numElementsInArray (standardColours); i += 2)


+ 6
- 5
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp View File

@@ -716,17 +716,12 @@ void LookAndFeel_V4::layoutFileBrowserComponent (FileBrowserComponent& browserCo
auto bottomSlice = b.removeFromBottom (sectionHeight);
currentPathBox->setBounds (topSlice.removeFromLeft (topSlice.getWidth() - buttonWidth));
currentPathBox->setColour (ComboBox::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground));
currentPathBox->setColour (ComboBox::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText));
currentPathBox->setColour (ComboBox::arrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText));
topSlice.removeFromLeft (6);
goUpButton->setBounds (topSlice);
bottomSlice.removeFromLeft (20);
filenameBox->setBounds (bottomSlice);
filenameBox->setColour (TextEditor::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground));
filenameBox->setColour (TextEditor::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText));
if (previewComp != nullptr)
previewComp->setBounds (b.removeFromRight (b.getWidth() / 3));
@@ -1443,6 +1438,12 @@ void LookAndFeel_V4::initialiseColours()
SidePanel::dismissButtonNormalColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
SidePanel::dismissButtonOverColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).darker().getARGB(),
SidePanel::dismissButtonDownColour, currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).brighter().getARGB(),
FileBrowserComponent::currentPathBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
FileBrowserComponent::currentPathBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
FileBrowserComponent::currentPathBoxArrowColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
FileBrowserComponent::filenameBoxBackgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuBackground).getARGB(),
FileBrowserComponent::filenameBoxTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
};
for (int i = 0; i < numElementsInArray (coloursToUse); i += 2)


Loading…
Cancel
Save