本文整理汇总了C++中JXWindowPainter::String方法的典型用法代码示例。如果您正苦于以下问题:C++ JXWindowPainter::String方法的具体用法?C++ JXWindowPainter::String怎么用?C++ JXWindowPainter::String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JXWindowPainter
的用法示例。
在下文中一共展示了JXWindowPainter::String方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: GetColormap
void
ClipboardWidget::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
// We need the colormap in order to specify colors.
JXColormap* cmap = GetColormap();
// This is where everything happens
// See JPainter.h for available functions
// This sets the color of the pen.
p.SetPenColor(cmap->GetCyanColor());
// This draws our rectangle.
p.Rect(10, 10, 150, 50);
// This draws itsText.
p.String(20,20,itsText,
130, JPainter::kHAlignCenter,
30, JPainter::kVAlignCenter);
}
示例3: if
void
JXTextMenuTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& origRect
)
{
JRect rect = AdjustRectForSeparator(cell.y, origRect);
if (cell.x == kCheckboxColumnIndex)
{
rect.left += kHilightBorderWidth;
DrawCheckbox(p, cell.y, rect);
}
else if (cell.x == kImageColumnIndex)
{
const JXImage* image;
if (itsTextMenuData->GetImage(cell.y, &image))
{
p.Image(*image, image->GetBounds(), rect);
}
}
else if (cell.x == kTextColumnIndex)
{
JIndex ulIndex;
JFontID id;
JSize size;
JFontStyle style;
const JString& text =
itsTextMenuData->GetText(cell.y, &ulIndex, &id, &size, &style);
if (!itsTextMenuData->IsEnabled(cell.y))
{
style.color = (GetColormap())->GetInactiveLabelColor();
}
p.SetFont(id, size, style);
rect.left += kHMarginWidth;
JXWindowPainter* xp = dynamic_cast<JXWindowPainter*>(&p);
assert( xp != NULL );
xp->String(rect.left, rect.top, text, ulIndex,
rect.width(), JPainter::kHAlignLeft,
rect.height(), JPainter::kVAlignCenter);
}
else if (cell.x == kSubmenuColumnIndex && itsTextMenuData->HasSubmenu(cell.y))
{
rect.right -= kHilightBorderWidth;
rect.left = rect.right - JXMenuTable::kSubmenuColWidth;
DrawSubmenuIndicator(p, cell.y, rect,
JConvertToBoolean(((JIndex) cell.y) == itsHilightRow));
}
else if (cell.x == kSubmenuColumnIndex)
{
const JString* nmShortcut;
JFontID id;
JSize size;
JFontStyle style;
if (itsTextMenuData->GetNMShortcut(cell.y, &nmShortcut, &id, &size, &style))
{
if (!itsTextMenuData->IsEnabled(cell.y))
{
style.color = (GetColormap())->GetInactiveLabelColor();
}
p.SetFont(id, size, style);
rect.left += kHNMSMarginWidth;
rect.right -= kHilightBorderWidth;
p.String(rect, *nmShortcut, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
}