本文整理汇总了C++中JXWindowPainter::SetPenColor方法的典型用法代码示例。如果您正苦于以下问题:C++ JXWindowPainter::SetPenColor方法的具体用法?C++ JXWindowPainter::SetPenColor怎么用?C++ JXWindowPainter::SetPenColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JXWindowPainter
的用法示例。
在下文中一共展示了JXWindowPainter::SetPenColor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
JXImageCheckbox::DrawBorder
(
JXWindowPainter& p,
const JRect& frame
)
{
const JBoolean drawChecked = DrawChecked();
const JBoolean isActive = IsActive();
const JSize borderWidth = GetBorderWidth();
if (drawChecked && isActive)
{
JXDrawDownFrame(p, frame, borderWidth);
}
else if (isActive)
{
JXDrawUpFrame(p, frame, borderWidth);
}
else if (borderWidth > 0)
{
p.SetLineWidth(borderWidth);
if (drawChecked)
{
p.SetPenColor((GetColormap())->GetWhiteColor());
}
else
{
p.SetPenColor((GetColormap())->GetInactiveLabelColor());
}
p.RectInside(frame);
}
}
示例2: 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);
}
示例3: if
void
JXButton::DrawBorder
(
JXWindowPainter& p,
const JRect& origFrame
)
{
JSize borderWidth = GetBorderWidth();
if (borderWidth > 0 && IsActive())
{
JRect frame = origFrame;
if (itsIsReturnButtonFlag)
{
p.JPainter::Rect(frame);
frame.Shrink(1,1);
borderWidth--;
}
if (itsIsPushedFlag)
{
JXDrawDownFrame(p, frame, borderWidth);
}
else
{
JXDrawUpFrame(p, frame, borderWidth);
}
}
else if (borderWidth > 0)
{
p.SetLineWidth(borderWidth);
p.SetPenColor((GetColormap())->GetInactiveLabelColor());
p.RectInside(origFrame);
}
}
示例4: GetColormap
void
Widget::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
JXColormap* cmap = GetColormap();
// This is where everything happens
// See JPainter.h for available functions
p.SetPenColor(cmap->GetGreenColor());
p.Rect(10, 10, 50, 50);
p.SetFilling(kJTrue);
p.SetPenColor(cmap->GetBlueColor());
p.Rect(10, 70, 50, 50);
}
示例5: GetColormap
void
ScrollingWidget::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
JXColormap* cmap = GetColormap();
// Drawing goes here
// See JPainter.h for available functions
p.SetPenColor(cmap->GetGreenColor());
p.Rect(10, 10, 50, 50);
p.SetFilling(kJTrue);
p.SetPenColor(cmap->GetBlueColor());
p.Rect(10, 70, 50, 50);
}
示例6:
void
JXWidget::DrawBackground
(
JXWindowPainter& p,
const JRect& frame
)
{
p.SetPenColor(GetCurrBackColor());
p.SetFilling(kJTrue);
p.JPainter::Rect(frame);
}
示例7: GetWindow
void
JXDocktab::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
const JColormap* cmap = p.GetColormap();
// drag region
JXWindow* w = GetWindow();
JXWindow* focusWindow;
JXDockWidget* dock;
if (w->GetDockWidget(&dock) &&
(dock->GetDockDirector())->GetFocusWindow(&focusWindow) &&
focusWindow == w)
{
p.SetPenColor(itsFocusColor);
p.SetFilling(kJTrue);
p.JPainter::Rect(rect);
p.SetPenColor((GetColormap())->GetBlackColor());
p.SetFilling(kJFalse);
p.SetPenColor(cmap->GetWhiteColor());
}
else
{
p.SetPenColor(cmap->GetGrayColor(60));
}
const JRect ap = GetAperture();
const JCoordinate y1 = ap.top + 1;
const JCoordinate y2 = ap.bottom - 2;
p.Line(3, y1, 3, y2);
p.Line(5, y1, 5, y2);
}
示例8:
void
JXInputField::DrawBorder
(
JXWindowPainter& p,
const JRect& frame
)
{
if (itsTable != NULL)
{
if (IsDNDTarget())
{
p.SetPenColor((p.GetColormap())->GetDefaultDNDBorderColor());
}
else
{
p.SetPenColor((GetColormap())->GetBlackColor());
}
p.JPainter::Rect(frame);
}
else
{
JXTEBase::DrawBorder(p, frame);
}
}
示例9: GetBorderWidth
void
JX3DWidget::DrawBorder
(
JXWindowPainter& p,
const JRect& frame
)
{
const JSize borderWidth = GetBorderWidth();
if (itsShowFocusFlag && HasFocus() && borderWidth > 0)
{
p.SetLineWidth(borderWidth);
p.SetPenColor((p.GetColormap())->GetWhiteColor());
p.RectInside(frame);
}
else
{
JXDrawDownFrame(p, frame, borderWidth);
}
}
示例10: GetAperture
void
JXHorizPartition::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
p.SetPenColor((p.GetColormap())->GetGray60Color());
const JRect ap = GetAperture();
const JCoordinate y1 = ap.top+1;
const JCoordinate y2 = ap.bottom-2;
const JSize compartmentCount = GetCompartmentCount();
JCoordinate x = 0;
for (JIndex i=1; i<compartmentCount; i++)
{
x += GetCompartmentSize(i);
p.Line(x+1, y1, x+1, y2);
p.Line(x+3, y1, x+3, y2);
x += kDragRegionSize;
}
}
示例11: GetAperture
void
JXVertPartition::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
p.SetPenColor((p.GetColormap())->GetGray60Color());
const JRect ap = GetAperture();
const JCoordinate x1 = ap.left+1;
const JCoordinate x2 = ap.right-2;
const JSize compartmentCount = GetCompartmentCount();
JCoordinate y = 0;
for (JIndex i=1; i<compartmentCount; i++)
{
y += GetCompartmentSize(i);
p.Line(x1, y+1, x2, y+1);
p.Line(x1, y+3, x2, y+3);
y += kDragRegionSize;
}
}
示例12: 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);
}
示例13: r
void
JXTabGroup::DrawTabBorder
(
JXWindowPainter& p,
const JRect& rect,
const JBoolean isSelected
)
{
JXDrawUpFrame(p, rect, kBorderWidth);
const JColormap* cmap = p.GetColormap();
if (itsEdge == kTop)
{
p.SetPenColor(cmap->GetDefaultBackColor());
p.JPainter::Point(rect.topLeft());
p.JPainter::Point(rect.topRight() + JPoint(-1,0));
p.JPainter::Point(rect.topRight() + JPoint(-2,0));
p.JPainter::Point(rect.topRight() + JPoint(-1,1));
p.JPainter::Point(rect.topRight() + JPoint(-1,2));
p.SetPenColor(cmap->Get3DLightColor());
p.JPainter::Point(rect.topLeft() + JPoint(kBorderWidth, kBorderWidth));
p.SetPenColor(cmap->Get3DShadeColor());
p.JPainter::Point(rect.topRight() + JPoint(-kBorderWidth-1, kBorderWidth));
if (isSelected)
{
JRect r(rect.bottom - kBorderWidth, rect.left + kBorderWidth,
rect.bottom, rect.right - kBorderWidth);
p.SetPenColor(cmap->GetGrayColor(kSelGrayPercentage));
p.JPainter::Rect(r);
p.JPainter::Point(rect.topLeft() + JPoint(-1,kSelMargin+kBorderWidth));
p.SetPenColor(cmap->Get3DLightColor());
p.JPainter::Point(rect.bottomLeft() + JPoint(1,-1));
p.JPainter::Point(rect.bottomRight() + JPoint(-2,-1));
p.JPainter::Point(rect.bottomRight() + JPoint(-1,-2));
p.JPainter::Point(rect.bottomRight() + JPoint(-1,-1));
}
}
else if (itsEdge == kLeft)
{
p.SetPenColor(cmap->GetDefaultBackColor());
p.JPainter::Point(rect.topLeft());
p.JPainter::Point(rect.bottomLeft() + JPoint(0,-1));
p.JPainter::Point(rect.bottomLeft() + JPoint(0,-2));
p.JPainter::Point(rect.bottomLeft() + JPoint(1,-1));
p.JPainter::Point(rect.bottomLeft() + JPoint(2,-1));
p.SetPenColor(cmap->Get3DLightColor());
p.JPainter::Point(rect.topLeft() + JPoint(kBorderWidth, kBorderWidth));
p.SetPenColor(cmap->Get3DShadeColor());
p.JPainter::Point(rect.bottomLeft() + JPoint(kBorderWidth, -kBorderWidth-1));
if (isSelected)
{
JRect r(rect.top + kBorderWidth, rect.right - kBorderWidth,
rect.bottom - kBorderWidth, rect.right);
p.SetPenColor(cmap->GetGrayColor(kSelGrayPercentage));
p.JPainter::Rect(r);
p.JPainter::Point(rect.topLeft() + JPoint(kSelMargin+kBorderWidth,-1));
p.SetPenColor(cmap->Get3DLightColor());
p.JPainter::Point(rect.topRight() + JPoint(-1,1));
if (rect.bottom < (GetAperture()).bottom)
{
p.JPainter::Point(rect.bottomRight() + JPoint(-1,-1));
p.JPainter::Point(rect.bottomRight() + JPoint(-2,-1));
p.JPainter::Point(rect.bottomRight() + JPoint(-1,-2));
}
}
}
else if (itsEdge == kBottom)
{
p.SetPenColor(cmap->GetDefaultBackColor());
p.JPainter::Point(rect.bottomLeft() + JPoint(0,-1));
p.JPainter::Point(rect.bottomLeft() + JPoint(0,-2));
p.JPainter::Point(rect.bottomLeft() + JPoint(1,-1));
p.JPainter::Point(rect.bottomLeft() + JPoint(2,-1));
p.JPainter::Point(rect.bottomRight() + JPoint(-1,-1));
p.SetPenColor(cmap->Get3DLightColor());
p.JPainter::Point(rect.bottomLeft() + JPoint(kBorderWidth, -kBorderWidth-1));
p.SetPenColor(cmap->Get3DShadeColor());
p.JPainter::Point(rect.bottomRight() + JPoint(-kBorderWidth-1, -kBorderWidth-1));
if (isSelected)
{
JRect r(rect.top, rect.left + kBorderWidth,
rect.top + kBorderWidth, rect.right - kBorderWidth);
p.SetPenColor(cmap->GetGrayColor(kSelGrayPercentage));
p.JPainter::Rect(r);
p.SetPenColor(cmap->Get3DShadeColor());
if (rect.left > (GetAperture()).left)
{
p.JPainter::Point(rect.topLeft());
}
p.JPainter::Point(rect.topRight() + JPoint(-1,0));
p.JPainter::Point(rect.topRight() + JPoint(-2,0));
p.JPainter::Point(rect.topRight() + JPoint(-2,1));
}
}
//.........这里部分代码省略.........
示例14: color
void
JXColorWheel::Draw
(
JXWindowPainter& p,
const JRect& rect
)
{
JXColormap* colormap = GetColormap();
const JColorIndex black = colormap->GetBlackColor();
const JRect bounds = GetBoundsGlobal();
const JCoordinate max = JMin(bounds.height(), bounds.width() - kSliderWidth - kSliderMargin);
const JCoordinate size = max - 2*kWheelMargin - 1;
const JCoordinate center = size/2 + kWheelMargin;
if (itsImage == NULL || itsImage->GetWidth() != max || itsColor.brightness != itsLastDrawBrightness)
{
p.SetFilling(kJTrue);
p.SetPenColor(black);
p.Ellipse(kWheelMargin, kWheelMargin, size, size);
p.SetFilling(kJFalse);
JRect r = bounds;
r.bottom = r.top + max;
r.right = r.left + max;
jdelete itsImage;
itsImage = jnew JXImage(GetDisplay(), p.GetDrawable(), r);
assert( itsImage != NULL );
itsLastDrawBrightness = itsColor.brightness;
for (JCoordinate x=0; x<max; x++)
{
const JCoordinate dx = - x + center;
for (JCoordinate y=0; y<max; y++)
{
if (itsImage->GetColor(x,y) == black)
{
const JCoordinate dy = y - center;
const JFloat r = sqrt(dx*dx + dy*dy) / center;
const JFloat a = 0.5 + atan2(dy, dx) / (2.0 * kJPi);
JHSB color(JRound(a * kJMaxHSBValue), JRound(r * kJMaxHSBValue), itsLastDrawBrightness);
itsImage->SetColor(x,y, colormap->JColormap::GetColor(color));
}
}
}
itsImage->ConvertToRemoteStorage();
}
p.JPainter::Image(*itsImage, itsImage->GetBounds(), 0,0);
const JFloat r = (itsColor.saturation / kJMaxHSBValueF) * size/2;
const JFloat a = ((itsColor.hue / kJMaxHSBValueF) - 0.5) * 2.0 * kJPi;
const JCoordinate x = center - JRound(r * cos(a));
const JCoordinate y = center + JRound(r * sin(a));
JRect mark(y-kWheelMargin, x-kWheelMargin, y+kWheelMargin+1, x+kWheelMargin+1);
p.SetPenColor(colormap->GetWhiteColor());
p.SetFilling(kJTrue);
p.JPainter::Rect(mark);
p.SetFilling(kJFalse);
p.SetPenColor(black);
p.JPainter::Rect(mark);
}