1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

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

This commit is contained in:
jules 2009-01-09 20:04:52 +00:00
parent d85394d1bd
commit 7bc8bf8bf9
12 changed files with 315 additions and 52 deletions

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();
}