本文整理汇总了C++中JPainter::String方法的典型用法代码示例。如果您正苦于以下问题:C++ JPainter::String方法的具体用法?C++ JPainter::String怎么用?C++ JPainter::String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPainter
的用法示例。
在下文中一共展示了JPainter::String方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: if
void
THXVarTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JPoint editCell;
if (GetEditedCell(&editCell) && cell == editCell)
{
return;
}
JRect r = rect;
r.left += kHMarginWidth;
const JIndex varIndex = cell.y + THXVarList::kUserFnOffset;
if (cell.x == kNameColumn)
{
p.String(r, itsVarList->GetVariableName(varIndex),
JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
else if (cell.x == kFnColumn)
{
const JString s = (itsVarList->GetFunction(varIndex))->Print();
p.String(r, s, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
示例3: CellToSymbolIndex
void
CBSymbolTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
const JIndex symbolIndex = CellToSymbolIndex(cell);
CBLanguage lang;
CBSymbolList::Type type;
const JString& symbolName =
itsSymbolList->GetSymbol(symbolIndex, &lang, &type);
const JString* signature;
itsSymbolList->GetSignature(symbolIndex, &signature);
if (CalcColWidths(symbolName, signature))
{
AdjustColWidths();
}
const JXImage* icon = NULL;
const JFontStyle& style = (CBGetSymbolTypeList())->GetStyle(type, &icon);
// draw icon
if (icon != NULL)
{
JRect r = rect;
r.right = r.left + kIconWidth;
p.Image(*icon, icon->GetBounds(), r);
}
// draw name
p.SetFontStyle(style);
JRect r = rect;
r.left += kIconWidth + kHMarginWidth;
p.String(r, symbolName, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
if (signature != NULL)
{
r.left += (GetFontManager())->GetStringWidth(
JGetDefaultFontName(), kJDefaultFontSize, JFontStyle(), symbolName);
p.String(r, *signature, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
示例4: JString
void
JXColHeaderWidget::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JXDrawUpFrame(p, rect, kCellFrameWidth);
JString str;
JBoolean hasTitle = kJFalse;
if (itsTitles != NULL)
{
const JString* title = itsTitles->NthElement(cell.x);
if (title != NULL)
{
str = *title;
hasTitle = kJTrue;
}
}
if (!hasTitle)
{
str = JString(cell.x, 0);
}
p.SetFont(JGetDefaultFontName(), kFontSize,
JFontStyle(kJTrue, kJFalse, 0, kJFalse, (p.GetColormap())->GetBlackColor()));
p.String(rect, str, JPainter::kHAlignCenter, JPainter::kVAlignCenter);
}
示例5: JString
void
GPMTreeHeaderWidget::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JXDrawUpFrame(p, rect, kJXDefaultBorderWidth);
JString str;
if (!GetColTitle(cell.x, &str))
{
str = JString(cell.x, JString::kBase10);
}
JSize underLines = 0;
if (itsList->TreeColIsSelected(cell.x))
{
underLines = 1;
}
const JFont font = GetFontManager()->GetFont(
JGetDefaultFontName(), JGetDefaultRowColHeaderFontSize(),
JFontStyle(kJTrue, kJFalse, underLines, kJFalse, (p.GetColormap())->GetBlackColor()));
p.SetFont(font);
p.String(rect, str, JPainter::kHAlignCenter, JPainter::kVAlignCenter);
}
示例6: cellNumber
void
DataTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
// Convert the array's current element into a JString.
JString cellNumber(itsData->GetElement(cell.y));
// Draw the JString that holds the value.
p.String(rect, cellNumber, JPainter::kHAlignLeft, JPainter::kVAlignTop);
}
示例7: cellNumber
void
SimpleTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
// Convert the row number into a JString.
JString cellNumber(cell.y);
// Draw the JString that holds the value.
p.String(rect, cellNumber, JPainter::kHAlignLeft, JPainter::kVAlignTop);
}
示例8:
void
FitParmsTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JString* str;
p.SetFont(GetFontManager()->GetDefaultFont());
JRect r = rect;
if (cell.x == 1)
{
r.right -= kHMarginWidth;
str = itsCol1->NthElement(cell.y);
p.String(r, *str, JPainter::kHAlignRight, JPainter::kVAlignCenter);
}
else
{
r.left += kHMarginWidth;
str = itsCol2->NthElement(cell.y);
p.String(r, *str, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
示例9:
void
JX2DCurveNameList::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
const JString* curveName = itsNameList->NthElement(cell.y);
JRect r = rect;
r.left += kHMarginWidth;
p.String(r, *curveName, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
示例10: if
void
CMLineIndexTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
if (JIndex(cell.x) == kBreakpointColumn)
{
DrawBreakpoints(p, cell, rect);
}
else if (JIndex(cell.x) == kExecPointColumn && cell.y == itsCurrentLineIndex)
{
// We can't use a static polygon because line heights can vary,
// e.g. due to underlines.
const JCoordinate delta = rect.height()/2;
JPolygon poly;
poly.AppendElement(JPoint(rect.left+kMarginWidth, rect.top));
poly.AppendElement(JPoint(rect.left+kMarginWidth+delta, rect.top + delta));
poly.AppendElement(JPoint(rect.left+kMarginWidth, rect.top + 2*delta));
p.SetPenColor(GetCurrentLineMarkerColor());
p.SetFilling(kJTrue);
p.Polygon(poly);
p.SetPenColor(GetColormap()->GetBlackColor());
p.SetFilling(kJFalse);
p.Polygon(poly);
}
else if (JIndex(cell.x) == kLineNumberColumn)
{
p.SetFont(itsText->GetDefaultFont());
JRect r = rect;
r.right -= kMarginWidth;
const JString str = GetLineText(cell.y);
p.String(r, str, JPainter::kHAlignRight);
}
}
示例11: if
void
GLFitParameterTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
JIndex realIndex = cell.x;
if (realIndex == kStartColIndex && !itsHasStartValues)
{
realIndex = kFitColIndex;
}
else if (realIndex == kFitColIndex && !itsHasStartValues)
{
realIndex = kErrorColIndex;
}
JString str;
if (realIndex == kNameColIndex)
{
str = *(itsNameList->NthElement(cell.y));
}
else if (realIndex == kStartColIndex)
{
str = JString(itsStartValues->GetElement(cell.y), JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 5);
}
else if (realIndex == kFitColIndex)
{
str = JString(itsFitValues->GetElement(cell.y), JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 5);
}
else if (realIndex == kErrorColIndex)
{
str = JString(itsErrorValues->GetElement(cell.y), JString::kPrecisionAsNeeded, JString::kStandardExponent, 0, 5);
}
JRect r = rect;
r.left += kHMarginWidth;
p.String(r, str, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
示例12: cellNumber
void
SelectionTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
// JTable keeps track of what's selected. If we want just
// basic hilighting of the selected cells, we can have JTable
// do it with this call:
HilightIfSelected(p, cell, rect);
// Convert the array's current element into a JString.
JString cellNumber(itsData->GetElement(cell.y));
// Draw the JString that holds the value.
p.String(rect, cellNumber, JPainter::kHAlignLeft, JPainter::kVAlignTop);
}
示例13:
void
GMAccountList::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
JFontStyle fontstyle;
if (itsDialog->GetDefaultIndex() == (JIndex)cell.y)
{
fontstyle.bold = kJTrue;
}
p.SetFont(JGetDefaultFontName(), kJDefaultFontSize, fontstyle);
JString str = itsAccountInfo->NthElement(cell.y)->GetNickname();
// check that column is wide enough
const JCoordinate w = p.GetStringWidth(str) + 2*kHMarginWidth;
if (w > GetColWidth(1))
{
itsMinColWidth = w;
}
// draw string
JRect r = rect;
r.left += kHMarginWidth;
p.String(r, str, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
if (cell.y == JCoordinate(itsAccountInfo->GetElementCount()))
{
AdjustColWidth();
}
}
示例14: JString
void
JXRowHeaderWidget::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
JXDrawUpFrame(p, rect, kCellFrameWidth);
JString str;
JBoolean hasTitle = kJFalse;
if (itsTitles != NULL)
{
const JString* title = itsTitles->NthElement(cell.y);
if (title != NULL)
{
str = *title;
hasTitle = kJTrue;
}
}
if (!hasTitle)
{
str = JString(cell.y, JString::kBase10);
}
p.SetFont(JGetDefaultFontName(), kJDefaultRowColHeaderFontSize,
JFontStyle(kJTrue, kJFalse, 0, kJFalse, (p.GetColormap())->GetBlackColor()));
p.String(rect, str, JPainter::kHAlignCenter, JPainter::kVAlignCenter);
const JCoordinate wmin = p.GetStringWidth(str) + 2*itsHMarginWidth;
if (rect.width() < wmin && itsMaxBcastWidth < wmin)
{
Broadcast(NeedsToBeWidened(wmin - itsMaxBcastWidth));
itsMaxBcastWidth = wmin;
}
}
示例15: if
void
GLFitDescriptionList::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
const JString* curveName = itsNameList->NthElement(cell.y);
const GLFitDescription& fd = GetFitManager()->GetFitDescription(cell.y);
JRect irect = rect;
irect.right = rect.left + kIconWidth;
if (fd.GetType() == GLFitDescription::kPolynomial)
{
p.Image(*itsPolyIcon, itsPolyIcon->GetBounds(), irect);
}
else if (fd.GetType() == GLFitDescription::kNonLinear)
{
p.Image(*itsNonLinearIcon, itsNonLinearIcon->GetBounds(), irect);
}
else if (fd.GetType() == GLFitDescription::kModule)
{
p.Image(*itsExecutableIcon, itsExecutableIcon->GetBounds(), irect);
}
else if (fd.GetType() >= GLFitDescription::kBLinear)
{
p.Image(*itsBuiltInIcon, itsBuiltInIcon->GetBounds(), irect);
}
JRect r = rect;
r.left += kHMarginWidth + kIconWidth;
p.String(r, *curveName, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}