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


C++ ComboList类代码示例

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


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

示例1:

void
DataFieldInteger::AppendComboValue(ComboList &combo_list, int value) const
{
  TCHAR a[edit_format.MAX_SIZE], b[display_format.MAX_SIZE];
  _stprintf(a, edit_format, value);
  _stprintf(b, display_format, value);
  combo_list.Append(combo_list.size(), a, b);
}
开发者ID:pascaltempez,项目名称:xcsoar,代码行数:8,代码来源:Integer.cpp

示例2:

void
DataFieldInteger::AppendComboValue(ComboList &combo_list, int value) const
{
    TCHAR a[16], b[16];
    _stprintf(a, mEditFormat, value);
    _stprintf(b, mDisplayFormat, value, mUnits);
    combo_list.Append(combo_list.size(), a, b);
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:8,代码来源:Integer.cpp

示例3:

void
DataFieldFloat::AppendComboValue(ComboList &combo_list, fixed value) const
{
  TCHAR a[edit_format.capacity()], b[display_format.capacity()];
  _stprintf(a, edit_format, (double)value);
  _stprintf(b, display_format, (double)value, unit.c_str());
  combo_list.Append(combo_list.size(), a, b);
}
开发者ID:Turbo87,项目名称:XCSoar-TE,代码行数:8,代码来源:Float.cpp

示例4: GetCurrentPanel

void
InfoBoxManager::ShowInfoBoxPicker(const int id)
{
  int i;

  if (id < 0) i = GetFocused();
  else i = id;

  if (i < 0)
    return;

  InfoBoxSettings &settings = CommonInterface::SetUISettings().info_boxes;
  const unsigned panel_index = GetCurrentPanel();
  InfoBoxSettings::Panel &panel = settings.panels[panel_index];

  const InfoBoxFactory::t_InfoBox old_type = panel.contents[i];

  ComboList list;
  for (unsigned j = InfoBoxFactory::MIN_TYPE_VAL; j < InfoBoxFactory::NUM_TYPES; j++) {
    const TCHAR * desc = InfoBoxFactory::GetDescription((t_InfoBox) j);
    list.Append(j, gettext(InfoBoxFactory::GetName((t_InfoBox) j)),
                gettext(InfoBoxFactory::GetName((t_InfoBox) j)),
                desc != NULL ? gettext(desc) : NULL);
  }

  list.Sort();
  list.ComboPopupItemSavedIndex = list.LookUp(old_type);

  /* let the user select */

  StaticString<20> caption;
  caption.Format(_T("%s: %d"), _("InfoBox"), i + 1);
  info_box_combo_list = &list;
  int result = ComboPicker(XCSoarInterface::main_window, caption, list,
                           OnInfoBoxHelp, true);
  if (result < 0)
    return;

  /* was there a modification? */

  InfoBoxFactory::t_InfoBox new_type = (InfoBoxFactory::t_InfoBox)list[result].DataFieldIndex;
  if (new_type == old_type)
    return;

  /* yes: apply and save it */

  panel.contents[i] = new_type;
  DisplayInfoBox();

  Profile::Save(panel, panel_index);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:51,代码来源:InfoBoxManager.cpp

示例5: FormatTimespanSmart

void
DataFieldTime::AppendComboValue(ComboList &combo_list, int value) const
{
  TCHAR buffer[128];
  FormatTimespanSmart(buffer, value, max_tokens);
  combo_list.Append(value, buffer);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:7,代码来源:Time.cpp

示例6: ComboPicker

int
ComboPicker(SingleWindow &parent, const TCHAR *caption,
            const ComboList &combo_list,
            ListHelpCallback_t help_callback,
            bool enable_item_help)
{
  ComboListPopup = &combo_list;

  const UPixelScalar font_height =
    UIGlobals::GetDialogLook().text_font->GetHeight() + Layout::FastScale(2);
  const UPixelScalar max_height = Layout::GetMaximumControlHeight();
  const UPixelScalar row_height = font_height >= max_height
    ? font_height
    /* this formula is supposed to be a compromise between too small
       and too large: */
    : (font_height + max_height) / 2;

  padding = (row_height - font_height) / 2;

  return ListPicker(parent, caption,
                    combo_list.size(),
                    combo_list.ComboPopupItemSavedIndex,
                    row_height,
                    OnPaintComboPopupListItem, false,
                    help_callback,
                    enable_item_help ? OnItemHelp : NULL);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:27,代码来源:ComboPicker.cpp

示例7: EnsureLoadedDeconst

ComboList *
DataFieldFileReader::CreateComboList() const
{
  /* sorry for the const_cast .. this method keeps the promise of not
     modifying the object, given that one does not count filling the
     (cached) file list as "modification" */
  EnsureLoadedDeconst();

  ComboList *cl = new ComboList();

  TCHAR buffer[MAX_PATH];

  for (unsigned i = 0; i < files.size(); i++) {
    const TCHAR *path = files[i].mTextFile;
    if (path == NULL)
      path = _T("");

    /* is a file with the same base name present in another data
       directory? */

    bool found = false;
    for (unsigned j = 1; j < files.size(); j++) {
      if (j != i && _tcscmp(path, files[j].mTextFile) == 0) {
        found = true;
        break;
      }
    }

    if (found) {
      /* yes - append the absolute path to allow the user to see the
         difference */
      _tcscpy(buffer, path);
      _tcscat(buffer, _T(" ("));
      _tcscat(buffer, files[i].mTextPathFile);
      _tcscat(buffer, _T(")"));
      path = buffer;
    }

    cl->Append(i, path);
    if (i == mValue) {
      cl->ComboPopupItemSavedIndex = i;
    }
  }

  return cl;
}
开发者ID:pascaltempez,项目名称:xcsoar,代码行数:46,代码来源:FileReader.cpp

示例8: AppendComboValue

static void
AppendComboValue(ComboList &combo_list, unsigned value)
{
  TCHAR buffer1[ARRAY_SIZE(buffer)], buffer2[ARRAY_SIZE(buffer)];
  _stprintf(buffer1, _T("%u"), value);
  _stprintf(buffer2, _T("%u°"), value);
  combo_list.Append(value, buffer1, buffer2);
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:8,代码来源:Angle.cpp

示例9: FormatTimespanSmart

void
DataFieldTime::AppendComboValue(ComboList &combo_list, int value) const
{
  TCHAR buffer[128], buffer2[32];
  FormatTimespanSmart(buffer, value, max_tokens);
  StringFormatUnsafe(buffer2, _T("%d"), value);
  combo_list.Append(value, buffer2, buffer);
}
开发者ID:CnZoom,项目名称:XcSoarWork,代码行数:8,代码来源:Time.cpp

示例10: ListClicked

static void
ListClicked(gcc_unused WndButton &button)
{
  ComboList list;
  unsigned len = PolarStore::Count();
  for (unsigned i = 0; i < len; i++)
    list.Append(i, PolarStore::GetItem(i).name);

  list.Sort();

  // let the user select
  int result = ComboPicker(UIGlobals::GetMainWindow(),
                           _("Load Polar"), list, NULL);
  if (result < 0)
    return;

  assert((unsigned)result < len);

  const PolarStore::Item &item = PolarStore::GetItem(list[result].DataFieldIndex);

  plane.reference_mass = fixed(item.reference_mass);
  plane.dry_mass = fixed(item.reference_mass);
  plane.max_ballast = fixed(item.max_ballast);

  if (item.wing_area > 0.0)
    plane.wing_area = fixed(item.wing_area);

  if (item.v_no > 0.0)
    plane.max_speed = fixed(item.v_no);

  plane.v1 = Units::ToSysUnit(fixed(item.v1), Unit::KILOMETER_PER_HOUR);
  plane.v2 = Units::ToSysUnit(fixed(item.v2), Unit::KILOMETER_PER_HOUR);
  plane.v3 = Units::ToSysUnit(fixed(item.v3), Unit::KILOMETER_PER_HOUR);
  plane.w1 = fixed(item.w1);
  plane.w2 = fixed(item.w2);
  plane.w3 = fixed(item.w3);

  plane.polar_name = list[result].StringValue;

  if (item.contest_handicap > 0)
    plane.handicap = item.contest_handicap;

  Update();
}
开发者ID:alon,项目名称:xcsoar,代码行数:44,代码来源:dlgPlanePolar.cpp

示例11: ImportClicked

static void
ImportClicked(gcc_unused WndButton &button)
{
  ComboList list;
  PolarFileVisitor fv(list);

  // Fill list
  VisitDataFiles(_T("*.plr"), fv);

  list.Sort();

  // let the user select
  int result = ComboPicker(UIGlobals::GetMainWindow(),
                           _("Load Polar From File"), list, NULL);
  if (result < 0)
    return;

  assert((unsigned)result < list.size());

  PolarInfo polar;
  const TCHAR* path = list[result].StringValue;
  PolarGlue::LoadFromFile(polar, path);

  plane.reference_mass = polar.reference_mass;
  plane.dry_mass = polar.reference_mass;
  plane.max_ballast = polar.max_ballast;

  if (positive(polar.wing_area))
    plane.wing_area = polar.wing_area;

  if (positive(polar.v_no))
    plane.max_speed = polar.v_no;

  plane.v1 = polar.v1;
  plane.v2 = polar.v2;
  plane.v3 = polar.v3;
  plane.w1 = polar.w1;
  plane.w2 = polar.w2;
  plane.w3 = polar.w3;

  plane.polar_name = list[result].StringValueFormatted;

  Update();
}
开发者ID:alon,项目名称:xcsoar,代码行数:44,代码来源:dlgPlanePolar.cpp

示例12: GetCurrentPanel

void
InfoBoxManager::SetupFocused(const int id)
{
  int i;

  if (id < 0) i = GetFocused();
  else i = id;

  if (i < 0)
    return;

  const unsigned panel = GetCurrentPanel();
  int old_type = GetType(i, panel);

  ComboList list;
  for (unsigned i = 0; i < InfoBoxFactory::NUM_TYPES; i++)
    list.Append(i, gettext(InfoBoxFactory::GetName(i)));

  list.Sort();
  list.ComboPopupItemSavedIndex = list.LookUp(old_type);

  /* let the user select */

  TCHAR caption[20];
  _stprintf(caption, _T("%s: %d"), _("InfoBox"), i + 1);
  info_box_combo_list = &list;
  int result = ComboPicker(XCSoarInterface::main_window, caption, list,
                           OnInfoBoxHelp);
  if (result < 0)
    return;

  /* was there a modification? */

  int new_type = list[result].DataFieldIndex;
  if (new_type == old_type)
    return;

  /* yes: apply and save it */

  SetType(i, new_type, panel);
  DisplayInfoBox();
  Profile::SetInfoBoxManagerConfig(infoBoxManagerConfig);
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:43,代码来源:InfoBoxManager.cpp

示例13: FilePicker

bool
FilePicker(const TCHAR *caption, const TCHAR *patterns, TCHAR *buffer)
{
  assert(patterns != NULL);

  DataFieldFileReader df;
  df.ScanMultiplePatterns(patterns);
  const ComboList combo_list = df.CreateComboList(nullptr);
  if (combo_list.size() == 0)
    return false;

  int i = ComboPicker(caption, combo_list, nullptr);
  if (i < 0)
    return false;

  const ComboList::Item &item = combo_list[i];
  df.SetFromCombo(item.DataFieldIndex, item.StringValue);

  _tcscpy(buffer, df.GetAsString());
  return true;
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:21,代码来源:FilePicker.cpp

示例14: fv

inline void
PlanePolarWidget::ImportClicked()
{
  ComboList list;
  PolarFileVisitor fv(list);

  // Fill list
  VisitDataFiles(_T("*.plr"), fv);

  list.Sort();

  // let the user select
  int result = ComboPicker(_("Load Polar From File"), list, NULL);
  if (result < 0)
    return;

  assert((unsigned)result < list.size());

  PolarInfo polar;
  const TCHAR* path = list[result].StringValue;
  PolarGlue::LoadFromFile(polar, path);

  plane.reference_mass = polar.reference_mass;
  plane.dry_mass = polar.reference_mass;
  plane.max_ballast = polar.max_ballast;

  if (positive(polar.wing_area))
    plane.wing_area = polar.wing_area;

  if (positive(polar.v_no))
    plane.max_speed = polar.v_no;

  plane.polar_shape = polar.shape;

  plane.polar_name = list[result].StringValueFormatted;

  Update();
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:38,代码来源:PlanePolarDialog.cpp

示例15: ComboPicker

inline void
PlanePolarWidget::ListClicked()
{
  ComboList list;
  unsigned len = PolarStore::Count();
  for (unsigned i = 0; i < len; i++)
    list.Append(i, PolarStore::GetItem(i).name);

  list.Sort();

  // let the user select
  int result = ComboPicker(_("Load Polar"), list, NULL);
  if (result < 0)
    return;

  assert((unsigned)result < len);

  const PolarStore::Item &item = PolarStore::GetItem(list[result].DataFieldIndex);

  plane.reference_mass = fixed(item.reference_mass);
  plane.dry_mass = fixed(item.reference_mass);
  plane.max_ballast = fixed(item.max_ballast);

  if (item.wing_area > 0.0)
    plane.wing_area = fixed(item.wing_area);

  if (item.v_no > 0.0)
    plane.max_speed = fixed(item.v_no);

  plane.polar_shape = item.ToPolarShape();

  plane.polar_name = list[result].StringValue;

  if (item.contest_handicap > 0)
    plane.handicap = item.contest_handicap;

  Update();
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:38,代码来源:PlanePolarDialog.cpp


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