Browse Source

Added DirectoryContentsDisplayComponent::ColourIds::highlightedTextColourId and removed a line in LookAndFeel_V4::drawFileBrowserRow() that could result in multiple unnecessary repaints

tags/2021-05-28
ed 8 years ago
parent
commit
f24e59e6ff
3 changed files with 16 additions and 13 deletions
  1. +3
    -2
      modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.h
  2. +10
    -4
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp
  3. +3
    -7
      modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp

+ 3
- 2
modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.h View File

@@ -91,8 +91,9 @@ public:
*/
enum ColourIds
{
highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
textColourId = 0x1000541, /**< The colour for the text. */
highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
textColourId = 0x1000541, /**< The colour for the text. */
highlightedTextColourId = 0x1000542 /**< The colour with which to draw the text in highlighted sections. */
};
//==============================================================================


+ 10
- 4
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp View File

@@ -182,8 +182,9 @@ LookAndFeel_V2::LookAndFeel_V2()
TableHeaderComponent::outlineColourId, 0x33000000,
TableHeaderComponent::highlightColourId, 0x8899aadd,
DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour,
DirectoryContentsDisplayComponent::textColourId, 0xff000000,
DirectoryContentsDisplayComponent::highlightColourId, textHighlightColour,
DirectoryContentsDisplayComponent::textColourId, 0xff000000,
DirectoryContentsDisplayComponent::highlightedTextColourId, 0xff000000,
0x1000440, /*LassoComponent::lassoFillColourId*/ 0x66dddddd,
0x1000441, /*LassoComponent::lassoOutlineColourId*/ 0x99111111,
@@ -2554,8 +2555,13 @@ void LookAndFeel_V2::drawFileBrowserRow (Graphics& g, int width, int height,
RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f);
}
g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::textColourId)
: findColour (DirectoryContentsDisplayComponent::textColourId));
if (isItemSelected)
g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::highlightedTextColourId)
: findColour (DirectoryContentsDisplayComponent::highlightedTextColourId));
else
g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::textColourId)
: findColour (DirectoryContentsDisplayComponent::textColourId));
g.setFont (height * 0.7f);
if (width > 450 && ! isDirectory)


+ 3
- 7
modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp View File

@@ -742,11 +742,6 @@ void LookAndFeel_V4::drawFileBrowserRow (Graphics& g, int width, int height,
bool isDirectory, bool isItemSelected,
int itemIndex, DirectoryContentsDisplayComponent& dcc)
{
if (auto fileListComp = dynamic_cast<Component*> (&dcc))
fileListComp->setColour (DirectoryContentsDisplayComponent::textColourId,
currentColourScheme.getUIColour (isItemSelected ? ColourScheme::UIColour::highlightedText
: ColourScheme::UIColour::menuText));
LookAndFeel_V2::drawFileBrowserRow (g, width, height, file, filename, icon,
fileSizeDescription, fileTimeDescription,
isDirectory, isItemSelected, itemIndex, dcc);
@@ -1409,8 +1404,9 @@ void LookAndFeel_V4::initialiseColours()
BubbleComponent::backgroundColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::widgetBackground).getARGB(),
BubbleComponent::outlineColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),
DirectoryContentsDisplayComponent::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
DirectoryContentsDisplayComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
DirectoryContentsDisplayComponent::highlightColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedFill).getARGB(),
DirectoryContentsDisplayComponent::textColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::menuText).getARGB(),
DirectoryContentsDisplayComponent::highlightedTextColourId, currentColourScheme.getUIColour (ColourScheme::UIColour::highlightedText).getARGB(),
0x1000440, /*LassoComponent::lassoFillColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::defaultFill).getARGB(),
0x1000441, /*LassoComponent::lassoOutlineColourId*/ currentColourScheme.getUIColour (ColourScheme::UIColour::outline).getARGB(),


Loading…
Cancel
Save