LookAndFeel::drawFileBrowserRow improvement.tags/2021-05-28
| @@ -1602,6 +1602,19 @@ ImageEffectFilter* LookAndFeel::getSliderEffect() | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| Font LookAndFeel::getSliderPopupFont() | |||||
| { | |||||
| return Font (15.0f, Font::bold); | |||||
| } | |||||
| int LookAndFeel::getSliderPopupPlacement() | |||||
| { | |||||
| return BubbleComponent::above | |||||
| | BubbleComponent::below | |||||
| | BubbleComponent::left | |||||
| | BubbleComponent::right; | |||||
| } | |||||
| //============================================================================== | //============================================================================== | ||||
| void LookAndFeel::getTooltipSize (const String& tipText, int& width, int& height) | void LookAndFeel::getTooltipSize (const String& tipText, int& width, int& height) | ||||
| { | { | ||||
| @@ -2510,10 +2523,13 @@ void LookAndFeel::drawFileBrowserRow (Graphics& g, int width, int height, | |||||
| const bool isDirectory, | const bool isDirectory, | ||||
| const bool isItemSelected, | const bool isItemSelected, | ||||
| const int /*itemIndex*/, | const int /*itemIndex*/, | ||||
| DirectoryContentsDisplayComponent&) | |||||
| DirectoryContentsDisplayComponent& dcc) | |||||
| { | { | ||||
| Component* const fileListComp = dynamic_cast<Component*> (&dcc); | |||||
| if (isItemSelected) | if (isItemSelected) | ||||
| g.fillAll (findColour (DirectoryContentsDisplayComponent::highlightColourId)); | |||||
| g.fillAll (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::highlightColourId) | |||||
| : findColour (DirectoryContentsDisplayComponent::highlightColourId)); | |||||
| const int x = 32; | const int x = 32; | ||||
| g.setColour (Colours::black); | g.setColour (Colours::black); | ||||
| @@ -2532,7 +2548,8 @@ void LookAndFeel::drawFileBrowserRow (Graphics& g, int width, int height, | |||||
| RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f); | RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize, 1.0f); | ||||
| } | } | ||||
| g.setColour (findColour (DirectoryContentsDisplayComponent::textColourId)); | |||||
| g.setColour (fileListComp != nullptr ? fileListComp->findColour (DirectoryContentsDisplayComponent::textColourId) | |||||
| : findColour (DirectoryContentsDisplayComponent::textColourId)); | |||||
| g.setFont (height * 0.7f); | g.setFont (height * 0.7f); | ||||
| if (width > 450 && ! isDirectory) | if (width > 450 && ! isDirectory) | ||||
| @@ -450,6 +450,9 @@ public: | |||||
| virtual ImageEffectFilter* getSliderEffect(); | virtual ImageEffectFilter* getSliderEffect(); | ||||
| virtual Font getSliderPopupFont(); | |||||
| virtual int getSliderPopupPlacement(); | |||||
| //============================================================================== | //============================================================================== | ||||
| virtual void getTooltipSize (const String& tipText, int& width, int& height); | virtual void getTooltipSize (const String& tipText, int& width, int& height); | ||||
| @@ -28,9 +28,9 @@ class Slider::Pimpl : public AsyncUpdater, | |||||
| public ValueListener | public ValueListener | ||||
| { | { | ||||
| public: | public: | ||||
| Pimpl (Slider& owner_, SliderStyle style_, TextEntryBoxPosition textBoxPosition) | |||||
| : owner (owner_), | |||||
| style (style_), | |||||
| Pimpl (Slider& s, SliderStyle sliderStyle, TextEntryBoxPosition textBoxPosition) | |||||
| : owner (s), | |||||
| style (sliderStyle), | |||||
| lastCurrentValue (0), lastValueMin (0), lastValueMax (0), | lastCurrentValue (0), lastValueMin (0), lastValueMax (0), | ||||
| minimum (0), maximum (10), interval (0), doubleClickReturnValue (0), | minimum (0), maximum (10), interval (0), doubleClickReturnValue (0), | ||||
| skewFactor (1.0), velocityModeSensitivity (1.0), | skewFactor (1.0), velocityModeSensitivity (1.0), | ||||
| @@ -1256,11 +1256,12 @@ public: | |||||
| public Timer | public Timer | ||||
| { | { | ||||
| public: | public: | ||||
| PopupDisplayComponent (Slider& owner_) | |||||
| : owner (owner_), | |||||
| font (15.0f, Font::bold) | |||||
| PopupDisplayComponent (Slider& s) | |||||
| : owner (s), | |||||
| font (s.getLookAndFeel().getSliderPopupFont()) | |||||
| { | { | ||||
| setAlwaysOnTop (true); | setAlwaysOnTop (true); | ||||
| setAllowedPlacement (owner.getLookAndFeel().getSliderPopupPlacement()); | |||||
| } | } | ||||
| void paintContent (Graphics& g, int w, int h) | void paintContent (Graphics& g, int w, int h) | ||||
| @@ -1470,9 +1471,9 @@ void Slider::setDoubleClickReturnValue (bool isDoubleClickEnabled, double value | |||||
| pimpl->doubleClickReturnValue = valueToSetOnDoubleClick; | pimpl->doubleClickReturnValue = valueToSetOnDoubleClick; | ||||
| } | } | ||||
| double Slider::getDoubleClickReturnValue (bool& isEnabled_) const | |||||
| double Slider::getDoubleClickReturnValue (bool& isEnabledResult) const | |||||
| { | { | ||||
| isEnabled_ = pimpl->doubleClickToValue; | |||||
| isEnabledResult = pimpl->doubleClickToValue; | |||||
| return pimpl->doubleClickReturnValue; | return pimpl->doubleClickReturnValue; | ||||
| } | } | ||||
| @@ -1546,7 +1547,7 @@ void Slider::stoppedDragging() {} | |||||
| void Slider::valueChanged() {} | void Slider::valueChanged() {} | ||||
| //============================================================================== | //============================================================================== | ||||
| void Slider::setPopupMenuEnabled (const bool menuEnabled_) { pimpl->menuEnabled = menuEnabled_; } | |||||
| void Slider::setPopupMenuEnabled (const bool menuEnabled) { pimpl->menuEnabled = menuEnabled; } | |||||
| void Slider::setScrollWheelEnabled (const bool enabled) { pimpl->scrollWheelEnabled = enabled; } | void Slider::setScrollWheelEnabled (const bool enabled) { pimpl->scrollWheelEnabled = enabled; } | ||||
| bool Slider::isHorizontal() const noexcept { return pimpl->isHorizontal(); } | bool Slider::isHorizontal() const noexcept { return pimpl->isHorizontal(); } | ||||