bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event) { if ( wxGridCellEditor::IsAcceptedKey(event) ) { const int keycode = event.GetKeyCode(); if ( wxIsascii(keycode) ) { #if wxUSE_INTL const wxString decimalPoint = wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER); #else const wxString decimalPoint(wxT('.')); #endif // accept digits, 'e' as in '1e+6', also '-', '+', and '.' if ( wxIsdigit(keycode) || tolower(keycode) == 'e' || keycode == decimalPoint || keycode == '+' || keycode == '-' ) { return true; } } } return false; }
wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) { m_refData = new wxAccelRefData; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( int i = 0; i < n; i++ ) { const wxAcceleratorEntry& entry = entries[i]; int keycode = entry.GetKeyCode(); if ( wxIsascii(keycode) ) keycode = wxToupper(keycode); M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry.GetFlags(), keycode, entry.GetCommand())); } }
wxString wxAcceleratorEntry::ToString() const { wxString text; int flags = GetFlags(); if ( flags & wxACCEL_ALT ) text += _("Alt+"); if ( flags & wxACCEL_CTRL ) text += _("Ctrl+"); if ( flags & wxACCEL_SHIFT ) text += _("Shift+"); #if defined(__WXMAC__) || defined(__WXCOCOA__) if ( flags & wxACCEL_RAW_CTRL ) text += _("RawCtrl+"); #endif const int code = GetKeyCode(); if ( code >= WXK_F1 && code <= WXK_F12 ) text << _("F") << code - WXK_F1 + 1; else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 ) text << _("KP_") << code - WXK_NUMPAD0; else if ( code >= WXK_SPECIAL1 && code <= WXK_SPECIAL20 ) text << _("SPECIAL") << code - WXK_SPECIAL1 + 1; else // check the named keys { size_t n; for ( n = 0; n < WXSIZEOF(wxKeyNames); n++ ) { const wxKeyName& kn = wxKeyNames[n]; if ( code == kn.code ) { text << wxGetTranslation(kn.name); break; } } if ( n == WXSIZEOF(wxKeyNames) ) { // must be a simple key if ( #if !wxUSE_UNICODE // we can't call wxIsalnum() for non-ASCII characters in ASCII // build as they're only defined for the ASCII range (or EOF) wxIsascii(code) && #endif // ANSI wxIsprint(code) ) { text << (wxChar)code; } else { wxFAIL_MSG( wxT("unknown keyboard accelerator code") ); } } } return text; }
wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) { m_refData = new wxAccelRefData; for ( int i = 0; i < n; i++ ) { const wxAcceleratorEntry& entry = entries[i]; int keycode = entry.GetKeyCode(); if ( wxIsascii(keycode) ) keycode = wxToupper(keycode); M_ACCELDATA->m_accels.Append(new wxAcceleratorEntry(entry.GetFlags(), keycode, entry.GetCommand())); } }
void wxTextCtrl::OnChar(wxKeyEvent& event) { // Indicates that we should generate a normal command, because // we're letting default behaviour happen (otherwise it's vetoed // by virtue of overriding OnChar) m_processedDefault = true; if (m_tempCallbackStruct) { XmTextVerifyCallbackStruct *textStruct = (XmTextVerifyCallbackStruct *) m_tempCallbackStruct; textStruct->doit = True; if (wxIsascii(event.m_keyCode) && (textStruct->text->length == 1)) { textStruct->text->ptr[0] = (char)((event.m_keyCode == WXK_RETURN) ? 10 : event.m_keyCode); } } }