本文整理汇总了C++中JRect::ycenter方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::ycenter方法的具体用法?C++ JRect::ycenter怎么用?C++ JRect::ycenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::ycenter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetBounds
void
JXExprEditor::GetDrawingOffset
(
JPoint* delta
)
const
{
const JRect bounds = GetBounds();
const JExprRectList* rectList = GetRectList();
const JRect exprBounds = rectList->GetBoundsRect();
delta->x = bounds.xcenter() - exprBounds.xcenter();
delta->y = bounds.ycenter() - exprBounds.ycenter();
}
示例2: 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);
}
}
示例3: PrepareToRender
JIndex
JNamedConstant::PrepareToRender
(
const JExprRenderer& renderer,
const JPoint& upperLeft,
const JSize fontSize,
JExprRectList* rectList
)
{
if (strcmp(JPGetStdNamedConstName(itsNameIndex), JPGetPiString()) == 0)
{
JRect ourRect;
ourRect.top = upperLeft.y;
ourRect.left = upperLeft.x;
ourRect.bottom = upperLeft.y + renderer.GetLineHeight(fontSize);
ourRect.right = upperLeft.x + renderer.GetGreekCharWidth(fontSize, kGreekPiChar);
const JCoordinate ourMidline = ourRect.ycenter();
return rectList->AddRect(ourRect, ourMidline, fontSize, this);
}
else
{
return JFunction::PrepareToRender(renderer, upperLeft, fontSize, rectList);
}
}
示例4: GetCellRect
void
CBCommandTable::HandleDNDHere
(
const JPoint& pt,
const JXWidget* source
)
{
JIndex newRowIndex = itsDNDRowIndex;
JPoint cell;
if (GetCell(JPinInRect(pt, GetBounds()), &cell))
{
const JRect r = GetCellRect(cell);
if (pt.y <= r.ycenter())
{
newRowIndex = cell.y;
}
else
{
newRowIndex = cell.y + 1;
}
}
if (newRowIndex != itsDNDRowIndex)
{
itsDNDRowIndex = newRowIndex;
Refresh();
}
}
示例5: GetApertureWidth
void
JXTextMenuTable::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
JXMenuTable::Draw(p, rect);
const JCoordinate w = GetApertureWidth();
const JSize rowCount = GetRowCount();
for (JIndex i=1; i<rowCount; i++) // ignore separator after last item
{
if (itsTextMenuData->HasSeparator(i))
{
JRect r = GetCellRect(JPoint(1,i));
r.top = r.bottom - kSeparatorHeight;
r.right = r.left + w;
// JXDrawDownFrame(p, r, kSeparatorHeight/2);
r.top = r.ycenter() - 1;
r.bottom = r.top + 2;
JXDrawDownFrame(p, r, 1);
}
}
if (itsHilightRow != 0)
{
const JRect r = GetCellRect(JPoint(1, itsHilightRow));
JRect r1 = AdjustRectForSeparator(itsHilightRow, r);
r1.right = r1.left + w;
JXDrawUpFrame(p, r1, kHilightBorderWidth);
}
}
示例6: GetBounds
void
JXSearchTextButton::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
const JRect bounds = GetBounds();
JRect r;
r.top = bounds.ycenter() - kArrowHalfHeight;
r.bottom = r.top + 2*kArrowHalfHeight + 1;
r.left = bounds.xcenter() - kArrowHalfWidth;
r.right = r.left + 2*kArrowHalfWidth;
const JColorIndex colorIndex =
IsActive() ? (p.GetColormap())->GetGrayColor(40) :
(p.GetColormap())->GetInactiveLabelColor();
if (itsFwdFlag)
{
r.right++;
JXFillArrowRight(p, r, colorIndex);
}
else
{
r.left--;
JXFillArrowLeft(p, r, colorIndex);
}
}
示例7: tableRect
void
JXColHeaderWidget::HandleMouseDrag
(
const JPoint& origPt,
const JXButtonStates& buttonStates,
const JXKeyModifiers& modifiers
)
{
if (itsDragType != kInvalidDrag)
{
JPoint pt = origPt;
// keep col width larger than minimum
if (pt.x < itsDragCellRect.left + itsMinColWidth)
{
pt.x = itsDragCellRect.left + itsMinColWidth;
}
// check if we have moved
if (pt.x != itsPrevPt.x)
{
JPainter* p = NULL;
const JBoolean ok = GetDragPainter(&p);
assert( ok );
const JRect enclApG = (GetEnclosure())->GetApertureGlobal();
JRect enclAp = JXContainer::GlobalToLocal(enclApG);
// scroll, if necessary
const JPoint ptG = JXContainer::LocalToGlobal(pt);
const JPoint ptT = JPinInRect(itsTable->JXContainer::GlobalToLocal(ptG),
itsTable->GetBounds());
const JRect tableAp = itsTable->GetAperture();
const JCoordinate y = tableAp.ycenter();
const JRect tableRect(y-1, ptT.x-1, y+1, ptT.x+1);
if (itsTable->ScrollToRect(tableRect))
{
(GetWindow())->Update();
enclAp = JXContainer::GlobalToLocal(enclApG); // local coords changed
}
else
{
// erase the old line
p->Line(itsPrevPt.x, enclAp.top, itsPrevPt.x, enclAp.bottom);
}
// draw the new line
p->Line(pt.x, enclAp.top, pt.x, enclAp.bottom);
// ready for next call
itsPrevPt = pt;
}
}
}
示例8: boxRect
void
JXTextCheckbox::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
const JRect bounds = GetBounds();
const JCoordinate y = bounds.ycenter();
// draw button
const JRect boxRect(y - kBoxHalfHeight, kMarginWidth,
y + kBoxHalfHeight, kMarginWidth + kBoxHeight);
const JBoolean drawChecked = DrawChecked();
const JBoolean isActive = IsActive();
if (drawChecked && isActive)
{
JXDrawDownFrame(p, boxRect, kJXDefaultBorderWidth, kJTrue, itsPushedColor);
}
else if (isActive)
{
JXDrawUpFrame(p, boxRect, kJXDefaultBorderWidth, kJTrue, itsNormalColor);
}
else
{
p.SetFilling(kJTrue);
if (drawChecked)
{
p.SetPenColor(itsPushedColor);
}
else
{
p.SetPenColor(itsNormalColor);
}
p.JPainter::Rect(boxRect);
p.SetFilling(kJFalse);
p.SetLineWidth(kJXDefaultBorderWidth);
p.SetPenColor((GetColormap())->GetInactiveLabelColor());
p.RectInside(boxRect);
}
// draw text
JRect textRect = bounds;
textRect.left += 2*kMarginWidth + kBoxHeight;
p.SetFont(itsFontName, itsFontSize, itsFontStyle);
p.String(textRect.left, textRect.top, itsLabel, itsULIndex,
textRect.width(), JPainter::kHAlignLeft,
textRect.height(), JPainter::kVAlignCenter);
}
示例9: GetWindow
void
CBSearchDocument::PlaceCmdLineWidgets()
{
CBExecOutputDocument::PlaceCmdLineWidgets();
JXWindow* window = GetWindow();
JXWidget::HSizingOption hSizing;
JXWidget::VSizingOption vSizing;
const JRect frame = GetFileDisplayInfo(&hSizing, &vSizing);
itsIndicator->Place(frame.left, frame.ycenter() - kIndicatorHeight/2);
itsIndicator->SetSize(frame.width(), kIndicatorHeight);
}
示例10: if
void
JXTabGroup::DrawCloseButton
(
const JIndex index,
JXWindowPainter& p,
const JRect& rect
)
{
if (index != itsMouseIndex)
{
return;
}
else if (!TabCanClose(index))
{
itsCloseRect.Set(0,0,0,0);
return;
}
if (itsEdge == kTop || itsEdge == kBottom)
{
itsCloseRect.top = rect.ycenter() - itsCloseImage->GetHeight()/2;
itsCloseRect.bottom = itsCloseRect.top + itsCloseImage->GetHeight();
itsCloseRect.right = rect.right - kCloseMarginWidth;
itsCloseRect.left = itsCloseRect.right - itsCloseImage->GetWidth();
}
else if (itsEdge == kLeft)
{
itsCloseRect.top = rect.top + kCloseMarginWidth;
itsCloseRect.bottom = itsCloseRect.top + itsCloseImage->GetHeight();
itsCloseRect.left = rect.xcenter() - itsCloseImage->GetWidth()/2;
itsCloseRect.right = itsCloseRect.left + itsCloseImage->GetWidth();
}
else // itsEdge == kRight
{
itsCloseRect.bottom = rect.bottom - kCloseMarginWidth;
itsCloseRect.top = itsCloseRect.bottom - itsCloseImage->GetHeight();
itsCloseRect.left = rect.xcenter() - itsCloseImage->GetWidth()/2;
itsCloseRect.right = itsCloseRect.left + itsCloseImage->GetWidth();
}
if (itsClosePushedFlag)
{
p.Image(*itsClosePushedImage, itsClosePushedImage->GetBounds(), itsCloseRect);
}
else
{
p.Image(*itsCloseImage, itsCloseImage->GetBounds(), itsCloseRect);
}
}
示例11:
void
SVNTabGroup::DrawTab
(
const JIndex index,
JXWindowPainter& p,
const JRect& rect,
const Edge edge
)
{
if (index == itsBusyIndex)
{
JXImage* image = itsImageList->NthElement(itsSpinnerIndex);
p.JPainter::Image(*image, image->GetBounds(),
rect.left + kMarginWidth, rect.ycenter() - (image->GetHeight()/2));
}
}
示例12: Print
JIndex
JFunction::PrepareToRender
(
const JExprRenderer& renderer,
const JPoint& upperLeft,
const JSize fontSize,
JExprRectList* rectList
)
{
const JString text = Print();
JRect ourRect;
ourRect.top = upperLeft.y;
ourRect.left = upperLeft.x;
ourRect.bottom = upperLeft.y + renderer.GetLineHeight(fontSize);
ourRect.right = upperLeft.x + renderer.GetStringWidth(fontSize, text);
const JCoordinate ourMidline = ourRect.ycenter();
return rectList->AddRect(ourRect, ourMidline, fontSize, this);
}
示例13: GetColormap
void
CMLineIndexTable::DrawBreakpoints
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
// check for breakpoint(s) on this line
JBoolean hasMultiple;
if (!FindNextBreakpoint(cell.y, &hasMultiple))
{
return;
}
// draw breakpoint(s)
JRect r = rect;
r.Shrink(kMarginWidth, kMarginWidth);
if (hasMultiple)
{
if (r.height() < 9) // to allow concentric circles to be distinguished
{
r.top = rect.ycenter() - 4;
r.bottom = r.top + 9;
r.left = rect.xcenter() - 4;
r.right = r.left + 9;
}
p.Ellipse(r);
r.Shrink(3, 3);
p.Ellipse(r);
}
else
{
DrawBreakpoint(itsBPList->NthElement(itsBPDrawIndex), p, GetColormap(), r);
}
}
示例14: GetFrame
void
JXWidget::CenterWithinEnclosure
(
const JBoolean adjustHoriz,
const JBoolean adjustVert
)
{
const JRect frame = GetFrame();
const JPoint oldPt = frame.topLeft();
const JRect enclBounds = (GetEnclosure())->GetBounds();
JCoordinate dx=0, dy=0;
if (adjustHoriz)
{
dx = (enclBounds.xcenter() - frame.width()/2) - oldPt.x;
}
if (adjustVert)
{
dy = (enclBounds.ycenter() - frame.height()/2) - oldPt.y;
}
Move(dx,dy);
}
示例15: JLFloor
void
JParallel::Render
(
const JExprRenderer& renderer,
const JExprRectList& rectList
)
const
{
// find ourselves in the list
JIndex ourIndex;
const JBoolean found = rectList.FindFunction(this, &ourIndex);
assert( found );
const JRect ourRect = rectList.GetRect(ourIndex);
const JCoordinate ourMidline = rectList.GetMidline(ourIndex);
const JSize fontSize = rectList.GetFontSize(ourIndex);
// draw ourselves
const JSize spaceWidth = renderer.GetStringWidth(fontSize, " ");
const JSize barWidth = renderer.GetVertBarWidth();
const JSize lineHeight = renderer.GetLineHeight(fontSize);
JSize maxBarLength;
if (((JSize) ourRect.height()) > lineHeight)
{
maxBarLength = JLFloor(ourRect.height()/2.0);
}
else
{
maxBarLength = ourRect.height();
}
JSize barLength;
if (ourMidline > ourRect.ycenter())
{
barLength = 2*(ourRect.bottom - ourMidline);
}
else
{
barLength = 2*(ourMidline - ourRect.top);
}
if (barLength > maxBarLength)
{
barLength = maxBarLength;
}
const JCoordinate barTop = ourMidline - barLength/2;
const JSize argCount = GetArgCount();
for (JIndex i=1; i<=argCount; i++)
{
const JFunction* arg = GetArg(i);
arg->Render(renderer, rectList);
JIndex argIndex;
const JBoolean found = rectList.FindFunction(arg, &argIndex);
assert( found );
const JRect argRect = rectList.GetRect(argIndex);
JCoordinate h = argRect.right + spaceWidth;
if (ParenthesizeArgForRender(*this, *arg))
{
renderer.DrawParentheses(argRect);
h += renderer.GetParenthesisWidth(argRect.height());
}
if (i < argCount)
{
renderer.DrawVertBar(h, barTop, barLength);
renderer.DrawVertBar(h + barWidth, barTop, barLength);
}
}
}