本文整理汇总了C++中TextButton::getToggleState方法的典型用法代码示例。如果您正苦于以下问题:C++ TextButton::getToggleState方法的具体用法?C++ TextButton::getToggleState怎么用?C++ TextButton::getToggleState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextButton
的用法示例。
在下文中一共展示了TextButton::getToggleState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawButtonText
void NonShinyLookAndFeel::drawButtonText (Graphics& g, TextButton& button,
bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
Font font (getFontForTextButton (button));
if (button.getToggleState())
font.setBold(true);
g.setFont (font);
g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId
: TextButton::textColourOffId)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f));
const int yIndent = jmin (4, button.proportionOfHeight (0.3f));
const int cornerSize = jmin (button.getHeight(), button.getWidth()) / 2;
const int fontHeight = roundToInt (font.getHeight() * 0.6f);
const int leftIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnLeft() ? 4 : 2));
const int rightIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnRight() ? 4 : 2));
g.drawFittedText (button.getButtonText(),
leftIndent,
yIndent,
button.getWidth() - leftIndent - rightIndent,
button.getHeight() - yIndent * 2,
Justification::centred, 2);
}
示例2: drawButtonText
void ProjucerLookAndFeel::drawButtonText (Graphics& g, TextButton& button, bool isMouseOverButton, bool isButtonDown)
{
ignoreUnused (isMouseOverButton, isButtonDown);
g.setFont (getTextButtonFont (button, button.getHeight()));
g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId
: TextButton::textColourOffId)
.withMultipliedAlpha (button.isEnabled() ? 1.0f
: 0.5f));
auto xIndent = jmin (8, button.getWidth() / 10);
auto yIndent = jmin (3, button.getHeight() / 6);
auto textBounds = button.getLocalBounds().reduced (xIndent, yIndent);
g.drawFittedText (button.getButtonText(), textBounds, Justification::centred, 3, 1.0f);
}