本文整理汇总了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());
}
}
示例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());
}
示例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);
}
示例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));
}
示例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());
}
示例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);
}
示例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));
}