Browse Source

Added some colour IDs for various properties of the ResizableWindow, DocumentWindow, TabbedButtonBar, TabbedComponent.

tags/2021-05-28
jules 17 years ago
parent
commit
7bc8bf8bf9
12 changed files with 315 additions and 52 deletions
  1. +5
    -5
      extras/audio plugins/How to use this framework.txt
  2. +1
    -1
      extras/the jucer/src/ui/jucer_JucerDocumentHolder.cpp
  3. +67
    -14
      juce_amalgamated.cpp
  4. +86
    -9
      juce_amalgamated.h
  5. +19
    -0
      src/juce_appframework/gui/components/layout/juce_TabbedButtonBar.h
  6. +4
    -4
      src/juce_appframework/gui/components/layout/juce_TabbedComponent.cpp
  7. +21
    -7
      src/juce_appframework/gui/components/layout/juce_TabbedComponent.h
  8. +29
    -4
      src/juce_appframework/gui/components/lookandfeel/juce_LookAndFeel.cpp
  9. +5
    -0
      src/juce_appframework/gui/components/lookandfeel/juce_LookAndFeel.h
  10. +13
    -0
      src/juce_appframework/gui/components/windows/juce_DocumentWindow.h
  11. +34
    -6
      src/juce_appframework/gui/components/windows/juce_ResizableWindow.cpp
  12. +31
    -2
      src/juce_appframework/gui/components/windows/juce_ResizableWindow.h

+ 5
- 5
extras/audio plugins/How to use this framework.txt View File

@@ -124,8 +124,8 @@ Each plugin project needs to contain a JucePluginCharacteristics.h file, which h
plugin-specific build details. In here, there are three macros that you can set to enable each
of the available formats:
#define JucePlugin_Build_VST 1
#define JucePlugin_Build_RTAS 1
#define JucePlugin_Build_VST 1
#define JucePlugin_Build_RTAS 1
#define JucePlugin_Build_AU 1
You can set these to 0 to disable the formats that you don't want to build, and this will avoid
@@ -197,7 +197,7 @@ any compilation problems if, for example, you don't have the appropriate SDK for
==========================================
- For an AU, make sure that the JucePlugin_Build_AU is enabled in your JucePluginCharacteristics.h
- For an AU, make sure that the JucePlugin_Build_AU is enabled in your JucePluginCharacteristics.h
- In XCode, create a new project based on the "Audio Unit Effect" template
- XCode will create a bunch of template source files for you - you can remove all of these from the project
and delete them
@@ -216,7 +216,7 @@ any compilation problems if, for example, you don't have the appropriate SDK for
You should now be able to build a functional AU! If you want VST support as well, then read on...
- Make sure that the JucePlugin_Build_VST is enabled in your JucePluginCharacteristics.h
- Make sure that the JucePlugin_Build_VST is enabled in your JucePluginCharacteristics.h
- For VST support, add all the juce_VST_* files from /wrapper/VST
- In your target info settings, add the vstsdk2_4 folder to your "Header Search Paths" list
- Make sure that in your Info.plist, the "Bundle Name" value is correctly set to the name of your plugin.
@@ -227,7 +227,7 @@ changing the suffix to ".vst", and put it in your VST folder.
If you also want to build an RTAS, then carry on reading...
- Make sure that the JucePlugin_Build_RTAS is enabled in your JucePluginCharacteristics.h
- Make sure that the JucePlugin_Build_RTAS is enabled in your JucePluginCharacteristics.h
- After installing the Digidesign SDK, make sure you've run the config_SDK_for_Mac command in
its root directory. This sets up some of the tools that it needs.
- Add the files from /wrapper/RTAS to your project. Obviously a couple of these are for Windows, so


+ 1
- 1
extras/the jucer/src/ui/jucer_JucerDocumentHolder.cpp View File

@@ -385,7 +385,7 @@ JucerDocumentHolder::JucerDocumentHolder (JucerDocument* const document_)
document->getInitialHeight());
addAndMakeVisible (tabbedComponent = new TabbedComponent (TabbedButtonBar::TabsAtRight));
tabbedComponent->setOutline (Colours::black, 0);
tabbedComponent->setOutline (0);
tabbedComponent->addTab (T("Class"), tabColour, new ClassPropertiesPanel (*document), true);


