Lots of fixes for OS/2

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-01-23 23:12:33 +00:00
parent bd330a69c9
commit e58dab20ce
17 changed files with 51 additions and 45 deletions

View File

@@ -288,8 +288,6 @@ protected:
wxAcceleratorTable m_vAccelTable; wxAcceleratorTable m_vAccelTable;
#endif // wxUSE_ACCEL #endif // wxUSE_ACCEL
wxFrame* m_pMenuBarFrame;
private: private:
// //
// Virtual function hiding suppression // Virtual function hiding suppression

View File

@@ -896,9 +896,13 @@ bool wxApp::ProcessMessage(
#endif // wxUSE_TOOLTIPS #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); wxTimerProc(NULL, 0, (int)pMsg->mp1, 0);
// //

View File

@@ -100,7 +100,7 @@ bool wxButton::Create(
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode
// //
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x

View File

@@ -131,7 +131,7 @@ bool wxCheckBox::Create(
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
SetSize( nX SetSize( nX
,nY ,nY

View File

@@ -143,7 +143,7 @@ bool wxComboBox::Create(
// //
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
int i; int i;

View File

@@ -144,7 +144,6 @@ bool wxFrame::Create(
,rsName ,rsName
)) ))
return FALSE; return FALSE;
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
wxModelessWindows.Append(this); wxModelessWindows.Append(this);
return TRUE; return TRUE;
} // end of wxFrame::Create } // end of wxFrame::Create

View File

@@ -179,8 +179,8 @@ bool wxListBox::Create(
{ {
Append(asChoices[lUi]); Append(asChoices[lUi]);
} }
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
// //
// Set standard wxWindows colors for Listbox items and highlighting // Set standard wxWindows colors for Listbox items and highlighting
// //

View File

@@ -628,7 +628,7 @@ wxMenuItem* wxMenu::FindItem(
void wxMenuBar::Init() void wxMenuBar::Init()
{ {
m_eventHandler = this; m_eventHandler = this;
m_pMenuBarFrame = NULL; m_menuBarFrame = NULL;
m_hMenu = 0; m_hMenu = 0;
} // end of wxMenuBar::Init } // end of wxMenuBar::Init
@@ -673,7 +673,7 @@ void wxMenuBar::Refresh()
{ {
wxCHECK_RET( IsAttached(), wxT("can't refresh unatteched menubar") ); 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 } // end of wxMenuBar::Refresh
WXHMENU wxMenuBar::Create() WXHMENU wxMenuBar::Create()
@@ -689,8 +689,8 @@ WXHMENU wxMenuBar::Create()
// //
// Menubars should be associated with a frame otherwise they are popups // Menubars should be associated with a frame otherwise they are popups
// //
if (m_pMenuBarFrame != NULL) if (m_menuBarFrame != NULL)
hFrame = GetWinHwnd(m_pMenuBarFrame); hFrame = GetWinHwnd(m_menuBarFrame);
else else
hFrame = HWND_DESKTOP; hFrame = HWND_DESKTOP;
// //
@@ -900,8 +900,6 @@ bool wxMenuBar::Insert(
,nPos ,nPos
); );
pMenu->Attach(this);
if (IsAttached()) if (IsAttached())
{ {
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)Title.c_str()); ::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!") ); wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
m_pMenuBarFrame = pFrame; m_menuBarFrame = pFrame;
#if wxUSE_ACCEL #if wxUSE_ACCEL
RebuildAccelTable(); RebuildAccelTable();
@@ -1043,7 +1041,7 @@ void wxMenuBar::Detach()
{ {
::WinDestroyWindow((HWND)m_hMenu); ::WinDestroyWindow((HWND)m_hMenu);
m_hMenu = (WXHMENU)NULL; m_hMenu = (WXHMENU)NULL;
m_pMenuBarFrame = NULL; m_menuBarFrame = NULL;
} // end of wxMenuBar::Detach } // end of wxMenuBar::Detach
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

View File

@@ -329,7 +329,7 @@ bool wxSlider::Create(
m_hWnd = (WXHWND)hScrollBar; m_hWnd = (WXHWND)hScrollBar;
SubclassWin(GetHWND()); SubclassWin(GetHWND());
::WinSetWindowText((HWND)m_hWnd, ""); ::WinSetWindowText((HWND)m_hWnd, "");
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
if (m_windowStyle & wxSL_LABELS) if (m_windowStyle & wxSL_LABELS)
{ {
// //

View File

@@ -141,7 +141,7 @@ bool wxSpinButton::Create(
::WinQueryWindowPos(m_hWnd, &vSwp); ::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x); SetXComp(vSwp.x);
SetYComp(vSwp.y); SetYComp(vSwp.y);
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
// //
// For OS/2 we want to hide the text portion so we can substitute an // 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 // independent text ctrl in its place. 10 device units does this

View File

@@ -187,7 +187,7 @@ bool wxSpinCtrl::Create(
m_hWndBuddy = m_hWnd; // One in the same for OS/2 m_hWndBuddy = m_hWnd; // One in the same for OS/2
if(pParent) if(pParent)
pParent->AddChild((wxSpinButton *)this); pParent->AddChild((wxSpinButton *)this);
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
::WinQueryWindowPos(m_hWnd, &vSwp); ::WinQueryWindowPos(m_hWnd, &vSwp);
SetXComp(vSwp.x); SetXComp(vSwp.x);
SetYComp(vSwp.y); SetYComp(vSwp.y);

View File

@@ -93,7 +93,7 @@ bool wxStaticBitmap::Create(
// Subclass again for purposes of dialog editing mode // Subclass again for purposes of dialog editing mode
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
SetFont(GetParent()->GetFont()); SetFont(*wxSMALL_FONT);
SetSize(nX, nY, nWidth, nHeight); SetSize(nX, nY, nWidth, nHeight);
return(FALSE); return(FALSE);
} }

View File

@@ -79,7 +79,7 @@ bool wxStaticBox::Create(
,sizeof(LONG) ,sizeof(LONG)
,(PVOID)&lColor ,(PVOID)&lColor
); );
SetFont(pParent->GetFont()); SetFont(*wxSMALL_FONT);
SetSize( rPos.x SetSize( rPos.x
,rPos.y ,rPos.y
,rSize.x ,rSize.x

View File

@@ -110,7 +110,7 @@ bool wxStaticText::Create(
); );
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
wxControl::SetFont(pParent->GetFont()); wxControl::SetFont(*wxSMALL_FONT);
SetSize( nX SetSize( nX
,nY ,nY
,nWidth ,nWidth

View File

@@ -208,16 +208,7 @@ bool wxTextCtrl::Create(
// //
// Set font, position, size and initial value // Set font, position, size and initial value
// //
wxFont& vFontParent = pParent->GetFont(); SetFont(*wxSMALL_FONT);
if (vFontParent.Ok())
{
SetFont(vFontParent);
}
else
{
SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
}
if (!rsValue.IsEmpty()) if (!rsValue.IsEmpty())
{ {
SetValue(rsValue); SetValue(rsValue);

View File

@@ -351,7 +351,7 @@ bool wxTopLevelWindowOS2::CreateFrame(
wxAssociateWinWithHandle(m_hWnd, this); wxAssociateWinWithHandle(m_hWnd, this);
wxAssociateWinWithHandle(m_hFrame, this); wxAssociateWinWithHandle(m_hFrame, this);
m_backgroundColour.Set(wxString("DARK GREY")); m_backgroundColour.Set(wxString("MEDIUM GREY"));
LONG lColor = (LONG)m_backgroundColour.GetPixel(); LONG lColor = (LONG)m_backgroundColour.GetPixel();

View File

@@ -1051,9 +1051,20 @@ void wxWindowOS2::SubclassWin(
{ {
HWND hwnd = (HWND)hWnd; HWND hwnd = (HWND)hWnd;
wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") );
wxCHECK_RET(::WinIsWindow(vHabmain, hwnd), wxT("invalid HWND in SubclassWin") ); 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 } // end of wxWindowOS2::SubclassWin
void wxWindowOS2::UnsubclassWin() void wxWindowOS2::UnsubclassWin()
@@ -3026,17 +3037,22 @@ bool wxWindowOS2::OS2Create(
// //
if (pParent) if (pParent)
{ {
if (IsKindOf(CLASSINFO(wxStatusBar)) && if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
pParent->IsKindOf(CLASSINFO(wxFrame))) pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
)
{ {
RECTL vRect; if (IsKindOf(CLASSINFO(wxStatusBar)) &&
wxFrame* pFrame = wxDynamicCast(pParent, wxFrame); pParent->IsKindOf(CLASSINFO(wxFrame)))
{
RECTL vRect;
wxFrame* pFrame = wxDynamicCast(pParent, wxFrame);
::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect); ::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect);
nY = vRect.yTop - (nY + nHeight); nY = vRect.yTop - (nY + nHeight);
}
else
nY = pParent->GetSize().y - (nY + nHeight);
} }
else
nY = pParent->GetSize().y - (nY + nHeight);
} }
else else
{ {