当前位置: 首页>>代码示例>>C++>>正文


C++ ToggleButton::getButtonText方法代码示例

本文整理汇总了C++中ToggleButton::getButtonText方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::getButtonText方法的具体用法?C++ ToggleButton::getButtonText怎么用?C++ ToggleButton::getButtonText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ToggleButton的用法示例。


在下文中一共展示了ToggleButton::getButtonText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawToggleButton

void OldSchoolLookAndFeel::drawToggleButton (Graphics& g,
                                             ToggleButton& button,
                                             bool isMouseOverButton,
                                             bool isButtonDown)
{
    if (button.hasKeyboardFocus (true))
    {
        g.setColour (button.findColour (TextEditor::focusedOutlineColourId));
        g.drawRect (0, 0, button.getWidth(), button.getHeight());
    }

    const int tickWidth = jmin (20, button.getHeight() - 4);

    drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
                 (float) tickWidth, (float) tickWidth,
                 button.getToggleState(),
                 button.isEnabled(),
                 isMouseOverButton,
                 isButtonDown);

    g.setColour (button.findColour (ToggleButton::textColourId));
    g.setFont (jmin (15.0f, button.getHeight() * 0.6f));

    if (! button.isEnabled())
        g.setOpacity (0.5f);

    const int textX = tickWidth + 5;

    g.drawFittedText (button.getButtonText(),
                      textX, 4,
                      button.getWidth() - textX - 2, button.getHeight() - 8,
                      Justification::centredLeft, 10);
}
开发者ID:randi2kewl,项目名称:ShoutOut,代码行数:33,代码来源:juce_OldSchoolLookAndFeel.cpp

示例2: drawToggleButton

//==============================================================================
void JuceticeLookAndFeel::drawToggleButton (Graphics& g,
                                            ToggleButton& button,
                                            bool isMouseOverButton,
                                            bool isButtonDown)
{
    const int tickWidth = jmin (20, button.getHeight() - 4);

    drawTickBox (g, button, 4, (button.getHeight() - tickWidth) / 2,
                 tickWidth, tickWidth,
                 button.getToggleState(),
                 button.isEnabled(),
                 isMouseOverButton,
                 isButtonDown);

    g.setColour (button.findColour (ToggleButton::textColourId));
    g.setFont (jmin (15.0f, button.getHeight() * 0.6f));

    if (! button.isEnabled())
        g.setOpacity (0.5f);

    const int textX = tickWidth + 5;

    g.drawFittedText (button.getButtonText(),
                      textX, 4,
                      button.getWidth() - textX - 2, button.getHeight() - 8,
                      Justification::centredLeft, 10);
}
开发者ID:dennyabrain,项目名称:DISTRHO,代码行数:28,代码来源:jucetice_JuceticeLookAndFeel.cpp

示例3: drawToggleButton

void NTLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown){
    
    float fontSize = jmin (15.0f, button.getHeight() * 0.75f);
    const int tickWidth = fontSize * 1.6f;
    
    drawTickBox (g, button, 4.0f, (button.getHeight() - tickWidth) * 0.5f,
                 tickWidth, tickWidth,
                 button.getToggleState(),
                 button.isEnabled(),
                 isMouseOverButton,
                 isButtonDown);
    
    g.setColour (button.findColour (ToggleButton::textColourId));
    g.setFont (fontSize);
    
    if (! button.isEnabled())
        g.setOpacity (0.5f);
    
    const int textX = (int) tickWidth + 10;
    
    g.drawFittedText (button.getButtonText(),
                      textX, 0,
                      button.getWidth() - textX - 2, button.getHeight(),
                      Justification::centredLeft, 10);
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:25,代码来源:NTLookAndFeel.cpp

示例4: drawToggleButton

void mlrVSTLookAndFeel::drawToggleButton (Graphics& g,
                                             ToggleButton& button,
                                             bool /*isMouseOverButton*/,
                                             bool /*isButtonDown*/)
{
    if (button.getToggleState())
    {
        g.setColour(button.findColour(ToggleButton::textColourId));
        g.fillRect(0, 0, button.getWidth(), button.getHeight());
        g.setColour(Colours::white);
    }
    else
    {
        g.setColour(Colours::white);
        g.fillRect(0, 0, button.getWidth(), button.getHeight());
        g.setColour(button.findColour(ToggleButton::textColourId));
    }

    g.setFont(defaultFont);

    if (! button.isEnabled()) g.setOpacity (0.5f);

    g.drawFittedText (button.getButtonText(), 4, 4,
                      button.getWidth() - 2, button.getHeight() - 8,
                      Justification::centredLeft, 10);
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:26,代码来源:mlrVSTLookAndFeel.cpp

示例5: drawToggleButton

void ProjucerLookAndFeel::drawToggleButton (Graphics& g, ToggleButton& button, bool isMouseOverButton, bool isButtonDown)
{
    ignoreUnused (isMouseOverButton, isButtonDown);

    if (! button.isEnabled())
        g.setOpacity (0.5f);

    bool isTextEmpty = button.getButtonText().isEmpty();
    bool isPropertyComponentChild = (dynamic_cast<BooleanPropertyComponent*> (button.getParentComponent()) != nullptr);

    auto bounds = button.getLocalBounds();

    auto sideLength = isPropertyComponentChild ? 25 : bounds.getHeight();

    auto rectBounds = isTextEmpty ? bounds
                                  : bounds.removeFromLeft (jmin (sideLength, bounds.getWidth() / 3));

    rectBounds = rectBounds.withSizeKeepingCentre (sideLength, sideLength).reduced (4);

    g.setColour (button.findColour (ToggleButton::tickDisabledColourId));
    g.drawRoundedRectangle (rectBounds.toFloat(), 2.0f, 1.0f);

    if (button.getToggleState())
    {
        g.setColour (button.findColour (ToggleButton::tickColourId));
        const auto tick = getTickShape (0.75f);
        g.fillPath (tick, tick.getTransformToScaleToFit (rectBounds.reduced (2).toFloat(), false));
    }

    if (! isTextEmpty)
    {
        bounds.removeFromLeft (5);

        const auto fontSize = jmin (15.0f, button.getHeight() * 0.75f);

        g.setFont (fontSize);
        g.setColour (isPropertyComponentChild ? findColour (widgetTextColourId)
                                              : button.findColour (ToggleButton::textColourId));

        g.drawFittedText (button.getButtonText(), bounds, Justification::centredLeft, 2);
    }
}
开发者ID:azeteg,项目名称:HISE,代码行数:42,代码来源:jucer_ProjucerLookAndFeel.cpp


注:本文中的ToggleButton::getButtonText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。