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


C++ AttributedString::draw方法代码示例

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


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

示例1: paintListBoxItem

    void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected) override
    {
        if (rowIsSelected)
            g.fillAll (Colours::deepskyblue);

        if (JuceDemoTypeBase* type = JuceDemoTypeBase::getDemoTypeList() [rowNumber])
        {
            String name (type->name.trimCharactersAtStart ("0123456789").trimStart());

            AttributedString a;
            a.setJustification (Justification::centredLeft);

            String category;

            if (name.containsChar (':'))
            {
                category = name.upToFirstOccurrenceOf (":", true, false);
                name = name.fromFirstOccurrenceOf (":", false, false).trim();

                if (height > 20)
                    category << "\n";
                else
                    category << " ";
            }

            if (category.isNotEmpty())
                a.append (category, Font (10.0f), Colour::greyLevel (0.5f));

            a.append (name, Font (13.0f), Colours::white.withAlpha (0.9f));

            a.draw (g, Rectangle<int> (width + 10, height).reduced (6, 0).toFloat());
        }
    }
开发者ID:topilski,项目名称:JUCE,代码行数:33,代码来源:MainWindow.cpp

示例2: paintListBoxItem

void pspSystemEditorGUI::paintListBoxItem(int rowNumber, Graphics &g, int width, int height, bool rowIsSelected){
    if (rowIsSelected){
        g.fillAll (Colours::midnightblue.brighter());
    }
    
    String name;
    String type;
    String separator;
    separator = " : ";
    AttributedString a;
    a.setJustification (Justification::centredLeft);
    
    name = psManager->getSystemName(rowNumber);
    if(name == "nosystemtocall"){
        return;
    }
    type = psManager->getSystemType(rowNumber);
    

    a.append (type, Font (12.0f), Colour::greyLevel (0.7f));
    a.append(separator, Font (12.0f), Colour::greyLevel (0.7f));
    a.append (name, Font (14.0f), Colours::white.withAlpha (1.0f));
    
    a.draw (g, Rectangle<int> (width + 10, height).reduced (6, 0).toFloat());
}
开发者ID:avperrotta,项目名称:psPlayground,代码行数:25,代码来源:pspSystemEditorGUI.cpp

示例3: paint

    void paint (Graphics& g) override
    {
        Rectangle<float> area (getLocalBounds().toFloat().reduced (2.0f));

        g.setColour (Colours::orange);
        g.drawRoundedRectangle (area, 10.0f, 2.0f);

        AttributedString s;
        s.setJustification (Justification::centred);
        s.setWordWrap (AttributedString::none);
        s.append ("Drag Me!");
        s.setColour (Colours::white);
        s.draw (g, area);
    }
开发者ID:0x4d52,项目名称:JUCE,代码行数:14,代码来源:AnimationDemo.cpp

示例4: paintItem

void CtrlrValueTreeEditorItem::paintItem (Graphics &g, int width, int height)
{
	Image icon = provider.getIconForItem (treeToEdit);
	if (isSelected())
	{
		drawSelectionRectangle (g,width,height);
	}

	g.setColour (Colours::black);

	AttributedString as = provider.getDisplayString(treeToEdit);
	as.setJustification (Justification (Justification::centredLeft));
	as.draw (g, Rectangle <float> (24.0, 0.0, width - 24.0, height));
	g.drawImageWithin (icon, 4, 0, 16, height, RectanglePlacement (RectanglePlacement::centred));
}
开发者ID:noscript,项目名称:ctrlr,代码行数:15,代码来源:CtrlrValueTreeEditor.cpp

示例5: paintListBoxItem

    void paintListBoxItem (int rowNumber, Graphics& g,
                           int width, int height, bool rowIsSelected)
    {
        if (rowIsSelected)
            g.fillAll (Colours::lightblue);

        Font font (fonts [rowNumber]);

        AttributedString s;
        s.setWordWrap (AttributedString::none);
        s.setJustification (Justification::centredLeft);
        s.append (font.getTypefaceName(), font.withPointHeight (height * 0.7f), Colours::black);
        s.append ("   " + font.getTypefaceName(), Font (height * 0.5f, Font::italic), Colours::grey);

        s.draw (g, Rectangle<int> (width, height).expanded (-4, 50).toFloat());
    }
开发者ID:alesaccoia,项目名称:JUCE,代码行数:16,代码来源:FontsDemo.cpp

示例6: paint

    void paint (Graphics& g) override
    {
        Rectangle<float> area (getLocalBounds().toFloat().reduced (2.0f));
        g.setColour (Colours::orange.withAlpha (0.6f));
        g.fillRoundedRectangle (area, 10.0f);

        g.setColour (Colours::darkgrey);
        g.drawRoundedRectangle (area, 10.0f, 2.0f);

        AttributedString s;
        s.setJustification (Justification::centred);
        s.setWordWrap (AttributedString::none);
        s.append ("Balls!\n"
                  "(Drag Me)");
        s.setColour (Colours::black);
        s.draw (g, area);
    }
开发者ID:mmgeddie,项目名称:seniordesign,代码行数:17,代码来源:AnimationDemo.cpp

示例7: draw

    void draw (CodeEditorComponent& owner, Graphics& g, const Font& fontToUse,
               const float rightClip, const float x, const int y,
               const int lineH, const float characterWidth) const
    {
        Colour lastColour (0x00000001);

        AttributedString as;
        as.setJustification (Justification::centredLeft);

        int column = 0;

        for (int i = 0; i < tokens.size(); ++i)
        {
            const float tokenX = x + column * characterWidth;
            if (tokenX > rightClip)
                break;

            const SyntaxToken& token = tokens.getReference(i);
            as.append (token.text.removeCharacters ("\r\n"), fontToUse, owner.getColourForTokenType (token.tokenType));
            column += token.length;
        }

        as.draw (g, Rectangle<float> (x, (float) y, 10000.0f, (float) lineH));
    }
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:24,代码来源:juce_CodeEditorComponent.cpp


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