本文整理汇总了C++中GlyphArrangement::addCurtailedLineOfText方法的典型用法代码示例。如果您正苦于以下问题:C++ GlyphArrangement::addCurtailedLineOfText方法的具体用法?C++ GlyphArrangement::addCurtailedLineOfText怎么用?C++ GlyphArrangement::addCurtailedLineOfText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlyphArrangement
的用法示例。
在下文中一共展示了GlyphArrangement::addCurtailedLineOfText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintListBoxItem
void PluginListComponent::paintListBoxItem (int row, Graphics& g, int width, int height, bool rowIsSelected)
{
if (rowIsSelected)
g.fillAll (findColour (TextEditor::highlightColourId));
String name, desc;
bool isBlacklisted = false;
if (row >= list.getNumTypes())
{
isBlacklisted = true;
name = list.getBlacklistedFiles() [row - list.getNumTypes()];
desc = TRANS("Deactivated after failing to initialise correctly");
}
else if (const PluginDescription* const pd = list.getType (row))
{
name = pd->name;
desc << pd->pluginFormatName
<< (pd->isInstrument ? " instrument" : " effect")
<< " - " << pd->numInputChannels << (pd->numInputChannels == 1 ? " in" : " ins")
<< " / " << pd->numOutputChannels << (pd->numOutputChannels == 1 ? " out" : " outs");
if (pd->manufacturerName.isNotEmpty()) desc << " - " << pd->manufacturerName;
if (pd->version.isNotEmpty()) desc << " - " << pd->version;
if (pd->category.isNotEmpty()) desc << " - category: '" << pd->category << '\'';
}
if (name.isNotEmpty())
{
GlyphArrangement ga;
ga.addCurtailedLineOfText (Font (height * 0.7f, Font::bold),
name, 8.0f, height * 0.8f, width - 10.0f, true);
g.setColour (isBlacklisted ? Colours::red : Colours::black);
ga.draw (g);
const Rectangle<float> bb (ga.getBoundingBox (0, -1, false));
ga.clear();
ga.addCurtailedLineOfText (Font (height * 0.6f), desc,
jmax (bb.getRight() + 10.0f, width / 3.0f), height * 0.8f,
width - bb.getRight() - 12.0f, true);
g.setColour (isBlacklisted ? Colours::red : Colours::grey);
ga.draw (g);
}
}
示例2: paintListBoxItem
void PluginListComponent::paintListBoxItem (int row,
Graphics& g,
int width, int height,
bool rowIsSelected)
{
if (rowIsSelected)
g.fillAll (findColour (TextEditor::highlightColourId));
const PluginDescription* const pd = list.getType (row);
if (pd != 0)
{
GlyphArrangement ga;
ga.addCurtailedLineOfText (Font (height * 0.7f, Font::bold), pd->name, 8.0f, height * 0.8f, width - 10.0f, true);
g.setColour (Colours::black);
ga.draw (g);
float x, y, r, b;
ga.getBoundingBox (0, -1, x, y, r, b, false);
String desc;
desc << pd->pluginFormatName
<< (pd->isInstrument ? " instrument" : " effect")
<< " - "
<< pd->numInputChannels << (pd->numInputChannels == 1 ? " in" : " ins")
<< " / "
<< pd->numOutputChannels << (pd->numOutputChannels == 1 ? " out" : " outs");
if (pd->manufacturerName.isNotEmpty())
desc << " - " << pd->manufacturerName;
if (pd->version.isNotEmpty())
desc << " - " << pd->version;
if (pd->category.isNotEmpty())
desc << " - category: '" << pd->category << '\'';
g.setColour (Colours::grey);
ga.clear();
ga.addCurtailedLineOfText (Font (height * 0.6f), desc, r + 10.0f, height * 0.8f, width - r - 12.0f, true);
ga.draw (g);
}
}
示例3: drawText
void Graphics::drawText (const String& text, const Rectangle<float>& area,
Justification justificationType, bool useEllipsesIfTooBig) const
{
if (text.isNotEmpty() && context.clipRegionIntersects (area.getSmallestIntegerContainer()))
{
GlyphArrangement arr;
arr.addCurtailedLineOfText (context.getFont(), text, 0.0f, 0.0f,
area.getWidth(), useEllipsesIfTooBig);
arr.justifyGlyphs (0, arr.getNumGlyphs(),
area.getX(), area.getY(), area.getWidth(), area.getHeight(),
justificationType);
arr.draw (*this);
}
}
示例4: drawText
void Graphics::drawText (const String& text,
const int x, const int y, const int width, const int height,
const Justification& justificationType,
const bool useEllipsesIfTooBig) const
{
if (text.isNotEmpty() && context->clipRegionIntersects (Rectangle<int> (x, y, width, height)))
{
GlyphArrangement arr;
arr.addCurtailedLineOfText (context->getFont(), text,
0.0f, 0.0f, (float) width,
useEllipsesIfTooBig);
arr.justifyGlyphs (0, arr.getNumGlyphs(),
(float) x, (float) y, (float) width, (float) height,
justificationType);
arr.draw (*this);
}
}