1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-06 04:00:08 +00:00

Added a new LookAndFeel (V4) and re-skinned the JUCE Demo and examples. Improved the JUCE Demo on mobile devices.

This commit is contained in:
hogliux 2017-04-27 12:21:41 +01:00
parent 3b422bef51
commit ef2c63e4e3
99 changed files with 5037 additions and 433 deletions

View file

@ -79,7 +79,10 @@ public:
virtual StandaloneFilterWindow* createWindow()
{
return new StandaloneFilterWindow (getApplicationName(), Colours::white, appProperties.getUserSettings(), false);
return new StandaloneFilterWindow (getApplicationName(),
LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
appProperties.getUserSettings(),
false);
}
//==============================================================================

View file

@ -212,7 +212,7 @@ public:
o.content->setSize (500, 450);
o.dialogTitle = TRANS("Audio/MIDI Settings");
o.dialogBackgroundColour = Colour (0xfff0f0f0);
o.dialogBackgroundColour = o.content->getLookAndFeel().findColour (ResizableWindow::backgroundColourId);
o.escapeKeyTriggersCloseButton = true;
o.useNativeTitleBar = true;
o.resizable = false;
@ -396,7 +396,7 @@ public:
const String& preferredDefaultDeviceName = String(),
const AudioDeviceManager::AudioDeviceSetup* preferredSetupOptions = nullptr)
: DocumentWindow (title, backgroundColour, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
optionsButton ("options")
optionsButton ("Options")
{
setTitleBarButtonsRequired (DocumentWindow::minimiseButton | DocumentWindow::closeButton, false);

View file

@ -34,8 +34,11 @@ public:
void paintRowBackground (Graphics& g, int /*rowNumber*/, int /*width*/, int /*height*/, bool rowIsSelected) override
{
if (rowIsSelected)
g.fillAll (owner.findColour (TextEditor::highlightColourId));
const auto defaultColour = owner.findColour (ListBox::backgroundColourId);
const auto c = rowIsSelected ? defaultColour.interpolatedWith (owner.findColour (ListBox::textColourId), 0.5f)
: defaultColour;
g.fillAll (c);
}
enum
@ -75,9 +78,10 @@ public:
if (text.isNotEmpty())
{
const auto defaultTextColour = owner.findColour (ListBox::textColourId);
g.setColour (isBlacklisted ? Colours::red
: columnId == nameCol ? Colours::black
: Colours::grey);
: columnId == nameCol ? defaultTextColour
: defaultTextColour.interpolatedWith (Colours::transparentBlack, 0.3f));
g.setFont (Font (height * 0.7f, Font::bold));
g.drawFittedText (text, 4, 0, width - 6, height, Justification::centredLeft, 1, 0.9f);
}

View file

@ -770,13 +770,11 @@ public:
return items.size();
}
void paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected) override
void paintListBoxItem (int row, Graphics& g, int width, int height, bool) override
{
if (isPositiveAndBelow (row, items.size()))
{
if (rowIsSelected)
g.fillAll (findColour (TextEditor::highlightColourId)
.withMultipliedAlpha (0.3f));
g.fillAll (findColour (ListBox::backgroundColourId));
const String item (items [row]);
bool enabled = false;

View file

@ -93,7 +93,7 @@ LookAndFeel& Desktop::getDefaultLookAndFeel() noexcept
if (currentLookAndFeel == nullptr)
{
if (defaultLookAndFeel == nullptr)
defaultLookAndFeel = new LookAndFeel_V3();
defaultLookAndFeel = new LookAndFeel_V4();
currentLookAndFeel = defaultLookAndFeel;
}

View file

@ -206,6 +206,7 @@ extern bool juce_areThereAnyAlwaysOnTopWindows();
#include "lookandfeel/juce_LookAndFeel_V2.cpp"
#include "lookandfeel/juce_LookAndFeel_V1.cpp"
#include "lookandfeel/juce_LookAndFeel_V3.cpp"
#include "lookandfeel/juce_LookAndFeel_V4.cpp"
#include "menus/juce_MenuBarComponent.cpp"
#include "menus/juce_MenuBarModel.cpp"
#include "menus/juce_PopupMenu.cpp"

View file

@ -282,6 +282,7 @@ class FlexBox;
#include "lookandfeel/juce_LookAndFeel_V2.h"
#include "lookandfeel/juce_LookAndFeel_V1.h"
#include "lookandfeel/juce_LookAndFeel_V3.h"
#include "lookandfeel/juce_LookAndFeel_V4.h"
#if JUCE_LINUX
#include "native/juce_linux_X11.h"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,238 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI 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.
==============================================================================
*/
#pragma once
class JUCE_API LookAndFeel_V4 : public LookAndFeel_V3
{
public:
/**
A struct containing the set of colours to apply to the GUI
*/
class ColourScheme
{
public:
/** The standard set of colours to use. */
enum UIColour
{
windowBackground = 0,
widgetBackground,
menuBackground,
outline,
defaultText,
defaultFill,
highlightedText,
highlightedFill,
menuText,
numColours
};
template <typename... ItemColours>
ColourScheme (ItemColours... coloursToUse)
{
static_assert (sizeof... (coloursToUse) == numColours, "Must supply one colour for each UIColour item");
const Colour c[] = { Colour (coloursToUse)... };
for (int i = 0; i < numColours; ++i)
palette[i] = c[i];
}
ColourScheme (const ColourScheme&) = default;
ColourScheme& operator= (const ColourScheme&) = default;
/** Returns a colour from the scheme */
Colour getUIColour (UIColour colourToGet) const noexcept;
/** Sets a scheme colour. */
void setUIColour (UIColour colourToSet, Colour newColour) noexcept;
/** Returns true if two ColourPalette objects contain the same colours. */
bool operator== (const ColourScheme&) const noexcept;
/** Returns false if two ColourPalette objects contain the same colours. */
bool operator!= (const ColourScheme&) const noexcept;
private:
Colour palette[numColours];
};
//==============================================================================
/** Creates a LookAndFeel_V4 object with a default colour scheme. */
LookAndFeel_V4();
/** Creates a LookAndFeel_V4 object with a given colour scheme. */
LookAndFeel_V4 (ColourScheme);
/** Destructor. */
~LookAndFeel_V4();
//==============================================================================
void setColourScheme (ColourScheme);
ColourScheme& getCurrentColourScheme() noexcept { return currentColourScheme; }
static ColourScheme getDarkColourScheme();
static ColourScheme getMidnightColourScheme();
static ColourScheme getGreyColourScheme();
static ColourScheme getLightColourScheme();
//==============================================================================
Button* createDocumentWindowButton (int) override;
void positionDocumentWindowButtons (DocumentWindow&, int, int, int, int, Button*, Button*, Button*, bool) override;
void drawDocumentWindowTitleBar (DocumentWindow&, Graphics&, int, int, int, int, const Image*, bool) override;
//==============================================================================
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;
//==============================================================================
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 getAlertWindowButtonHeight() override;
Font getAlertWindowTitleFont() override;
Font getAlertWindowMessageFont() override;
Font getAlertWindowFont() override;
//==============================================================================
void drawProgressBar (Graphics&, ProgressBar&, int width, int height, double progress, const String& textToShow) override;
bool isProgressBarOpaque (ProgressBar&) override { return false; }
//==============================================================================
int getDefaultScrollbarWidth() override;
void drawScrollbar (Graphics&, ScrollBar&, int x, int y, int width, int height, bool isScrollbarVertical,
int thumbStartPosition, int thumbSize, bool isMouseOver, bool isMouseDown) override;
//==============================================================================
Path getTickShape (float height) override;
Path getCrossShape (float height) override;
//==============================================================================
void fillTextEditorBackground (Graphics&, int width, int height, TextEditor&) override;
void drawTextEditorOutline (Graphics&, int width, int height, TextEditor&) override;
//==============================================================================
Button* createFileBrowserGoUpButton() override;
void layoutFileBrowserComponent (FileBrowserComponent&,
DirectoryContentsDisplayComponent*,
FilePreviewComponent*,
ComboBox* currentPathBox,
TextEditor* filenameBox,
Button* goUpButton) 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;
//==============================================================================
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 getIdealPopupMenuItemSize (const String& text, bool isSeparator, int standardMenuItemHeight,
int& idealWidth, int& idealHeight) override;
void drawMenuBarBackground (Graphics&, int width, int height, bool isMouseOverBar, MenuBarComponent&) 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;
void positionComboBoxText (ComboBox&, 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 drawRotarySlider (Graphics&, int x, int y, int width, int height,
float sliderPosProportional, float rotaryStartAngle,
float rotaryEndAngle, Slider&) override;
void drawPointer (Graphics&, float x, float y, float diameter,
const Colour&, int direction) noexcept;
//==============================================================================
void drawTooltip (Graphics&, const String& text, int width, int height) override;
//==============================================================================
void drawConcertinaPanelHeader (Graphics&, const Rectangle<int>& area,
bool isMouseOver, bool isMouseDown,
ConcertinaPanel&, Component& panel) override;
//==============================================================================
void drawLevelMeter (Graphics&, int, int, float) override;
//==============================================================================
void paintToolbarBackground (Graphics&, int width, int height, Toolbar&) 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&, Image&) override;
//==============================================================================
void drawStretchableLayoutResizerBar (Graphics&, int, int, bool, bool, bool) override;
private:
//==============================================================================
void drawLinearProgressBar (Graphics&, ProgressBar&, int width, int height, double progress);
void drawCircularProgressBar (Graphics&, ProgressBar&, const String&);
int getPropertyComponentIndent (PropertyComponent&);
//==============================================================================
void initialiseColours();
ColourScheme currentColourScheme;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LookAndFeel_V4)
};