本文整理汇总了C++中TabBarButton::findColour方法的典型用法代码示例。如果您正苦于以下问题:C++ TabBarButton::findColour方法的具体用法?C++ TabBarButton::findColour怎么用?C++ TabBarButton::findColour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabBarButton
的用法示例。
在下文中一共展示了TabBarButton::findColour方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTabBackgroundColour
Colour IntrojucerLookAndFeel::getTabBackgroundColour (TabBarButton& button)
{
const Colour normalBkg (button.findColour (mainBackgroundColourId));
Colour bkg (normalBkg.contrasting (0.15f));
if (button.isFrontTab())
bkg = bkg.overlaidWith (Colours::yellow.withAlpha (0.5f));
return bkg;
}
示例2: fillTabButtonShape
void CtrlrTabsLF::fillTabButtonShape (TabBarButton& button, Graphics& g, const Path& path, bool /*isMouseOver*/, bool /*isMouseDown*/)
{
const Colour tabBackground (button.getTabBackgroundColour());
const bool isFrontTab = button.isFrontTab();
g.setColour (isFrontTab ? tabBackground
: tabBackground.withMultipliedAlpha (0.9f));
g.fillPath (path);
g.setColour (button.findColour (isFrontTab ? TabbedButtonBar::frontOutlineColourId
: TabbedButtonBar::tabOutlineColourId, false)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));
g.strokePath (path, PathStrokeType (isFrontTab ? owner.getProperty(Ids::uiTabsFrontTabOutline) : owner.getProperty(Ids::uiTabsTabOutline)));
}
示例3: drawTabButton
void IntrojucerLookAndFeel::drawTabButton (TabBarButton& button, Graphics& g, bool isMouseOver, bool isMouseDown)
{
const Rectangle<int> activeArea (button.getActiveArea());
const Colour bkg (getTabBackgroundColour (button));
g.setGradientFill (ColourGradient (bkg.brighter (0.1f), 0, (float) activeArea.getY(),
bkg.darker (0.1f), 0, (float) activeArea.getBottom(), false));
g.fillRect (activeArea);
g.setColour (button.findColour (mainBackgroundColourId).darker (0.3f));
g.drawRect (activeArea);
GlyphArrangement textLayout;
createTabTextLayout (button, button.getTextArea(), textLayout);
const float alpha = button.isEnabled() ? ((isMouseOver || isMouseDown) ? 1.0f : 0.8f) : 0.3f;
g.setColour (bkg.contrasting().withMultipliedAlpha (alpha));
textLayout.draw (g);
}
示例4: drawTabButton
void CtrlrLuaMethodEditorTabsLF::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));
}
示例5: drawTabButton
void preenfmLookAndFeel::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);
g.setColour (col);
g.setFont (Font (depth * .5));
g.drawFittedText (button.getName().trim(), 0, 0,length, depth, Justification::centred, 1);
}