+ 67
- 14
juce_amalgamated.cpp View File

@@ -58874,7 +58874,6 @@ private:
TabbedComponent::TabbedComponent (const TabbedButtonBar::Orientation orientation)
: panelComponent (0),
tabDepth (30),
outlineColour (Colours::grey),
outlineThickness (1),
edgeIndent (0)
{
@@ -59017,9 +59016,8 @@ const String& TabbedComponent::getCurrentTabName() const
return tabs->getCurrentTabName();
}

void TabbedComponent::setOutline (const Colour& colour, int thickness)
void TabbedComponent::setOutline (int thickness)
{
outlineColour = colour;
outlineThickness = thickness;
repaint();
}
@@ -59031,6 +59029,8 @@ void TabbedComponent::setIndent (const int indentThickness)

void TabbedComponent::paint (Graphics& g)
{
g.fillAll (findColour (backgroundColourId));

const TabbedButtonBar::Orientation o = getOrientation();

int x = 0;
@@ -59061,7 +59061,7 @@ void TabbedComponent::paint (Graphics& g)
else if (o == TabbedButtonBar::TabsAtRight)
++r;

g.setColour (outlineColour);
g.setColour (findColour (outlineColourId));
g.drawRect (x, y, r - x, b - y, outlineThickness);
}
}
@@ -59529,6 +59529,9 @@ LookAndFeel::LookAndFeel()
Slider::textBoxHighlightColourId, textHighlightColour,
Slider::textBoxOutlineColourId, standardOutlineColour,

ResizableWindow::backgroundColourId, 0xff777777,
//DocumentWindow::textColourId, 0xff000000, // (this is deliberately not set)

AlertWindow::backgroundColourId, 0xffededed,
AlertWindow::textColourId, 0xff000000,
AlertWindow::outlineColourId, 0xff666666,
@@ -59540,6 +59543,11 @@ LookAndFeel::LookAndFeel()
TooltipWindow::textColourId, 0xff000000,
TooltipWindow::outlineColourId, 0x4c000000,

TabbedComponent::backgroundColourId, 0x00000000,
TabbedComponent::outlineColourId, 0xff777777,
TabbedButtonBar::tabOutlineColourId, 0x80000000,
TabbedButtonBar::frontOutlineColourId, 0x90000000,

Toolbar::backgroundColourId, 0xfff6f8f9,
Toolbar::separatorColourId, 0x4c000000,
Toolbar::buttonMouseOverBackgroundColourId, 0x4c0000ff,
@@ -59603,6 +59611,11 @@ void LookAndFeel::setColour (const int colourId, const Colour& colour) throw()
colours.add (colour);
}

bool LookAndFeel::isColourSpecified (const int colourId) const throw()
{
return colourIds.contains (colourId);
}

static LookAndFeel* defaultLF = 0;
static LookAndFeel* currentDefaultLF = 0;

@@ -61010,7 +61023,11 @@ void LookAndFeel::drawDocumentWindowTitleBar (DocumentWindow& window,
textW -= iconW;
}

g.setColour (window.getBackgroundColour().contrasting (isActive ? 0.7f : 0.4f));
if (window.isColourSpecified (DocumentWindow::textColourId) || isColourSpecified (DocumentWindow::textColourId))
g.setColour (findColour (DocumentWindow::textColourId));
else
g.setColour (window.getBackgroundColour().contrasting (isActive ? 0.7f : 0.4f));

g.drawText (window.getName(), textX, 0, textW, h, Justification::centredLeft, true);
}

@@ -61349,7 +61366,10 @@ void LookAndFeel::fillTabButtonShape (Graphics& g,

g.fillPath (path);

g.setColour (Colours::black.withAlpha (button.isEnabled() ? 0.5f : 0.25f));
g.setColour (button.findColour (isFrontTab ? TabbedButtonBar::frontOutlineColourId
: TabbedButtonBar::tabOutlineColourId, false)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));

g.strokePath (path, PathStrokeType (isFrontTab ? 1.0f : 0.5f));
}

