当前位置: 首页>>代码示例>>C++>>正文


C++ JRect::ycenter方法代码示例

本文整理汇总了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();
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:15,代码来源:JXExprEditor.cpp

示例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);
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:60,代码来源:JXFSBindingTable.cpp

示例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);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:25,代码来源:JNamedConstant.cpp

示例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();
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:29,代码来源:CBCommandTable.cpp

示例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);
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:34,代码来源:JXTextMenuTable.cpp

示例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);
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:29,代码来源:JXSearchTextButton.cpp

示例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;
			}
		}
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:60,代码来源:JXColHeaderWidget.cpp

示例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);
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:52,代码来源:JXTextCheckbox.cpp

示例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);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:14,代码来源:CBSearchDocument.cpp

示例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);
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:49,代码来源:JXTabGroup.cpp

示例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));
		}
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:16,代码来源:SVNTabGroup.cpp

示例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);
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:20,代码来源:JFunction.cpp

示例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);
		}
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:40,代码来源:CMLineIndexTable.cpp

示例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);
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:23,代码来源:JXWidget.cpp

示例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);
			}
		}
}
开发者ID:dllaurence,项目名称:jx_application_framework,代码行数:73,代码来源:JParallel.cpp


注:本文中的JRect::ycenter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。