29LookAndFeel_V3::LookAndFeel_V3()
49LookAndFeel_V3::~LookAndFeel_V3() {}
51bool LookAndFeel_V3::areScrollbarButtonsVisible() {
return false; }
53void LookAndFeel_V3::drawStretchableLayoutResizerBar (Graphics& g,
int ,
int ,
bool ,
57 g.fillAll (Colours::yellow.withAlpha (0.4f));
91 bool isMouseOver,
bool ,
97 Colours::darkgrey.withAlpha (0.1f), (
float) area.getBottom()));
109static void drawButtonShape (Graphics& g,
const Path& outline, Colour
baseColour,
float height)
116 g.fillPath (outline);
120 .scaled (1.0f, (height - 1.6f) / height));
122 g.setColour (Colours::black.withAlpha (0.4f *
mainAlpha));
123 g.strokePath (outline, PathStrokeType (1.0f));
126void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button,
const Colour& backgroundColour,
129 Colour
baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (
true) ? 1.3f : 0.9f)
130 .withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f));
135 const bool flatOnLeft = button.isConnectedOnLeft();
136 const bool flatOnRight = button.isConnectedOnRight();
137 const bool flatOnTop = button.isConnectedOnTop();
140 const float width = (
float) button.getWidth() - 1.0f;
141 const float height = (
float) button.getHeight() - 1.0f;
143 if (width > 0 && height > 0)
145 const float cornerSize = 4.0f;
148 outline.addRoundedRectangle (0.5f, 0.5f, width, height, cornerSize, cornerSize,
154 drawButtonShape (g, outline,
baseColour, height);
158void LookAndFeel_V3::drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header)
160 auto r = header.getLocalBounds();
163 g.setColour (outlineColour);
164 g.fillRect (r.removeFromBottom (1));
169 g.setColour (outlineColour);
171 for (
int i = header.getNumColumns (
true); --i >= 0;)
172 g.fillRect (header.getColumnPosition (i).removeFromRight (1));
175int LookAndFeel_V3::getTabButtonOverlap (
int ) {
return -1; }
176int LookAndFeel_V3::getTabButtonSpaceAroundImage() {
return 0; }
178void LookAndFeel_V3::createTabTextLayout (
const TabBarButton& button,
float length,
float depth,
179 Colour colour, TextLayout& textLayout)
181 Font font (depth * 0.5f);
182 font.setUnderline (button.hasKeyboardFocus (
false));
186 s.append (button.getButtonText().trim(), font, colour);
188 textLayout.createLayout (s, length);
191void LookAndFeel_V3::drawTabButton (TabBarButton& button, Graphics& g,
bool isMouseOver,
bool isMouseDown)
193 const Rectangle<int>
activeArea (button.getActiveArea());
197 const Colour
bkg (button.getTabBackgroundColour());
199 if (button.getToggleState())
216 g.setGradientFill (ColourGradient (
bkg.brighter (0.2f),
p1.toFloat(),
217 bkg.darker (0.1f),
p2.toFloat(),
false));
226 if (
o != TabbedButtonBar::TabsAtBottom) g.fillRect (r.removeFromTop (1));
227 if (
o != TabbedButtonBar::TabsAtTop) g.fillRect (r.removeFromBottom (1));
228 if (
o != TabbedButtonBar::TabsAtRight) g.fillRect (r.removeFromLeft (1));
229 if (
o != TabbedButtonBar::TabsAtLeft) g.fillRect (r.removeFromRight (1));
231 const float alpha = button.isEnabled() ? ((isMouseOver ||
isMouseDown) ? 1.0f : 0.8f) : 0.3f;
233 Colour
col (
bkg.contrasting().withMultipliedAlpha (alpha));
235 if (TabbedButtonBar*
bar = button.findParentComponentOfClass<TabbedButtonBar>())
246 const Rectangle<float> area (button.getTextArea().toFloat());
251 if (button.getTabbedButtonBar().isVertical())
254 TextLayout textLayout;
255 createTabTextLayout (button, length, depth,
col, textLayout);
263 case TabbedButtonBar::TabsAtTop:
264 case TabbedButtonBar::TabsAtBottom: t = t.translated (area.
getX(), area.
getY());
break;
269 textLayout.draw (g, Rectangle<float> (length, depth));
272void LookAndFeel_V3::drawTabAreaBehindFrontButton (TabbedButtonBar&
bar, Graphics& g,
const int w,
const int h)
277 ColourGradient gradient (Colours::black.withAlpha (
bar.isEnabled() ? 0.08f : 0.04f), 0, 0,
278 Colours::transparentBlack, 0, 0,
false);
280 switch (
bar.getOrientation())
282 case TabbedButtonBar::TabsAtLeft:
283 gradient.point1.x = (
float) w;
285 shadowRect.setBounds ((
int) gradient.point2.x, 0, w - (
int) gradient.point2.x, h);
286 line.setBounds (w - 1, 0, 1, h);
289 case TabbedButtonBar::TabsAtRight:
291 shadowRect.setBounds (0, 0, (
int) gradient.point2.x, h);
292 line.setBounds (0, 0, 1, h);
295 case TabbedButtonBar::TabsAtTop:
296 gradient.point1.y = (
float) h;
298 shadowRect.setBounds (0, (
int) gradient.point2.y, w, h - (
int) gradient.point2.y);
299 line.setBounds (0, h - 1, w, 1);
302 case TabbedButtonBar::TabsAtBottom:
304 shadowRect.setBounds (0, 0, w, (
int) gradient.point2.y);
305 line.setBounds (0, 0, w, 1);
311 g.setGradientFill (gradient);
318void LookAndFeel_V3::drawTextEditorOutline (Graphics& g,
int width,
int height, TextEditor& textEditor)
320 if (textEditor.isEnabled())
322 if (textEditor.hasKeyboardFocus (
true) && ! textEditor.isReadOnly())
325 g.drawRect (0, 0, width, height, 2);
330 g.drawRect (0, 0, width, height);
335void LookAndFeel_V3::drawTreeviewPlusMinusBox (Graphics& g,
const Rectangle<float>& area,
336 Colour backgroundColour,
bool isOpen,
bool isMouseOver)
339 p.addTriangle (0.0f, 0.0f, 1.0f, isOpen ? 0.0f : 0.5f, isOpen ? 0.5f : 0.0f, 1.0f);
341 g.setColour (backgroundColour.contrasting().withAlpha (isMouseOver ? 0.5f : 0.3f));
342 g.fillPath (p, p.getTransformToScaleToFit (area.reduced (2, area.getHeight() / 4),
true));
345bool LookAndFeel_V3::areLinesDrawnForTreeView (TreeView&)
350int LookAndFeel_V3::getTreeViewIndentSize (TreeView&)
355void LookAndFeel_V3::drawComboBox (Graphics& g,
int width,
int height,
const bool ,
360 if (box.isEnabled() && box.hasKeyboardFocus (
false))
363 g.drawRect (0, 0, width, height, 2);
368 g.drawRect (0, 0, width, height);
371 const float arrowX = 0.3f;
372 const float arrowH = 0.2f;
380 p.addTriangle (x + w * 0.5f, y + h * (0.45f -
arrowH),
381 x + w * (1.0f -
arrowX), y + h * 0.45f,
382 x + w *
arrowX, y + h * 0.45f);
384 p.addTriangle (x + w * 0.5f, y + h * (0.55f +
arrowH),
385 x + w * (1.0f -
arrowX), y + h * 0.55f,
386 x + w *
arrowX, y + h * 0.55f);
392void LookAndFeel_V3::drawLinearSlider (Graphics& g,
int x,
int y,
int width,
int height,
410 .withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f)
411 .withMultipliedAlpha (0.8f);
424 drawLinearSliderOutline (g, x, y, width, height, style, slider);
433void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g,
int x,
int y,
int width,
int height,
442 const Colour
gradCol1 (
trackColour.overlaidWith (Colour (slider.isEnabled() ? 0x13000000 : 0x09000000)));
446 if (slider.isHorizontal())
466 g.strokePath (indent, PathStrokeType (0.5f));
479void LookAndFeel_V3::drawMenuBarBackground (
Graphics& g,
int width,
int height,
486 g.
setColour (colour.contrasting (0.15f));
488 g.
fillRect (r.removeFromBottom (1));
494void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g,
int width,
int height,
497 const Colour
textColour (button.findColour (0x100ad01 ,
true));
501 if (button.isEnabled())
503 g.setColour (
textColour.withAlpha (button.isDown() ? 0.4f : (button.isOver() ? 0.2f : 0.1f)));
504 g.fillRoundedRectangle (button.getLocalBounds().toFloat(), 4.0f);
505 g.drawRoundedRectangle (button.getLocalBounds().toFloat(), 4.0f, 1.0f);
509 g.setFont ((
float) height * 0.6f);
514 const float thickness = 7.0f;
515 const float indent = 22.0f;
518 p.addEllipse (0.0f, 0.0f, 100.0f, 100.0f);
519 p.addRectangle (indent, 50.0f - thickness, 100.0f - indent * 2.0f, thickness * 2.0f);
520 p.addRectangle (50.0f - thickness, indent, thickness * 2.0f, 50.0f - indent - thickness);
521 p.addRectangle (50.0f - thickness, 50.0f + thickness, thickness * 2.0f, 50.0f - indent - thickness);
522 p.setUsingNonZeroWinding (
false);
524 g.setColour (
textColour.darker (0.1f).withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f)));
525 g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, (
float) width - 4.0f, (
float) height - 4.0f,
true));
528 if (button.hasKeyboardFocus (
false))
531 g.drawRect (0, 0, width, height);
540 :
Button (name), colour (c), normalShape (normal), toggledShape (
toggled)
546 Colour background (Colours::grey);
549 background =
rw->getBackgroundColour();
571 diam * 2.0f * scale,
diam * 2.0f * scale,
true));
576 Path normalShape, toggledShape;
581Button* LookAndFeel_V3::createDocumentWindowButton (
int buttonType)
586 if (
buttonType == DocumentWindow::closeButton)
591 return new LookAndFeel_V3_DocumentWindowButton (
"close", Colour (0xffdd1100), shape, shape);
594 if (
buttonType == DocumentWindow::minimiseButton)
598 return new LookAndFeel_V3_DocumentWindowButton (
"minimise", Colour (0xffaa8811), shape, shape);
601 if (
buttonType == DocumentWindow::maximiseButton)
615 return new LookAndFeel_V3_DocumentWindowButton (
"maximise", Colour (0xff119911), shape,
fullscreenShape);
624 static const unsigned char pathData[]
625 = { 110,109,32,210,202,64,126,183,148,64,108,39,244,247,64,245,76,124,64,108,178,131,27,65,246,76,252,64,108,175,242,4,65,246,76,252,
626 64,108,236,5,68,65,0,0,160,180,108,240,150,90,65,21,136,52,63,108,48,59,16,65,0,0,32,65,108,32,210,202,64,126,183,148,64, 99,101,0,0 };
630 p.
scaleToFit (0, 0, height * 2.0f, height,
true);
636 static const unsigned char pathData[]
637 = { 110,109,88,57,198,65,29,90,171,65,108,63,53,154,65,8,172,126,65,108,76,55,198,65,215,163,38,65,108,141,151,175,65,82,184,242,64,108,117,147,131,65,90,100,81,65,108,184,30,47,65,82,184,242,64,108,59,223,1,65,215,163,38,65,108,84,227,89,65,8,172,126,65,
638 108,35,219,1,65,29,90,171,65,108,209,34,47,65,231,251,193,65,108,117,147,131,65,207,247,149,65,108,129,149,175,65,231,251,193,65,99,101,0,0 };
642 p.
scaleToFit (0, 0, height * 2.0f, height,
true);
@ backgroundColourId
A background colour to fill the bubble with.
static ColourGradient horizontal(Colour colour1, float x1, Colour colour2, float x2)
Creates a horizontal linear gradient between two X coordinates.
static ColourGradient vertical(Colour colour1, float y1, Colour colour2, float y2)
Creates a vertical linear gradient between two Y coordinates.
Represents a colour, also including a transparency value.
Colour withAlpha(uint8 newAlpha) const noexcept
Returns a colour that's the same colour as this one, but with a new alpha value.
Colour brighter(float amountBrighter=0.4f) const noexcept
Returns a brighter version of this colour.
static Colour greyLevel(float brightness) noexcept
Returns an opaque shade of grey.
Colour contrasting(float amount=1.0f) const noexcept
Returns a colour that will be clearly visible against this colour.
@ arrowColourId
The colour for the arrow shape that pops up the menu.
@ outlineColourId
The colour for an outline around the box.
@ focusedOutlineColourId
The colour that will be used to draw a box around the edge of the component when it has focus.
@ buttonColourId
The base colour for the button (a LookAndFeel class will probably use variations on this).
@ backgroundColourId
The background colour to fill the box with.
The base class for all JUCE user-interface objects.
int getHeight() const noexcept
Returns the component's height in pixels.
int getWidth() const noexcept
Returns the component's width in pixels.
bool isEnabled() const noexcept
Returns true if the component (and all its parents) are enabled.
A panel which holds a vertical stack of components which can be expanded and contracted.
Represents a particular font, including its size, style, etc.
Font boldened() const
Returns a copy of this font with the bold attribute set.
A graphics context, used for drawing a component or image.
void drawFittedText(const String &text, int x, int y, int width, int height, Justification justificationFlags, int maximumNumberOfLines, float minimumHorizontalScale=0.0f) const
Tries to draw a text string inside a given space.
void setFont(const Font &newFont)
Changes the font to use for subsequent text-drawing functions.
void setGradientFill(const ColourGradient &gradient)
Sets the context to use a gradient for its fill pattern.
void drawRect(int x, int y, int width, int height, int lineThickness=1) const
Draws a rectangular outline, using the current colour or brush.
void fillRect(Rectangle< int > rectangle) const
Fills a rectangle with the current colour or brush.
void fillPath(const Path &path) const
Fills a path using the currently selected colour or brush.
void drawEllipse(float x, float y, float width, float height, float lineThickness) const
Draws an elliptical stroke using the current colour or brush.
void setColour(Colour newColour)
Changes the current drawing colour.
void strokePath(const Path &path, const PathStrokeType &strokeType, const AffineTransform &transform={}) const
Draws a path's outline using the currently selected colour or brush.
void fillAll() const
Fills the context's entire clip region with the current colour or brush.
void fillEllipse(float x, float y, float width, float height) const
Fills an ellipse with the current colour or brush.
@ centred
Indicates that the item should be centred vertically and horizontally.
@ centredLeft
Indicates that the item should be centred vertically but placed on the left hand side.
void drawScrollbar(Graphics &, ScrollBar &, int x, int y, int width, int height, bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override
Draws the thumb area of a scrollbar.
Path getTickShape(float height) override
Returns a tick shape for use in yes/no boxes, etc.
void drawPopupMenuBackground(Graphics &, int width, int height) override
Fills the background of a popup menu component.
Path getCrossShape(float height) override
Returns a cross shape for use in yes/no boxes, etc.
bool isColourSpecified(int colourId) const noexcept
Returns true if the specified colour ID has been explicitly set using the setColour() method.
void setColour(int colourId, Colour colour) noexcept
Registers a colour to be used for a particular purpose.
Colour findColour(int colourId) const noexcept
Looks for a colour that has been registered with the given colour ID number.
Describes a type of stroke used to render a solid outline along a path.
A path is a sequence of lines and curves that may either form a closed shape or be open-ended.
void loadPathFromData(const void *data, size_t numberOfBytes)
Loads a stored path from a block of data.
void addRoundedRectangle(float x, float y, float width, float height, float cornerSize)
Adds a rectangle with rounded corners to the path.
AffineTransform getTransformToScaleToFit(float x, float y, float width, float height, bool preserveProportions, Justification justificationType=Justification::centred) const
Returns a transform that can be used to rescale the path to fit into a given space.
void scaleToFit(float x, float y, float width, float height, bool preserveProportions) noexcept
Rescales this path to make it fit neatly into a given space.
void addLineSegment(Line< float > line, float lineThickness)
Adds a line with a specified thickness.
Manages a rectangle and allows geometric operations to be performed on it.
ValueType getRight() const noexcept
Returns the x coordinate of the rectangle's right-hand-side.
Rectangle withHeight(ValueType newHeight) const noexcept
Returns a rectangle which has the same position and width as this one, but with a different height.
ValueType getX() const noexcept
Returns the x coordinate of the rectangle's left-hand-side.
ValueType getBottom() const noexcept
Returns the y coordinate of the rectangle's bottom edge.
ValueType getWidth() const noexcept
Returns the width of the rectangle.
ValueType getY() const noexcept
Returns the y coordinate of the rectangle's top edge.
Rectangle withTop(ValueType newTop) const noexcept
Returns a new rectangle with a different y position, but the same bottom edge as this one.
ValueType getHeight() const noexcept
Returns the height of the rectangle.
A base class for top-level windows that can be dragged around and resized.
SliderStyle
The types of slider available.
@ LinearBarVertical
A vertical bar slider with the text label drawn on top of it.
@ LinearBar
A horizontal bar slider with the text label drawn on top of it.
@ trackColourId
The colour to draw the groove that the thumb moves along.
@ backgroundColourId
A colour to use to fill the slider's background.
@ thumbColourId
The colour to draw the thumb with.
@ outlineColourId
The colour to use to draw an outline around the content.
@ buttonColourId
The colour used to fill the button shape (when the button is toggled 'off').
@ buttonOnColourId
The colour used to fill the button shape (when the button is toggled 'on').
@ outlineColourId
If this is non-transparent, it will be used to draw a box around the edge of the component.
@ focusedOutlineColourId
If this is non-transparent, it will be used to draw a box around the edge of the component when it ha...
@ selectedItemBackgroundColourId
The colour to use to fill the background of any selected items.
constexpr Type jmin(Type a, Type b)
Returns the smaller of two values.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
static constexpr FloatType pi
A predefined value for Pi.