@@ -61362,7 +61382,7 @@ void LookAndFeel::drawTabButtonText (Graphics& g,
TabbedButtonBar::Orientation orientation,
const bool isMouseOver,
const bool isMouseDown,
const bool /*isFrontTab*/)
const bool isFrontTab)
{
int length = w;
int depth = h;
@@ -61399,7 +61419,12 @@ void LookAndFeel::drawTabButtonText (Graphics& g,
transform = transform.translated ((float) x, (float) y);
}

g.setColour (preferredBackgroundColour.contrasting());
if (isFrontTab && (button.isColourSpecified (TabbedButtonBar::frontTextColourId) || isColourSpecified (TabbedButtonBar::frontTextColourId)))
g.setColour (findColour (TabbedButtonBar::frontTextColourId));
else if (button.isColourSpecified (TabbedButtonBar::tabTextColourId) || isColourSpecified (TabbedButtonBar::tabTextColourId))
g.setColour (findColour (TabbedButtonBar::tabTextColourId));
else
g.setColour (preferredBackgroundColour.contrasting());

if (! (isMouseOver || isMouseDown))
g.setOpacity (0.8f);
@@ -72489,6 +72514,28 @@ END_JUCE_NAMESPACE

BEGIN_JUCE_NAMESPACE

ResizableWindow::ResizableWindow (const String& name,
const bool addToDesktop_)
: TopLevelWindow (name, addToDesktop_),
resizableCorner (0),
resizableBorder (0),
contentComponent (0),
resizeToFitContent (false),
fullscreen (false),
lastNonFullScreenPos (50, 50, 256, 256),
constrainer (0)
#ifdef JUCE_DEBUG
, hasBeenResized (false)
#endif
{
defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16);

lastNonFullScreenPos.setBounds (50, 50, 256, 256);

if (addToDesktop_)
Component::addToDesktop (getDesktopWindowStyleFlags());
}

ResizableWindow::ResizableWindow (const String& name,
const Colour& backgroundColour_,
const bool addToDesktop_)
@@ -72498,6 +72545,7 @@ ResizableWindow::ResizableWindow (const String& name,
contentComponent (0),
resizeToFitContent (false),
fullscreen (false),
lastNonFullScreenPos (50, 50, 256, 256),
constrainer (0)
#ifdef JUCE_DEBUG
, hasBeenResized (false)
@@ -72507,8 +72555,6 @@ ResizableWindow::ResizableWindow (const String& name,

defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16);

lastNonFullScreenPos.setBounds (50, 50, 256, 256);

if (addToDesktop_)
Component::addToDesktop (getDesktopWindowStyleFlags());
}
@@ -72735,7 +72781,7 @@ void ResizableWindow::setBoundsConstrained (int x, int y, int w, int h)

void ResizableWindow::paint (Graphics& g)
{
g.fillAll (backgroundColour);
g.fillAll (getBackgroundColour());

if (! isFullScreen())
{
@@ -72773,13 +72819,20 @@ void ResizableWindow::lookAndFeelChanged()
}
}

const Colour ResizableWindow::getBackgroundColour() const throw()
{
return findColour (backgroundColourId, false);
}

void ResizableWindow::setBackgroundColour (const Colour& newColour)
{
if (Desktop::canUseSemiTransparentWindows())
backgroundColour = newColour;
else
Colour backgroundColour (newColour);
if (! Desktop::canUseSemiTransparentWindows())
backgroundColour = newColour.withAlpha (1.0f);

setColour (backgroundColourId, backgroundColour);

setOpaque (backgroundColour.isOpaque());
repaint();
}


+ 86
- 9
juce_amalgamated.h View File

@@ -46959,6 +46959,24 @@ public:
*/
void setTabBackgroundColour (const int tabIndex, const Colour& newColour);

/** A set of colour IDs to use to change the colour of various aspects of the component.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.

@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
the look and feel will choose an appropriate colour. */
frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
this isn't specified, the look and feel will choose an appropriate
colour. */
};

/** @internal */
void resized();
/** @internal */
@@ -47047,14 +47065,14 @@ public:
*/
int getTabBarDepth() const throw() { return tabDepth; }

