本文整理汇总了C++中DataFieldEnum::AddChoice方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldEnum::AddChoice方法的具体用法?C++ DataFieldEnum::AddChoice怎么用?C++ DataFieldEnum::AddChoice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldEnum
的用法示例。
在下文中一共展示了DataFieldEnum::AddChoice方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEnum
void
RASPSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
WndProperty *wp;
wp = AddEnum(_("Field"), nullptr);
DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
dfe->EnableItemHelp(true);
dfe->addEnumText(_("Terrain"));
for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_MAP; i++) {
const TCHAR *label = RASP.ItemLabel(i);
if (label != NULL)
dfe->AddChoice(i, label, nullptr, RASP.ItemHelp(i));
}
dfe->Set(RASP.GetParameter());
wp->RefreshDisplay();
wp = AddEnum(_("Time"), nullptr);
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();
}
示例2: AddEnum
void
RASPSettingsPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
const WeatherUIState &state = CommonInterface::GetUIState().weather;
time = state.time;
WndProperty *wp;
wp = AddEnum(_("Field"), nullptr, this);
DataFieldEnum *dfe = (DataFieldEnum *)wp->GetDataField();
dfe->EnableItemHelp(true);
for (unsigned i = 0; i < rasp.GetItemCount(); i++) {
const auto &mi = rasp.GetItemInfo(i);
const TCHAR *label = mi.label;
if (label != nullptr)
label = gettext(label);
const TCHAR *help = mi.help;
if (help != nullptr)
help = gettext(help);
dfe->AddChoice(i, mi.name, label, help);
}
dfe->Set(state.map);
wp->RefreshDisplay();
AddEnum(_("Time"), nullptr, this);
UpdateTimeControl();
}
示例3: GetHeadingString
static void
FillDirectionEnum(DataFieldEnum &df)
{
TCHAR buffer[64];
df.AddChoice(WILDCARD, _T("*"));
df.AddChoice(0, GetHeadingString(buffer));
static constexpr unsigned directions[] = {
360, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330
};
for (unsigned i = 0; i < ARRAY_SIZE(directions); ++i)
df.AddChoice(directions[i], FormatBearing(directions[i]).c_str());
df.Set(WILDCARD);
}
示例4:
static void
FillDistanceEnum(DataFieldEnum &df)
{
df.AddChoice(0, _T("*"));
static constexpr unsigned distances[] = {
25, 50, 75, 100, 150, 250, 500, 1000
};
TCHAR buffer[64];
const TCHAR *unit = Units::GetDistanceName();
for (unsigned i = 0; i < ARRAY_SIZE(distances); ++i) {
_stprintf(buffer, _T("%u %s"), distances[i], unit);
df.AddChoice(distances[i], buffer);
}
df.Set(0u);
}
示例5:
static unsigned
AddPort(DataFieldEnum &df, DeviceConfig::PortType type,
const TCHAR *text, const TCHAR *display_string=NULL,
const TCHAR *help=NULL)
{
/* the uppper 16 bit is the port type, and the lower 16 bit is a
serial number to make the enum id unique */
unsigned id = ((unsigned)type << 16) + df.Count();
df.AddChoice(id, text, display_string, help);
return id;
}
示例6: 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;
}