From 47df2b8c540f17c55464719d0da74c0b43a29515 Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 17 Jun 2002 22:08:57 +0000 Subject: [PATCH] Catching up git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/frame.h | 8 --- include/wx/os2/popupwin.h | 23 +++---- include/wx/os2/radiobox.h | 4 +- include/wx/os2/toplevel.h | 9 +++ include/wx/os2/window.h | 5 +- src/os2/font.cpp | 2 +- src/os2/fontutil.cpp | 125 ++------------------------------------ src/os2/frame.cpp | 61 +------------------ src/os2/popupwin.cpp | 79 +++--------------------- src/os2/thread.cpp | 78 ++++++++++++++++++------ src/os2/toplevel.cpp | 92 +++++++++++++++++++++++----- src/os2/window.cpp | 16 ++--- 12 files changed, 188 insertions(+), 314 deletions(-) diff --git a/include/wx/os2/frame.h b/include/wx/os2/frame.h index 88cac74d0f..d05f166f99 100644 --- a/include/wx/os2/frame.h +++ b/include/wx/os2/frame.h @@ -62,7 +62,6 @@ public: virtual void Raise(void); // event handlers - void OnActivate(wxActivateEvent& rEvent); void OnSysColourChanged(wxSysColourChangedEvent& rEvent); // Toolbar @@ -122,12 +121,6 @@ public: void SetToolTipCtrl(WXHWND hHwndTT) { m_hWndToolTip = hHwndTT; } #endif // tooltips - // - // Called by wxWindow whenever it gets focus - // - void SetLastFocus(wxWindow* pWin) { m_pWinLastFocused = pWin; } - wxWindow *GetLastFocus(void) const { return m_pWinLastFocused; } - void SetClient(WXHWND c_Hwnd); void SetClient(wxWindow* c_Window); wxWindow *GetClient(); @@ -188,7 +181,6 @@ protected: bool m_bFsIsShowing; bool m_bWasMinimized; bool m_bIsShown; - wxWindow* m_pWinLastFocused; private: #if wxUSE_TOOLTIPS diff --git a/include/wx/os2/popupwin.h b/include/wx/os2/popupwin.h index 9341ecdd5c..72ddbab4d7 100644 --- a/include/wx/os2/popupwin.h +++ b/include/wx/os2/popupwin.h @@ -21,7 +21,10 @@ class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase public: wxPopupWindow() { } - wxPopupWindow(wxWindow* pParent) { (void)Create(pParent); } + wxPopupWindow( wxWindow* pParent + ,int nFlags + ) + { (void)Create(pParent, nFlags); } bool Create( wxWindow* pParent ,int nFlags = wxBORDER_NONE @@ -30,19 +33,8 @@ public: // Implementation only from now on // ------------------------------- // - - // - // Override Show() to prevent wxPopupWindow from being activated - // - virtual bool Show(bool show = TRUE); - - // - // Find a shown popup window with the given window as parent, return NULL - // if none - // - static wxPopupWindow *FindPopupFor(wxWindow* pWin); - protected: + virtual void DoGetPosition( int* pnX ,int* pny ) const; @@ -50,6 +42,11 @@ protected: virtual WXDWORD OS2GetStyle( long lFlags ,WXDWORD* dwExstyle ) const; + // + // Get the HWND to be used as parent of this window with CreateWindow() + // + virtual WXHWND OS2GetParent(void) const; + // // The list of all currently shown popup windows used by FindPopupFor() // diff --git a/include/wx/os2/radiobox.h b/include/wx/os2/radiobox.h index 2e0f9af62f..8b1e97a9c0 100644 --- a/include/wx/os2/radiobox.h +++ b/include/wx/os2/radiobox.h @@ -70,7 +70,7 @@ public: void Command(wxCommandEvent& rEvent); bool ContainsHWND(WXHWND hWnd) const; - bool Enable(bool bEnable); + virtual bool Enable(bool bEnable = TRUE); void Enable( int nItem ,bool bEnable ); @@ -87,7 +87,7 @@ public: ,WXWORD wId ); void SendNotificationEvent(void); - void Show( int nItem + virtual void Show( int nItem ,bool bShow = TRUE ) ; bool Show(bool bShow); diff --git a/include/wx/os2/toplevel.h b/include/wx/os2/toplevel.h index d0e1a3e469..b45053a862 100644 --- a/include/wx/os2/toplevel.h +++ b/include/wx/os2/toplevel.h @@ -86,6 +86,11 @@ public: // -------------------------- // PSWP GetSwpClient(void) { return &m_vSwpClient; } + + void OnActivate(wxActivateEvent& rEvent); + + void SetLastFocus(wxWindow *pWin) { m_pWinLastFocused = pWin; } + wxWindow* GetLastFocus(void) const { return m_pWinLastFocused; } protected: // // Common part of all ctors @@ -157,11 +162,15 @@ protected: bool m_bFsIsMaximized; bool m_bFsIsShowing; + wxWindow* m_pWinLastFocused; + WXHWND m_hFrame; SWP m_vSwp; SWP m_vSwpClient; static bool m_sbInitialized; static wxWindow* m_spHiddenParent; + + DECLARE_EVENT_TABLE() }; // end of CLASS wxTopLevelWindowOS2 // diff --git a/include/wx/os2/window.h b/include/wx/os2/window.h index 12e1debc20..3d1e43bf7d 100644 --- a/include/wx/os2/window.h +++ b/include/wx/os2/window.h @@ -237,6 +237,10 @@ public: WXFARPROC OS2GetOldWndProc(void) const { return m_fnOldWndProc; } void OS2SetOldWndProc(WXFARPROC fnProc) { m_fnOldWndProc = fnProc; } + // + // Return TRUE if the window is of a standard (i.e. not wxWindows') class + // + bool IsOfStandardClass(void) const { return m_fnOldWndProc != NULL; } wxWindow* FindItem(long lId) const; wxWindow* FindItemByHWND( WXHWND hWnd @@ -503,7 +507,6 @@ protected: bool m_bUseCtl3D:1; // Using CTL3D for this control bool m_bBackgroundTransparent:1; bool m_bMouseInWindow:1; - bool m_bDoubleClickAllowed:1; bool m_bLastKeydownProcessed:1; bool m_bWinCaptured:1; WXDWORD m_dwExStyle; diff --git a/src/os2/font.cpp b/src/os2/font.cpp index d35787fca9..747b3232f7 100644 --- a/src/os2/font.cpp +++ b/src/os2/font.cpp @@ -1117,5 +1117,5 @@ void wxFont::SetPS( M_FONTDATA->SetPS(hPS); RealizeResource(); -} // end of wxFont::SetUnderlined +} // end of wxFont::SetPS diff --git a/src/os2/fontutil.cpp b/src/os2/fontutil.cpp index 805b4eeb9e..bb4490f96c 100644 --- a/src/os2/fontutil.cpp +++ b/src/os2/fontutil.cpp @@ -323,27 +323,12 @@ void wxFillLogFont( ,(int)lNumFonts ); - wxString sVals; - - // - // For debugging, delete later - // - for (int i = 0; i < lNumFonts; i++) - { - sVals << "Face: " << pFM[i].szFacename - << "Family: " << pFM[i].szFamilyname - << " PointSize: " << pFM[i].lEmHeight - << " Height: " << pFM[i].lXHeight - ; - sVals = ""; - } - // // Initialize FATTR and FACENAMEDESC // pFattrs->usRecordLength = sizeof(FATTRS); pFattrs->fsFontUse = FATTR_FONTUSE_OUTLINE | // only outline fonts allowed - FATTR_FONTUSE_TRANSFORMABLE; // may be transformed + FATTR_FONTUSE_TRANSFORMABLE; // may be transformed pFattrs->fsType = 0; pFattrs->lMaxBaselineExt = pFattrs->lAveCharWidth = 0; pFattrs->idRegistry = 0; @@ -639,110 +624,12 @@ wxFont wxCreateFontFromLogFont( , PFACENAMEDESC pFaceName ) { - // - // Extract family from facename - // - int nFontFamily; - - if (strcmp(pLogFont->szFacename, "Times New Roman") == 0) - nFontFamily = wxROMAN; - else if (strcmp(pLogFont->szFacename, "WarpSans") == 0) - nFontFamily = wxSWISS; - else if (strcmp(pLogFont->szFacename, "Script") == 0) - nFontFamily = wxSCRIPT; - else if (strcmp(pLogFont->szFacename, "Courier New") == 0) - nFontFamily = wxMODERN; - else - nFontFamily = wxSWISS; - - // - // Weight and Style - // - int nFontWeight = wxNORMAL; - - switch (pFaceName->usWeightClass) - { - case FWEIGHT_LIGHT: - nFontWeight = wxLIGHT; - break; - - default: - case FWEIGHT_NORMAL: - nFontWeight = wxNORMAL; - break; - - case FWEIGHT_BOLD: - nFontWeight = wxBOLD; - break; - } - - int nFontStyle; - - if(pLogFont->fsSelection & FATTR_SEL_ITALIC) - nFontStyle = wxITALIC; - else - nFontStyle = wxNORMAL; - - bool bFontUnderline = (pLogFont->fsSelection & FATTR_SEL_UNDERSCORE); - wxString sFontFace = pLogFont->szFacename; - int nFontPoints = pFM->lEmHeight; - wxFontEncoding vFontEncoding; - - switch (pLogFont->usCodePage) - { - default: - wxFAIL_MSG(wxT("unsupported charset")); - // fall through - - case 850: - vFontEncoding = wxFONTENCODING_CP1252; - break; - - case 1250: - vFontEncoding = wxFONTENCODING_CP1250; - break; - - case 921: - vFontEncoding = wxFONTENCODING_CP1257; - break; - - case 866: - vFontEncoding = wxFONTENCODING_CP1251; - break; - - case 864: - vFontEncoding = wxFONTENCODING_CP1256; - break; - - case 869: - vFontEncoding = wxFONTENCODING_CP1253; - break; - - case 862: - vFontEncoding = wxFONTENCODING_CP1255; - break; - - case 857: - vFontEncoding = wxFONTENCODING_CP1254; - break; - - case 874: - vFontEncoding = wxFONTENCODING_CP437; - break; - - case 437: - vFontEncoding = wxFONTENCODING_CP437; - break; - } + wxNativeFontInfo vInfo; - return wxFont( nFontPoints - ,nFontFamily - ,nFontStyle - ,nFontWeight - ,bFontUnderline - ,sFontFace - ,vFontEncoding - ); + vInfo.fa = *pLogFont; + vInfo.fm = *pFM; + vInfo.fn = *pFaceName; + return wxFont(vInfo); } // end of wxCreateFontFromLogFont int wxGpiStrcmp( diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index a49e174364..4c345bcea7 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -67,7 +67,6 @@ extern void wxAssociateWinWithHandle( HWND hWnd // ---------------------------------------------------------------------------- BEGIN_EVENT_TABLE(wxFrame, wxFrameBase) - EVT_ACTIVATE(wxFrame::OnActivate) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) END_EVENT_TABLE() @@ -101,7 +100,6 @@ void wxFrame::Init() m_nFsToolBarHeight = 0; m_hWndToolTip = 0L; m_bWasMinimized = FALSE; - m_pWinLastFocused = NULL; m_frameMenuBar = NULL; @@ -658,70 +656,13 @@ bool wxFrame::ShowFullScreen( ,m_vFsOldSize.height ,SWP_SIZE | SWP_SHOW ); - return TRUE; } + return wxFrameBase::ShowFullScreen(bShow, lStyle); } // end of wxFrame::ShowFullScreen // // Frame window // -// -// Default activation behaviour - set the focus for the first child -// subwindow found. -// -void wxFrame::OnActivate( - wxActivateEvent& rEvent -) -{ - if ( rEvent.GetActive() ) - { - // restore focus to the child which was last focused - wxLogTrace(_T("focus"), _T("wxFrame %08x activated."), m_hWnd); - - wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent() - : NULL; - if (!pParent) - { - pParent = this; - } - - wxSetFocusToChild( pParent - ,&m_pWinLastFocused - ); - } - else // deactivating - { - // - // Remember the last focused child if it is our child - // - m_pWinLastFocused = FindFocus(); - - for (wxWindowList::Node* pNode = GetChildren().GetFirst(); - pNode; - pNode = pNode->GetNext()) - { - // FIXME all this is totally bogus - we need to do the same as wxPanel, - // but how to do it without duplicating the code? - - // restore focus - wxWindow* pChild = pNode->GetData(); - - if (!pChild->IsTopLevel() -#if wxUSE_TOOLBAR - && !wxDynamicCast(pChild, wxToolBar) -#endif // wxUSE_TOOLBAR -#if wxUSE_STATUSBAR - && !wxDynamicCast(pChild, wxStatusBar) -#endif // wxUSE_STATUSBAR - ) - { - pChild->SetFocus(); - return; - } - } - } -} // end of wxFrame::OnActivate - // ---------------------------------------------------------------------------- // wxFrame size management: we exclude the areas taken by menu/status/toolbars // from the client area, so the client area is what's really available for the diff --git a/src/os2/popupwin.cpp b/src/os2/popupwin.cpp index 4c0ca2757a..7ffb1164f8 100644 --- a/src/os2/popupwin.cpp +++ b/src/os2/popupwin.cpp @@ -30,7 +30,7 @@ #include "wx/popupwin.h" -wxWindowList wxPopupWindow::m_svShownPopups; +IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) // ============================================================================ // implementation @@ -64,6 +64,14 @@ void wxPopupWindow::DoGetPosition( GetParent()->ClientToScreen(pnX, pnY); } // end of wxPopupWindow::DoGetPosition +WXHWND wxPopupWindow::OS2GetParent() const +{ + // we must be a child of the desktop to be able to extend beyond the parent + // window client area (like the comboboxes drop downs do) + // + return (WXHWND)HWND_DESKTOP; +} // end of wxPopupWindow::OS2GetParent + WXDWORD wxPopupWindow::OS2GetStyle( long lFlags , WXDWORD* dwExstyle @@ -76,73 +84,4 @@ WXDWORD wxPopupWindow::OS2GetStyle( return dwStyle; } // end of wxPopupWindow::OS2GetStyle -bool wxPopupWindow::Show( - bool bShow -) -{ - SWP vSwp; - // - // Skip wxWindow::Show() which calls wxBringWindowToTop(): this results in - // activating the popup window and stealing the atcivation from our parent - // which means that the parent frame becomes deactivated when opening a - // combobox, for example -- definitely not what we want - // - if (!wxWindowBase::Show(bShow)) - return FALSE; - - if (bShow) - { - m_svShownPopups.Append(this); - } - else // remove from the shown list - { - m_svShownPopups.DeleteObject(this); - } - ::WinQueryWindowPos(GetHwnd(), &vSwp); - - if (bShow) - { - ::WinSetWindowPos( GetHwnd() - ,HWND_TOP - ,vSwp.x - ,vSwp.y - ,vSwp.cx - ,vSwp.cy - ,SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER - ); - } - else - { - ::WinSetWindowPos( GetHwnd() - ,HWND_BOTTOM - ,vSwp.x - ,vSwp.y - ,vSwp.cx - ,vSwp.cy - ,SWP_HIDE | SWP_ZORDER - ); - } - return TRUE; -} // end of wxPopupWindow::Show - -/* static */ -wxPopupWindow* wxPopupWindow::FindPopupFor( - wxWindow* pWinParent -) -{ - // - // Find a popup with the given parent in the linked list of all shown - // popups - // - for ( wxWindowList::Node *node = m_svShownPopups.GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow* pWin = node->GetData(); - - if (pWin->GetParent() == pWinParent ) - return (wxPopupWindow *)pWin; - } - return NULL; -} // end of wxPopupWindow::FindPopupFor diff --git a/src/os2/thread.cpp b/src/os2/thread.cpp index af2e0f7304..db6ba06510 100644 --- a/src/os2/thread.cpp +++ b/src/os2/thread.cpp @@ -85,7 +85,9 @@ public: HMTX m_vMutex; }; -wxMutex::wxMutex() +wxMutex::wxMutex( + wxMutexType eMutexType +) { APIRET ulrc; @@ -95,13 +97,10 @@ wxMutex::wxMutex() { wxLogSysError(_("Can not create mutex.")); } - m_locked = 0; } wxMutex::~wxMutex() { - if (m_locked > 0) - wxLogDebug(wxT("Warning: freeing a locked mutex (%d locks)."), m_locked); ::DosCloseMutexSem(m_internal->m_vMutex); m_internal->m_vMutex = NULL; } @@ -131,7 +130,6 @@ wxMutexError wxMutex::Lock() default: wxFAIL_MSG(wxT("impossible return value in wxMutex::Lock")); } - m_locked++; return wxMUTEX_NO_ERROR; } @@ -143,7 +141,6 @@ wxMutexError wxMutex::TryLock() if (ulrc == ERROR_TIMEOUT || ulrc == ERROR_TOO_MANY_SEM_REQUESTS) return wxMUTEX_BUSY; - m_locked++; return wxMUTEX_NO_ERROR; } @@ -151,9 +148,6 @@ wxMutexError wxMutex::Unlock() { APIRET ulrc; - if (m_locked > 0) - m_locked--; - ulrc = ::DosReleaseMutexSem(m_internal->m_vMutex); if (ulrc != 0) { @@ -180,7 +174,7 @@ public: m_nWaiters = 0; } - inline bool Wait( + inline APIRET Wait( unsigned long ulTimeout ) { @@ -189,7 +183,7 @@ public: m_nWaiters++; ulrc = ::DosWaitEventSem(m_vEvent, ulTimeout); m_nWaiters--; - return (ulrc != ERROR_TIMEOUT); + return (ulrc); } inline ~wxConditionInternal () @@ -234,34 +228,80 @@ wxCondition::~wxCondition() m_internal = NULL; } -void wxCondition::Wait() +wxCondError wxCondition::Wait() { - (void)m_internal->Wait(SEM_INDEFINITE_WAIT); + APIRET rc = m_internal->Wait(SEM_INDEFINITE_WAIT); + + switch(rc) + { + case NO_ERROR: + return wxCOND_NO_ERROR; + case ERROR_INVALID_HANDLE: + return wxCOND_INVALID; + case ERROR_TIMEOUT: + return wxCOND_TIMEOUT; + default: + return wxCOND_MISC_ERROR; + } } -bool wxCondition::Wait( +wxCondError wxCondition::WaitTimeout( unsigned long lMilliSec ) { - return m_internal->Wait(lMilliSec); + APIRET rc = m_internal->Wait(lMilliSec); + + switch(rc) + { + case NO_ERROR: + return wxCOND_NO_ERROR; + case ERROR_INVALID_HANDLE: + return wxCOND_INVALID; + case ERROR_TIMEOUT: + return wxCOND_TIMEOUT; + default: + return wxCOND_MISC_ERROR; + } } -void wxCondition::Signal() +wxCondError wxCondition::Signal() { - ::DosPostEventSem(m_internal->m_vEvent); + APIRET rc = ::DosPostEventSem(m_internal->m_vEvent); + + switch(rc) + { + case NO_ERROR: + return wxCOND_NO_ERROR; + case ERROR_INVALID_HANDLE: + return wxCOND_INVALID; + default: + return wxCOND_MISC_ERROR; + } } -void wxCondition::Broadcast() +wxCondError wxCondition::Broadcast() { int i; + APIRET rc = NO_ERROR; for (i = 0; i < m_internal->m_nWaiters; i++) { - if (::DosPostEventSem(m_internal->m_vEvent) != 0) + if ((rc = ::DosPostEventSem(m_internal->m_vEvent)) != NO_ERROR) { wxLogSysError(_("Couldn't change the state of event object.")); + break; } } + + switch(rc) + { + case NO_ERROR: + return wxCOND_NO_ERROR; + case ERROR_INVALID_HANDLE: + return wxCOND_INVALID; + default: + return wxCOND_MISC_ERROR; + } } // ---------------------------------------------------------------------------- diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index 4e74fa9343..0b4219617a 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -59,6 +59,14 @@ extern void wxAssociateWinWithHandle( HWND hWnd bool wxTopLevelWindowOS2::m_sbInitialized = FALSE; wxWindow* wxTopLevelWindowOS2::m_spHiddenParent = NULL; +// ============================================================================ +// wxTopLevelWindowOS2 implementation +// ============================================================================ + +BEGIN_EVENT_TABLE(wxTopLevelWindowOS2, wxTopLevelWindowBase) + EVT_ACTIVATE(wxTopLevelWindowOS2::OnActivate) +END_EVENT_TABLE() + // ============================================================================ // wxTopLevelWindowMSW implementation // ============================================================================ @@ -70,21 +78,20 @@ MRESULT EXPENTRY wxDlgProc( HWND WXUNUSED(hWnd) ,MPARAM WXUNUSED(lParam) ) { - if (uMessage == WM_INITDLG) - { - // - // For this message, returning TRUE tells system to set focus to the - // first control in the dialog box. - // - return (MRESULT)TRUE; - } - else + switch(uMessage) { - // - // For all the other ones, FALSE means that we didn't process the - // message - // - return (MRESULT)FALSE; + case WM_INITDLG: + // + // For this message, returning TRUE tells system to set focus to + // the first control in the dialog box, but as we set the focus + // ourselves, we return FALSE from here as well, so fall through + // + default: + // + // For all the other ones, FALSE means that we didn't process the + // message + // + return (MRESULT)FALSE; } } // end of wxDlgProc @@ -111,8 +118,65 @@ void wxTopLevelWindowOS2::Init() m_hFrame = NULLHANDLE; memset(&m_vSwp, 0, sizeof(SWP)); memset(&m_vSwpClient, 0, sizeof(SWP)); + m_pWinLastFocused = (wxWindow *)NULL; } // end of wxTopLevelWindowIOS2::Init +void wxTopLevelWindowOS2::OnActivate( + wxActivateEvent& rEvent +) +{ + if (rEvent.GetActive()) + { + // + // Restore focus to the child which was last focused + // + wxLogTrace(_T("focus"), _T("wxTLW %08x activated."), m_hWnd); + + wxWindow* pParent = m_pWinLastFocused ? m_pWinLastFocused->GetParent() + : NULL; + if (!pParent) + { + pParent = this; + } + + wxSetFocusToChild( pParent + ,&m_pWinLastFocused + ); + } + else // deactivating + { + // + // Remember the last focused child if it is our child + // + m_pWinLastFocused = FindFocus(); + + // + // So we NULL it out if it's a child from some other frame + // + wxWindow* pWin = m_pWinLastFocused; + + while (pWin) + { + if (pWin->IsTopLevel()) + { + if (pWin != this) + { + m_pWinLastFocused = NULL; + } + break; + } + pWin = pWin->GetParent(); + } + + wxLogTrace(_T("focus"), + _T("wxTLW %08x deactivated, last focused: %08x."), + m_hWnd, + m_pWinLastFocused ? GetHwndOf(m_pWinLastFocused) + : NULL); + rEvent.Skip(); + } +} // end of wxTopLevelWindowOS2::OnActivate + WXDWORD wxTopLevelWindowOS2::OS2GetStyle( long lStyle , WXDWORD* pdwExflags diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 12a47e3f5d..318aeb93ec 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -293,11 +293,10 @@ void wxWindowOS2::Init() // // PM specific // - m_bDoubleClickAllowed = 0; m_bWinCaptured = FALSE; m_isBeingDeleted = FALSE; - m_fnOldWndProc = 0; + m_fnOldWndProc = NULL; m_bUseCtl3D = FALSE; m_bMouseInWindow = FALSE; m_bLastKeydownProcessed = FALSE; @@ -342,12 +341,12 @@ wxWindowOS2::~wxWindowOS2() for (wxWindow* pWin = GetParent(); pWin; pWin = pWin->GetParent()) { - wxFrame* pFrame = wxDynamicCast(pWin, wxFrame); + wxTopLevelWindow* pFrame = wxDynamicCast(pWin, wxTopLevelWindow); if (pFrame) { if (pFrame->GetLastFocus() == this) - pFrame->SetLastFocus((wxWindow*)NULL); + pFrame->SetLastFocus(NULL); } } @@ -2732,10 +2731,13 @@ MRESULT wxWindowOS2::OS2WindowProc( break; case WM_QUERYDLGCODE: - if ( m_lDlgCode ) + if (!IsOfStandardClass()) { - mResult = (MRESULT)m_lDlgCode; - bProcessed = TRUE; + if ( m_lDlgCode ) + { + mResult = (MRESULT)m_lDlgCode; + bProcessed = TRUE; + } } // //else: get the dlg code from the DefWindowProc() -- 2.45.2