Ejemplo n.º 1
0
void
WndProperty::BeginEditing()
{
  if (edit.is_read_only()) {
    /* this would display xml file help on a read-only wndproperty if
       it exists */
    OnHelp();
  } else if (mDataField != NULL && mDataField->SupportCombo) {
    SingleWindow *root = (SingleWindow *)get_root_owner();

    /* if this asserton fails, then there no valid root window could
       be found - maybe it didn't register its wndproc? */
    assert(root != NULL);

    dlgComboPicker(*root, this);
  } else if (CanEditInPlace()) {
    edit.set_focus();
  } else if (mDataField != NULL) {
    const TCHAR *value = mDataField->GetAsString();
    if (value == NULL)
      return;

    StaticString<EDITSTRINGSIZE> buffer(value);
    if (!TextEntryDialog(*(SingleWindow *)get_root_owner(), buffer,
                         GetCaption()))
      return;

    mDataField->SetAsString(buffer);
    RefreshDisplay();
  }
}
Ejemplo n.º 2
0
void
WndProperty::on_editor_setfocus()
{
  if (mDataField != NULL && CanEditInPlace()) {
    edit.set_text(mDataField->GetAsString());
  }

  invalidate();
}
Ejemplo n.º 3
0
void
WndProperty::RefreshDisplay()
{
  if (!mDataField)
    return;

  if (edit.has_focus() && CanEditInPlace())
    edit.set_text(mDataField->GetAsString());
  else
    edit.set_text(mDataField->GetAsDisplayString());
}
Ejemplo n.º 4
0
void
WndProperty::on_editor_killfocus()
{
  if (mDataField != NULL && CanEditInPlace()) {
    TCHAR sTmp[128];
    edit.get_text(sTmp, (sizeof(sTmp) / sizeof(TCHAR)) - 1);
    mDataField->SetAsString(sTmp);
    edit.set_text(mDataField->GetAsDisplayString());
  }

  invalidate();
}
Ejemplo n.º 5
0
bool
WndProperty::Editor::on_key_check(unsigned key_code) const
{
  switch (key_code) {
  case VK_RETURN:
    return is_read_only() ||
      (parent->mDataField != NULL && parent->mDataField->SupportCombo) ||
      !CanEditInPlace();

  case VK_LEFT:
  case VK_RIGHT:
    return true;

  default:
    return false;
  }
}
Ejemplo n.º 6
0
bool
WndProperty::Editor::OnKeyCheck(unsigned key_code) const
{
  switch (key_code) {
  case VK_RETURN:
    return IsReadOnly() ||
      (parent->mDataField != NULL && parent->mDataField->supports_combolist) ||
      !CanEditInPlace() || parent->HasHelp();

  case VK_LEFT:
  case VK_RIGHT:
    return !IsReadOnly();

  default:
    return EditWindow::OnKeyCheck(key_code);
  }
}