bool Clickable::Key(const KeyInput &key) { if (!HasFocus() && key.deviceId != DEVICE_ID_MOUSE) { down_ = false; return false; } // TODO: Replace most of Update with this. bool ret = false; if (key.flags & KEY_DOWN) { if (IsAcceptKey(key)) { down_ = true; ret = true; } } if (key.flags & KEY_UP) { if (IsAcceptKey(key)) { if (down_) { Click(); down_ = false; ret = true; } } else if (IsEscapeKey(key)) { down_ = false; } } return ret; }
void CSearchDialog::OnCharHook(wxKeyEvent& event) { if (IsEscapeKey(event)) { EndDialog(wxID_CANCEL); return; } event.Skip(); }
void wxDialogBase::OnCharHook(wxKeyEvent& event) { if ( IsEscapeKey(event) ) { if ( SendCloseButtonClickEvent() ) { // Skip the call to event.Skip() below, we did handle this key. return; } } event.Skip(); }