diff --git a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp index 6753f030a6..720eeb9388 100644 --- a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp +++ b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.cpp @@ -773,3 +773,19 @@ void IntrojucerLookAndFeel::drawButtonBackground (Graphics& g, g.setColour (Colours::black.withAlpha (0.4f * mainAlpha)); g.strokePath (outline, PathStrokeType (1.0f)); } + +void IntrojucerLookAndFeel::drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header) +{ + Rectangle r (header.getLocalBounds()); + + g.setColour (Colours::black.withAlpha (0.5f)); + g.fillRect (r.removeFromBottom (1)); + + g.setColour (Colours::white.withAlpha (0.6f)); + g.fillRect (r); + + g.setColour (Colours::black.withAlpha (0.5f)); + + for (int i = header.getNumColumns (true); --i >= 0;) + g.fillRect (header.getColumnPosition (i).removeFromRight (1)); +} diff --git a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.h b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.h index def8a6d6ea..e2d39edda7 100644 --- a/extras/Introjucer/Source/Application/jucer_AppearanceSettings.h +++ b/extras/Introjucer/Source/Application/jucer_AppearanceSettings.h @@ -88,28 +88,29 @@ public: int getTabButtonOverlap (int tabDepth) override; int getTabButtonSpaceAroundImage() override; - int getTabButtonBestWidth (TabBarButton& button, int tabDepth) override; - static Colour getTabBackgroundColour (TabBarButton& button); - void drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown) override; + int getTabButtonBestWidth (TabBarButton&, int tabDepth) override; + static Colour getTabBackgroundColour (TabBarButton&); + void drawTabButton (TabBarButton& button, Graphics&, bool isMouseOver, bool isMouseDown) override; - Rectangle getTabButtonExtraComponentBounds (const TabBarButton& button, Rectangle& textArea, Component& comp) override; + Rectangle getTabButtonExtraComponentBounds (const TabBarButton&, Rectangle& textArea, Component&) override; void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int, int) override {} - void drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/, bool isMouseOver, bool isMouseDragging) override; + void drawStretchableLayoutResizerBar (Graphics&, int w, int h, bool isVerticalBar, bool isMouseOver, bool isMouseDragging) override; Rectangle getPropertyComponentContentPosition (PropertyComponent&) override; bool areScrollbarButtonsVisible() override { return false; } - void drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height, bool isScrollbarVertical, - int thumbStartPosition, int thumbSize, bool /*isMouseOver*/, bool /*isMouseDown*/) override; + void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height, bool isScrollbarVertical, + int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override; - void drawConcertinaPanelHeader (Graphics& g, const Rectangle& area, - bool isMouseOver, bool isMouseDown, - ConcertinaPanel& concertina, Component& panel) override; + void drawConcertinaPanelHeader (Graphics&, const Rectangle& area, bool isMouseOver, bool isMouseDown, + ConcertinaPanel&, Component&) override; - void drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour, + void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour, bool isMouseOverButton, bool isButtonDown) override; + void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) override; + static Colour getScrollbarColourForBackground (Colour background); private: diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp index c6b7b1d3a8..dbaa9b9b7d 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp @@ -403,7 +403,7 @@ bool MainWindowList::openFile (const File& file) if (file.hasFileExtension (Project::projectFileExtension)) { - ScopedPointer newDoc (new Project (file)); + ScopedPointer newDoc (new Project (file)); if (newDoc->loadFrom (file, true)) { diff --git a/extras/Introjucer/Source/Utility/jucer_Icons.h b/extras/Introjucer/Source/Utility/jucer_Icons.h index f4273eac02..0944828cde 100644 --- a/extras/Introjucer/Source/Utility/jucer_Icons.h +++ b/extras/Introjucer/Source/Utility/jucer_Icons.h @@ -26,6 +26,40 @@ #define __JUCER_ICONS_JUCEHEADER__ +//============================================================================== +struct Icon +{ + Icon() : path (nullptr) {} + Icon (const Path& p, Colour c) : path (&p), colour (c) {} + Icon (const Path* p, Colour c) : path (p), colour (c) {} + + void draw (Graphics& g, const Rectangle& area, bool isCrossedOut) const + { + if (path != nullptr) + { + g.setColour (colour); + + const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize); + g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area)); + + if (isCrossedOut) + { + g.setColour (Colours::red.withAlpha (0.8f)); + g.drawLine ((float) area.getX(), area.getY() + area.getHeight() * 0.2f, + (float) area.getRight(), area.getY() + area.getHeight() * 0.8f, 3.0f); + } + } + } + + Icon withContrastingColourTo (Colour background) const + { + return Icon (path, background.contrasting (colour, 0.6f)); + } + + const Path* path; + Colour colour; +}; + //============================================================================== class Icons { diff --git a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h index 6a62084f2f..9315d2e606 100644 --- a/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h +++ b/extras/Introjucer/Source/Utility/jucer_MiscUtilities.h @@ -54,41 +54,6 @@ void showUTF8ToolWindow (ScopedPointer& ownerPointer); bool cancelAnyModalComponents(); bool reinvokeCommandAfterCancellingModalComps (const ApplicationCommandTarget::InvocationInfo&); -//============================================================================== -struct Icon -{ - Icon() : path (nullptr) {} - Icon (const Path& p, Colour c) : path (&p), colour (c) {} - Icon (const Path* p, Colour c) : path (p), colour (c) {} - - void draw (Graphics& g, const Rectangle& area, bool isCrossedOut) const - { - if (path != nullptr) - { - g.setColour (colour); - - const RectanglePlacement placement (RectanglePlacement::centred | RectanglePlacement::onlyReduceInSize); - g.fillPath (*path, placement.getTransformToFit (path->getBounds(), area)); - - if (isCrossedOut) - { - g.setColour (Colours::red.withAlpha (0.8f)); - g.drawLine ((float) area.getX(), area.getY() + area.getHeight() * 0.2f, - (float) area.getRight(), area.getY() + area.getHeight() * 0.8f, 3.0f); - } - } - } - - Icon withContrastingColourTo (Colour background) const - { - return Icon (path, background.contrasting (colour, 0.6f)); - } - - const Path* path; - Colour colour; -}; - - //============================================================================== class RolloverHelpComp : public Component, private Timer diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp index c6f83877ef..6e3a22af09 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp @@ -2365,19 +2365,19 @@ void LookAndFeel::drawTableHeaderBackground (Graphics& g, TableHeaderComponent& { g.fillAll (Colours::white); - const int w = header.getWidth(); - const int h = header.getHeight(); + Rectangle area (header.getLocalBounds()); + area.removeFromTop (area.getHeight() / 2); - g.setGradientFill (ColourGradient (Colour (0xffe8ebf9), 0.0f, h * 0.5f, - Colour (0xfff6f8f9), 0.0f, h - 1.0f, + g.setGradientFill (ColourGradient (Colour (0xffe8ebf9), 0.0f, (float) area.getY(), + Colour (0xfff6f8f9), 0.0f, (float) area.getBottom(), false)); - g.fillRect (0, h / 2, w, h); + g.fillRect (area); g.setColour (Colour (0x33000000)); - g.fillRect (0, h - 1, w, 1); + g.fillRect (area.removeFromBottom (1)); for (int i = header.getNumColumns (true); --i >= 0;) - g.fillRect (header.getColumnPosition (i).getRight() - 1, 0, 1, h - 1); + g.fillRect (header.getColumnPosition (i).removeFromRight (1)); } void LookAndFeel::drawTableHeaderColumn (Graphics& g, const String& columnName, int /*columnId*/, @@ -2390,28 +2390,25 @@ void LookAndFeel::drawTableHeaderColumn (Graphics& g, const String& columnName, else if (isMouseOver) g.fillAll (Colour (0x5599aadd)); - int rightOfText = width - 4; + Rectangle area (width, height); + area.reduce (4, 0); if ((columnFlags & (TableHeaderComponent::sortedForwards | TableHeaderComponent::sortedBackwards)) != 0) { - const float top = height * ((columnFlags & TableHeaderComponent::sortedForwards) != 0 ? 0.35f : (1.0f - 0.35f)); - const float bottom = height - top; - - const float w = height * 0.5f; - const float x = rightOfText - (w * 1.25f); - rightOfText = (int) x; - Path sortArrow; - sortArrow.addTriangle (x, bottom, x + w * 0.5f, top, x + w, bottom); + sortArrow.addTriangle (0.0f, 0.0f, + 0.5f, (columnFlags & TableHeaderComponent::sortedForwards) != 0 ? -0.8f : 0.8f, + 1.0f, 0.0f); g.setColour (Colour (0x99000000)); - g.fillPath (sortArrow); + g.fillPath (sortArrow, RectanglePlacement (RectanglePlacement::centred) + .getTransformToFit (sortArrow.getBounds(), + area.removeFromRight (height * 0.5f).reduced (2).toFloat())); } g.setColour (Colours::black); g.setFont (Font (height * 0.5f, Font::bold)); - const int textX = 4; - g.drawFittedText (columnName, textX, 0, rightOfText - textX, height, Justification::centredLeft, 1); + g.drawFittedText (columnName, area, Justification::centredLeft, 1); } //============================================================================== diff --git a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h index 914e018422..845dec4537 100644 --- a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h +++ b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.h @@ -315,12 +315,10 @@ public: */ virtual void tableColumnsChanged (TableHeaderComponent* tableHeader) = 0; - /** This is called when one or more of the table's columns are resized. - */ + /** This is called when one or more of the table's columns are resized. */ virtual void tableColumnsResized (TableHeaderComponent* tableHeader) = 0; - /** This is called when the column by which the table should be sorted is changed. - */ + /** This is called when the column by which the table should be sorted is changed. */ virtual void tableSortOrderChanged (TableHeaderComponent* tableHeader) = 0; /** This is called when the user begins or ends dragging one of the columns around.