本文整理汇总了C++中JRect::Expand方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::Expand方法的具体用法?C++ JRect::Expand怎么用?C++ JRect::Expand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::Expand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
JXFSBindingTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JPoint editCell;
if (GetEditedCell(&editCell) && cell == editCell)
{
return;
}
HilightIfSelected(p, cell, rect);
const JFSBinding* b = itsBindingList->GetBinding(cell.y);
JFSBinding::CommandType type;
JBoolean singleFile;
const JString& cmd = b->GetCommand(&type, &singleFile);
if (cell.x == kPatternColumn)
{
p.SetFont(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle());
JRect r = rect;
r.left += kHMarginWidth;
p.String(r, b->GetPattern(), JPainter::kHAlignLeft, JPainter::kVAlignCenter);
p.SetFont(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle());
}
else if (cell.x == kCommandColumn)
{
p.SetFont(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle());
JRect r = rect;
r.left += kHMarginWidth;
p.String(r, cmd, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
p.SetFont(JGetDefaultFontName(), kJDefaultFontSize, JFontStyle());
}
else if (cell.x == kTypeColumn)
{
const JString& str = itsTypeMenu->GetItemText(kCmdTypeToMenuIndex[type]);
p.String(rect, str, JPainter::kHAlignCenter, JPainter::kVAlignCenter);
}
else if (cell.x == kSingleFileColumn && singleFile)
{
JRect r;
r.top = rect.ycenter();
r.left = rect.xcenter();
r.bottom = r.top+1;
r.right = r.left+1;
r.Expand(3, 3);
p.SetFilling(kJTrue);
p.Ellipse(r);
p.SetFilling(kJFalse);
}
}
示例2: 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)
{
//.........这里部分代码省略.........