本文整理汇总了C++中Justification::getOnlyVerticalFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ Justification::getOnlyVerticalFlags方法的具体用法?C++ Justification::getOnlyVerticalFlags怎么用?C++ Justification::getOnlyVerticalFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Justification
的用法示例。
在下文中一共展示了Justification::getOnlyVerticalFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawSingleLineText
//==============================================================================
void Graphics::drawSingleLineText (const String& text, const int startX, const int baselineY,
const Justification& justification) const
{
if (text.isNotEmpty()
&& startX < context.getClipBounds().getRight())
{
GlyphArrangement arr;
arr.addLineOfText (context.getFont(), text, (float) startX, (float) baselineY);
// Don't pass any vertical placement flags to this method - they'll be ignored.
jassert (justification.getOnlyVerticalFlags() == 0);
const int flags = justification.getOnlyHorizontalFlags();
if (flags != Justification::left)
{
float w = arr.getBoundingBox (0, -1, true).getWidth();
if ((flags & (Justification::horizontallyCentred | Justification::horizontallyJustified)) != 0)
w /= 2.0f;
arr.draw (*this, AffineTransform::translation (-w, 0));
}
else
{
arr.draw (*this);
}
}
}
示例2: drawText
void FilterChart::drawText (Graphics &g,
const Point<int> ptOrigin,
const String text,
Justification just)
{
const Font& font = g.getCurrentFont();
const int w = font.getStringWidth(text);
int x, y;
if (just.getOnlyHorizontalFlags() & Justification::right)
x = ptOrigin.getX() - w;
else
x = ptOrigin.getX();
if (just.getOnlyVerticalFlags() & Justification::top)
y = int (ptOrigin.getY() + font.getAscent() + 0.5);
else
y = ptOrigin.getY();
g.drawSingleLineText (text, x, y);
}