attempt to clean up a little keyboard handling code
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@133 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1311c7a9bb
commit
f54f3bffce
@ -1293,42 +1293,34 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
return MSWOnMeasureItem((int)wParam, (WXMEASUREITEMSTRUCT *)lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
// return Default();
|
||||
|
||||
if (wParam == VK_SHIFT)
|
||||
return Default();
|
||||
|
||||
else if (wParam == VK_CONTROL)
|
||||
// these keys are not interesting to the application (@@ or are they?)
|
||||
if ( wParam == VK_SHIFT || wParam == VK_CONTROL )
|
||||
return Default();
|
||||
|
||||
// Avoid duplicate messages to OnChar
|
||||
else if ((wParam != VK_ESCAPE) && (wParam != VK_SPACE) && (wParam != VK_RETURN) && (wParam != VK_BACK) && (wParam != VK_TAB))
|
||||
{
|
||||
if ((wParam == VK_ESCAPE) || (wParam == VK_SPACE) ||
|
||||
(wParam == VK_RETURN) || (wParam == VK_BACK) ||
|
||||
(wParam == VK_TAB))
|
||||
return Default();
|
||||
|
||||
MSWOnChar((WORD)wParam, lParam);
|
||||
if (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE)
|
||||
return Default();
|
||||
}
|
||||
else
|
||||
return Default();
|
||||
break;
|
||||
}
|
||||
case WM_KEYUP:
|
||||
{
|
||||
/*
|
||||
if (wParam == VK_SHIFT)
|
||||
wxShiftDown = FALSE;
|
||||
else if (wParam == VK_CONTROL)
|
||||
wxControlDown = FALSE;
|
||||
*/
|
||||
//VZ: commented - what is it for?
|
||||
//if (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE)
|
||||
// return Default();
|
||||
break;
|
||||
}
|
||||
|
||||
// VZ: WM_KEYUP not processed
|
||||
|
||||
case WM_CHAR: // Always an ASCII character
|
||||
{
|
||||
MSWOnChar((WORD)wParam, lParam, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_HSCROLL:
|
||||
{
|
||||
#ifdef __WIN32__
|
||||
@ -1544,7 +1536,7 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win)
|
||||
{
|
||||
// adding NULL hWnd is (first) surely a result of an error and
|
||||
// (secondly) breaks menu command processing
|
||||
wxCHECK( hWnd != NULL );
|
||||
wxCHECK_RET( hWnd != NULL, "attempt to add a NULL hWnd to window list" );
|
||||
|
||||
if ( !wxWinHandleList->Find((long)hWnd) )
|
||||
wxWinHandleList->Append((long)hWnd, win);
|
||||
@ -1858,7 +1850,7 @@ bool wxWindow::MSWOnDrawItem(const int id, WXDRAWITEMSTRUCT *itemStruct)
|
||||
if ( id == 0 ) { // is it a menu item?
|
||||
DRAWITEMSTRUCT *pDrawStruct = (DRAWITEMSTRUCT *)itemStruct;
|
||||
wxMenuItem *pMenuItem = (wxMenuItem *)(pDrawStruct->itemData);
|
||||
wxCHECK_RET( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
|
||||
wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
|
||||
|
||||
// prepare to call OnDrawItem()
|
||||
wxDC dc;
|
||||
@ -1891,7 +1883,7 @@ bool wxWindow::MSWOnMeasureItem(const int id, WXMEASUREITEMSTRUCT *itemStruct)
|
||||
if ( id == 0 ) { // is it a menu item?
|
||||
MEASUREITEMSTRUCT *pMeasureStruct = (MEASUREITEMSTRUCT *)itemStruct;
|
||||
wxMenuItem *pMenuItem = (wxMenuItem *)(pMeasureStruct->itemData);
|
||||
wxCHECK_RET( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
|
||||
wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE );
|
||||
|
||||
return pMenuItem->OnMeasureItem(&pMeasureStruct->itemWidth,
|
||||
&pMeasureStruct->itemHeight);
|
||||
@ -2556,11 +2548,13 @@ void wxWindow::MSWOnChar(const WXWORD wParam, const WXLPARAM lParam, const bool
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if ((id = wxCharCodeMSWToWX(wParam)) == 0)
|
||||
else if ((id = wxCharCodeMSWToWX(wParam)) == 0) {
|
||||
// it's ASCII and will be processed here only when called from
|
||||
// WM_CHAR (i.e. when isASCII = TRUE)
|
||||
id = -1;
|
||||
}
|
||||
|
||||
if (id > -1)
|
||||
if (id != -1)
|
||||
{
|
||||
wxKeyEvent event(wxEVT_CHAR);
|
||||
event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE);
|
||||
|
Loading…
Reference in New Issue
Block a user