/** Specifies an outline that should be drawn around the entire content component.
/** Specifies the thickness of an outline that should be drawn around the content component.

If this thickness is > 0, a line will be drawn around the three sides of the content
component which don't touch the tab-bar, and the content component will be inset by this amount.

If this thickness is > 0, a line of the specified colour will be drawn around
the three sides of the content component which don't touch the tab-bar, and
the content component will be inset by this amount.
To set the colour of the line, use setColour (outlineColourId, ...).
*/
void setOutline (const Colour& newOutlineColour,
const int newThickness);
void setOutline (const int newThickness);

/** Specifies a gap to leave around the edge of the content component.

@@ -47152,6 +47170,20 @@ public:
*/
TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }

/** A set of colour IDs to use to change the colour of various aspects of the component.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.

@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
(See setOutline) */
};

/** @internal */
void paint (Graphics& g);
/** @internal */
@@ -47178,7 +47210,6 @@ private:
Array <Component*> contentComponents;
Component* panelComponent;
int tabDepth;
Colour outlineColour;
int outlineThickness, edgeIndent;

friend class TabCompButtonBar;
@@ -47596,6 +47627,18 @@ class JUCE_API ResizableWindow : public TopLevelWindow
{
public:

/** Creates a ResizableWindow.

This constructor doesn't specify a background colour, so the LookAndFeel's default
background colour will be used.

@param name the name to give the component
@param addToDesktop if true, the window will be automatically added to the
desktop; if false, you can use it as a child component
*/
ResizableWindow (const String& name,
const bool addToDesktop);

/** Creates a ResizableWindow.

@param name the name to give the component
@@ -47619,9 +47662,11 @@ public:
As a convenience the window will fill itself with this colour, but you
can override the paint() method if you need more customised behaviour.

This method is the same as retrieving the colour for ResizableWindow::backgroundColourId.

@see setBackgroundColour
*/
const Colour& getBackgroundColour() const throw() { return backgroundColour; }
const Colour getBackgroundColour() const throw();

/** Changes the colour currently being used for the window's background.

@@ -47633,6 +47678,9 @@ public:
semi-transparent windows this might cause problems, (though it's unlikely you'll
be using this class as a base for a semi-transparent component anyway).

You can also use the ResizableWindow::backgroundColourId colour id to set
this colour.

@see getBackgroundColour
*/
void setBackgroundColour (const Colour& newColour);
@@ -47784,6 +47832,18 @@ public:
*/
void setContentComponentSize (int width, int height);

/** A set of colour IDs to use to change the colour of various aspects of the window.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.

@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
};

juce_UseDebuggingNewOperator

protected:
@@ -47846,7 +47906,6 @@ protected:
private:
Component* contentComponent;
bool resizeToFitContent, fullscreen;
Colour backgroundColour;
ComponentDragger dragger;
Rectangle lastNonFullScreenPos;
ComponentBoundsConstrainer defaultConstrainer;
@@ -48038,6 +48097,19 @@ public:
/** Returns the maximise button, (or 0 if there isn't one). */
Button* getMaximiseButton() const throw();

/** A set of colour IDs to use to change the colour of various aspects of the window.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.

@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
and feel class how this is used. */
};

/** @internal */
void paint (Graphics& g);
/** @internal */
@@ -52799,6 +52871,11 @@ public:
*/
void setColour (const int colourId, const Colour& colour) throw();

/** Returns true if the specified colour ID has been explicitly set using the
setColour() method.
*/
bool isColourSpecified (const int colourId) const throw();

/** Draws the lozenge-shaped background for a standard button. */
virtual void drawButtonBackground (Graphics& g,
Button& button,


+ 19
- 0
src/juce_appframework/gui/components/layout/juce_TabbedButtonBar.h View File

@@ -238,6 +238,25 @@ public:
*/
void setTabBackgroundColour (const int tabIndex, const Colour& newColour);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the component.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
tabOutlineColourId = 0x1005812, /**< The colour to use to draw an outline around the tabs. */
tabTextColourId = 0x1005813, /**< The colour to use to draw the tab names. If this isn't specified,
the look and feel will choose an appropriate colour. */
frontOutlineColourId = 0x1005814, /**< The colour to use to draw an outline around the currently-selected tab. */
frontTextColourId = 0x1005815, /**< The colour to use to draw the currently-selected tab name. If
this isn't specified, the look and feel will choose an appropriate
colour. */
};
//==============================================================================
/** @internal */
void resized();


