Exemplo n.º 1
0
/**
 * This event handler is called when a key is pressed
 * @param key_code The key code of the pressed key
 * @return True if the event was handled, False otherwise
 */
static bool
FormKeyDown(WndForm &Sender, unsigned key_code)
{
  (void)Sender;

  switch (key_code) {
  case VK_UP:
    if (!has_pointer())
      break;

    wdf->ZoomIn();
    return true;
  case VK_DOWN:
    if (!has_pointer())
      break;

    wdf->ZoomOut();
    return true;
  case VK_LEFT:
#ifdef GNAV
  case '6':
#endif
    wdf->PrevTarget();
    return true;
  case VK_RIGHT:
#ifdef GNAV
  case '7':
#endif
    wdf->NextTarget();
    return true;
  }

  return false;
}
Exemplo n.º 2
0
static const AbstractAirspace *
GetSelectedAirspace()
{
  return has_pointer() || FocusAirspace == NULL
    ? CursorAirspace
    : FocusAirspace;
}
Exemplo n.º 3
0
DataField *
WndProperty::SetDataField(DataField *Value)
{
  DataField *res = mDataField;

  if (mDataField != Value) {
    if (mDataField != NULL) {
      if (!mDataField->Unuse()) {
        delete (mDataField);
        res = NULL;
      }
    }

    Value->Use();

    mDataField = Value;

    mDialogStyle = has_pointer() && mDataField->SupportCombo;

    UpdateLayout();

    RefreshDisplay();
  }

  return res;
}
Exemplo n.º 4
0
void
dlgAirspaceWarningInit(SingleWindow &parent)
{
  wf = LoadDialog(CallBackTable,
                      parent,
                      _T("IDR_XML_AIRSPACEWARNING"));
  if (wf == NULL)
    return;

  wf->SetKeyDownNotify(OnKeyDown);
  wf->SetTimerNotify(OnTimer);

  hBrushInsideBk.set(Color(254,50,50));
  hBrushNearBk.set(Color(254,254,50));
  hBrushInsideAckBk.set(Color(254,100,100));
  hBrushNearAckBk.set(Color(254,254,100));

  wAirspaceList = (WndListFrame*)wf->FindByName(_T("frmAirspaceWarningList"));
  wAirspaceList->SetPaintItemCallback(OnAirspaceListItemPaint);
  wAirspaceList->SetCursorCallback(AirspaceWarningCursorCallback);

  if (!has_pointer())
    /* on platforms without a pointing device (e.g. ALTAIR), allow
       "focusing" an airspace by pressing enter */
    wAirspaceList->SetActivateCallback(OnAirspaceListEnter);
}
Exemplo n.º 5
0
static void
OnAirspaceListEnter(gcc_unused unsigned i)
{
  if (!has_pointer())
    /* on platforms without a pointing device (e.g. ALTAIR), allow
       "focusing" an airspace by pressing enter */
    FocusAirspace = CursorAirspace;
  else if (CursorAirspace != NULL)
    dlgAirspaceDetails(*CursorAirspace);
}