本文整理汇总了C++中JXWindowPainter::GetStringWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ JXWindowPainter::GetStringWidth方法的具体用法?C++ JXWindowPainter::GetStringWidth怎么用?C++ JXWindowPainter::GetStringWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JXWindowPainter
的用法示例。
在下文中一共展示了JXWindowPainter::GetStringWidth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r
void
JXTabGroup::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
const JRect ap = GetAperture();
p.SetFont(itsFontName, itsFontSize, itsFontStyle);
const JSize lineHeight = p.GetLineHeight();
const JSize tabHeight = 2*(kBorderWidth + kTextMargin) + lineHeight;
JIndex selIndex;
JRect selRect;
const JBoolean hasSelection = itsCardFile->GetCurrentCardIndex(&selIndex);
itsTabRects->RemoveAll();
itsCanScrollUpFlag = JI2B(itsFirstDrawIndex > 1);
itsCanScrollDownFlag = kJFalse;
const JCoordinate scrollArrowWidth = 2*(kArrowWidth + kBorderWidth);
const JSize count = itsTitles->GetElementCount();
itsLastDrawIndex = JMax(count, itsFirstDrawIndex);
const JColormap* cmap = p.GetColormap();
if (itsEdge == kTop)
{
JRect r(ap.top + kSelMargin, ap.left + kSelMargin,
ap.top + kSelMargin + tabHeight, ap.left + kSelMargin);
for (JIndex i=itsFirstDrawIndex; i<=count; i++)
{
const JString* title = itsTitles->NthElement(i);
const JBoolean isSel = JI2B(hasSelection && i == selIndex);
const TabInfo info = itsTabInfoList->GetElement(i);
r.right += 2*kBorderWidth + info.preMargin +info.postMargin + p.GetStringWidth(*title);
if (info.closable)
{
r.right += kCloseMarginWidth + itsCloseImage->GetWidth();
}
JPoint titlePt(r.left + kBorderWidth + info.preMargin,
r.top + kBorderWidth + kTextMargin);
if (isSel)
{
// titlePt.y -= kSelMargin;
r.top -= kSelMargin;
r.Expand(kSelMargin, 0);
selRect = r;
}
if (isSel)
{
p.SetPenColor(cmap->GetGrayColor(kSelGrayPercentage));
p.SetFilling(kJTrue);
p.JPainter::Rect(r);
p.SetFilling(kJFalse);
}
else
{
DrawTabBorder(p, r, kJFalse);
}
p.JPainter::String(titlePt, *title);
itsTabRects->AppendElement(r);
if (isSel)
{
r.top += kSelMargin;
r.Shrink(kSelMargin, 0);
}
r.Shrink(kBorderWidth, kBorderWidth);
DrawTab(i, p, r, itsEdge);
DrawCloseButton(i, p, r);
r.Expand(kBorderWidth, kBorderWidth);
if (r.right >= ap.right - scrollArrowWidth)
{
if (itsFirstDrawIndex == 1 && i == count && r.right <= ap.right)
{
break;
}
itsCanScrollDownFlag = JI2B( itsFirstDrawIndex < count );
itsLastDrawIndex = i;
if (r.right > ap.right - scrollArrowWidth && i > itsFirstDrawIndex)
{
itsLastDrawIndex--;
}
break;
}
r.left = r.right;
}
}
else if (itsEdge == kLeft)
{
//.........这里部分代码省略.........