+ 4
- 4
src/juce_appframework/gui/components/layout/juce_TabbedComponent.cpp View File

@@ -87,7 +87,6 @@ private:
TabbedComponent::TabbedComponent (const TabbedButtonBar::Orientation orientation)
: panelComponent (0),
tabDepth (30),
outlineColour (Colours::grey),
outlineThickness (1),
edgeIndent (0)
{
@@ -232,9 +231,8 @@ const String& TabbedComponent::getCurrentTabName() const
return tabs->getCurrentTabName();
}
void TabbedComponent::setOutline (const Colour& colour, int thickness)
void TabbedComponent::setOutline (int thickness)
{
outlineColour = colour;
outlineThickness = thickness;
repaint();
}
@@ -246,6 +244,8 @@ void TabbedComponent::setIndent (const int indentThickness)
void TabbedComponent::paint (Graphics& g)
{
g.fillAll (findColour (backgroundColourId));
const TabbedButtonBar::Orientation o = getOrientation();
int x = 0;
@@ -276,7 +276,7 @@ void TabbedComponent::paint (Graphics& g)
else if (o == TabbedButtonBar::TabsAtRight)
++r;
g.setColour (outlineColour);
g.setColour (findColour (outlineColourId));
g.drawRect (x, y, r - x, b - y, outlineThickness);
}
}


+ 21
- 7
src/juce_appframework/gui/components/layout/juce_TabbedComponent.h View File

@@ -88,14 +88,14 @@ public:
*/
int getTabBarDepth() const throw() { return tabDepth; }
/** Specifies an outline that should be drawn around the entire content component.
/** Specifies the thickness of an outline that should be drawn around the content component.
If this thickness is > 0, a line of the specified colour will be drawn around
the three sides of the content component which don't touch the tab-bar, and
the content component will be inset by this amount.
If this thickness is > 0, a line will be drawn around the three sides of the content
component which don't touch the tab-bar, and the content component will be inset by this amount.
To set the colour of the line, use setColour (outlineColourId, ...).
*/
void setOutline (const Colour& newOutlineColour,
const int newThickness);
void setOutline (const int newThickness);
/** Specifies a gap to leave around the edge of the content component.
@@ -196,6 +196,21 @@ public:
*/
TabbedButtonBar& getTabbedButtonBar() const throw() { return *tabs; }
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the component.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
backgroundColourId = 0x1005800, /**< The colour to fill the background behind the tabs. */
outlineColourId = 0x1005801, /**< The colour to use to draw an outline around the content.
(See setOutline) */
};
//==============================================================================
/** @internal */
void paint (Graphics& g);
@@ -224,7 +239,6 @@ private:
Array <Component*> contentComponents;
Component* panelComponent;
int tabDepth;
Colour outlineColour;
int outlineThickness, edgeIndent;
friend class TabCompButtonBar;


