本文整理汇总了C++中Canvas类的典型用法代码示例。如果您正苦于以下问题:C++ Canvas类的具体用法?C++ Canvas怎么用?C++ Canvas使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Canvas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reset_cliprect
void WindowManagerProvider::reset_cliprect(GUITopLevelWindow *handle, Canvas &canvas)
{
canvas.reset_cliprect();
}
示例2: OnPaint
virtual void OnPaint(Canvas &canvas) override {
canvas.ClearWhite();
HorizonRenderer::Draw(canvas, canvas.GetRect(), look, attitude);
}
示例3: PixelScalar
void
InfoBoxWindow::PaintValue(Canvas &canvas)
{
if (data.value.empty())
return;
canvas.SetTextColor(look.GetValueColor(data.value_color));
#ifndef GNAV
// Do text-based unit rendering on higher resolutions
if (Layout::FastScale(10) > 18) {
canvas.Select(*look.unit_font);
PixelScalar unit_width =
UnitSymbolRenderer::GetSize(canvas, data.value_unit).cx;
canvas.Select(*look.value.font);
int ascent_height = look.value.font->GetAscentHeight();
PixelSize value_size = canvas.CalcTextSize(data.value);
if (value_size.cx > value_rect.right - value_rect.left) {
canvas.Select(*look.small_font);
ascent_height = look.small_font->GetAscentHeight();
value_size = canvas.CalcTextSize(data.value);
}
PixelScalar x = std::max(PixelScalar(0),
PixelScalar((value_rect.left + value_rect.right
- value_size.cx - unit_width) / 2));
PixelScalar y = (value_rect.top + value_rect.bottom - value_size.cy) / 2;
canvas.TextAutoClipped(x, y, data.value);
if (unit_width != 0) {
const int unit_height =
UnitSymbolRenderer::GetAscentHeight(*look.unit_font, data.value_unit);
canvas.Select(*look.unit_font);
UnitSymbolRenderer::Draw(canvas,
{ x + value_size.cx,
y + ascent_height - unit_height },
data.value_unit, look.unit_fraction_pen);
}
return;
}
#endif
canvas.Select(*look.value.font);
UPixelScalar ascent_height = look.value.font->GetAscentHeight();
UPixelScalar capital_height = look.value.font->GetCapitalHeight();
PixelSize value_size = canvas.CalcTextSize(data.value);
if (value_size.cx > value_rect.right - value_rect.left) {
canvas.Select(*look.small_font);
ascent_height = look.small_font->GetAscentHeight();
capital_height = look.small_font->GetCapitalHeight();
value_size = canvas.CalcTextSize(data.value);
}
PixelSize unit_size;
const UnitSymbol *unit_symbol = units_look.GetSymbol(data.value_unit);
if (unit_symbol != NULL) {
unit_size = unit_symbol->GetSize();
} else {
unit_size.cx = 0;
unit_size.cy = 0;
}
PixelScalar x = std::max(PixelScalar(1),
PixelScalar((value_rect.left + value_rect.right
- value_size.cx
- Layout::FastScale(unit_size.cx)) / 2));
PixelScalar y = value_rect.top + 1 - ascent_height +
(value_rect.bottom - value_rect.top + capital_height) / 2;
canvas.TextAutoClipped(x, y, data.value);
if (unit_symbol != NULL) {
#ifndef HAVE_CLIPPING
/* sort-of clipping */
if (x + value_size.cx >= (int)canvas.GetWidth())
return;
#endif
unit_symbol->Draw(canvas, x + value_size.cx,
y + ascent_height - unit_symbol->GetScreenSize().cy,
look.inverse ? UnitSymbol::INVERSE : UnitSymbol::NORMAL);
}
}
示例4: maFillRect
void maFillRect(int left, int top, int width, int height) {
Canvas *drawTarget = graphics->getDrawTarget();
if (drawTarget) {
drawTarget->fillRect(left, top, width, height, graphics->getDrawColor());
}
}
示例5: RenderWindChart
void
RenderWindChart(Canvas &canvas, const PixelRect rc,
const ChartLook &chart_look,
const FlightStatistics &fs,
const NMEAInfo &nmea_info,
const WindStore &wind_store)
{
unsigned numsteps = 10;
bool found = true;
LeastSquares windstats_mag;
ChartRenderer chart(chart_look, canvas, rc);
if (fs.altitude_ceiling.y_max - fs.altitude_ceiling.y_min <= fixed(10)) {
chart.DrawNoData();
return;
}
for (unsigned i = 0; i < numsteps; i++) {
fixed h = fixed(fs.altitude_ceiling.y_max - fs.altitude_base.y_min) * i /
(numsteps - 1) + fixed(fs.altitude_base.y_min);
Vector wind = wind_store.GetWind(nmea_info.time, h, found);
fixed mag = wind.Magnitude();
windstats_mag.LeastSquaresUpdate(mag, h);
}
chart.ScaleXFromData(windstats_mag);
chart.ScaleXFromValue(fixed(0));
chart.ScaleXFromValue(fixed(10));
chart.ScaleYFromData(windstats_mag);
chart.DrawXGrid(Units::ToSysSpeed(fixed(5)),
ChartLook::STYLE_THINDASHPAPER, fixed(5), true);
chart.DrawYGrid(Units::ToSysAltitude(fixed(1000)),
ChartLook::STYLE_THINDASHPAPER, fixed(1000), true);
chart.DrawLineGraph(windstats_mag, ChartLook::STYLE_MEDIUMBLACK);
#define WINDVECTORMAG 25
numsteps = (int)((rc.bottom - rc.top) / WINDVECTORMAG) - 1;
canvas.Select(chart_look.GetPen(ChartLook::STYLE_MEDIUMBLACK));
// draw direction vectors
fixed hfact;
for (unsigned i = 0; i < numsteps; i++) {
hfact = fixed(i + 1) / (numsteps + 1);
fixed h = fixed(fs.altitude_ceiling.y_max - fs.altitude_base.y_min) * hfact +
fixed(fs.altitude_base.y_min);
Vector wind = wind_store.GetWind(nmea_info.time, h, found);
if (windstats_mag.x_max == fixed(0))
windstats_mag.x_max = fixed(1); // prevent /0 problems
wind.x /= fixed(windstats_mag.x_max);
wind.y /= fixed(windstats_mag.x_max);
fixed mag = wind.Magnitude();
if (negative(mag))
continue;
Angle angle = Angle::FromXY(wind.y, -wind.x);
RasterPoint point = chart.ToScreen((chart.GetXMin() + chart.GetXMax()) / 2, h);
DrawArrow(canvas, point, mag * WINDVECTORMAG, angle);
}
chart.DrawXLabel(_T("w"), Units::GetSpeedName());
chart.DrawYLabel(_T("h"), Units::GetAltitudeName());
}
示例6: plus_rc
void
DigitEntry::OnPaint(Canvas &canvas)
{
assert(cursor < length);
const bool focused = HasCursorKeys() && HasFocus();
if (HaveClipping())
canvas.Clear(look.background_color);
canvas.Select(look.text_font);
canvas.SetBackgroundOpaque();
const unsigned text_height = look.text_font.GetHeight();
const int y = (top + bottom - text_height) / 2;
PixelRect rc;
rc.top = top;
rc.bottom = bottom;
TCHAR buffer[4];
for (unsigned i = 0; i < length; ++i) {
const Column &c = columns[i];
rc.left = c.left;
rc.right = c.right;
if (focused && i == cursor) {
canvas.SetTextColor(look.list.focused.text_color);
canvas.SetBackgroundColor(look.list.focused.background_color);
} else if (c.IsEditable()) {
canvas.SetTextColor(look.list.text_color);
canvas.SetBackgroundColor(look.list.background_color);
} else {
canvas.SetTextColor(look.list.text_color);
canvas.SetBackgroundColor(look.background_color);
}
const TCHAR *text = buffer;
buffer[1] = _T('\0');
switch (c.type) {
case Column::Type::DIGIT:
case Column::Type::DIGIT6:
assert(c.value < 10);
buffer[0] = _T('0') + c.value;
break;
case Column::Type::HOUR:
assert(c.value < 24);
_stprintf(buffer, _T("%02u"), c.value);
break;
case Column::Type::DIGIT36:
assert(c.value < 36);
_stprintf(buffer, _T("%02u"), c.value);
break;
case Column::Type::DIGIT19:
assert(c.value < 19);
_stprintf(buffer, _T("%02u"), c.value);
break;
case Column::Type::SIGN:
buffer[0] = c.IsNegative() ? _T('-') : _T('+');
break;
case Column::Type::DECIMAL_POINT:
buffer[0] = _T('.');
break;
case Column::Type::COLON:
buffer[0] = _T(':');
break;
case Column::Type::NORTH_SOUTH:
buffer[0] = c.IsNegative() ? _T('S') : _T('N');
break;
case Column::Type::EAST_WEST:
buffer[0] = c.IsNegative() ? _T('W') : _T('E');
break;
case Column::Type::DEGREES:
text = _T("°");
break;
case Column::Type::APOSTROPHE:
text = _T("'");
break;
case Column::Type::QUOTE:
text = _T("\"");
break;
case Column::Type::UNIT:
// TODO: render unit symbol?
text = Units::unit_descriptors[c.value].name;
break;
//.........这里部分代码省略.........
示例7: Draw
static void
Draw(Canvas &canvas, PixelRect rc,
const ArrivalAltitudeMapItem &item,
const TwoTextRowsRenderer &row_renderer,
const FinalGlideBarLook &look)
{
const unsigned line_height = rc.bottom - rc.top;
bool elevation_available =
!RasterBuffer::IsSpecial((short)item.elevation);
bool reach_relevant = item.reach.IsReachRelevant();
RoughAltitude arrival_altitude =
item.reach.terrain_valid == ReachResult::Validity::VALID
? item.reach.terrain
: item.reach.direct;
if (elevation_available)
arrival_altitude -= item.elevation;
bool reachable =
item.reach.terrain_valid != ReachResult::Validity::UNREACHABLE &&
arrival_altitude.IsPositive();
// Draw final glide arrow icon
const RasterPoint pt(rc.left + line_height / 2, rc.top + line_height / 2);
RasterPoint arrow[] = {
{ -7, -3 }, { 0, 4 }, { 7, -3 }
};
Angle arrow_angle = reachable ? Angle::HalfCircle() : Angle::Zero();
PolygonRotateShift(arrow, ARRAY_SIZE(arrow), pt, arrow_angle);
if (reachable) {
canvas.Select(look.brush_above);
canvas.Select(look.pen_above);
} else {
canvas.Select(look.brush_below);
canvas.Select(look.pen_below);
}
canvas.DrawPolygon(arrow, ARRAY_SIZE(arrow));
const unsigned text_padding = Layout::GetTextPadding();
rc.left += line_height + text_padding;
// Format title row
TCHAR altitude_buffer[32];
StaticString<256> buffer;
buffer.clear();
if (elevation_available) {
RoughAltitude relative_arrival_altitude =
item.reach.direct - item.elevation;
FormatRelativeUserAltitude(fixed((short)relative_arrival_altitude),
altitude_buffer, ARRAY_SIZE(altitude_buffer));
buffer.AppendFormat(_T("%s %s, "), altitude_buffer, _("AGL"));
}
buffer.AppendFormat(_T("%s %s"),
FormatUserAltitude(fixed(item.reach.direct)).c_str(),
_("MSL"));
// Draw title row
row_renderer.DrawFirstRow(canvas, rc, buffer);
// Format comment row
if (reach_relevant) {
buffer.Format(_T("%s: "), _("around terrain"));
if (elevation_available) {
RoughAltitude relative_arrival_altitude =
item.reach.terrain - item.elevation;
FormatRelativeUserAltitude(fixed((short)relative_arrival_altitude),
altitude_buffer, ARRAY_SIZE(altitude_buffer));
buffer.AppendFormat(_T("%s %s, "), altitude_buffer, _("AGL"));
}
buffer.AppendFormat(_T("%s %s, "),
FormatUserAltitude(fixed(item.reach.terrain)).c_str(),
_("MSL"));
} else if (elevation_available &&
(int)item.reach.direct >= (int)item.elevation &&
item.reach.terrain_valid == ReachResult::Validity::UNREACHABLE) {
buffer.UnsafeFormat(_T("%s "), _("Unreachable due to terrain."));
} else {
buffer.clear();
}
buffer += _("Arrival altitude incl. safety height");
// Draw comment row
//.........这里部分代码省略.........
示例8: if
void
FinalGlideBarRenderer::Draw(Canvas &canvas, const PixelRect &rc,
const DerivedInfo &calculated) const
{
RasterPoint GlideBar[6] = {
{ 0, 0 }, { 9, -9 }, { 18, 0 }, { 18, 0 }, { 9, 0 }, { 0, 0 }
};
RasterPoint GlideBar0[6] = {
{ 0, 0 }, { 9, -9 }, { 18, 0 }, { 18, 0 }, { 9, 0 }, { 0, 0 }
};
TCHAR Value[10];
if (!calculated.task_stats.task_valid ||
!calculated.task_stats.total.solution_remaining.IsOk() ||
!calculated.task_stats.total.solution_mc0.IsDefined())
return;
const int y0 = (rc.bottom + rc.top) / 2;
// 60 units is size, div by 8 means 60*8 = 480 meters.
int Offset = ((int)calculated.task_stats.total.solution_remaining.altitude_difference) / 8;
int Offset0 = ((int)calculated.task_stats.total.solution_mc0.altitude_difference) / 8;
// TODO feature: should be an angle if in final glide mode
if (Offset > 60)
Offset = 60;
if (Offset < -60)
Offset = -60;
Offset = Layout::Scale(Offset);
if (Offset < 0)
GlideBar[1].y = Layout::Scale(9);
if (Offset0 > 60)
Offset0 = 60;
if (Offset0 < -60)
Offset0 = -60;
Offset0 = Layout::Scale(Offset0);
if (Offset0 < 0)
GlideBar0[1].y = Layout::Scale(9);
for (unsigned i = 0; i < 6; i++) {
GlideBar[i].y += y0;
GlideBar[i].x = Layout::Scale(GlideBar[i].x) + rc.left;
}
GlideBar[0].y -= Offset;
GlideBar[1].y -= Offset;
GlideBar[2].y -= Offset;
for (unsigned i = 0; i < 6; i++) {
GlideBar0[i].y += y0;
GlideBar0[i].x = Layout::Scale(GlideBar0[i].x) + rc.left;
}
GlideBar0[0].y -= Offset0;
GlideBar0[1].y -= Offset0;
GlideBar0[2].y -= Offset0;
if ((Offset < 0) && (Offset0 < 0)) {
// both below
if (Offset0 != Offset) {
PixelScalar dy = (GlideBar0[0].y - GlideBar[0].y) +
(GlideBar0[0].y - GlideBar0[3].y);
dy = max(Layout::Scale(3), dy);
GlideBar[3].y = GlideBar0[0].y - dy;
GlideBar[4].y = GlideBar0[1].y - dy;
GlideBar[5].y = GlideBar0[2].y - dy;
GlideBar0[0].y = GlideBar[3].y;
GlideBar0[1].y = GlideBar[4].y;
GlideBar0[2].y = GlideBar[5].y;
} else {
Offset0 = 0;
}
} else if ((Offset > 0) && (Offset0 > 0)) {
// both above
GlideBar0[3].y = GlideBar[0].y;
GlideBar0[4].y = GlideBar[1].y;
GlideBar0[5].y = GlideBar[2].y;
if (abs(Offset0 - Offset) < Layout::Scale(4))
Offset = Offset0;
}
// draw actual glide bar
if (Offset <= 0) {
if (calculated.common_stats.landable_reachable) {
canvas.Select(look.hpFinalGlideBelowLandable);
canvas.Select(look.hbFinalGlideBelowLandable);
} else {
canvas.Select(look.hpFinalGlideBelow);
canvas.Select(look.hbFinalGlideBelow);
}
} else {
canvas.Select(look.hpFinalGlideAbove);
canvas.Select(look.hbFinalGlideAbove);
}
//.........这里部分代码省略.........
示例9: draw
void Player::draw(Canvas &canvas) {
canvas.fillRect(x, y, x + WIDTH, y + HEIGHT);
// update velocity
computeVelocity();
}
示例10: activate
/// set focus on the viewport and make canvas current
void activate()
{
mSelf->setFocus();
mCanvas->workspace()->setCurrentCanvas(mCanvas);
}
示例11: onClicked
void onClicked()
{
mSelf->setFocus();
mCanvas->workspace()->setCurrentCanvas(mCanvas);
}
示例12: assert
VirtualCanvas::VirtualCanvas(const Canvas &canvas, PixelSize new_size)
:Canvas(::CreateCompatibleDC(canvas), new_size)
{
assert(canvas.IsDefined());
}
示例13: LBASSERT
void Display::discoverLocal( Config* config, const uint32_t flags )
{
Node* node = config->findAppNode();
LBASSERT( node );
if( !node )
return;
const Pipes& pipes = node->getPipes();
LBASSERT( !pipes.empty( ));
if( pipes.empty( ))
return;
Pipe* pipe = pipes.front();
Window* window = new Window( pipe );
window->setViewport( Viewport( .25f, .2f, .5f, .5f ));
window->setName( pipe->getName() + " window" );
window->setIAttribute( Window::IATTR_PLANES_STENCIL, 1 );
Channel* channel = new Channel( window );
channel->setName( pipe->getName() + " channel" );
Observer* observer = new Observer( config );
const PixelViewport& pvp = pipe->getPixelViewport();
Wall wall;
if( pvp.isValid( ))
wall.resizeHorizontalToAR( float( pvp.w ) / float( pvp.h ));
Canvas* canvas = new Canvas( config );
canvas->setWall( wall );
Segment* segment = new Segment( canvas );
segment->setChannel( channel );
Strings names;
const Nodes& nodes = config->getNodes();
const bool scalability = nodes.size() > 1 || pipes.size() > 1;
if( scalability )
names.push_back( EQ_SERVER_CONFIG_LAYOUT_2D_DYNAMIC );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_SIMPLE );
if( scalability )
{
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DS );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_STATIC );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DYNAMIC );
if( flags & fabric::ConfigParams::FLAG_MULTIPROCESS_DB &&
nodes.size() > 1 )
{
for( NodesCIter i = nodes.begin(); i != nodes.end(); ++i )
{
if( (*i)->getPipes().size() > 1 )
{
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_2D );
break;
}
}
}
}
for( StringsCIter i = names.begin(); i != names.end(); ++i )
{
Layout* layout = new Layout( config );
layout->setName( *i );
View* view = new View( layout );
view->setObserver( observer );
view->setWall( wall );
canvas->addLayout( layout );
}
config->activateCanvas( canvas );
}
示例14: load
Font Font::load(Canvas &canvas, const std::string &family_name, const FontDescription &reference_desc, FontFamily &font_family, const XMLResourceDocument &doc, std::function<Resource<Sprite>(Canvas &, const std::string &)> cb_get_sprite)
{
DomElement font_element;
XMLResourceNode resource;
resource = doc.get_resource(family_name);
font_element = resource.get_element();
DomElement sprite_element = font_element.named_item("sprite").to_element();
if (!sprite_element.is_null())
{
if (!sprite_element.has_attribute("glyphs"))
throw Exception(string_format("Font resource %1 has no 'glyphs' attribute.", resource.get_name()));
if (!sprite_element.has_attribute("letters"))
throw Exception(string_format("Font resource %1 has no 'letters' attribute.", resource.get_name()));
if (!cb_get_sprite)
throw Exception(string_format("Font resource %1 requires a sprite loader callback specified.", resource.get_name()));
Resource<Sprite> spr_glyphs = cb_get_sprite(canvas, sprite_element.get_attribute("glyphs"));
const std::string &letters = sprite_element.get_attribute("letters");
int spacelen = StringHelp::text_to_int(sprite_element.get_attribute("spacelen", "-1"));
bool monospace = StringHelp::text_to_bool(sprite_element.get_attribute("monospace", "false"));
// Modify the default font metrics, if specified
float height = 0.0f;
float line_height = 0.0f;
float ascent = 0.0f;
float descent = 0.0f;
float internal_leading = 0.0f;
float external_leading = 0.0f;
if (sprite_element.has_attribute("height"))
height = StringHelp::text_to_float(sprite_element.get_attribute("height", "0"));
if (sprite_element.has_attribute("line_height"))
line_height = StringHelp::text_to_float(sprite_element.get_attribute("line_height", "0"));
if (sprite_element.has_attribute("ascent"))
ascent = StringHelp::text_to_float(sprite_element.get_attribute("ascent", "0"));
if (sprite_element.has_attribute("descent"))
descent = StringHelp::text_to_float(sprite_element.get_attribute("descent", "0"));
if (sprite_element.has_attribute("internal_leading"))
internal_leading = StringHelp::text_to_float(sprite_element.get_attribute("internal_leading", "0"));
if (sprite_element.has_attribute("external_leading"))
external_leading = StringHelp::text_to_float(sprite_element.get_attribute("external_leading", "0"));
FontMetrics font_metrics(height, ascent, descent, internal_leading, external_leading, line_height, canvas.get_pixel_ratio());
font_family.add(canvas, spr_glyphs.get(), letters, spacelen, monospace, font_metrics);
FontDescription desc = reference_desc.clone();
return Font(font_family, desc);
}
DomElement ttf_element = font_element.named_item("ttf").to_element();
if (ttf_element.is_null())
ttf_element = font_element.named_item("freetype").to_element();
if (!ttf_element.is_null())
{
FontDescription desc = reference_desc.clone();
std::string filename;
if (ttf_element.has_attribute("file"))
{
filename = PathHelp::combine(resource.get_base_path(), ttf_element.get_attribute("file"));
}
if (!ttf_element.has_attribute("typeface"))
throw Exception(string_format("Font resource %1 has no 'typeface' attribute.", resource.get_name()));
std::string font_typeface_name = ttf_element.get_attribute("typeface");
if (ttf_element.has_attribute("height"))
desc.set_height(ttf_element.get_attribute_int("height", 0));
if (ttf_element.has_attribute("average_width"))
desc.set_average_width(ttf_element.get_attribute_int("average_width", 0));
if (ttf_element.has_attribute("anti_alias"))
desc.set_anti_alias(ttf_element.get_attribute_bool("anti_alias", true));
if (ttf_element.has_attribute("subpixel"))
desc.set_subpixel(ttf_element.get_attribute_bool("subpixel", true));
if (filename.empty())
{
font_family.add(font_typeface_name, desc);
return Font(font_family, desc);
}
else
//.........这里部分代码省略.........
示例15: DrawElement
result DrawElement(const Osp::Graphics::Canvas& canvas, const Osp::Graphics::Rectangle& rect, CustomListItemStatus itemStatus)
{
result r = E_SUCCESS;
Canvas* pCanvas = const_cast<Canvas*>(&canvas);
pCanvas->SetLineWidth(1);
if (itemStatus == CUSTOM_LIST_ITEM_STATUS_SELECTED) {
pCanvas->FillRectangle(Color(4,58,99), rect);
}
pCanvas->SetForegroundColor(Color::COLOR_WHITE);
Font fontcol1;
fontcol1.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 36);
Font fontcol2;
fontcol2.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 28);
Font fontcol3;
fontcol3.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 36);
Font fontcol4;
fontcol4.Construct(Osp::Graphics::FONT_STYLE_PLAIN, 28);
EnrichedText texteelcol1;
texteelcol1.Construct(Dimension(280, 50));
texteelcol1.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
texteelcol1.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
texteelcol1.SetTextAbbreviationEnabled(true);
if ((searchq.GetLength() > 0) && (col1s.GetLength() > 0)) {
TextElement * textelcol1b = new TextElement();
textelcol1b->Construct(L" ");
if (col1b.GetLength() > 0) {
textelcol1b->SetText(col1b);
textelcol1b->SetTextColor(Color::COLOR_WHITE);
textelcol1b->SetFont(fontcol1);
texteelcol1.Add(*textelcol1b);
}
TextElement * textelcol1s = new TextElement();
textelcol1s->Construct(col1s);
textelcol1s->SetTextColor(Color(237,255,0));
textelcol1s->SetFont(fontcol1);
texteelcol1.Add(*textelcol1s);
TextElement * textelcol1a = new TextElement();
textelcol1a->Construct(L" ");
if (col1a.GetLength() > 0) {
textelcol1a->SetText(col1a);
textelcol1a->SetTextColor(Color::COLOR_WHITE);
textelcol1a->SetFont(fontcol1);
texteelcol1.Add(*textelcol1a);
}
pCanvas->DrawText(Point(20,15), texteelcol1);
delete textelcol1b;
delete textelcol1s;
delete textelcol1a;
} else {
TextElement textelcol1;
textelcol1.Construct(col1);
textelcol1.SetTextColor(Color::COLOR_WHITE);
textelcol1.SetFont(fontcol1);
texteelcol1.Add(textelcol1);
pCanvas->DrawText(Point(20,15), texteelcol1);
}
EnrichedText texteelcol2;
texteelcol2.Construct(Dimension(280, 40));
texteelcol2.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
texteelcol2.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
texteelcol2.SetTextAbbreviationEnabled(true);
TextElement textelcol2;
textelcol2.Construct(col2);
if (itemStatus == CUSTOM_LIST_ITEM_STATUS_SELECTED) {
textelcol2.SetTextColor(Color::COLOR_WHITE);
} else {
textelcol2.SetTextColor(Color(10, 73, 136));
}
textelcol2.SetFont(fontcol2);
texteelcol2.Add(textelcol2);
if ((searchq.GetLength() > 0) && (col4.GetLength() > 0)) {
pCanvas->DrawText(Point(20,53), texteelcol2);
} else {
pCanvas->DrawText(Point(20,60), texteelcol2);
}
EnrichedText texteelcol3;
texteelcol3.Construct(Dimension(160, 70));
texteelcol3.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_RIGHT);
texteelcol3.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_MIDDLE);
TextElement textelcol3;
textelcol3.Construct(col3);
textelcol3.SetTextColor(Color::COLOR_WHITE);
textelcol3.SetFont(fontcol3);
texteelcol3.Add(textelcol3);
pCanvas->DrawText(Point(300,15), texteelcol3);
if ((searchq.GetLength() > 0) && (col4.GetLength() > 0)) {
EnrichedText texteelcol4;
texteelcol4.Construct(Dimension(430, 60));
texteelcol4.SetHorizontalAlignment(Osp::Graphics::TEXT_ALIGNMENT_LEFT);
texteelcol4.SetVerticalAlignment(Osp::Graphics::TEXT_ALIGNMENT_TOP);
texteelcol4.SetTextAbbreviationEnabled(true);
texteelcol4.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);
if ((searchq.GetLength() > 0) && (col4s.GetLength() > 0)) {
//.........这里部分代码省略.........