void ShowFormControl(SubForm &form, const TCHAR *control_name, bool visible) { Window *window = form.FindByName(control_name); assert(window != NULL); window->SetVisible(visible); }
void SetFormControlEnabled(SubForm &form, const TCHAR *control_name, bool enabled) { Window *window = form.FindByName(control_name); assert(window != NULL); window->SetEnabled(enabled); }
void ShowOptionalFormControl(SubForm &form, const TCHAR *control_name, bool visible) { Window *window = form.FindByName(control_name); if (window != NULL) window->SetVisible(visible); }
static void SetDataAccessCallback(SubForm &form, const TCHAR *name, DataField::DataAccessCallback cb) { WndProperty *edit = (WndProperty *)form.FindByName(name); assert(edit != nullptr); DataField *df = edit->GetDataField(); assert(df != nullptr); df->SetDataAccessCallback(cb); }
void SetFormValue(SubForm &form, const TCHAR *control_name, const TCHAR *value) { assert(control_name != NULL); assert(value != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); ctl->SetText(value); }
int GetFormValueInteger(const SubForm &form, const TCHAR *control_name) { assert(control_name != NULL); const WndProperty *control = (const WndProperty *)form.FindByName(control_name); assert(control != NULL); return control->GetDataField()->GetAsInteger(); }
fixed GetFormValueFixed(const SubForm &form, const TCHAR *control_name) { const WndProperty *control = (const WndProperty *)form.FindByName(control_name); assert(control != NULL); const DataFieldFloat &df = *(const DataFieldFloat *)control->GetDataField(); assert(df.GetType() == DataField::Type::REAL); return df.GetAsFixed(); }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, unsigned int value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; ctl->GetDataField()->SetAsInteger(value); ctl->RefreshDisplay(); }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, fixed value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); DataFieldFloat &df = *(DataFieldFloat *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::REAL); df.Set(value); ctl->RefreshDisplay(); }
void LoadFormPropertyEnum(SubForm &form, const TCHAR *control_name, int value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); DataFieldEnum &df = *(DataFieldEnum *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::ENUM); df.Set(value); ctl->RefreshDisplay(); }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, bool value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; DataFieldBoolean &df = *(DataFieldBoolean *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::BOOLEAN); df.Set(value); ctl->RefreshDisplay(); }
bool GetFormValueBoolean(const SubForm &form, const TCHAR *control_name) { assert(control_name != NULL); const WndProperty *control = (const WndProperty *)form.FindByName(control_name); assert(control != NULL); const DataFieldBoolean &df = *(const DataFieldBoolean *)control->GetDataField(); assert(df.GetType() == DataField::Type::BOOLEAN); return df.GetAsBoolean(); }
void LoadOptionalFormProperty(SubForm &form, const TCHAR *control_name, UnitGroup unit_group, fixed value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); if (ctl == NULL) return; Unit unit = Units::GetUserUnitByGroup(unit_group); DataFieldFloat &df = *(DataFieldFloat *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::REAL); df.SetUnits(Units::GetUnitName(unit)); df.Set(Units::ToUserUnit(value, unit)); ctl->RefreshDisplay(); }
void LoadFormProperty(SubForm &form, const TCHAR *control_name, const StaticEnumChoice *list, unsigned value) { assert(control_name != NULL); WndProperty *ctl = (WndProperty *)form.FindByName(control_name); assert(ctl != NULL); DataFieldEnum &df = *(DataFieldEnum *)ctl->GetDataField(); assert(df.GetType() == DataField::Type::ENUM); if (list[0].help != NULL) df.EnableItemHelp(true); df.AddChoices(list); df.Set(value); ctl->RefreshDisplay(); }
/** * Clears and deletes the windows created by LoadWindow * during Prepare() associated with the WindowWidget */ virtual void Unprepare() override { form.Clear(); }