本文整理汇总了C++中AttributedString::append方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributedString::append方法的具体用法?C++ AttributedString::append怎么用?C++ AttributedString::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributedString
的用法示例。
在下文中一共展示了AttributedString::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
示例4: 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())));
}
示例5: setMessage
//==============================================================================
void AlertWindow::setMessage (const String& message)
{
const String newMessage (message.substring (0, 2048));
if (text != newMessage)
{
text = newMessage;
font = getLookAndFeel().getAlertWindowMessageFont();
AttributedString newText;
newText.append (getName() + "\n\n", Font (font.getHeight() * 1.1f, Font::bold));
newText.append (text, font);
attributedText = newText;
updateLayout (true);
repaint();
}
}
示例6: 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);
}
示例7: 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;
}
示例8: showBubbleMessage
void TracktionMarketplaceUnlockForm::showBubbleMessage (const String& text, Component& target)
{
bubble = new BubbleMessageComponent (500);
addChildComponent (bubble);
AttributedString attString;
attString.append (text, Font (15.0f));
bubble->showAt (getLocalArea (&target, target.getLocalBounds()),
attString, 500, // numMillisecondsBeforeRemoving
true, // removeWhenMouseClicked
false); // deleteSelfAfterUse
}
示例9: showMessageBubble
void MainAppWindow::showMessageBubble (const String& text)
{
currentBubbleMessage = new BubbleMessageComponent (500);
getContentComponent()->addChildComponent (currentBubbleMessage);
AttributedString attString;
attString.append (text, Font (15.0f));
currentBubbleMessage->showAt (Rectangle<int> (getLocalBounds().getCentreX(), 10, 1, 1),
attString,
500, // numMillisecondsBeforeRemoving
true, // removeWhenMouseClicked
false); // deleteSelfAfterUse
}
示例10: handleOscParameterMessage
void SoundboardAudioProcessorEditor::handleOscParameterMessage(OscParameter *parameter) {
if (parameter->addressMatch("/ultraschall/soundboard/gain$")) {
gainSlider->setValue(gainSlider->proportionOfLengthToValue(parameter->getValue()), dontSendNotification);
AttributedString text;
String value(gainSlider->getValue());
if (value.length() == 1) {
text.append(" ");
} else if (value.length() == 2) {
text.append(" ");
}
text.append(value, ThemeForeground1);
text.append(" %", ThemeForeground1);
gainBubble->toFront(false);
gainBubble->showAt(gainSlider, text, 500);
if (grid->isVisible())
grid->resized();
} else if(parameter->addressMatch("/ultraschall/soundboard/duck/gain$")) {
gainSlider->setValue(gainSlider->proportionOfLengthToValue(parameter->getValue()), dontSendNotification);
} else if(parameter->addressMatch("/ultraschall/soundboard/duck/enabled$")) {
bool ducking = parameter->getValue();
gainSlider->setEnabled(!ducking);
}
}
示例11: 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);
}
示例12: reportFoundMatch
void CtrlrLuaMethodCodeEditor::reportFoundMatch (CodeDocument &document, const String &methodName, const Range<int> range)
{
CodeDocument::Position pos (document, range.getStart());
AttributedString as;
as.append ("Method: ", Colours::black);
as.append (methodName, Colours::blue);
as.append ("\tline: ", Colours::black);
as.append (String(pos.getLineNumber()+1), Colours::darkgreen);
as.append ("\tstart: ", Colours::black);
as.append (String(range.getStart()), Colours::darkgreen);
as.append ("\tend: ", Colours::black);
as.append (String(range.getEnd()), Colours::darkgreen);
owner.getMethodEditArea()->insertOutput (as);
}
示例13: 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);
}
示例14: 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);
}
示例15: 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));
}