+ 29
- 4
src/juce_appframework/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -160,6 +160,9 @@ LookAndFeel::LookAndFeel()
Slider::textBoxHighlightColourId, textHighlightColour,
Slider::textBoxOutlineColourId, standardOutlineColour,
ResizableWindow::backgroundColourId, 0xff777777,
//DocumentWindow::textColourId, 0xff000000, // (this is deliberately not set)
AlertWindow::backgroundColourId, 0xffededed,
AlertWindow::textColourId, 0xff000000,
AlertWindow::outlineColourId, 0xff666666,
@@ -171,6 +174,11 @@ LookAndFeel::LookAndFeel()
TooltipWindow::textColourId, 0xff000000,
TooltipWindow::outlineColourId, 0x4c000000,
TabbedComponent::backgroundColourId, 0x00000000,
TabbedComponent::outlineColourId, 0xff777777,
TabbedButtonBar::tabOutlineColourId, 0x80000000,
TabbedButtonBar::frontOutlineColourId, 0x90000000,
Toolbar::backgroundColourId, 0xfff6f8f9,
Toolbar::separatorColourId, 0x4c000000,
Toolbar::buttonMouseOverBackgroundColourId, 0x4c0000ff,
@@ -235,6 +243,11 @@ void LookAndFeel::setColour (const int colourId, const Colour& colour) throw()
colours.add (colour);
}
bool LookAndFeel::isColourSpecified (const int colourId) const throw()
{
return colourIds.contains (colourId);
}
//==============================================================================
static LookAndFeel* defaultLF = 0;
static LookAndFeel* currentDefaultLF = 0;
@@ -1658,7 +1671,11 @@ void LookAndFeel::drawDocumentWindowTitleBar (DocumentWindow& window,
textW -= iconW;
}
g.setColour (window.getBackgroundColour().contrasting (isActive ? 0.7f : 0.4f));
if (window.isColourSpecified (DocumentWindow::textColourId) || isColourSpecified (DocumentWindow::textColourId))
g.setColour (findColour (DocumentWindow::textColourId));
else
g.setColour (window.getBackgroundColour().contrasting (isActive ? 0.7f : 0.4f));
g.drawText (window.getName(), textX, 0, textW, h, Justification::centredLeft, true);
}
@@ -2005,7 +2022,10 @@ void LookAndFeel::fillTabButtonShape (Graphics& g,
g.fillPath (path);
g.setColour (Colours::black.withAlpha (button.isEnabled() ? 0.5f : 0.25f));
g.setColour (button.findColour (isFrontTab ? TabbedButtonBar::frontOutlineColourId
: TabbedButtonBar::tabOutlineColourId, false)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));
g.strokePath (path, PathStrokeType (isFrontTab ? 1.0f : 0.5f));
}
@@ -2018,7 +2038,7 @@ void LookAndFeel::drawTabButtonText (Graphics& g,
TabbedButtonBar::Orientation orientation,
const bool isMouseOver,
const bool isMouseDown,
const bool /*isFrontTab*/)
const bool isFrontTab)
{
int length = w;
int depth = h;
@@ -2055,7 +2075,12 @@ void LookAndFeel::drawTabButtonText (Graphics& g,
transform = transform.translated ((float) x, (float) y);
}
g.setColour (preferredBackgroundColour.contrasting());
if (isFrontTab && (button.isColourSpecified (TabbedButtonBar::frontTextColourId) || isColourSpecified (TabbedButtonBar::frontTextColourId)))
g.setColour (findColour (TabbedButtonBar::frontTextColourId));
else if (button.isColourSpecified (TabbedButtonBar::tabTextColourId) || isColourSpecified (TabbedButtonBar::tabTextColourId))
g.setColour (findColour (TabbedButtonBar::tabTextColourId));
else
g.setColour (preferredBackgroundColour.contrasting());
if (! (isMouseOver || isMouseDown))
g.setOpacity (0.8f);


+ 5
- 0
src/juce_appframework/gui/components/lookandfeel/juce_LookAndFeel.h View File

@@ -126,6 +126,11 @@ public:
*/
void setColour (const int colourId, const Colour& colour) throw();
/** Returns true if the specified colour ID has been explicitly set using the
setColour() method.
*/
bool isColourSpecified (const int colourId) const throw();
//==============================================================================
/** Draws the lozenge-shaped background for a standard button. */
virtual void drawButtonBackground (Graphics& g,


+ 13
- 0
src/juce_appframework/gui/components/windows/juce_DocumentWindow.h View File

@@ -210,6 +210,19 @@ public:
/** Returns the maximise button, (or 0 if there isn't one). */
Button* getMaximiseButton() const throw();
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the window.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
textColourId = 0x1005701, /**< The colour to draw any text with. It's up to the look
and feel class how this is used. */
};
//==============================================================================
/** @internal */


+ 34
- 6
src/juce_appframework/gui/components/windows/juce_ResizableWindow.cpp View File

@@ -41,6 +41,28 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
ResizableWindow::ResizableWindow (const String& name,
const bool addToDesktop_)
: TopLevelWindow (name, addToDesktop_),
resizableCorner (0),
resizableBorder (0),
contentComponent (0),
resizeToFitContent (false),
fullscreen (false),
lastNonFullScreenPos (50, 50, 256, 256),
constrainer (0)
#ifdef JUCE_DEBUG
, hasBeenResized (false)
#endif
{
defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16);
lastNonFullScreenPos.setBounds (50, 50, 256, 256);
if (addToDesktop_)
Component::addToDesktop (getDesktopWindowStyleFlags());
}
ResizableWindow::ResizableWindow (const String& name,
const Colour& backgroundColour_,
const bool addToDesktop_)
@@ -50,6 +72,7 @@ ResizableWindow::ResizableWindow (const String& name,
contentComponent (0),
resizeToFitContent (false),
fullscreen (false),
lastNonFullScreenPos (50, 50, 256, 256),
constrainer (0)
#ifdef JUCE_DEBUG
, hasBeenResized (false)
@@ -59,8 +82,6 @@ ResizableWindow::ResizableWindow (const String& name,
defaultConstrainer.setMinimumOnscreenAmounts (0x10000, 16, 24, 16);
lastNonFullScreenPos.setBounds (50, 50, 256, 256);
if (addToDesktop_)
Component::addToDesktop (getDesktopWindowStyleFlags());
}
@@ -292,7 +313,7 @@ void ResizableWindow::setBoundsConstrained (int x, int y, int w, int h)
//==============================================================================
void ResizableWindow::paint (Graphics& g)
{
g.fillAll (backgroundColour);
g.fillAll (getBackgroundColour());
if (! isFullScreen())
{
@@ -330,13 +351,20 @@ void ResizableWindow::lookAndFeelChanged()
}
}
const Colour ResizableWindow::getBackgroundColour() const throw()
{
return findColour (backgroundColourId, false);
}
void ResizableWindow::setBackgroundColour (const Colour& newColour)
{
if (Desktop::canUseSemiTransparentWindows())
backgroundColour = newColour;
else
Colour backgroundColour (newColour);
if (! Desktop::canUseSemiTransparentWindows())
backgroundColour = newColour.withAlpha (1.0f);
setColour (backgroundColourId, backgroundColour);
setOpaque (backgroundColour.isOpaque());
repaint();
}


+ 31
- 2
src/juce_appframework/gui/components/windows/juce_ResizableWindow.h View File

@@ -62,6 +62,18 @@ class JUCE_API ResizableWindow : public TopLevelWindow
{
public:
//==============================================================================
/** Creates a ResizableWindow.
This constructor doesn't specify a background colour, so the LookAndFeel's default
background colour will be used.
@param name the name to give the component
@param addToDesktop if true, the window will be automatically added to the
desktop; if false, you can use it as a child component
*/
ResizableWindow (const String& name,
const bool addToDesktop);
/** Creates a ResizableWindow.
@param name the name to give the component
@@ -86,9 +98,11 @@ public:
As a convenience the window will fill itself with this colour, but you
can override the paint() method if you need more customised behaviour.
This method is the same as retrieving the colour for ResizableWindow::backgroundColourId.
@see setBackgroundColour
*/
const Colour& getBackgroundColour() const throw() { return backgroundColour; }
const Colour getBackgroundColour() const throw();
/** Changes the colour currently being used for the window's background.
@@ -100,6 +114,9 @@ public:
semi-transparent windows this might cause problems, (though it's unlikely you'll
be using this class as a base for a semi-transparent component anyway).
You can also use the ResizableWindow::backgroundColourId colour id to set
this colour.
@see getBackgroundColour
*/
void setBackgroundColour (const Colour& newColour);
@@ -257,6 +274,19 @@ public:
*/
void setContentComponentSize (int width, int height);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the window.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
backgroundColourId = 0x1005700, /**< A colour to use to fill the window's background. */
};
//==============================================================================
juce_UseDebuggingNewOperator
@@ -320,7 +350,6 @@ protected:
private:
Component* contentComponent;
bool resizeToFitContent, fullscreen;
Colour backgroundColour;
ComponentDragger dragger;
Rectangle lastNonFullScreenPos;
ComponentBoundsConstrainer defaultConstrainer;


Loading…
Cancel
Save