From e58dab20ce995856303154a367bcca904066525c Mon Sep 17 00:00:00 2001 From: David Webster Date: Wed, 23 Jan 2002 23:12:33 +0000 Subject: [PATCH] Lots of fixes for OS/2 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/menu.h | 2 -- src/os2/app.cpp | 8 ++++++-- src/os2/button.cpp | 2 +- src/os2/checkbox.cpp | 2 +- src/os2/combobox.cpp | 2 +- src/os2/frame.cpp | 1 - src/os2/listbox.cpp | 4 ++-- src/os2/menu.cpp | 14 ++++++-------- src/os2/slider.cpp | 2 +- src/os2/spinbutt.cpp | 2 +- src/os2/spinctrl.cpp | 2 +- src/os2/statbmp.cpp | 2 +- src/os2/statbox.cpp | 2 +- src/os2/stattext.cpp | 2 +- src/os2/textctrl.cpp | 11 +---------- src/os2/toplevel.cpp | 2 +- src/os2/window.cpp | 36 ++++++++++++++++++++++++++---------- 17 files changed, 51 insertions(+), 45 deletions(-) diff --git a/include/wx/os2/menu.h b/include/wx/os2/menu.h index e75b73d6f0..4a0baba04b 100644 --- a/include/wx/os2/menu.h +++ b/include/wx/os2/menu.h @@ -288,8 +288,6 @@ protected: wxAcceleratorTable m_vAccelTable; #endif // wxUSE_ACCEL - wxFrame* m_pMenuBarFrame; - private: // // Virtual function hiding suppression diff --git a/src/os2/app.cpp b/src/os2/app.cpp index a2608efbf2..7bcf7d2b7d 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -896,9 +896,13 @@ bool wxApp::ProcessMessage( #endif // wxUSE_TOOLTIPS // - // We must relay Timer events to wxTimer's processing function + // Pass non-system timer messages to the wxTimerProc // - if (pMsg->msg == WM_TIMER) + if (pMsg->msg == WM_TIMER && + (SHORT1FROMMP(pMsg->mp1) != TID_CURSOR && + SHORT1FROMMP(pMsg->mp1) != TID_FLASHWINDOW && + SHORT1FROMMP(pMsg->mp1) != TID_SCROLL + )) wxTimerProc(NULL, 0, (int)pMsg->mp1, 0); // diff --git a/src/os2/button.cpp b/src/os2/button.cpp index 83301398f7..ab27b61602 100644 --- a/src/os2/button.cpp +++ b/src/os2/button.cpp @@ -100,7 +100,7 @@ bool wxButton::Create( // Subclass again for purposes of dialog editing mode // SubclassWin(m_hWnd); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); SetSize( rPos.x ,rPos.y ,rSize.x diff --git a/src/os2/checkbox.cpp b/src/os2/checkbox.cpp index eaa7389885..2c18c0eb22 100644 --- a/src/os2/checkbox.cpp +++ b/src/os2/checkbox.cpp @@ -131,7 +131,7 @@ bool wxCheckBox::Create( ,(PVOID)&lColor ); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); SetSize( nX ,nY diff --git a/src/os2/combobox.cpp b/src/os2/combobox.cpp index 1fd96160e5..fc4697b255 100644 --- a/src/os2/combobox.cpp +++ b/src/os2/combobox.cpp @@ -143,7 +143,7 @@ bool wxComboBox::Create( // SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); int i; diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 0f687f7f86..4b5e439c6a 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -144,7 +144,6 @@ bool wxFrame::Create( ,rsName )) return FALSE; - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); wxModelessWindows.Append(this); return TRUE; } // end of wxFrame::Create diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 290b46be30..f99ec829ec 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -179,8 +179,8 @@ bool wxListBox::Create( { Append(asChoices[lUi]); } - SetFont(pParent->GetFont()); - + SetFont(*wxSMALL_FONT); + // // Set standard wxWindows colors for Listbox items and highlighting // diff --git a/src/os2/menu.cpp b/src/os2/menu.cpp index a964e5497a..6b82bb84fd 100644 --- a/src/os2/menu.cpp +++ b/src/os2/menu.cpp @@ -628,7 +628,7 @@ wxMenuItem* wxMenu::FindItem( void wxMenuBar::Init() { m_eventHandler = this; - m_pMenuBarFrame = NULL; + m_menuBarFrame = NULL; m_hMenu = 0; } // end of wxMenuBar::Init @@ -673,7 +673,7 @@ void wxMenuBar::Refresh() { wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") ); - WinSendMsg(GetWinHwnd(m_pMenuBarFrame), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); + WinSendMsg(GetWinHwnd(m_menuBarFrame), WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0); } // end of wxMenuBar::Refresh WXHMENU wxMenuBar::Create() @@ -689,8 +689,8 @@ WXHMENU wxMenuBar::Create() // // Menubars should be associated with a frame otherwise they are popups // - if (m_pMenuBarFrame != NULL) - hFrame = GetWinHwnd(m_pMenuBarFrame); + if (m_menuBarFrame != NULL) + hFrame = GetWinHwnd(m_menuBarFrame); else hFrame = HWND_DESKTOP; // @@ -900,8 +900,6 @@ bool wxMenuBar::Insert( ,nPos ); - pMenu->Attach(this); - if (IsAttached()) { ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)Title.c_str()); @@ -1024,7 +1022,7 @@ void wxMenuBar::Attach( ) { wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") ); - m_pMenuBarFrame = pFrame; + m_menuBarFrame = pFrame; #if wxUSE_ACCEL RebuildAccelTable(); @@ -1043,7 +1041,7 @@ void wxMenuBar::Detach() { ::WinDestroyWindow((HWND)m_hMenu); m_hMenu = (WXHMENU)NULL; - m_pMenuBarFrame = NULL; + m_menuBarFrame = NULL; } // end of wxMenuBar::Detach // --------------------------------------------------------------------------- diff --git a/src/os2/slider.cpp b/src/os2/slider.cpp index 931d848e9d..7819dca287 100644 --- a/src/os2/slider.cpp +++ b/src/os2/slider.cpp @@ -329,7 +329,7 @@ bool wxSlider::Create( m_hWnd = (WXHWND)hScrollBar; SubclassWin(GetHWND()); ::WinSetWindowText((HWND)m_hWnd, ""); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); if (m_windowStyle & wxSL_LABELS) { // diff --git a/src/os2/spinbutt.cpp b/src/os2/spinbutt.cpp index 55e9b2c6a3..720b9d0f1e 100644 --- a/src/os2/spinbutt.cpp +++ b/src/os2/spinbutt.cpp @@ -141,7 +141,7 @@ bool wxSpinButton::Create( ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); // // For OS/2 we want to hide the text portion so we can substitute an // independent text ctrl in its place. 10 device units does this diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index 6804a3ab94..bfda23f725 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -187,7 +187,7 @@ bool wxSpinCtrl::Create( m_hWndBuddy = m_hWnd; // One in the same for OS/2 if(pParent) pParent->AddChild((wxSpinButton *)this); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); ::WinQueryWindowPos(m_hWnd, &vSwp); SetXComp(vSwp.x); SetYComp(vSwp.y); diff --git a/src/os2/statbmp.cpp b/src/os2/statbmp.cpp index f162d5c472..d06a109a0e 100644 --- a/src/os2/statbmp.cpp +++ b/src/os2/statbmp.cpp @@ -93,7 +93,7 @@ bool wxStaticBitmap::Create( // Subclass again for purposes of dialog editing mode SubclassWin(m_hWnd); - SetFont(GetParent()->GetFont()); + SetFont(*wxSMALL_FONT); SetSize(nX, nY, nWidth, nHeight); return(FALSE); } diff --git a/src/os2/statbox.cpp b/src/os2/statbox.cpp index 792a6fd304..7ca2b7fa23 100644 --- a/src/os2/statbox.cpp +++ b/src/os2/statbox.cpp @@ -79,7 +79,7 @@ bool wxStaticBox::Create( ,sizeof(LONG) ,(PVOID)&lColor ); - SetFont(pParent->GetFont()); + SetFont(*wxSMALL_FONT); SetSize( rPos.x ,rPos.y ,rSize.x diff --git a/src/os2/stattext.cpp b/src/os2/stattext.cpp index 7f033e228c..8719214241 100644 --- a/src/os2/stattext.cpp +++ b/src/os2/stattext.cpp @@ -110,7 +110,7 @@ bool wxStaticText::Create( ); SubclassWin(m_hWnd); - wxControl::SetFont(pParent->GetFont()); + wxControl::SetFont(*wxSMALL_FONT); SetSize( nX ,nY ,nWidth diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index 4070a29689..66b4819ebb 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -208,16 +208,7 @@ bool wxTextCtrl::Create( // // Set font, position, size and initial value // - wxFont& vFontParent = pParent->GetFont(); - - if (vFontParent.Ok()) - { - SetFont(vFontParent); - } - else - { - SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT)); - } + SetFont(*wxSMALL_FONT); if (!rsValue.IsEmpty()) { SetValue(rsValue); diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index abbd5c5c21..238342a052 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -351,7 +351,7 @@ bool wxTopLevelWindowOS2::CreateFrame( wxAssociateWinWithHandle(m_hWnd, this); wxAssociateWinWithHandle(m_hFrame, this); - m_backgroundColour.Set(wxString("DARK GREY")); + m_backgroundColour.Set(wxString("MEDIUM GREY")); LONG lColor = (LONG)m_backgroundColour.GetPixel(); diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 30ac8d5c44..8dbadd4520 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -1051,9 +1051,20 @@ void wxWindowOS2::SubclassWin( { HWND hwnd = (HWND)hWnd; - wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") ); wxCHECK_RET(::WinIsWindow(vHabmain, hwnd), wxT("invalid HWND in SubclassWin") ); - m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc); + wxAssociateWinWithHandle( hWnd + ,(wxWindow*)this + ); + if (!wxCheckWindowWndProc( hWnd + ,(WXFARPROC)wxWndProc + )) + { + m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc); + } + else + { + m_fnOldWndProc = (WXFARPROC)NULL; + } } // end of wxWindowOS2::SubclassWin void wxWindowOS2::UnsubclassWin() @@ -3026,17 +3037,22 @@ bool wxWindowOS2::OS2Create( // if (pParent) { - if (IsKindOf(CLASSINFO(wxStatusBar)) && - pParent->IsKindOf(CLASSINFO(wxFrame))) + if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) || + pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) + ) { - RECTL vRect; - wxFrame* pFrame = wxDynamicCast(pParent, wxFrame); + if (IsKindOf(CLASSINFO(wxStatusBar)) && + pParent->IsKindOf(CLASSINFO(wxFrame))) + { + RECTL vRect; + wxFrame* pFrame = wxDynamicCast(pParent, wxFrame); - ::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect); - nY = vRect.yTop - (nY + nHeight); + ::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect); + nY = vRect.yTop - (nY + nHeight); + } + else + nY = pParent->GetSize().y - (nY + nHeight); } - else - nY = pParent->GetSize().y - (nY + nHeight); } else { -- 2.45.2