本文整理汇总了C++中AttributedString::setJustification方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributedString::setJustification方法的具体用法?C++ AttributedString::setJustification怎么用?C++ AttributedString::setJustification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributedString
的用法示例。
在下文中一共展示了AttributedString::setJustification方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: 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());
}
}
示例3: bubbleMessage
void NodeComponent::bubbleMessage(String msg)
{
AttributedString text (msg);
text.setJustification (Justification::centred);
bbl.setAlwaysOnTop (true);
bbl.addToDesktop (0);
bbl.showAt(this, text, 5000., true, false);
}
示例4: getDisplayString
const AttributedString CtrlrLuaMethodEditor::getDisplayString(const ValueTree &item) const
{
AttributedString str;
if (item.getType () == Ids::luaMethod)
{
Colour text;
if ((bool)item.getProperty(Ids::luaMethodValid) == false)
text = Colours::red;
else
text = Colours::black;
str.append (item.getProperty(Ids::luaMethodName).toString()+"\n", Font(12.0f, Font::plain), text);
if ((int)item.getProperty(Ids::luaMethodSource) == CtrlrLuaMethod::codeInFile)
{
str.append (File::descriptionOfSizeInBytes (File(item.getProperty(Ids::luaMethodSourcePath).toString()).getSize()), Font(10.0f, Font::italic), text.brighter(0.2f));
}
else
{
str.append (File::descriptionOfSizeInBytes (item.getProperty(Ids::luaMethodCode).toString().length()), Font(10.0f, Font::italic), text.brighter(0.2f));
}
str.setJustification (Justification::left);
}
if (item.getType() == Ids::luaMethodGroup)
{
str.append (item.getProperty(Ids::name), Font(14.0f, Font::plain), Colours::black);
str.append (" ["+String(item.getNumChildren())+"]", Font(10.0f, Font::italic), Colours::darkgrey);
str.setJustification (Justification::left);
}
if (item.getType() == Ids::luaManagerMethods)
{
str.append ("LUA", Font(14.0f, Font::bold), Colours::black);
str.setJustification (Justification::left);
}
return (str);
}
示例5: updateLayout
void updateLayout (const int width)
{
AttributedString s;
s.setJustification (Justification::topLeft);
s.append (getText(), getFont());
TextLayout text;
text.createLayoutWithBalancedLineLengths (s, width - 8.0f);
setSize (width, jmin (width, (int) (text.getHeight() + getFont().getHeight())));
}
示例6: bubbleMessage
void FilterComponent::bubbleMessage(String msg)
{
BubbleMessageComponent* bbl = new BubbleMessageComponent();
AttributedString text (msg);
text.setJustification (Justification::centred);
bbl->setAlwaysOnTop (true);
bbl->addToDesktop (0);
bbl->showAt(this, text, 2000., true, true);
}
示例7: createTabTextLayout
void CtrlrLuaMethodEditorTabsLF::createTabTextLayout (const TabBarButton& button, float length, float depth, Colour colour, TextLayout& textLayout)
{
Font font (12.0f);
font.setUnderline (button.hasKeyboardFocus (false));
AttributedString s;
s.setJustification (Justification::centred);
s.append (button.getButtonText().trim(), font, colour);
textLayout.createLayout (s, length);
}
示例8: layoutTooltipText
static TextLayout layoutTooltipText (const String& text, const Colour& colour) noexcept
{
const float tooltipFontSize = 13.0f;
const int maxToolTipWidth = 400;
AttributedString s;
s.setJustification (Justification::centred);
s.append (text, Font (tooltipFontSize, Font::bold), colour);
TextLayout tl;
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
return tl;
}
示例9: 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);
}
示例10: 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));
}
示例11: 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());
}
示例12: 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);
}
示例13: 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));
}