Beispiel #1
0
void
ShowFormControl(SubForm &form, const TCHAR *control_name, bool visible)
{
  Window *window = form.FindByName(control_name);
  assert(window != NULL);
  window->SetVisible(visible);
}
Beispiel #2
0
void
SetFormControlEnabled(SubForm &form, const TCHAR *control_name, bool enabled)
{
  Window *window = form.FindByName(control_name);
  assert(window != NULL);
  window->SetEnabled(enabled);
}
Beispiel #3
0
void
ShowOptionalFormControl(SubForm &form, const TCHAR *control_name,
                        bool visible)
{
  Window *window = form.FindByName(control_name);
  if (window != NULL)
    window->SetVisible(visible);
}
Beispiel #4
0
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);
}
Beispiel #5
0
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);
}
Beispiel #6
0
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();
}
Beispiel #7
0
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();
}
Beispiel #8
0
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();
}
Beispiel #9
0
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();
}
Beispiel #10
0
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();
}
Beispiel #11
0
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();
}
Beispiel #12
0
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();
}
Beispiel #13
0
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();
}
Beispiel #14
0
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();
}
Beispiel #15
0
 /**
  * Clears and deletes the windows created by LoadWindow
  * during Prepare() associated with the WindowWidget
  */
 virtual void Unprepare() override {
   form.Clear();
 }