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


C++ DataFieldEnum::GetValue方法代码示例

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


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

示例1: LoadDialog

void
dlgWeatherShowModal()
{
  WndForm *wf = LoadDialog(nullptr, UIGlobals::GetMainWindow(),
                           _T("IDR_XML_WEATHER"));
  if (wf == NULL)
    return;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpTime"));
  assert(wp != nullptr);
  DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->addEnumText(_("Now"));
  for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) {
    if (RASP.isWeatherAvailable(i)) {
      TCHAR timetext[10];
      _stprintf(timetext, _T("%04d"), RASP.IndexToTime(i));
      dfe->addEnumText(timetext, i);
    }
  }

  dfe->Set(RASP.GetTime());
  wp->RefreshDisplay();

  wp = (WndProperty *)wf->FindByName(_T("prpDisplayItem"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  dfe->EnableItemHelp(true);
  dfe->addEnumText(_("Terrain"));

  for (int i = 1; i <= 15; i++) {
    const TCHAR *label = RASP.ItemLabel(i);
    if (label != NULL)
      dfe->AddChoice(i, label, nullptr, RASP.ItemHelp(i));
  }
  dfe->Set(RASP.GetParameter());
  wp->RefreshDisplay();

  wf->ShowModal();

  wp = (WndProperty *)wf->FindByName(_T("prpTime"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  RASP.SetTime(dfe->GetValue());

  wp = (WndProperty *)wf->FindByName(_T("prpDisplayItem"));
  assert(wp != nullptr);
  dfe = (DataFieldEnum *)wp->GetDataField();
  RASP.SetParameter(dfe->GetValue());

  delete wf;
}
开发者ID:Tjeerdm,项目名称:XCSoarDktjm,代码行数:53,代码来源:dlgWeather.cpp

示例2:

inline void
RASPSettingsPanel::OnTimeModified(const DataFieldEnum &df)
{
  const int value = df.GetValue();
  time = value >= 0
    ? BrokenTime::FromMinuteOfDay(value)
    : BrokenTime::Invalid();
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:8,代码来源:RASPDialog.cpp

示例3: switch

/**
 * @return true if the value has changed
 */
static bool
FinishPortField(DeviceConfig &config, const DataFieldEnum &df)
{
  unsigned value = df.GetValue();

  /* decode the port type from the upper 16 bits of the id; we don't
     need the rest, because that's just some serial we don't care
     about */
  const DeviceConfig::PortType new_type =
    (DeviceConfig::PortType)(value >> 16);
  switch (new_type) {
  case DeviceConfig::PortType::DISABLED:
  case DeviceConfig::PortType::AUTO:
  case DeviceConfig::PortType::INTERNAL:
  case DeviceConfig::PortType::DROIDSOAR_V2:
  case DeviceConfig::PortType::NUNCHUCK:
  case DeviceConfig::PortType::I2CPRESSURESENSOR:
  case DeviceConfig::PortType::IOIOVOLTAGE:
  case DeviceConfig::PortType::TCP_CLIENT:
  case DeviceConfig::PortType::TCP_LISTENER:
  case DeviceConfig::PortType::UDP_LISTENER:
  case DeviceConfig::PortType::RFCOMM_SERVER:
    if (new_type == config.port_type)
      return false;

    config.port_type = new_type;
    return true;

  case DeviceConfig::PortType::SERIAL:
  case DeviceConfig::PortType::PTY:
    /* Serial Port */
    if (new_type == config.port_type &&
        StringIsEqual(config.path, df.GetAsString()))
      return false;

    config.port_type = new_type;
    config.path = df.GetAsString();
    return true;

  case DeviceConfig::PortType::RFCOMM:
    /* Bluetooth */
    if (new_type == config.port_type &&
        StringIsEqual(config.bluetooth_mac, df.GetAsString()))
      return false;

    config.port_type = new_type;
    config.bluetooth_mac = df.GetAsString();
    return true;

  case DeviceConfig::PortType::IOIOUART:
    /* IOIO UART */
    if (new_type == config.port_type &&
        config.ioio_uart_id == (unsigned)ParseUnsigned(df.GetAsString()))
      return false;

    config.port_type = new_type;
    config.ioio_uart_id = (unsigned)ParseUnsigned(df.GetAsString());
    return true;
  }

  gcc_unreachable();
  assert(false);
  return false;
}
开发者ID:M-Scholli,项目名称:XCSoar,代码行数:67,代码来源:DeviceEditWidget.cpp


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