mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-20 01:14:20 +00:00
Added Animated App template and examples
This commit is contained in:
parent
fefcf7aca6
commit
ff6520a89a
1141 changed files with 438491 additions and 94 deletions
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
//==============================================================================
|
||||
static Typeface::Ptr getTypefaceForFontFromLookAndFeel (const Font& font)
|
||||
{
|
||||
return LookAndFeel::getDefaultLookAndFeel().getTypefaceForFont (font);
|
||||
}
|
||||
|
||||
typedef Typeface::Ptr (*GetTypefaceForFont) (const Font&);
|
||||
extern GetTypefaceForFont juce_getTypefaceForFont;
|
||||
|
||||
//==============================================================================
|
||||
LookAndFeel::LookAndFeel()
|
||||
: useNativeAlertWindows (false)
|
||||
{
|
||||
/* if this fails it means you're trying to create a LookAndFeel object before
|
||||
the static Colours have been initialised. That ain't gonna work. It probably
|
||||
means that you're using a static LookAndFeel object and that your compiler has
|
||||
decided to intialise it before the Colours class.
|
||||
*/
|
||||
jassert (Colours::white == Colour (0xffffffff));
|
||||
|
||||
juce_getTypefaceForFont = getTypefaceForFontFromLookAndFeel;
|
||||
}
|
||||
|
||||
LookAndFeel::~LookAndFeel()
|
||||
{
|
||||
masterReference.clear();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Colour LookAndFeel::findColour (int colourID) const noexcept
|
||||
{
|
||||
const ColourSetting c = { colourID, Colour() };
|
||||
const int index = colours.indexOf (c);
|
||||
|
||||
if (index >= 0)
|
||||
return colours.getReference (index).colour;
|
||||
|
||||
jassertfalse;
|
||||
return Colours::black;
|
||||
}
|
||||
|
||||
void LookAndFeel::setColour (int colourID, Colour newColour) noexcept
|
||||
{
|
||||
const ColourSetting c = { colourID, newColour };
|
||||
const int index = colours.indexOf (c);
|
||||
|
||||
if (index >= 0)
|
||||
colours.getReference (index).colour = newColour;
|
||||
else
|
||||
colours.add (c);
|
||||
}
|
||||
|
||||
bool LookAndFeel::isColourSpecified (const int colourID) const noexcept
|
||||
{
|
||||
const ColourSetting c = { colourID, Colour() };
|
||||
return colours.contains (c);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
LookAndFeel& LookAndFeel::getDefaultLookAndFeel() noexcept
|
||||
{
|
||||
return Desktop::getInstance().getDefaultLookAndFeel();
|
||||
}
|
||||
|
||||
void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) noexcept
|
||||
{
|
||||
Desktop::getInstance().setDefaultLookAndFeel (newDefaultLookAndFeel);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Typeface::Ptr LookAndFeel::getTypefaceForFont (const Font& font)
|
||||
{
|
||||
if (defaultSans.isNotEmpty() && font.getTypefaceName() == Font::getDefaultSansSerifFontName())
|
||||
{
|
||||
Font f (font);
|
||||
f.setTypefaceName (defaultSans);
|
||||
return Typeface::createSystemTypefaceFor (f);
|
||||
}
|
||||
|
||||
return Font::getDefaultTypefaceForFont (font);
|
||||
}
|
||||
|
||||
void LookAndFeel::setDefaultSansSerifTypefaceName (const String& newName)
|
||||
{
|
||||
if (defaultSans != newName)
|
||||
{
|
||||
Typeface::clearTypefaceCache();
|
||||
defaultSans = newName;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
MouseCursor LookAndFeel::getMouseCursorFor (Component& component)
|
||||
{
|
||||
MouseCursor m (component.getMouseCursor());
|
||||
|
||||
Component* parent = component.getParentComponent();
|
||||
while (parent != nullptr && m == MouseCursor::ParentCursor)
|
||||
{
|
||||
m = parent->getMouseCursor();
|
||||
parent = parent->getParentComponent();
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
LowLevelGraphicsContext* LookAndFeel::createGraphicsContext (const Image& imageToRenderOn, const Point<int>& origin,
|
||||
const RectangleList<int>& initialClip)
|
||||
{
|
||||
return new LowLevelGraphicsSoftwareRenderer (imageToRenderOn, origin, initialClip);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel::setUsingNativeAlertWindows (bool shouldUseNativeAlerts)
|
||||
{
|
||||
useNativeAlertWindows = shouldUseNativeAlerts;
|
||||
}
|
||||
|
||||
bool LookAndFeel::isUsingNativeAlertWindows()
|
||||
{
|
||||
#if JUCE_LINUX
|
||||
return false; // not available currently..
|
||||
#else
|
||||
return useNativeAlertWindows;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_LOOKANDFEEL_H_INCLUDED
|
||||
#define JUCE_LOOKANDFEEL_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
/** This class is used to hold a few look and feel base classes which are associated
|
||||
with classes that may not be present because they're from modules other than
|
||||
juce_gui_basics.
|
||||
*/
|
||||
struct JUCE_API ExtraLookAndFeelBaseClasses
|
||||
{
|
||||
//==============================================================================
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API LassoComponentMethods
|
||||
{
|
||||
virtual ~LassoComponentMethods() {}
|
||||
|
||||
virtual void drawLasso (Graphics&, Component& lassoComp) = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API KeyMappingEditorComponentMethods
|
||||
{
|
||||
virtual ~KeyMappingEditorComponentMethods() {}
|
||||
|
||||
virtual void drawKeymapChangeButton (Graphics&, int width, int height, Button&, const String& keyDescription) = 0;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/** This abstract base class is implemented by LookAndFeel classes. */
|
||||
struct JUCE_API AudioDeviceSelectorComponentMethods
|
||||
{
|
||||
virtual ~AudioDeviceSelectorComponentMethods() {}
|
||||
|
||||
virtual void drawLevelMeter (Graphics&, int width, int height, float level) = 0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
LookAndFeel objects define the appearance of all the JUCE widgets, and subclasses
|
||||
can be used to apply different 'skins' to the application.
|
||||
|
||||
This class is an abstract base-class - for actual look-and-feels that you can
|
||||
instantiate, see LookAndFeel_V1, LookAndFeel_V2 and LookAndFeel_V3.
|
||||
|
||||
@see LookAndFeel_V1, LookAndFeel_V2, LookAndFeel_V3
|
||||
*/
|
||||
class JUCE_API LookAndFeel : public ScrollBar::LookAndFeelMethods,
|
||||
public Button::LookAndFeelMethods,
|
||||
public ImageButton::LookAndFeelMethods,
|
||||
public TextEditor::LookAndFeelMethods,
|
||||
public FileBrowserComponent::LookAndFeelMethods,
|
||||
public TreeView::LookAndFeelMethods,
|
||||
public BubbleComponent::LookAndFeelMethods,
|
||||
public AlertWindow::LookAndFeelMethods,
|
||||
public PopupMenu::LookAndFeelMethods,
|
||||
public ComboBox::LookAndFeelMethods,
|
||||
public Label::LookAndFeelMethods,
|
||||
public Slider::LookAndFeelMethods,
|
||||
public ResizableWindow::LookAndFeelMethods,
|
||||
public DocumentWindow::LookAndFeelMethods,
|
||||
public TooltipWindow::LookAndFeelMethods,
|
||||
public TabbedButtonBar::LookAndFeelMethods,
|
||||
public PropertyComponent::LookAndFeelMethods,
|
||||
public FilenameComponent::LookAndFeelMethods,
|
||||
public GroupComponent::LookAndFeelMethods,
|
||||
public TableHeaderComponent::LookAndFeelMethods,
|
||||
public CallOutBox::LookAndFeelMethods,
|
||||
public Toolbar::LookAndFeelMethods,
|
||||
public ConcertinaPanel::LookAndFeelMethods,
|
||||
public ProgressBar::LookAndFeelMethods,
|
||||
public StretchableLayoutResizerBar::LookAndFeelMethods,
|
||||
public ExtraLookAndFeelBaseClasses::KeyMappingEditorComponentMethods,
|
||||
public ExtraLookAndFeelBaseClasses::AudioDeviceSelectorComponentMethods,
|
||||
public ExtraLookAndFeelBaseClasses::LassoComponentMethods
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates the default JUCE look and feel. */
|
||||
LookAndFeel();
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~LookAndFeel();
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the current default look-and-feel for a component to use when it
|
||||
hasn't got one explicitly set.
|
||||
|
||||
@see setDefaultLookAndFeel
|
||||
*/
|
||||
static LookAndFeel& getDefaultLookAndFeel() noexcept;
|
||||
|
||||
/** Changes the default look-and-feel.
|
||||
|
||||
@param newDefaultLookAndFeel the new look-and-feel object to use - if this is
|
||||
set to null, it will revert to using the default one. The
|
||||
object passed-in must be deleted by the caller when
|
||||
it's no longer needed.
|
||||
@see getDefaultLookAndFeel
|
||||
*/
|
||||
static void setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Looks for a colour that has been registered with the given colour ID number.
|
||||
|
||||
If a colour has been set for this ID number using setColour(), then it is
|
||||
returned. If none has been set, it will just return Colours::black.
|
||||
|
||||
The colour IDs for various purposes are stored as enums in the components that
|
||||
they are relevent to - for an example, see Slider::ColourIds,
|
||||
Label::ColourIds, TextEditor::ColourIds, TreeView::ColourIds, etc.
|
||||
|
||||
If you're looking up a colour for use in drawing a component, it's usually
|
||||
best not to call this directly, but to use the Component::findColour() method
|
||||
instead. That will first check whether a suitable colour has been registered
|
||||
directly with the component, and will fall-back on calling the component's
|
||||
LookAndFeel's findColour() method if none is found.
|
||||
|
||||
@see setColour, Component::findColour, Component::setColour
|
||||
*/
|
||||
Colour findColour (int colourId) const noexcept;
|
||||
|
||||
/** Registers a colour to be used for a particular purpose.
|
||||
For more details, see the comments for findColour().
|
||||
@see findColour, Component::findColour, Component::setColour
|
||||
*/
|
||||
void setColour (int colourId, Colour colour) noexcept;
|
||||
|
||||
/** Returns true if the specified colour ID has been explicitly set using the
|
||||
setColour() method.
|
||||
*/
|
||||
bool isColourSpecified (int colourId) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the typeface that should be used for a given font.
|
||||
The default implementation just does what you'd expect it to, but you can override
|
||||
this if you want to intercept fonts and use your own custom typeface object.
|
||||
*/
|
||||
virtual Typeface::Ptr getTypefaceForFont (const Font&);
|
||||
|
||||
/** Allows you to change the default sans-serif font.
|
||||
|
||||
If you need to supply your own Typeface object for any of the default fonts, rather
|
||||
than just supplying the name (e.g. if you want to use an embedded font), then
|
||||
you should instead override getTypefaceForFont() to create and return the typeface.
|
||||
*/
|
||||
void setDefaultSansSerifTypefaceName (const String& newName);
|
||||
|
||||
//==============================================================================
|
||||
/** Override this to get the chance to swap a component's mouse cursor for a
|
||||
customised one.
|
||||
*/
|
||||
virtual MouseCursor getMouseCursorFor (Component&);
|
||||
|
||||
//==============================================================================
|
||||
/** Creates a new graphics context object. */
|
||||
virtual LowLevelGraphicsContext* createGraphicsContext (const Image& imageToRenderOn,
|
||||
const Point<int>& origin,
|
||||
const RectangleList<int>& initialClip);
|
||||
|
||||
void setUsingNativeAlertWindows (bool shouldUseNativeAlerts);
|
||||
bool isUsingNativeAlertWindows();
|
||||
|
||||
//==============================================================================
|
||||
/** Draws a small image that spins to indicate that something's happening.
|
||||
This method should use the current time to animate itself, so just keep
|
||||
repainting it every so often.
|
||||
*/
|
||||
virtual void drawSpinningWaitAnimation (Graphics&, const Colour& colour,
|
||||
int x, int y, int w, int h) = 0;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a tick shape for use in yes/no boxes, etc. */
|
||||
virtual Path getTickShape (float height) = 0;
|
||||
/** Returns a cross shape for use in yes/no boxes, etc. */
|
||||
virtual Path getCrossShape (float height) = 0;
|
||||
|
||||
//==============================================================================
|
||||
virtual DropShadower* createDropShadowerForComponent (Component*) = 0;
|
||||
|
||||
//==============================================================================
|
||||
/** Plays the system's default 'beep' noise, to alert the user about something very important. */
|
||||
virtual void playAlertSound();
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
friend class WeakReference<LookAndFeel>;
|
||||
WeakReference<LookAndFeel>::Master masterReference;
|
||||
|
||||
struct ColourSetting
|
||||
{
|
||||
int colourID;
|
||||
Colour colour;
|
||||
|
||||
bool operator< (const ColourSetting& other) const noexcept { return colourID < other.colourID; }
|
||||
bool operator== (const ColourSetting& other) const noexcept { return colourID == other.colourID; }
|
||||
};
|
||||
|
||||
SortedSet<ColourSetting> colours;
|
||||
String defaultSans, defaultSerif, defaultFixed;
|
||||
bool useNativeAlertWindows;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel)
|
||||
};
|
||||
|
||||
|
||||
#endif // JUCE_LOOKANDFEEL_H_INCLUDED
|
||||
|
|
@ -0,0 +1,567 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
LookAndFeel_V1::LookAndFeel_V1()
|
||||
{
|
||||
setColour (TextButton::buttonColourId, Colour (0xffbbbbff));
|
||||
setColour (ListBox::outlineColourId, findColour (ComboBox::outlineColourId));
|
||||
setColour (ScrollBar::thumbColourId, Colour (0xffbbbbdd));
|
||||
setColour (ScrollBar::backgroundColourId, Colours::transparentBlack);
|
||||
setColour (Slider::thumbColourId, Colours::white);
|
||||
setColour (Slider::trackColourId, Colour (0x7f000000));
|
||||
setColour (Slider::textBoxOutlineColourId, Colours::grey);
|
||||
setColour (ProgressBar::backgroundColourId, Colours::white.withAlpha (0.6f));
|
||||
setColour (ProgressBar::foregroundColourId, Colours::green.withAlpha (0.7f));
|
||||
setColour (PopupMenu::backgroundColourId, Colour (0xffeef5f8));
|
||||
setColour (PopupMenu::highlightedBackgroundColourId, Colour (0xbfa4c2ce));
|
||||
setColour (PopupMenu::highlightedTextColourId, Colours::black);
|
||||
setColour (TextEditor::focusedOutlineColourId, findColour (TextButton::buttonColourId));
|
||||
|
||||
scrollbarShadow.setShadowProperties (DropShadow (Colours::black.withAlpha (0.5f), 2, Point<int>()));
|
||||
}
|
||||
|
||||
LookAndFeel_V1::~LookAndFeel_V1()
|
||||
{
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel_V1::drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
|
||||
bool isMouseOverButton, bool isButtonDown)
|
||||
{
|
||||
const int width = button.getWidth();
|
||||
const int height = button.getHeight();
|
||||
|
||||
const float indent = 2.0f;
|
||||
const int cornerSize = jmin (roundToInt (width * 0.4f),
|
||||
roundToInt (height * 0.4f));
|
||||
|
||||
Path p;
|
||||
p.addRoundedRectangle (indent, indent,
|
||||
width - indent * 2.0f,
|
||||
height - indent * 2.0f,
|
||||
(float) cornerSize);
|
||||
|
||||
Colour bc (backgroundColour.withMultipliedSaturation (0.3f));
|
||||
|
||||
if (isMouseOverButton)
|
||||
{
|
||||
if (isButtonDown)
|
||||
bc = bc.brighter();
|
||||
else if (bc.getBrightness() > 0.5f)
|
||||
bc = bc.darker (0.1f);
|
||||
else
|
||||
bc = bc.brighter (0.1f);
|
||||
}
|
||||
|
||||
g.setColour (bc);
|
||||
g.fillPath (p);
|
||||
|
||||
g.setColour (bc.contrasting().withAlpha ((isMouseOverButton) ? 0.6f : 0.4f));
|
||||
g.strokePath (p, PathStrokeType ((isMouseOverButton) ? 2.0f : 1.4f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawTickBox (Graphics& g, Component& /*component*/,
|
||||
float x, float y, float w, float h,
|
||||
const bool ticked,
|
||||
const bool isEnabled,
|
||||
const bool /*isMouseOverButton*/,
|
||||
const bool isButtonDown)
|
||||
{
|
||||
Path box;
|
||||
box.addRoundedRectangle (0.0f, 2.0f, 6.0f, 6.0f, 1.0f);
|
||||
|
||||
g.setColour (isEnabled ? Colours::blue.withAlpha (isButtonDown ? 0.3f : 0.1f)
|
||||
: Colours::lightgrey.withAlpha (0.1f));
|
||||
|
||||
AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f).translated (x, y));
|
||||
|
||||
g.fillPath (box, trans);
|
||||
|
||||
g.setColour (Colours::black.withAlpha (0.6f));
|
||||
g.strokePath (box, PathStrokeType (0.9f), trans);
|
||||
|
||||
if (ticked)
|
||||
{
|
||||
Path tick;
|
||||
tick.startNewSubPath (1.5f, 3.0f);
|
||||
tick.lineTo (3.0f, 6.0f);
|
||||
tick.lineTo (6.0f, 0.0f);
|
||||
|
||||
g.setColour (isEnabled ? Colours::black : Colours::grey);
|
||||
g.strokePath (tick, PathStrokeType (2.5f), trans);
|
||||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown)
|
||||
{
|
||||
if (button.hasKeyboardFocus (true))
|
||||
{
|
||||
g.setColour (button.findColour (TextEditor::focusedOutlineColourId));
|
||||
g.drawRect (0, 0, button.getWidth(), button.getHeight());
|
||||
}
|
||||
|
||||
const int tickWidth = jmin (20, button.getHeight() - 4);
|
||||
|
||||
drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
|
||||
(float) tickWidth, (float) tickWidth,
|
||||
button.getToggleState(),
|
||||
button.isEnabled(),
|
||||
isMouseOverButton,
|
||||
isButtonDown);
|
||||
|
||||
g.setColour (button.findColour (ToggleButton::textColourId));
|
||||
g.setFont (jmin (15.0f, button.getHeight() * 0.6f));
|
||||
|
||||
if (! button.isEnabled())
|
||||
g.setOpacity (0.5f);
|
||||
|
||||
const int textX = tickWidth + 5;
|
||||
|
||||
g.drawFittedText (button.getButtonText(),
|
||||
textX, 4,
|
||||
button.getWidth() - textX - 2, button.getHeight() - 8,
|
||||
Justification::centredLeft, 10);
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawProgressBar (Graphics& g, ProgressBar& progressBar,
|
||||
int width, int height,
|
||||
double progress, const String& textToShow)
|
||||
{
|
||||
if (progress < 0 || progress >= 1.0)
|
||||
{
|
||||
LookAndFeel_V2::drawProgressBar (g, progressBar, width, height, progress, textToShow);
|
||||
}
|
||||
else
|
||||
{
|
||||
const Colour background (progressBar.findColour (ProgressBar::backgroundColourId));
|
||||
const Colour foreground (progressBar.findColour (ProgressBar::foregroundColourId));
|
||||
|
||||
g.fillAll (background);
|
||||
g.setColour (foreground);
|
||||
|
||||
g.fillRect (1, 1,
|
||||
jlimit (0, width - 2, roundToInt (progress * (width - 2))),
|
||||
height - 2);
|
||||
|
||||
if (textToShow.isNotEmpty())
|
||||
{
|
||||
g.setColour (Colour::contrasting (background, foreground));
|
||||
g.setFont (height * 0.6f);
|
||||
|
||||
g.drawText (textToShow, 0, 0, width, height, Justification::centred, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawScrollbarButton (Graphics& g, ScrollBar& bar,
|
||||
int width, int height, int buttonDirection,
|
||||
bool isScrollbarVertical,
|
||||
bool isMouseOverButton,
|
||||
bool isButtonDown)
|
||||
{
|
||||
if (isScrollbarVertical)
|
||||
width -= 2;
|
||||
else
|
||||
height -= 2;
|
||||
|
||||
Path p;
|
||||
|
||||
if (buttonDirection == 0)
|
||||
p.addTriangle (width * 0.5f, height * 0.2f,
|
||||
width * 0.1f, height * 0.7f,
|
||||
width * 0.9f, height * 0.7f);
|
||||
else if (buttonDirection == 1)
|
||||
p.addTriangle (width * 0.8f, height * 0.5f,
|
||||
width * 0.3f, height * 0.1f,
|
||||
width * 0.3f, height * 0.9f);
|
||||
else if (buttonDirection == 2)
|
||||
p.addTriangle (width * 0.5f, height * 0.8f,
|
||||
width * 0.1f, height * 0.3f,
|
||||
width * 0.9f, height * 0.3f);
|
||||
else if (buttonDirection == 3)
|
||||
p.addTriangle (width * 0.2f, height * 0.5f,
|
||||
width * 0.7f, height * 0.1f,
|
||||
width * 0.7f, height * 0.9f);
|
||||
|
||||
if (isButtonDown)
|
||||
g.setColour (Colours::white);
|
||||
else if (isMouseOverButton)
|
||||
g.setColour (Colours::white.withAlpha (0.7f));
|
||||
else
|
||||
g.setColour (bar.findColour (ScrollBar::thumbColourId).withAlpha (0.5f));
|
||||
|
||||
g.fillPath (p);
|
||||
|
||||
g.setColour (Colours::black.withAlpha (0.5f));
|
||||
g.strokePath (p, PathStrokeType (0.5f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawScrollbar (Graphics& g, ScrollBar& bar,
|
||||
int x, int y, int width, int height,
|
||||
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,
|
||||
bool isMouseOver, bool isMouseDown)
|
||||
{
|
||||
g.fillAll (bar.findColour (ScrollBar::backgroundColourId));
|
||||
|
||||
g.setColour (bar.findColour (ScrollBar::thumbColourId)
|
||||
.withAlpha ((isMouseOver || isMouseDown) ? 0.4f : 0.15f));
|
||||
|
||||
if (thumbSize > 0.0f)
|
||||
{
|
||||
Rectangle<int> thumb;
|
||||
|
||||
if (isScrollbarVertical)
|
||||
{
|
||||
width -= 2;
|
||||
g.fillRect (x + roundToInt (width * 0.35f), y,
|
||||
roundToInt (width * 0.3f), height);
|
||||
|
||||
thumb.setBounds (x + 1, thumbStartPosition,
|
||||
width - 2, thumbSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
height -= 2;
|
||||
g.fillRect (x, y + roundToInt (height * 0.35f),
|
||||
width, roundToInt (height * 0.3f));
|
||||
|
||||
thumb.setBounds (thumbStartPosition, y + 1,
|
||||
thumbSize, height - 2);
|
||||
}
|
||||
|
||||
g.setColour (bar.findColour (ScrollBar::thumbColourId)
|
||||
.withAlpha ((isMouseOver || isMouseDown) ? 0.95f : 0.7f));
|
||||
|
||||
g.fillRect (thumb);
|
||||
|
||||
g.setColour (Colours::black.withAlpha ((isMouseOver || isMouseDown) ? 0.4f : 0.25f));
|
||||
g.drawRect (thumb.getX(), thumb.getY(), thumb.getWidth(), thumb.getHeight());
|
||||
|
||||
if (thumbSize > 16)
|
||||
{
|
||||
for (int i = 3; --i >= 0;)
|
||||
{
|
||||
const float linePos = thumbStartPosition + thumbSize / 2 + (i - 1) * 4.0f;
|
||||
g.setColour (Colours::black.withAlpha (0.15f));
|
||||
|
||||
if (isScrollbarVertical)
|
||||
{
|
||||
g.drawLine (x + width * 0.2f, linePos, width * 0.8f, linePos);
|
||||
g.setColour (Colours::white.withAlpha (0.15f));
|
||||
g.drawLine (width * 0.2f, linePos - 1, width * 0.8f, linePos - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.drawLine (linePos, height * 0.2f, linePos, height * 0.8f);
|
||||
g.setColour (Colours::white.withAlpha (0.15f));
|
||||
g.drawLine (linePos - 1, height * 0.2f, linePos - 1, height * 0.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImageEffectFilter* LookAndFeel_V1::getScrollbarEffect()
|
||||
{
|
||||
return &scrollbarShadow;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel_V1::drawPopupMenuBackground (Graphics& g, int width, int height)
|
||||
{
|
||||
g.fillAll (findColour (PopupMenu::backgroundColourId));
|
||||
|
||||
g.setColour (Colours::black.withAlpha (0.6f));
|
||||
g.drawRect (0, 0, width, height);
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawMenuBarBackground (Graphics& g, int /*width*/, int /*height*/, bool, MenuBarComponent& menuBar)
|
||||
{
|
||||
g.fillAll (menuBar.findColour (PopupMenu::backgroundColourId));
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel_V1::drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor)
|
||||
{
|
||||
if (textEditor.isEnabled())
|
||||
{
|
||||
g.setColour (textEditor.findColour (TextEditor::outlineColourId));
|
||||
g.drawRect (0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel_V1::drawComboBox (Graphics& g, int width, int height,
|
||||
const bool isButtonDown,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH,
|
||||
ComboBox& box)
|
||||
{
|
||||
g.fillAll (box.findColour (ComboBox::backgroundColourId));
|
||||
|
||||
g.setColour (box.findColour ((isButtonDown) ? ComboBox::buttonColourId
|
||||
: ComboBox::backgroundColourId));
|
||||
g.fillRect (buttonX, buttonY, buttonW, buttonH);
|
||||
|
||||
g.setColour (box.findColour (ComboBox::outlineColourId));
|
||||
g.drawRect (0, 0, width, height);
|
||||
|
||||
const float arrowX = 0.2f;
|
||||
const float arrowH = 0.3f;
|
||||
|
||||
if (box.isEnabled())
|
||||
{
|
||||
Path p;
|
||||
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH),
|
||||
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
|
||||
buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f);
|
||||
|
||||
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH),
|
||||
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
|
||||
buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f);
|
||||
|
||||
g.setColour (box.findColour ((isButtonDown) ? ComboBox::backgroundColourId
|
||||
: ComboBox::buttonColourId));
|
||||
g.fillPath (p);
|
||||
}
|
||||
}
|
||||
|
||||
Font LookAndFeel_V1::getComboBoxFont (ComboBox& box)
|
||||
{
|
||||
Font f (jmin (15.0f, box.getHeight() * 0.85f));
|
||||
f.setHorizontalScale (0.9f);
|
||||
return f;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
static void drawTriangle (Graphics& g, float x1, float y1, float x2, float y2, float x3, float y3, Colour fill, Colour outline)
|
||||
{
|
||||
Path p;
|
||||
p.addTriangle (x1, y1, x2, y2, x3, y3);
|
||||
g.setColour (fill);
|
||||
g.fillPath (p);
|
||||
|
||||
g.setColour (outline);
|
||||
g.strokePath (p, PathStrokeType (0.3f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::drawLinearSlider (Graphics& g,
|
||||
int x, int y, int w, int h,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle style,
|
||||
Slider& slider)
|
||||
{
|
||||
g.fillAll (slider.findColour (Slider::backgroundColourId));
|
||||
|
||||
if (style == Slider::LinearBar)
|
||||
{
|
||||
g.setColour (slider.findColour (Slider::thumbColourId));
|
||||
g.fillRect (x, y, (int) sliderPos - x, h);
|
||||
|
||||
g.setColour (slider.findColour (Slider::textBoxTextColourId).withMultipliedAlpha (0.5f));
|
||||
g.drawRect (x, y, (int) sliderPos - x, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.setColour (slider.findColour (Slider::trackColourId)
|
||||
.withMultipliedAlpha (slider.isEnabled() ? 1.0f : 0.3f));
|
||||
|
||||
if (slider.isHorizontal())
|
||||
{
|
||||
g.fillRect (x, y + roundToInt (h * 0.6f),
|
||||
w, roundToInt (h * 0.2f));
|
||||
}
|
||||
else
|
||||
{
|
||||
g.fillRect (x + roundToInt (w * 0.5f - jmin (3.0f, w * 0.1f)), y,
|
||||
jmin (4, roundToInt (w * 0.2f)), h);
|
||||
}
|
||||
|
||||
float alpha = 0.35f;
|
||||
|
||||
if (slider.isEnabled())
|
||||
alpha = slider.isMouseOverOrDragging() ? 1.0f : 0.7f;
|
||||
|
||||
const Colour fill (slider.findColour (Slider::thumbColourId).withAlpha (alpha));
|
||||
const Colour outline (Colours::black.withAlpha (slider.isEnabled() ? 0.7f : 0.35f));
|
||||
|
||||
if (style == Slider::TwoValueVertical || style == Slider::ThreeValueVertical)
|
||||
{
|
||||
drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), minSliderPos,
|
||||
x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos - 7.0f,
|
||||
x + w * 0.5f - jmin (8.0f, w * 0.4f), minSliderPos,
|
||||
fill, outline);
|
||||
|
||||
drawTriangle (g, x + w * 0.5f + jmin (4.0f, w * 0.3f), maxSliderPos,
|
||||
x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos,
|
||||
x + w * 0.5f - jmin (8.0f, w * 0.4f), maxSliderPos + 7.0f,
|
||||
fill, outline);
|
||||
}
|
||||
else if (style == Slider::TwoValueHorizontal || style == Slider::ThreeValueHorizontal)
|
||||
{
|
||||
drawTriangle (g, minSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f),
|
||||
minSliderPos - 7.0f, y + h * 0.9f ,
|
||||
minSliderPos, y + h * 0.9f,
|
||||
fill, outline);
|
||||
|
||||
drawTriangle (g, maxSliderPos, y + h * 0.6f - jmin (4.0f, h * 0.3f),
|
||||
maxSliderPos, y + h * 0.9f,
|
||||
maxSliderPos + 7.0f, y + h * 0.9f,
|
||||
fill, outline);
|
||||
}
|
||||
|
||||
if (style == Slider::LinearHorizontal || style == Slider::ThreeValueHorizontal)
|
||||
{
|
||||
drawTriangle (g, sliderPos, y + h * 0.9f,
|
||||
sliderPos - 7.0f, y + h * 0.2f,
|
||||
sliderPos + 7.0f, y + h * 0.2f,
|
||||
fill, outline);
|
||||
}
|
||||
else if (style == Slider::LinearVertical || style == Slider::ThreeValueVertical)
|
||||
{
|
||||
drawTriangle (g, x + w * 0.5f - jmin (4.0f, w * 0.3f), sliderPos,
|
||||
x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos - 7.0f,
|
||||
x + w * 0.5f + jmin (8.0f, w * 0.4f), sliderPos + 7.0f,
|
||||
fill, outline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button* LookAndFeel_V1::createSliderButton (Slider&, const bool isIncrement)
|
||||
{
|
||||
if (isIncrement)
|
||||
return new ArrowButton ("u", 0.75f, Colours::white.withAlpha (0.8f));
|
||||
|
||||
return new ArrowButton ("d", 0.25f, Colours::white.withAlpha (0.8f));
|
||||
}
|
||||
|
||||
ImageEffectFilter* LookAndFeel_V1::getSliderEffect (Slider&)
|
||||
{
|
||||
return &scrollbarShadow;
|
||||
}
|
||||
|
||||
int LookAndFeel_V1::getSliderThumbRadius (Slider&)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void LookAndFeel_V1::drawCornerResizer (Graphics& g, int w, int h, bool isMouseOver, bool isMouseDragging)
|
||||
{
|
||||
g.setColour ((isMouseOver || isMouseDragging) ? Colours::lightgrey
|
||||
: Colours::darkgrey);
|
||||
|
||||
const float lineThickness = jmin (w, h) * 0.1f;
|
||||
|
||||
for (float i = 0.0f; i < 1.0f; i += 0.3f)
|
||||
{
|
||||
g.drawLine (w * i,
|
||||
h + 1.0f,
|
||||
w + 1.0f,
|
||||
h * i,
|
||||
lineThickness);
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Button* LookAndFeel_V1::createDocumentWindowButton (int buttonType)
|
||||
{
|
||||
Path shape;
|
||||
|
||||
if (buttonType == DocumentWindow::closeButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.0f, 1.0f, 1.0f), 0.35f);
|
||||
shape.addLineSegment (Line<float> (1.0f, 0.0f, 0.0f, 1.0f), 0.35f);
|
||||
|
||||
ShapeButton* const b = new ShapeButton ("close",
|
||||
Colour (0x7fff3333),
|
||||
Colour (0xd7ff3333),
|
||||
Colour (0xf7ff3333));
|
||||
|
||||
b->setShape (shape, true, true, true);
|
||||
return b;
|
||||
}
|
||||
else if (buttonType == DocumentWindow::minimiseButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.5f, 1.0f, 0.5f), 0.25f);
|
||||
|
||||
DrawableButton* b = new DrawableButton ("minimise", DrawableButton::ImageFitted);
|
||||
DrawablePath dp;
|
||||
dp.setPath (shape);
|
||||
dp.setFill (Colours::black.withAlpha (0.3f));
|
||||
b->setImages (&dp);
|
||||
return b;
|
||||
}
|
||||
else if (buttonType == DocumentWindow::maximiseButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.5f, 0.0f, 0.5f, 1.0f), 0.25f);
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.5f, 1.0f, 0.5f), 0.25f);
|
||||
|
||||
DrawableButton* b = new DrawableButton ("maximise", DrawableButton::ImageFitted);
|
||||
DrawablePath dp;
|
||||
dp.setPath (shape);
|
||||
dp.setFill (Colours::black.withAlpha (0.3f));
|
||||
b->setImages (&dp);
|
||||
return b;
|
||||
}
|
||||
|
||||
jassertfalse;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LookAndFeel_V1::positionDocumentWindowButtons (DocumentWindow&,
|
||||
int titleBarX, int titleBarY, int titleBarW, int titleBarH,
|
||||
Button* minimiseButton,
|
||||
Button* maximiseButton,
|
||||
Button* closeButton,
|
||||
bool positionTitleBarButtonsOnLeft)
|
||||
{
|
||||
titleBarY += titleBarH / 8;
|
||||
titleBarH -= titleBarH / 4;
|
||||
|
||||
const int buttonW = titleBarH;
|
||||
|
||||
int x = positionTitleBarButtonsOnLeft ? titleBarX + 4
|
||||
: titleBarX + titleBarW - buttonW - 4;
|
||||
|
||||
if (closeButton != nullptr)
|
||||
{
|
||||
closeButton->setBounds (x, titleBarY, buttonW, titleBarH);
|
||||
x += positionTitleBarButtonsOnLeft ? buttonW + buttonW / 5
|
||||
: -(buttonW + buttonW / 5);
|
||||
}
|
||||
|
||||
if (positionTitleBarButtonsOnLeft)
|
||||
std::swap (minimiseButton, maximiseButton);
|
||||
|
||||
if (maximiseButton != nullptr)
|
||||
{
|
||||
maximiseButton->setBounds (x, titleBarY - 2, buttonW, titleBarH);
|
||||
x += positionTitleBarButtonsOnLeft ? buttonW : -buttonW;
|
||||
}
|
||||
|
||||
if (minimiseButton != nullptr)
|
||||
minimiseButton->setBounds (x, titleBarY - 2, buttonW, titleBarH);
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_LOOKANDFEEL_V1_H_INCLUDED
|
||||
#define JUCE_LOOKANDFEEL_V1_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
The original JUCE look-and-feel, as used back from 2002 to about 2007ish.
|
||||
@see LookAndFeel, LookAndFeel_V2, LookAndFeel_V3
|
||||
*/
|
||||
class JUCE_API LookAndFeel_V1 : public LookAndFeel_V2
|
||||
{
|
||||
public:
|
||||
LookAndFeel_V1();
|
||||
~LookAndFeel_V1();
|
||||
|
||||
//==============================================================================
|
||||
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
|
||||
bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawTickBox (Graphics&, Component&, float x, float y, float w, float h,
|
||||
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawProgressBar (Graphics&, ProgressBar&, int width, int height,
|
||||
double progress, const String& textToShow) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawScrollbarButton (Graphics&, ScrollBar&, int width, int height,
|
||||
int buttonDirection, bool isScrollbarVertical,
|
||||
bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height,
|
||||
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,
|
||||
bool isMouseOver, bool isMouseDown) override;
|
||||
|
||||
ImageEffectFilter* getScrollbarEffect() override;
|
||||
|
||||
//==============================================================================
|
||||
void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawPopupMenuBackground (Graphics&, int width, int height) override;
|
||||
void drawMenuBarBackground (Graphics&, int width, int height, bool isMouseOverBar, MenuBarComponent&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH, ComboBox&) override;
|
||||
|
||||
Font getComboBoxFont (ComboBox&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawLinearSlider (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
int getSliderThumbRadius (Slider&) override;
|
||||
Button* createSliderButton (Slider&, bool isIncrement) override;
|
||||
ImageEffectFilter* getSliderEffect (Slider&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawCornerResizer (Graphics&, int w, int h, bool isMouseOver, bool isMouseDragging) override;
|
||||
|
||||
Button* createDocumentWindowButton (int buttonType) override;
|
||||
|
||||
void positionDocumentWindowButtons (DocumentWindow&,
|
||||
int titleBarX, int titleBarY, int titleBarW, int titleBarH,
|
||||
Button* minimiseButton, Button* maximiseButton, Button* closeButton,
|
||||
bool positionTitleBarButtonsOnLeft) override;
|
||||
|
||||
private:
|
||||
DropShadowEffect scrollbarShadow;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel_V1)
|
||||
};
|
||||
|
||||
|
||||
#endif // JUCE_LOOKANDFEEL_V1_H_INCLUDED
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,350 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_LOOKANDFEEL_V2_H_INCLUDED
|
||||
#define JUCE_LOOKANDFEEL_V2_H_INCLUDED
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
This LookAndFeel subclass implements the juce style from around 2008-12.
|
||||
|
||||
@see LookAndFeel, LookAndFeel_V1, LookAndFeel_V3
|
||||
*/
|
||||
class JUCE_API LookAndFeel_V2 : public LookAndFeel
|
||||
{
|
||||
public:
|
||||
LookAndFeel_V2();
|
||||
~LookAndFeel_V2();
|
||||
|
||||
//==============================================================================
|
||||
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
|
||||
bool isMouseOverButton, bool isButtonDown) override;
|
||||
Font getTextButtonFont (TextButton&, int buttonHeight) override;
|
||||
|
||||
void drawButtonText (Graphics&, TextButton&, bool isMouseOverButton, bool isButtonDown) override;
|
||||
int getTextButtonWidthToFitText (TextButton&, int buttonHeight) override;
|
||||
|
||||
void drawToggleButton (Graphics&, ToggleButton&, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void changeToggleButtonWidthToFitText (ToggleButton&) override;
|
||||
|
||||
void drawTickBox (Graphics&, Component&,
|
||||
float x, float y, float w, float h,
|
||||
bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawDrawableButton (Graphics&, DrawableButton&, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
//==============================================================================
|
||||
AlertWindow* createAlertWindow (const String& title, const String& message,
|
||||
const String& button1,
|
||||
const String& button2,
|
||||
const String& button3,
|
||||
AlertWindow::AlertIconType iconType,
|
||||
int numButtons, Component* associatedComponent) override;
|
||||
|
||||
void drawAlertBox (Graphics&, AlertWindow&, const Rectangle<int>& textArea, TextLayout&) override;
|
||||
int getAlertBoxWindowFlags() override;
|
||||
int getAlertWindowButtonHeight() override;
|
||||
Font getAlertWindowMessageFont() override;
|
||||
Font getAlertWindowFont() override;
|
||||
|
||||
//==============================================================================
|
||||
void drawProgressBar (Graphics&, ProgressBar&, int width, int height, double progress, const String& textToShow) override;
|
||||
void drawSpinningWaitAnimation (Graphics&, const Colour& colour, int x, int y, int w, int h) override;
|
||||
|
||||
//==============================================================================
|
||||
bool areScrollbarButtonsVisible() override;
|
||||
void drawScrollbarButton (Graphics&, ScrollBar&, int width, int height, int buttonDirection,
|
||||
bool isScrollbarVertical, bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height,
|
||||
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,
|
||||
bool isMouseOver, bool isMouseDown) override;
|
||||
|
||||
ImageEffectFilter* getScrollbarEffect() override;
|
||||
int getMinimumScrollbarThumbSize (ScrollBar&) override;
|
||||
int getDefaultScrollbarWidth() override;
|
||||
int getScrollbarButtonSize (ScrollBar&) override;
|
||||
|
||||
//==============================================================================
|
||||
Path getTickShape (float height) override;
|
||||
Path getCrossShape (float height) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawTreeviewPlusMinusBox (Graphics&, const Rectangle<float>& area,
|
||||
Colour backgroundColour, bool isOpen, bool isMouseOver) override;
|
||||
bool areLinesDrawnForTreeView (TreeView&) override;
|
||||
int getTreeViewIndentSize (TreeView&) override;
|
||||
|
||||
//==============================================================================
|
||||
void fillTextEditorBackground (Graphics&, int width, int height, TextEditor&) override;
|
||||
void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) override;
|
||||
CaretComponent* createCaretComponent (Component* keyFocusOwner) override;
|
||||
|
||||
//==============================================================================
|
||||
const Drawable* getDefaultFolderImage() override;
|
||||
const Drawable* getDefaultDocumentFileImage() override;
|
||||
|
||||
AttributedString createFileChooserHeaderText (const String& title, const String& instructions) override;
|
||||
|
||||
void drawFileBrowserRow (Graphics&, int width, int height,
|
||||
const String& filename, Image* icon,
|
||||
const String& fileSizeDescription, const String& fileTimeDescription,
|
||||
bool isDirectory, bool isItemSelected, int itemIndex,
|
||||
DirectoryContentsDisplayComponent&) override;
|
||||
|
||||
Button* createFileBrowserGoUpButton() override;
|
||||
|
||||
void layoutFileBrowserComponent (FileBrowserComponent&,
|
||||
DirectoryContentsDisplayComponent*,
|
||||
FilePreviewComponent*,
|
||||
ComboBox* currentPathBox,
|
||||
TextEditor* filenameBox,
|
||||
Button* goUpButton) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawBubble (Graphics&, BubbleComponent&, const Point<float>& tip, const Rectangle<float>& body) override;
|
||||
|
||||
void drawLasso (Graphics&, Component&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawPopupMenuBackground (Graphics&, int width, int height) override;
|
||||
|
||||
void drawPopupMenuItem (Graphics&, const Rectangle<int>& area,
|
||||
bool isSeparator, bool isActive, bool isHighlighted, bool isTicked, bool hasSubMenu,
|
||||
const String& text, const String& shortcutKeyText,
|
||||
const Drawable* icon, const Colour* textColour) override;
|
||||
|
||||
void drawPopupMenuSectionHeader (Graphics&, const Rectangle<int>& area,
|
||||
const String& sectionName) override;
|
||||
|
||||
Font getPopupMenuFont() override;
|
||||
|
||||
void drawPopupMenuUpDownArrow (Graphics&, int width, int height, bool isScrollUpArrow) override;
|
||||
|
||||
void getIdealPopupMenuItemSize (const String& text, bool isSeparator, int standardMenuItemHeight,
|
||||
int& idealWidth, int& idealHeight) override;
|
||||
int getMenuWindowFlags() override;
|
||||
|
||||
void drawMenuBarBackground (Graphics&, int width, int height, bool isMouseOverBar, MenuBarComponent&) override;
|
||||
int getMenuBarItemWidth (MenuBarComponent&, int itemIndex, const String& itemText) override;
|
||||
Font getMenuBarFont (MenuBarComponent&, int itemIndex, const String& itemText) override;
|
||||
int getDefaultMenuBarHeight() override;
|
||||
|
||||
void drawMenuBarItem (Graphics&, int width, int height,
|
||||
int itemIndex, const String& itemText,
|
||||
bool isMouseOverItem, bool isMenuOpen, bool isMouseOverBar,
|
||||
MenuBarComponent&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH,
|
||||
ComboBox&) override;
|
||||
Font getComboBoxFont (ComboBox&) override;
|
||||
Label* createComboBoxTextBox (ComboBox&) override;
|
||||
void positionComboBoxText (ComboBox&, Label&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawLabel (Graphics&, Label&) override;
|
||||
Font getLabelFont (Label&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawLinearSlider (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
void drawLinearSliderBackground (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
void drawLinearSliderThumb (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
void drawRotarySlider (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPosProportional, float rotaryStartAngle, float rotaryEndAngle,
|
||||
Slider&) override;
|
||||
|
||||
int getSliderThumbRadius (Slider&) override;
|
||||
Button* createSliderButton (Slider&, bool isIncrement) override;
|
||||
Label* createSliderTextBox (Slider&) override;
|
||||
ImageEffectFilter* getSliderEffect (Slider&) override;
|
||||
Font getSliderPopupFont (Slider&) override;
|
||||
int getSliderPopupPlacement (Slider&) override;
|
||||
|
||||
//==============================================================================
|
||||
void getTooltipSize (const String& tipText, int& width, int& height) override;
|
||||
void drawTooltip (Graphics&, const String& text, int width, int height) override;
|
||||
|
||||
//==============================================================================
|
||||
Button* createFilenameComponentBrowseButton (const String& text) override;
|
||||
void layoutFilenameComponent (FilenameComponent&, ComboBox* filenameBox, Button* browseButton) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area,
|
||||
bool isMouseOver, bool isMouseDown,
|
||||
ConcertinaPanel&, Component& panel) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawCornerResizer (Graphics&, int w, int h, bool isMouseOver, bool isMouseDragging) override;
|
||||
void drawResizableFrame (Graphics&, int w, int h, const BorderSize<int>&) override;
|
||||
|
||||
//==============================================================================
|
||||
void fillResizableWindowBackground (Graphics&, int w, int h, const BorderSize<int>&, ResizableWindow&) override;
|
||||
void drawResizableWindowBorder (Graphics&, int w, int h, const BorderSize<int>& border, ResizableWindow&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawDocumentWindowTitleBar (DocumentWindow&, Graphics&, int w, int h,
|
||||
int titleSpaceX, int titleSpaceW,
|
||||
const Image* icon, bool drawTitleTextOnLeft) override;
|
||||
|
||||
Button* createDocumentWindowButton (int buttonType) override;
|
||||
|
||||
void positionDocumentWindowButtons (DocumentWindow&,
|
||||
int titleBarX, int titleBarY, int titleBarW, int titleBarH,
|
||||
Button* minimiseButton,
|
||||
Button* maximiseButton,
|
||||
Button* closeButton,
|
||||
bool positionTitleBarButtonsOnLeft) override;
|
||||
|
||||
//==============================================================================
|
||||
DropShadower* createDropShadowerForComponent (Component*) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawStretchableLayoutResizerBar (Graphics&, int w, int h, bool isVerticalBar,
|
||||
bool isMouseOver, bool isMouseDragging) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawGroupComponentOutline (Graphics&, int w, int h, const String& text,
|
||||
const Justification&, GroupComponent&) override;
|
||||
|
||||
//==============================================================================
|
||||
int getTabButtonSpaceAroundImage() override;
|
||||
int getTabButtonOverlap (int tabDepth) override;
|
||||
int getTabButtonBestWidth (TabBarButton&, int tabDepth) override;
|
||||
Rectangle<int> getTabButtonExtraComponentBounds (const TabBarButton&, Rectangle<int>& textArea, Component& extraComp) override;
|
||||
|
||||
void drawTabButton (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
|
||||
void drawTabButtonText (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
|
||||
void drawTabbedButtonBarBackground (TabbedButtonBar&, Graphics&) override;
|
||||
void drawTabAreaBehindFrontButton (TabbedButtonBar&, Graphics&, int w, int h) override;
|
||||
|
||||
void createTabButtonShape (TabBarButton&, Path&, bool isMouseOver, bool isMouseDown) override;
|
||||
void fillTabButtonShape (TabBarButton&, Graphics&, const Path&, bool isMouseOver, bool isMouseDown) override;
|
||||
|
||||
Button* createTabBarExtrasButton() override;
|
||||
|
||||
//==============================================================================
|
||||
void drawImageButton (Graphics&, Image*,
|
||||
int imageX, int imageY, int imageW, int imageH,
|
||||
const Colour& overlayColour, float imageOpacity, ImageButton&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) override;
|
||||
|
||||
void drawTableHeaderColumn (Graphics&, const String& columnName, int columnId,
|
||||
int width, int height, bool isMouseOver, bool isMouseDown,
|
||||
int columnFlags) override;
|
||||
|
||||
//==============================================================================
|
||||
void paintToolbarBackground (Graphics&, int width, int height, Toolbar&) override;
|
||||
|
||||
Button* createToolbarMissingItemsButton (Toolbar&) override;
|
||||
|
||||
void paintToolbarButtonBackground (Graphics&, int width, int height,
|
||||
bool isMouseOver, bool isMouseDown,
|
||||
ToolbarItemComponent&) override;
|
||||
|
||||
void paintToolbarButtonLabel (Graphics&, int x, int y, int width, int height,
|
||||
const String& text, ToolbarItemComponent&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawPropertyPanelSectionHeader (Graphics&, const String& name, bool isOpen, int width, int height) override;
|
||||
void drawPropertyComponentBackground (Graphics&, int width, int height, PropertyComponent&) override;
|
||||
void drawPropertyComponentLabel (Graphics&, int width, int height, PropertyComponent&) override;
|
||||
Rectangle<int> getPropertyComponentContentPosition (PropertyComponent&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawCallOutBoxBackground (CallOutBox&, Graphics&, const Path& path, Image& cachedImage) override;
|
||||
int getCallOutBoxBorderSize (const CallOutBox&) override;
|
||||
|
||||
//==============================================================================
|
||||
void drawLevelMeter (Graphics&, int width, int height, float level) override;
|
||||
|
||||
void drawKeymapChangeButton (Graphics&, int width, int height, Button&, const String& keyDescription) override;
|
||||
|
||||
//==============================================================================
|
||||
/** Draws a 3D raised (or indented) bevel using two colours.
|
||||
|
||||
The bevel is drawn inside the given rectangle, and greater bevel thicknesses
|
||||
extend inwards.
|
||||
|
||||
The top-left colour is used for the top- and left-hand edges of the
|
||||
bevel; the bottom-right colour is used for the bottom- and right-hand
|
||||
edges.
|
||||
|
||||
If useGradient is true, then the bevel fades out to make it look more curved
|
||||
and less angular. If sharpEdgeOnOutside is true, the outside of the bevel is
|
||||
sharp, and it fades towards the centre; if sharpEdgeOnOutside is false, then
|
||||
the centre edges are sharp and it fades towards the outside.
|
||||
*/
|
||||
static void drawBevel (Graphics&,
|
||||
int x, int y, int width, int height,
|
||||
int bevelThickness,
|
||||
const Colour& topLeftColour = Colours::white,
|
||||
const Colour& bottomRightColour = Colours::black,
|
||||
bool useGradient = true,
|
||||
bool sharpEdgeOnOutside = true);
|
||||
|
||||
/** Utility function to draw a shiny, glassy circle (for round LED-type buttons). */
|
||||
static void drawGlassSphere (Graphics&, float x, float y, float diameter,
|
||||
const Colour&, float outlineThickness) noexcept;
|
||||
|
||||
static void drawGlassPointer (Graphics&, float x, float y, float diameter,
|
||||
const Colour&, float outlineThickness, int direction) noexcept;
|
||||
|
||||
/** Utility function to draw a shiny, glassy oblong (for text buttons). */
|
||||
static void drawGlassLozenge (Graphics&,
|
||||
float x, float y, float width, float height,
|
||||
const Colour&, float outlineThickness, float cornerSize,
|
||||
bool flatOnLeft, bool flatOnRight, bool flatOnTop, bool flatOnBottom) noexcept;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
ScopedPointer<Drawable> folderImage, documentImage;
|
||||
|
||||
void drawShinyButtonShape (Graphics&,
|
||||
float x, float y, float w, float h, float maxCornerSize,
|
||||
const Colour&, float strokeWidth,
|
||||
bool flatOnLeft, bool flatOnRight, bool flatOnTop, bool flatOnBottom) noexcept;
|
||||
|
||||
class GlassWindowButton;
|
||||
class SliderLabelComp;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel_V2)
|
||||
};
|
||||
|
||||
|
||||
#endif // JUCE_LOOKANDFEEL_V2_H_INCLUDED
|
||||
|
|
@ -0,0 +1,633 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
LookAndFeel_V3::LookAndFeel_V3()
|
||||
{
|
||||
setColour (TreeView::selectedItemBackgroundColourId, Colour (0x301111ee));
|
||||
|
||||
const Colour textButtonColour (0xffeeeeff);
|
||||
setColour (TextButton::buttonColourId, textButtonColour);
|
||||
setColour (ComboBox::buttonColourId, textButtonColour);
|
||||
setColour (TextEditor::outlineColourId, Colours::transparentBlack);
|
||||
setColour (TabbedButtonBar::tabOutlineColourId, Colour (0x66000000));
|
||||
setColour (TabbedComponent::outlineColourId, Colour (0x66000000));
|
||||
setColour (Slider::trackColourId, Colour (0xbbffffff));
|
||||
setColour (Slider::thumbColourId, Colour (0xffddddff));
|
||||
setColour (BubbleComponent::backgroundColourId, Colour (0xeeeeeedd));
|
||||
setColour (ScrollBar::thumbColourId, Colour::greyLevel (0.8f).contrasting().withAlpha (0.13f));
|
||||
}
|
||||
|
||||
LookAndFeel_V3::~LookAndFeel_V3() {}
|
||||
|
||||
bool LookAndFeel_V3::areScrollbarButtonsVisible() { return false; }
|
||||
|
||||
void LookAndFeel_V3::drawStretchableLayoutResizerBar (Graphics& g, int /*w*/, int /*h*/, bool /*isVerticalBar*/,
|
||||
bool isMouseOver, bool isMouseDragging)
|
||||
{
|
||||
if (isMouseOver || isMouseDragging)
|
||||
g.fillAll (Colours::yellow.withAlpha (0.4f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height,
|
||||
bool isScrollbarVertical, int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown)
|
||||
{
|
||||
Path thumbPath;
|
||||
|
||||
if (thumbSize > 0)
|
||||
{
|
||||
const float thumbIndent = (isScrollbarVertical ? width : height) * 0.25f;
|
||||
const float thumbIndentx2 = thumbIndent * 2.0f;
|
||||
|
||||
if (isScrollbarVertical)
|
||||
thumbPath.addRoundedRectangle (x + thumbIndent, thumbStartPosition + thumbIndent,
|
||||
width - thumbIndentx2, thumbSize - thumbIndentx2, (width - thumbIndentx2) * 0.5f);
|
||||
else
|
||||
thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, y + thumbIndent,
|
||||
thumbSize - thumbIndentx2, height - thumbIndentx2, (height - thumbIndentx2) * 0.5f);
|
||||
}
|
||||
|
||||
Colour thumbCol (scrollbar.findColour (ScrollBar::thumbColourId, true));
|
||||
|
||||
if (isMouseOver || isMouseDown)
|
||||
thumbCol = thumbCol.withMultipliedAlpha (2.0f);
|
||||
|
||||
g.setColour (thumbCol);
|
||||
g.fillPath (thumbPath);
|
||||
|
||||
g.setColour (thumbCol.contrasting ((isMouseOver || isMouseDown) ? 0.2f : 0.1f));
|
||||
g.strokePath (thumbPath, PathStrokeType (1.0f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawConcertinaPanelHeader (Graphics& g, const Rectangle<int>& area,
|
||||
bool isMouseOver, bool /*isMouseDown*/,
|
||||
ConcertinaPanel&, Component& panel)
|
||||
{
|
||||
const Colour bkg (Colours::grey);
|
||||
|
||||
g.setGradientFill (ColourGradient (Colours::white.withAlpha (isMouseOver ? 0.4f : 0.2f), 0, (float) area.getY(),
|
||||
Colours::darkgrey.withAlpha (0.1f), 0, (float) area.getBottom(), false));
|
||||
g.fillAll();
|
||||
|
||||
g.setColour (bkg.contrasting().withAlpha (0.1f));
|
||||
g.fillRect (area.withHeight (1));
|
||||
g.fillRect (area.withTop (area.getBottom() - 1));
|
||||
|
||||
g.setColour (bkg.contrasting());
|
||||
g.setFont (Font (area.getHeight() * 0.6f).boldened());
|
||||
g.drawFittedText (panel.getName(), 4, 0, area.getWidth() - 6, area.getHeight(), Justification::centredLeft, 1);
|
||||
}
|
||||
|
||||
static void drawButtonShape (Graphics& g, const Path& outline, Colour baseColour, float height)
|
||||
{
|
||||
const float mainBrightness = baseColour.getBrightness();
|
||||
const float mainAlpha = baseColour.getFloatAlpha();
|
||||
|
||||
g.setGradientFill (ColourGradient (baseColour.brighter (0.2f), 0.0f, 0.0f,
|
||||
baseColour.darker (0.25f), 0.0f, height, false));
|
||||
g.fillPath (outline);
|
||||
|
||||
g.setColour (Colours::white.withAlpha (0.4f * mainAlpha * mainBrightness * mainBrightness));
|
||||
g.strokePath (outline, PathStrokeType (1.0f), AffineTransform::translation (0.0f, 1.0f)
|
||||
.scaled (1.0f, (height - 1.6f) / height));
|
||||
|
||||
g.setColour (Colours::black.withAlpha (0.4f * mainAlpha));
|
||||
g.strokePath (outline, PathStrokeType (1.0f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour,
|
||||
bool isMouseOverButton, bool isButtonDown)
|
||||
{
|
||||
Colour baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true) ? 1.3f : 0.9f)
|
||||
.withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f));
|
||||
|
||||
if (isButtonDown || isMouseOverButton)
|
||||
baseColour = baseColour.contrasting (isButtonDown ? 0.2f : 0.1f);
|
||||
|
||||
const bool flatOnLeft = button.isConnectedOnLeft();
|
||||
const bool flatOnRight = button.isConnectedOnRight();
|
||||
const bool flatOnTop = button.isConnectedOnTop();
|
||||
const bool flatOnBottom = button.isConnectedOnBottom();
|
||||
|
||||
const float width = button.getWidth() - 1.0f;
|
||||
const float height = button.getHeight() - 1.0f;
|
||||
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
const float cornerSize = 4.0f;
|
||||
|
||||
Path outline;
|
||||
outline.addRoundedRectangle (0.5f, 0.5f, width, height, cornerSize, cornerSize,
|
||||
! (flatOnLeft || flatOnTop),
|
||||
! (flatOnRight || flatOnTop),
|
||||
! (flatOnLeft || flatOnBottom),
|
||||
! (flatOnRight || flatOnBottom));
|
||||
|
||||
drawButtonShape (g, outline, baseColour, height);
|
||||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawTableHeaderBackground (Graphics& g, TableHeaderComponent& header)
|
||||
{
|
||||
Rectangle<int> 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));
|
||||
}
|
||||
|
||||
int LookAndFeel_V3::getTabButtonOverlap (int /*tabDepth*/) { return -1; }
|
||||
int LookAndFeel_V3::getTabButtonSpaceAroundImage() { return 0; }
|
||||
|
||||
void LookAndFeel_V3::createTabTextLayout (const TabBarButton& button, float length, float depth,
|
||||
Colour colour, TextLayout& textLayout)
|
||||
{
|
||||
Font font (depth * 0.5f);
|
||||
font.setUnderline (button.hasKeyboardFocus (false));
|
||||
|
||||
AttributedString s;
|
||||
s.setJustification (Justification::centred);
|
||||
s.append (button.getButtonText().trim(), font, colour);
|
||||
|
||||
textLayout.createLayout (s, length);
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
|
||||
{
|
||||
const Rectangle<int> activeArea (button.getActiveArea());
|
||||
|
||||
const TabbedButtonBar::Orientation o = button.getTabbedButtonBar().getOrientation();
|
||||
|
||||
const Colour bkg (button.getTabBackgroundColour());
|
||||
|
||||
if (button.getToggleState())
|
||||
{
|
||||
g.setColour (bkg);
|
||||
}
|
||||
else
|
||||
{
|
||||
Point<int> p1, p2;
|
||||
|
||||
switch (o)
|
||||
{
|
||||
case TabbedButtonBar::TabsAtBottom: p1 = activeArea.getBottomLeft(); p2 = activeArea.getTopLeft(); break;
|
||||
case TabbedButtonBar::TabsAtTop: p1 = activeArea.getTopLeft(); p2 = activeArea.getBottomLeft(); break;
|
||||
case TabbedButtonBar::TabsAtRight: p1 = activeArea.getTopRight(); p2 = activeArea.getTopLeft(); break;
|
||||
case TabbedButtonBar::TabsAtLeft: p1 = activeArea.getTopLeft(); p2 = activeArea.getTopRight(); break;
|
||||
default: jassertfalse; break;
|
||||
}
|
||||
|
||||
g.setGradientFill (ColourGradient (bkg.brighter (0.2f), (float) p1.x, (float) p1.y,
|
||||
bkg.darker (0.1f), (float) p2.x, (float) p2.y, false));
|
||||
}
|
||||
|
||||
g.fillRect (activeArea);
|
||||
|
||||
g.setColour (button.findColour (TabbedButtonBar::tabOutlineColourId));
|
||||
|
||||
Rectangle<int> r (activeArea);
|
||||
|
||||
if (o != TabbedButtonBar::TabsAtBottom) g.fillRect (r.removeFromTop (1));
|
||||
if (o != TabbedButtonBar::TabsAtTop) g.fillRect (r.removeFromBottom (1));
|
||||
if (o != TabbedButtonBar::TabsAtRight) g.fillRect (r.removeFromLeft (1));
|
||||
if (o != TabbedButtonBar::TabsAtLeft) g.fillRect (r.removeFromRight (1));
|
||||
|
||||
const float alpha = button.isEnabled() ? ((isMouseOver || isMouseDown) ? 1.0f : 0.8f) : 0.3f;
|
||||
|
||||
Colour col (bkg.contrasting().withMultipliedAlpha (alpha));
|
||||
|
||||
if (TabbedButtonBar* bar = button.findParentComponentOfClass<TabbedButtonBar>())
|
||||
{
|
||||
TabbedButtonBar::ColourIds colID = button.isFrontTab() ? TabbedButtonBar::frontTextColourId
|
||||
: TabbedButtonBar::tabTextColourId;
|
||||
|
||||
if (bar->isColourSpecified (colID))
|
||||
col = bar->findColour (colID);
|
||||
else if (isColourSpecified (colID))
|
||||
col = findColour (colID);
|
||||
}
|
||||
|
||||
const Rectangle<float> area (button.getTextArea().toFloat());
|
||||
|
||||
float length = area.getWidth();
|
||||
float depth = area.getHeight();
|
||||
|
||||
if (button.getTabbedButtonBar().isVertical())
|
||||
std::swap (length, depth);
|
||||
|
||||
TextLayout textLayout;
|
||||
createTabTextLayout (button, length, depth, col, textLayout);
|
||||
|
||||
AffineTransform t;
|
||||
|
||||
switch (o)
|
||||
{
|
||||
case TabbedButtonBar::TabsAtLeft: t = t.rotated (float_Pi * -0.5f).translated (area.getX(), area.getBottom()); break;
|
||||
case TabbedButtonBar::TabsAtRight: t = t.rotated (float_Pi * 0.5f).translated (area.getRight(), area.getY()); break;
|
||||
case TabbedButtonBar::TabsAtTop:
|
||||
case TabbedButtonBar::TabsAtBottom: t = t.translated (area.getX(), area.getY()); break;
|
||||
default: jassertfalse; break;
|
||||
}
|
||||
|
||||
g.addTransform (t);
|
||||
textLayout.draw (g, Rectangle<float> (length, depth));
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphics& g, const int w, const int h)
|
||||
{
|
||||
const float shadowSize = 0.15f;
|
||||
|
||||
Rectangle<int> shadowRect, line;
|
||||
ColourGradient gradient (Colours::black.withAlpha (bar.isEnabled() ? 0.08f : 0.04f), 0, 0,
|
||||
Colours::transparentBlack, 0, 0, false);
|
||||
|
||||
switch (bar.getOrientation())
|
||||
{
|
||||
case TabbedButtonBar::TabsAtLeft:
|
||||
gradient.point1.x = (float) w;
|
||||
gradient.point2.x = w * (1.0f - shadowSize);
|
||||
shadowRect.setBounds ((int) gradient.point2.x, 0, w - (int) gradient.point2.x, h);
|
||||
line.setBounds (w - 1, 0, 1, h);
|
||||
break;
|
||||
|
||||
case TabbedButtonBar::TabsAtRight:
|
||||
gradient.point2.x = w * shadowSize;
|
||||
shadowRect.setBounds (0, 0, (int) gradient.point2.x, h);
|
||||
line.setBounds (0, 0, 1, h);
|
||||
break;
|
||||
|
||||
case TabbedButtonBar::TabsAtTop:
|
||||
gradient.point1.y = (float) h;
|
||||
gradient.point2.y = h * (1.0f - shadowSize);
|
||||
shadowRect.setBounds (0, (int) gradient.point2.y, w, h - (int) gradient.point2.y);
|
||||
line.setBounds (0, h - 1, w, 1);
|
||||
break;
|
||||
|
||||
case TabbedButtonBar::TabsAtBottom:
|
||||
gradient.point2.y = h * shadowSize;
|
||||
shadowRect.setBounds (0, 0, w, (int) gradient.point2.y);
|
||||
line.setBounds (0, 0, w, 1);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
g.setGradientFill (gradient);
|
||||
g.fillRect (shadowRect.expanded (2, 2));
|
||||
|
||||
g.setColour (bar.findColour (TabbedButtonBar::tabOutlineColourId));
|
||||
g.fillRect (line);
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawTextEditorOutline (Graphics& g, int width, int height, TextEditor& textEditor)
|
||||
{
|
||||
if (textEditor.isEnabled())
|
||||
{
|
||||
if (textEditor.hasKeyboardFocus (true) && ! textEditor.isReadOnly())
|
||||
{
|
||||
g.setColour (textEditor.findColour (TextEditor::focusedOutlineColourId));
|
||||
g.drawRect (0, 0, width, height, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.setColour (textEditor.findColour (TextEditor::outlineColourId));
|
||||
g.drawRect (0, 0, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawTreeviewPlusMinusBox (Graphics& g, const Rectangle<float>& area,
|
||||
Colour backgroundColour, bool isOpen, bool isMouseOver)
|
||||
{
|
||||
Path p;
|
||||
p.addTriangle (0.0f, 0.0f, 1.0f, isOpen ? 0.0f : 0.5f, isOpen ? 0.5f : 0.0f, 1.0f);
|
||||
|
||||
g.setColour (backgroundColour.contrasting().withAlpha (isMouseOver ? 0.5f : 0.3f));
|
||||
g.fillPath (p, p.getTransformToScaleToFit (area.reduced (2, area.getHeight() / 4), true));
|
||||
}
|
||||
|
||||
bool LookAndFeel_V3::areLinesDrawnForTreeView (TreeView&)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int LookAndFeel_V3::getTreeViewIndentSize (TreeView&)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawComboBox (Graphics& g, int width, int height, const bool /*isButtonDown*/,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box)
|
||||
{
|
||||
g.fillAll (box.findColour (ComboBox::backgroundColourId));
|
||||
|
||||
const Colour buttonColour (box.findColour (ComboBox::buttonColourId));
|
||||
|
||||
if (box.isEnabled() && box.hasKeyboardFocus (false))
|
||||
{
|
||||
g.setColour (buttonColour);
|
||||
g.drawRect (0, 0, width, height, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
g.setColour (box.findColour (ComboBox::outlineColourId));
|
||||
g.drawRect (0, 0, width, height);
|
||||
}
|
||||
|
||||
const float arrowX = 0.3f;
|
||||
const float arrowH = 0.2f;
|
||||
|
||||
Path p;
|
||||
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.45f - arrowH),
|
||||
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.45f,
|
||||
buttonX + buttonW * arrowX, buttonY + buttonH * 0.45f);
|
||||
|
||||
p.addTriangle (buttonX + buttonW * 0.5f, buttonY + buttonH * (0.55f + arrowH),
|
||||
buttonX + buttonW * (1.0f - arrowX), buttonY + buttonH * 0.55f,
|
||||
buttonX + buttonW * arrowX, buttonY + buttonH * 0.55f);
|
||||
|
||||
g.setColour (box.findColour (ComboBox::arrowColourId).withMultipliedAlpha (box.isEnabled() ? 1.0f : 0.3f));
|
||||
g.fillPath (p);
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawLinearSlider (Graphics& g, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle style, Slider& slider)
|
||||
{
|
||||
g.fillAll (slider.findColour (Slider::backgroundColourId));
|
||||
|
||||
if (style == Slider::LinearBar || style == Slider::LinearBarVertical)
|
||||
{
|
||||
const float fx = (float) x, fy = (float) y, fw = (float) width, fh = (float) height;
|
||||
|
||||
Path p;
|
||||
|
||||
if (style == Slider::LinearBarVertical)
|
||||
p.addRectangle (fx, sliderPos, fw, 1.0f + fh - sliderPos);
|
||||
else
|
||||
p.addRectangle (fx, fy, sliderPos - fx, fh);
|
||||
|
||||
Colour baseColour (slider.findColour (Slider::thumbColourId)
|
||||
.withMultipliedSaturation (slider.isEnabled() ? 1.0f : 0.5f)
|
||||
.withMultipliedAlpha (0.8f));
|
||||
|
||||
g.setGradientFill (ColourGradient (baseColour.brighter (0.08f), 0.0f, 0.0f,
|
||||
baseColour.darker (0.08f), 0.0f, (float) height, false));
|
||||
g.fillPath (p);
|
||||
|
||||
g.setColour (baseColour.darker (0.2f));
|
||||
|
||||
if (style == Slider::LinearBarVertical)
|
||||
g.fillRect (fx, sliderPos, fw, 1.0f);
|
||||
else
|
||||
g.fillRect (sliderPos, fy, 1.0f, fh);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawLinearSliderBackground (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
|
||||
drawLinearSliderThumb (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
|
||||
}
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawLinearSliderBackground (Graphics& g, int x, int y, int width, int height,
|
||||
float /*sliderPos*/,
|
||||
float /*minSliderPos*/,
|
||||
float /*maxSliderPos*/,
|
||||
const Slider::SliderStyle /*style*/, Slider& slider)
|
||||
{
|
||||
const float sliderRadius = (float) (getSliderThumbRadius (slider) - 2);
|
||||
|
||||
const Colour trackColour (slider.findColour (Slider::trackColourId));
|
||||
const Colour gradCol1 (trackColour.overlaidWith (Colour (slider.isEnabled() ? 0x13000000 : 0x09000000)));
|
||||
const Colour gradCol2 (trackColour.overlaidWith (Colour (0x06000000)));
|
||||
Path indent;
|
||||
|
||||
if (slider.isHorizontal())
|
||||
{
|
||||
const float iy = y + height * 0.5f - sliderRadius * 0.5f;
|
||||
|
||||
g.setGradientFill (ColourGradient (gradCol1, 0.0f, iy,
|
||||
gradCol2, 0.0f, iy + sliderRadius, false));
|
||||
|
||||
indent.addRoundedRectangle (x - sliderRadius * 0.5f, iy, width + sliderRadius, sliderRadius, 5.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float ix = x + width * 0.5f - sliderRadius * 0.5f;
|
||||
|
||||
g.setGradientFill (ColourGradient (gradCol1, ix, 0.0f,
|
||||
gradCol2, ix + sliderRadius, 0.0f, false));
|
||||
|
||||
indent.addRoundedRectangle (ix, y - sliderRadius * 0.5f, sliderRadius, height + sliderRadius, 5.0f);
|
||||
}
|
||||
|
||||
g.fillPath (indent);
|
||||
|
||||
g.setColour (trackColour.contrasting (0.5f));
|
||||
g.strokePath (indent, PathStrokeType (0.5f));
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawPopupMenuBackground (Graphics& g, int width, int height)
|
||||
{
|
||||
g.fillAll (findColour (PopupMenu::backgroundColourId));
|
||||
(void) width; (void) height;
|
||||
|
||||
#if ! JUCE_MAC
|
||||
g.setColour (findColour (PopupMenu::textColourId).withAlpha (0.6f));
|
||||
g.drawRect (0, 0, width, height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawMenuBarBackground (Graphics& g, int width, int height,
|
||||
bool, MenuBarComponent& menuBar)
|
||||
{
|
||||
const Colour colour (menuBar.findColour (PopupMenu::backgroundColourId));
|
||||
|
||||
Rectangle<int> r (width, height);
|
||||
|
||||
g.setColour (colour.contrasting (0.15f));
|
||||
g.fillRect (r.removeFromTop (1));
|
||||
g.fillRect (r.removeFromBottom (1));
|
||||
|
||||
g.setGradientFill (ColourGradient (colour, 0, 0, colour.darker (0.08f), 0, (float) height, false));
|
||||
g.fillRect (r);
|
||||
}
|
||||
|
||||
void LookAndFeel_V3::drawKeymapChangeButton (Graphics& g, int width, int height,
|
||||
Button& button, const String& keyDescription)
|
||||
{
|
||||
const Colour textColour (button.findColour (0x100ad01 /*KeyMappingEditorComponent::textColourId*/, true));
|
||||
|
||||
if (keyDescription.isNotEmpty())
|
||||
{
|
||||
if (button.isEnabled())
|
||||
{
|
||||
g.setColour (textColour.withAlpha (button.isDown() ? 0.4f : (button.isOver() ? 0.2f : 0.1f)));
|
||||
g.fillRoundedRectangle (button.getLocalBounds().toFloat(), 4.0f);
|
||||
g.drawRoundedRectangle (button.getLocalBounds().toFloat(), 4.0f, 1.0f);
|
||||
}
|
||||
|
||||
g.setColour (textColour);
|
||||
g.setFont (height * 0.6f);
|
||||
g.drawFittedText (keyDescription, 4, 0, width - 8, height, Justification::centred, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float thickness = 7.0f;
|
||||
const float indent = 22.0f;
|
||||
|
||||
Path p;
|
||||
p.addEllipse (0.0f, 0.0f, 100.0f, 100.0f);
|
||||
p.addRectangle (indent, 50.0f - thickness, 100.0f - indent * 2.0f, thickness * 2.0f);
|
||||
p.addRectangle (50.0f - thickness, indent, thickness * 2.0f, 50.0f - indent - thickness);
|
||||
p.addRectangle (50.0f - thickness, 50.0f + thickness, thickness * 2.0f, 50.0f - indent - thickness);
|
||||
p.setUsingNonZeroWinding (false);
|
||||
|
||||
g.setColour (textColour.darker(0.1f).withAlpha (button.isDown() ? 0.7f : (button.isOver() ? 0.5f : 0.3f)));
|
||||
g.fillPath (p, p.getTransformToScaleToFit (2.0f, 2.0f, width - 4.0f, height - 4.0f, true));
|
||||
}
|
||||
|
||||
if (button.hasKeyboardFocus (false))
|
||||
{
|
||||
g.setColour (textColour.withAlpha (0.4f));
|
||||
g.drawRect (0, 0, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class LookAndFeel_V3_DocumentWindowButton : public Button
|
||||
{
|
||||
public:
|
||||
LookAndFeel_V3_DocumentWindowButton (const String& name, Colour c, const Path& normal, const Path& toggled)
|
||||
: Button (name), colour (c), normalShape (normal), toggledShape (toggled)
|
||||
{
|
||||
}
|
||||
|
||||
void paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown) override
|
||||
{
|
||||
Colour background (Colours::grey);
|
||||
|
||||
if (ResizableWindow* rw = findParentComponentOfClass<ResizableWindow>())
|
||||
background = rw->getBackgroundColour();
|
||||
|
||||
const float cx = getWidth() * 0.5f, cy = getHeight() * 0.5f;
|
||||
const float diam = jmin (cx, cy) * (isButtonDown ? 0.60f : 0.65f);
|
||||
|
||||
g.setColour (background);
|
||||
g.fillEllipse (cx - diam, cy - diam, diam * 2.0f, diam * 2.0f);
|
||||
|
||||
Colour c (background.contrasting (colour, 0.6f));
|
||||
|
||||
if (! isEnabled())
|
||||
c = c.withAlpha (0.6f);
|
||||
else if (isMouseOverButton)
|
||||
c = c.brighter();
|
||||
|
||||
g.setColour (c);
|
||||
g.drawEllipse (cx - diam, cy - diam, diam * 2.0f, diam * 2.0f, diam * 0.2f);
|
||||
|
||||
Path& p = getToggleState() ? toggledShape : normalShape;
|
||||
|
||||
float scale = 0.55f;
|
||||
g.fillPath (p, p.getTransformToScaleToFit (cx - diam * scale, cy - diam * scale,
|
||||
diam * 2.0f * scale, diam * 2.0f * scale, true));
|
||||
}
|
||||
|
||||
private:
|
||||
Colour colour;
|
||||
Path normalShape, toggledShape;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel_V3_DocumentWindowButton)
|
||||
};
|
||||
|
||||
Button* LookAndFeel_V3::createDocumentWindowButton (int buttonType)
|
||||
{
|
||||
Path shape;
|
||||
const float crossThickness = 0.25f;
|
||||
|
||||
if (buttonType == DocumentWindow::closeButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.0f, 1.0f, 1.0f), crossThickness * 1.4f);
|
||||
shape.addLineSegment (Line<float> (1.0f, 0.0f, 0.0f, 1.0f), crossThickness * 1.4f);
|
||||
|
||||
return new LookAndFeel_V3_DocumentWindowButton ("close", Colour (0xffdd1100), shape, shape);
|
||||
}
|
||||
|
||||
if (buttonType == DocumentWindow::minimiseButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.5f, 1.0f, 0.5f), crossThickness);
|
||||
|
||||
return new LookAndFeel_V3_DocumentWindowButton ("minimise", Colour (0xffaa8811), shape, shape);
|
||||
}
|
||||
|
||||
if (buttonType == DocumentWindow::maximiseButton)
|
||||
{
|
||||
shape.addLineSegment (Line<float> (0.5f, 0.0f, 0.5f, 1.0f), crossThickness);
|
||||
shape.addLineSegment (Line<float> (0.0f, 0.5f, 1.0f, 0.5f), crossThickness);
|
||||
|
||||
Path fullscreenShape;
|
||||
fullscreenShape.startNewSubPath (45.0f, 100.0f);
|
||||
fullscreenShape.lineTo (0.0f, 100.0f);
|
||||
fullscreenShape.lineTo (0.0f, 0.0f);
|
||||
fullscreenShape.lineTo (100.0f, 0.0f);
|
||||
fullscreenShape.lineTo (100.0f, 45.0f);
|
||||
fullscreenShape.addRectangle (45.0f, 45.0f, 100.0f, 100.0f);
|
||||
PathStrokeType (30.0f).createStrokedPath (fullscreenShape, fullscreenShape);
|
||||
|
||||
return new LookAndFeel_V3_DocumentWindowButton ("maximise", Colour (0xff119911), shape, fullscreenShape);
|
||||
}
|
||||
|
||||
jassertfalse;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Path LookAndFeel_V3::getTickShape (const float height)
|
||||
{
|
||||
static const unsigned char pathData[]
|
||||
= { 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,
|
||||
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 };
|
||||
|
||||
Path p;
|
||||
p.loadPathFromData (pathData, sizeof (pathData));
|
||||
p.scaleToFit (0, 0, height * 2.0f, height, true);
|
||||
return p;
|
||||
}
|
||||
|
||||
Path LookAndFeel_V3::getCrossShape (const float height)
|
||||
{
|
||||
static const unsigned char pathData[]
|
||||
= { 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,
|
||||
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 };
|
||||
|
||||
Path p;
|
||||
p.loadPathFromData (pathData, sizeof (pathData));
|
||||
p.scaleToFit (0, 0, height * 2.0f, height, true);
|
||||
return p;
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library.
|
||||
Copyright (c) 2013 - Raw Material Software Ltd.
|
||||
|
||||
Permission is granted to use this software under the terms of either:
|
||||
a) the GPL v2 (or any later version)
|
||||
b) the Affero GPL v3
|
||||
|
||||
Details of these licenses can be found at: www.gnu.org/licenses
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.juce.com for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef JUCE_LOOKANDFEEL_V3_H_INCLUDED
|
||||
#define JUCE_LOOKANDFEEL_V3_H_INCLUDED
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
The latest JUCE look-and-feel style, as introduced in 2013.
|
||||
@see LookAndFeel, LookAndFeel_V1, LookAndFeel_V2
|
||||
*/
|
||||
class JUCE_API LookAndFeel_V3 : public LookAndFeel_V2
|
||||
{
|
||||
public:
|
||||
LookAndFeel_V3();
|
||||
~LookAndFeel_V3();
|
||||
|
||||
//==============================================================================
|
||||
void drawButtonBackground (Graphics&, Button&, const Colour& backgroundColour,
|
||||
bool isMouseOverButton, bool isButtonDown) override;
|
||||
|
||||
void drawTableHeaderBackground (Graphics&, TableHeaderComponent&) override;
|
||||
|
||||
void drawTreeviewPlusMinusBox (Graphics&, const Rectangle<float>& area,
|
||||
Colour backgroundColour, bool isOpen, bool isMouseOver) override;
|
||||
bool areLinesDrawnForTreeView (TreeView&) override;
|
||||
int getTreeViewIndentSize (TreeView&) override;
|
||||
|
||||
Button* createDocumentWindowButton (int buttonType) override;
|
||||
|
||||
void drawComboBox (Graphics&, int width, int height, bool isButtonDown,
|
||||
int buttonX, int buttonY, int buttonW, int buttonH, ComboBox& box) override;
|
||||
|
||||
void drawKeymapChangeButton (Graphics&, int width, int height, Button& button, const String& keyDescription) override;
|
||||
|
||||
void drawPopupMenuBackground (Graphics&, int width, int height) override;
|
||||
void drawMenuBarBackground (Graphics&, int width, int height, bool, MenuBarComponent&) override;
|
||||
|
||||
int getTabButtonOverlap (int tabDepth) override;
|
||||
int getTabButtonSpaceAroundImage() override;
|
||||
void drawTabButton (TabBarButton&, Graphics&, bool isMouseOver, bool isMouseDown) override;
|
||||
void drawTabAreaBehindFrontButton (TabbedButtonBar& bar, Graphics& g, int w, int h) override;
|
||||
|
||||
void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) override;
|
||||
|
||||
void drawStretchableLayoutResizerBar (Graphics&, int w, int h, bool isVerticalBar, bool isMouseOver, bool isMouseDragging) override;
|
||||
|
||||
bool areScrollbarButtonsVisible() 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 drawLinearSlider (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
void drawLinearSliderBackground (Graphics&, int x, int y, int width, int height,
|
||||
float sliderPos, float minSliderPos, float maxSliderPos,
|
||||
const Slider::SliderStyle, Slider&) override;
|
||||
|
||||
void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area, bool isMouseOver, bool isMouseDown,
|
||||
ConcertinaPanel&, Component&) override;
|
||||
|
||||
Path getTickShape (float height) override;
|
||||
Path getCrossShape (float height) override;
|
||||
|
||||
static void createTabTextLayout (const TabBarButton& button, float length, float depth, Colour colour, TextLayout&);
|
||||
|
||||
private:
|
||||
Image backgroundTexture;
|
||||
Colour backgroundTextureBaseColour;
|
||||
};
|
||||
|
||||
|
||||
#endif // JUCE_LOOKANDFEEL_V3_H_INCLUDED
|
||||
Loading…
Add table
Add a link
Reference in a new issue