Exemple #1
0
void
RowFormWidget::AddMultiLine(const TCHAR *text)
{
  assert(IsDefined());

  const PixelRect rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  LargeTextWindowStyle style;
  if (IsEmbedded() || Layout::scale_1024 < 2048)
    /* sunken edge doesn't fit well on the tiny screen of an embedded
       device */
    style.Border();
  else
    style.SunkenEdge();

  PanelControl &panel = *(PanelControl *)GetWindow();
  LargeTextWindow *ltw = new LargeTextWindow();
  ltw->Create(panel, rc, style);
  ltw->SetFont(*look.text_font);

  if (text != nullptr)
    ltw->SetText(text);

  Add(Row::Type::MULTI_LINE, ltw);
}
Exemple #2
0
WndProperty *
RowFormWidget::CreateEdit(const TCHAR *label, const TCHAR *help,
                          bool read_only)
{
  assert(IsDefined());

  const PixelRect edit_rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  WindowStyle style;
  if (!read_only)
    style.TabStop();

  PanelControl &panel = *(PanelControl *)GetWindow();
  WndProperty *edit =
    new WndProperty(panel, look, label,
                    edit_rc, (*label == '\0') ? 0 : 100,
                    style);
  edit->SetReadOnly(read_only);

  if (help != NULL)
    edit->SetHelpText(help);

  return edit;
}
Exemple #3
0
void
RowFormWidget::AddSpacer()
{
  assert(IsDefined());

  HLine *window = new HLine(GetLook());
  ContainerWindow &panel = *(ContainerWindow *)GetWindow();
  const PixelRect rc = InitialControlRect(Layout::Scale(3));
  window->Create(panel, rc);
  Add(window);
}
Exemple #4
0
WndProperty *
RowFormWidget::AddSpacer()
{
  assert(IsDefined());

  const PixelRect edit_rc = InitialControlRect(Layout::Scale(6));

  WindowStyle style;
  EditWindowStyle edit_style;
  edit_style.SetVerticalCenter();
  edit_style.SetReadOnly();

  PanelControl &panel = *(PanelControl *)GetWindow();
  WndProperty *edit = new WndProperty(panel, look, _T(""), edit_rc, 0, style, edit_style, NULL);
  Add(edit);
  return edit;
}
Exemple #5
0
void
RowFormWidget::AddButton(const TCHAR *label, ActionListener &listener, int id)
{
  assert(IsDefined());

  const PixelRect button_rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  ButtonWindowStyle button_style;
  button_style.TabStop();
  button_style.multiline();

  ContainerWindow &panel = *(ContainerWindow *)GetWindow();

  WndButton *button = new WndButton(panel, look, label, button_rc, button_style, listener, id);

  Add(Row::Type::BUTTON, button);
}
Exemple #6
0
WndProperty *
RowFormWidget::CreateEdit(const TCHAR *label, const TCHAR *help,
                          bool read_only)
{
  assert(IsDefined());

  const PixelRect edit_rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  WindowStyle style;
  if (!read_only)
    style.ControlParent();

  EditWindowStyle edit_style;
  edit_style.SetVerticalCenter();

  if (read_only)
    edit_style.SetReadOnly();
  else
    edit_style.TabStop();

  if (IsEmbedded() || Layout::scale_1024 < 2048)
    /* sunken edge doesn't fit well on the tiny screen of an embedded
       device */
    edit_style.Border();
  else
    edit_style.SunkenEdge();

  PanelControl &panel = *(PanelControl *)GetWindow();
  WndProperty *edit =
    new WndProperty(panel, look, label,
                    edit_rc, (*label == '\0') ? 0 : 100,
                    style, edit_style, NULL);
  if (help != NULL)
    edit->SetHelpText(help);

  return edit;
}
Exemple #7
0
void
RowFormWidget::AddMultiLine(const TCHAR *label, const TCHAR *help,
                            const TCHAR *text)
{
  assert(IsDefined());

  const PixelRect edit_rc =
    InitialControlRect(Layout::GetMinimumControlHeight());

  WindowStyle style;

  EditWindowStyle edit_style;
  edit_style.SetMultiLine();
  edit_style.VerticalScroll();
  edit_style.SetReadOnly();

  if (IsEmbedded() || Layout::scale_1024 < 2048)
    /* sunken edge doesn't fit well on the tiny screen of an embedded
       device */
    edit_style.Border();
  else
    edit_style.SunkenEdge();

  PanelControl &panel = *(PanelControl *)GetWindow();
  WndProperty *edit =
    new WndProperty(panel, look, label,
                    edit_rc, (*label == '\0') ? 0 : 100,
                    style, edit_style, NULL);
  if (help != NULL)
    edit->SetHelpText(help);

  if (text != NULL)
    edit->SetText(text);

  Add(Row::Type::MULTI_LINE, edit);
}