本文整理汇总了C++中DrawInfo::GetShortName方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawInfo::GetShortName方法的具体用法?C++ DrawInfo::GetShortName怎么用?C++ DrawInfo::GetShortName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawInfo
的用法示例。
在下文中一共展示了DrawInfo::GetShortName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawWindowInfo
void WxGraphs::DrawWindowInfo(wxDC * dc, const wxRegion & repainted_region)
{
if (repainted_region.IsEmpty())
return;
int info_left_marg = m_screen_margins.leftmargin + 8;
int param_name_shift = 5;
if (m_draws.size() < 1)
return;
int w, h;
dc->GetSize(&w, &h);
DrawInfo *info = m_draws[0]->GetDrawInfo();
wxString name = info->GetSetName().c_str();
int namew, nameh;
dc->GetTextExtent(name, &namew, &nameh);
if (repainted_region.Contains(info_left_marg, m_screen_margins.infotopmargin, w - m_screen_margins.infotopmargin, nameh) == wxOutRegion)
return;
dc->SetTextForeground(*wxWHITE);
dc->DrawText(name, info_left_marg, m_screen_margins.infotopmargin);
wxColor color = dc->GetTextForeground();
int xpos = info_left_marg + namew + param_name_shift;
for (int i = 0; i < (int)m_draws.size(); ++i) {
if (!m_draws[i]->GetEnable())
continue;
DrawInfo *info = m_draws[i]->GetDrawInfo();
dc->SetTextForeground(info->GetDrawColor());
name = info->GetShortName().c_str();
dc->GetTextExtent(name, &namew, &nameh);
dc->DrawText(name, xpos, m_screen_margins.infotopmargin);
xpos += namew + param_name_shift;
}
dc->SetTextForeground(color);
}
示例2: DrawWindowInfo
void GCDCGraphs::DrawWindowInfo(wxGraphicsContext &dc) {
double info_left_marg = m_screen_margins.leftmargin + 8;
double param_name_shift = 5;
if (m_draws.size() < 1)
return;
int w, h;
GetClientSize(&w, &h);
DrawInfo *info = m_draws[0]->GetDrawInfo();
wxString name = info->GetSetName().c_str();
double namew, nameh, th, tsel;
dc.GetTextExtent(name, &namew, &nameh, &th, &tsel);
dc.DrawText(name, info_left_marg, m_screen_margins.infotopmargin);
int xpos = info_left_marg + namew + param_name_shift;
for (int i = 0; i < (int)m_draws.size(); ++i) {
if (!m_draws[i]->GetEnable())
continue;
DrawInfo *info = m_draws[i]->GetDrawInfo();
dc.SetFont(GetFont(), info->GetDrawColor());
name = info->GetShortName().c_str();
if (!name.IsEmpty()) {
dc.GetTextExtent(name, &namew, &nameh, &th, &tsel);
dc.DrawText(name, xpos, m_screen_margins.infotopmargin);
xpos += namew + param_name_shift;
} else {
xpos += param_name_shift;
}
}
}
示例3: PrintDrawsInfo
//.........这里部分代码省略.........
wxString time;
time += _("From: ");
time += FormatTime(fd->GetTimeOfIndex(0), pt);
time += _(" to: ");
time += FormatTime(fd->GetTimeOfIndex(fd->GetValuesTable().size() - 1), pt);
dc->GetTextExtent(time, &tw, &th);
if (tw > w && f.GetPointSize() >= 2) {
f.SetPointSize(f.GetPointSize() - 1);
dc->SetFont(f);
} else {
dc->DrawText(time, hw - tw / 2, maxy);
maxy += int(1.4 * th);
painted = true;
}
} while (!painted);
f.SetPointSize(point_size) ;
dc->SetFont(f);
painted = false;
bool painting = false;
int pmaxy = maxy;
do {
for (int i = 0; i < m_draws_count; ++i) {
Draw *d = m_draws[i];
if (!d->GetEnable())
continue;
DrawInfo* di = d->GetDrawInfo();
int cx = 0.02 * w;
wxString str = wxString::Format(_T("%s = %s "),
di->GetShortName().c_str(),
di->GetName().c_str());
dc->SetTextForeground(di->GetDrawColor());
dc->GetTextExtent(str, &tw, &th);
if (painting)
dc->DrawText(str, cx, maxy);
cx += tw;
const Draw::VT& vt = d->GetValuesTable();
if (vt.m_count) {
dc->SetTextForeground(*wxBLACK);
wxString unit = di->GetUnit();
str = wxString(_T(": "))
+ _("min.=") + d->GetDrawInfo()->GetValueStr(vt.m_min, _T("- -")) +
+ _T(" ; ") + _("avg.=") + wxString(d->GetDrawInfo()->GetValueStr(vt.m_sum / vt.m_count, _T("- -"))) +
+ _T(" ; ") + _("max.=") + wxString(d->GetDrawInfo()->GetValueStr(vt.m_max, _T("- -"))) +
+ _T(" ") + unit;
if (painting) {
dc->GetTextExtent(str, &tw, &th);
dc->DrawText(str, cx, maxy);
}
cx += tw;
if (di->GetSpecial() == TDraw::HOURSUM) {
wxString u = unit;
if (u.Replace(_T("/h"), _T("")) == 0)
u += _T("*h");
wxString vals;
示例4: PrintBackground
int BackgroundPrinter::PrintBackground(wxDC *dc, std::vector<Draw*> draws, const SS& sd) {
dc->SetTextForeground(GetTimeAxisCol());
dc->SetBrush(wxBrush(GetTimeAxisCol(), wxSOLID));
int ax_dist = FindVerticalAxesDistance(dc, draws, sd);
SS::iterator ssi = sd.begin();
do {
set<int>::iterator si = (*ssi).begin();
if ((*ssi).end() == si)
assert(false);
int di = *si;
m_draw = draws[di];
m_leftmargin += ax_dist;
SS::iterator next = ssi;
next++;
if (next == sd.end()) {
int w,h;
GetSize(&w, &h);
w = w - m_leftmargin + ax_dist;
SetSize(w, h);
DrawBackground(dc);
#ifdef __WXMSW__
DrawTimeAxis(dc, 48, 24, 15, 7);
#else
DrawTimeAxis(dc, 8, 4, 6);
#endif
}
DrawYAxisVals(dc, tick_len, line_width);
DrawYAxis(dc, arrow_height, arrow_width, line_width);
int x = (int)(arrow_width * 1.2) , y = line_width;
int textw, texth;
DrawUnit(dc, x, y);
dc->GetTextExtent(draws[*si]->GetDrawInfo()->GetUnit(), &textw, &texth);
wxColour pc = dc->GetTextForeground();
y = m_topmargin;
for (set<int>::reverse_iterator i = (*ssi).rbegin(); i != (*ssi).rend(); i++) {
DrawInfo* di = draws[*i]->GetDrawInfo();
dc->GetTextExtent(di->GetShortName(), &textw, &texth);
dc->SetTextForeground(di->GetDrawColor());
dc->DrawText(di->GetShortName(), m_leftmargin - 2 * line_width - textw, y - texth - line_width);
y -= texth + line_width;
}
dc->SetTextForeground(pc);
++ssi;
} while (ssi != sd.end());
return m_leftmargin;
}