当前位置: 首页>>代码示例>>C++>>正文


C++ InfoBoxWindow::SetValue方法代码示例

本文整理汇总了C++中InfoBoxWindow::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoBoxWindow::SetValue方法的具体用法?C++ InfoBoxWindow::SetValue怎么用?C++ InfoBoxWindow::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InfoBoxWindow的用法示例。


在下文中一共展示了InfoBoxWindow::SetValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
InfoBoxContentFinalDistance::Update(InfoBoxWindow &infobox)
{

  if (!XCSoarInterface::Calculated().task_stats.task_valid) {
    infobox.SetInvalid();
    return;
  }

  const CommonStats &common_stats = XCSoarInterface::Calculated().common_stats;
  const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;

  // Set Value
  TCHAR tmp[32];
  Units::FormatUserDistance(common_stats.task_finished
                            ? task_stats.current_leg.solution_remaining.Vector.Distance
                            : task_stats.total.remaining.get_distance(),
                            tmp, 32, false);
  infobox.SetValue(tmp);

  // Set Unit
  infobox.SetValueUnit(Units::DistanceUnit);
}
开发者ID:galippi,项目名称:xcsoar,代码行数:23,代码来源:Task.cpp

示例2: if

void
InfoBoxContentTeamBearing::Update(InfoBoxWindow &infobox)
{
  // Set Value
  TCHAR tmp[32];
  _stprintf(tmp, _T("%2.0f")_T(DEG)_T("T"), (double)
            XCSoarInterface::Calculated().TeammateBearing.value_degrees());
  infobox.SetValue(tmp);

  // Set Comment
  if (!XCSoarInterface::SettingsComputer().TeamFlarmIdTarget.defined())
    infobox.SetComment(_T("---"));
  else if (!string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget))
    infobox.SetComment(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
  else
    infobox.SetComment(_T("???"));

  if (XCSoarInterface::Basic().flarm.FindTraffic(
      XCSoarInterface::SettingsComputer().TeamFlarmIdTarget) != NULL)
    infobox.SetColorBottom(2);
  else
    infobox.SetColorBottom(1);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:23,代码来源:Team.cpp

示例3: sizeof

void
InfoBoxContentTerrainHeight::Update(InfoBoxWindow &infobox)
{
  TCHAR sTmp[32];

  if (!XCSoarInterface::Calculated().TerrainValid) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(XCSoarInterface::Calculated().TerrainAlt, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(XCSoarInterface::Calculated().TerrainAlt, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::AltitudeUnit);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:23,代码来源:Altitude.cpp

示例4:

void
InfoBoxContentTerrainHeight::Update(InfoBoxWindow &infobox)
{
  const DerivedInfo &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.terrain_valid){
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.terrain_altitude, sTmp,
                            ARRAY_SIZE(sTmp), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.terrain_altitude, sTmp,
                                     ARRAY_SIZE(sTmp));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
开发者ID:macsux,项目名称:XCSoar,代码行数:24,代码来源:Altitude.cpp

示例5: sizeof

void
InfoBoxContentTerrainHeight::Update(InfoBoxWindow &infobox)
{
  const DERIVED_INFO &calculated = CommonInterface::Calculated();
  TCHAR sTmp[32];

  if (!calculated.TerrainValid){
    infobox.SetInvalid();
    return;
  }

  // Set Value
  Units::FormatUserAltitude(calculated.TerrainAlt, sTmp,
                            sizeof(sTmp) / sizeof(sTmp[0]), false);
  infobox.SetValue(sTmp);

  // Set Comment
  Units::FormatAlternateUserAltitude(calculated.TerrainAlt, sTmp,
                                     sizeof(sTmp) / sizeof(sTmp[0]));
  infobox.SetComment(sTmp);

  // Set Unit
  infobox.SetValueUnit(Units::Current.AltitudeUnit);
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:24,代码来源:Altitude.cpp

示例6: if

void
InfoBoxContentNextWaypoint::Update(InfoBoxWindow &infobox)
{
  const Waypoint* way_point = protected_task_manager.getActiveWaypoint();

  if (!way_point) {
    // Set Title
    infobox.SetTitle(_T("Next"));

    infobox.SetInvalid();
    return;
  }

  // Set Title
  TCHAR tmp[32];
  if (XCSoarInterface::SettingsMap().DisplayTextType == DISPLAYFIRSTTHREE) {
    _tcsncpy(tmp, way_point->Name.c_str(), 3);
    tmp[3] = '\0';
  } else if (XCSoarInterface::SettingsMap().DisplayTextType == DISPLAYNUMBER) {
    _stprintf(tmp, _T("%d"), way_point->id);
  } else {
    _tcsncpy(tmp, way_point->Name.c_str(), (sizeof(tmp) / sizeof(TCHAR)) - 1);
    tmp[(sizeof(tmp) / sizeof(TCHAR)) - 1] = '\0';
  }
  infobox.SetTitle(tmp);

  if (!XCSoarInterface::Calculated().task_stats.task_valid ||
      XCSoarInterface::Calculated().task_stats.current_leg.solution_remaining.
      Vector.Distance <= fixed(10)) {
    infobox.SetInvalid();
    return;
  }

  // Set Value
  double Value =
      (XCSoarInterface::Calculated().task_stats.current_leg.
       solution_remaining.Vector.Bearing - XCSoarInterface::Basic().
       TrackBearing).as_delta().value_degrees();

#ifndef __MINGW32__
  if (Value > 1)
    _stprintf(tmp, _T("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, _T("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, _T("«»"));
#else
  if (Value > 1)
    _stprintf(tmp, _T("%2.0f°»"), Value);
  else if (Value < -1)
    _stprintf(tmp, _T("«%2.0f°"), -Value);
  else
    _tcscpy(tmp, _T("«»"));
#endif

  infobox.SetValue(tmp);

  // Set Comment
  infobox.SetComment(way_point->Comment.c_str());

  // Set Color
  if (XCSoarInterface::Calculated().task_stats.current_leg.
      solution_remaining.is_final_glide())
    // blue
    infobox.SetColor(2);
  else
    // black
    infobox.SetColor(0);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:69,代码来源:Task.cpp

示例7: switch

void
InfoBoxContentBattery::Update(InfoBoxWindow &infobox)
{
#ifdef HAVE_BATTERY
  TCHAR tmp[32];

  bool DisplaySupplyVoltageAsValue=false;
  switch (Power::External::Status) {
    case Power::External::OFF:
      infobox.SetComment(_("AC Off"));
      break;
    case Power::External::ON:
      if (!XCSoarInterface::Basic().voltage_available)
        infobox.SetComment(_("AC ON"));
      else{
        DisplaySupplyVoltageAsValue = true;
        SetValueFromFixed(infobox, _T("%2.1fV"),
                          XCSoarInterface::Basic().voltage);
      }
      break;
    case Power::External::UNKNOWN:
    default:
      infobox.SetCommentInvalid();
  }
#ifndef ANDROID
  switch (Power::Battery::Status){
    case Power::Battery::HIGH:
    case Power::Battery::LOW:
    case Power::Battery::CRITICAL:
    case Power::Battery::CHARGING:
      if (Power::Battery::RemainingPercentValid){
#endif
        _stprintf(tmp, _T("%d%%"), Power::Battery::RemainingPercent);
        if (!DisplaySupplyVoltageAsValue)
          infobox.SetValue(tmp);
        else
          infobox.SetComment(tmp);
#ifndef ANDROID
      }
      else
        if (!DisplaySupplyVoltageAsValue)
          infobox.SetValueInvalid();
        else
          infobox.SetCommentInvalid();
      break;
    case Power::Battery::NOBATTERY:
    case Power::Battery::UNKNOWN:
      if (!DisplaySupplyVoltageAsValue)
        infobox.SetValueInvalid();
      else
        infobox.SetCommentInvalid();
  }
#endif
  return;

#endif

  if (XCSoarInterface::Basic().voltage_available) {
    SetValueFromFixed(infobox, _T("%2.1fV"),
                      XCSoarInterface::Basic().voltage);
    return;
  }

  infobox.SetInvalid();
}
开发者ID:macsux,项目名称:XCSoar,代码行数:65,代码来源:Other.cpp


注:本文中的InfoBoxWindow::SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。