本文整理汇总了C++中ComboList::LookUp方法的典型用法代码示例。如果您正苦于以下问题:C++ ComboList::LookUp方法的具体用法?C++ ComboList::LookUp怎么用?C++ ComboList::LookUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComboList
的用法示例。
在下文中一共展示了ComboList::LookUp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}