Fixed OS/2 compilation after wxDC changes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2008-01-19 21:15:03 +00:00
parent ad8dd67e02
commit 38400bb46b
7 changed files with 100 additions and 91 deletions

View File

@@ -241,13 +241,6 @@ void wxStatusBarGeneric::OnPaint(wxPaintEvent& WXUNUSED(event) )
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
#ifdef __WXPM__
wxColour vColor;
vColor = wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR);
::WinFillRect(dc.m_hPS, &dc.m_vRclPaint, vColor.GetPixel());
#endif
for (int i = 0; i < m_nFields; i ++) for (int i = 0; i < m_nFields; i ++)
DrawField(dc, i); DrawField(dc, i);
} }

View File

@@ -19,6 +19,7 @@
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#endif #endif
#include "wx/os2/dcclient.h"
#include "wx/os2/private.h" #include "wx/os2/private.h"
@@ -129,8 +130,9 @@ bool wxBitmapButton::OS2OnDraw( WXDRAWITEMSTRUCT* pItem)
// //
int nX1 = 0; int nX1 = 0;
int nY1 = 0; int nY1 = 0;
int nWidth = vDc.m_vRclPaint.xRight - vDc.m_vRclPaint.xLeft; wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
int nHeight = vDc.m_vRclPaint.yTop - vDc.m_vRclPaint.yBottom; int nWidth = impl->m_vRclPaint.xRight - impl->m_vRclPaint.xLeft;
int nHeight = impl->m_vRclPaint.yTop - impl->m_vRclPaint.yBottom;
int nBmpWidth = pBitmap->GetWidth(); int nBmpWidth = pBitmap->GetWidth();
int nBmpHeight = pBitmap->GetHeight(); int nBmpHeight = pBitmap->GetHeight();
@@ -189,31 +191,32 @@ void wxBitmapButton::DrawFace (wxClientDC& rDC, bool bSel)
// Note: DrawLine expects wxWidgets coordinate system so swap // Note: DrawLine expects wxWidgets coordinate system so swap
// //
rDC.SetPen(bSel ? vDarkShadowPen : vHiLitePen); rDC.SetPen(bSel ? vDarkShadowPen : vHiLitePen);
wxPMDCImpl *impl = (wxPMDCImpl*) rDC.GetImpl();
// top // top
rDC.DrawLine( rDC.m_vRclPaint.xLeft + 1 rDC.DrawLine( impl->m_vRclPaint.xLeft + 1
,rDC.m_vRclPaint.yBottom + 1 ,impl->m_vRclPaint.yBottom + 1
,rDC.m_vRclPaint.xRight - 1 ,impl->m_vRclPaint.xRight - 1
,rDC.m_vRclPaint.yBottom + 1 ,impl->m_vRclPaint.yBottom + 1
); );
// left // left
rDC.DrawLine( rDC.m_vRclPaint.xLeft + 1 rDC.DrawLine( impl->m_vRclPaint.xLeft + 1
,rDC.m_vRclPaint.yBottom + 1 ,impl->m_vRclPaint.yBottom + 1
,rDC.m_vRclPaint.xLeft + 1 ,impl->m_vRclPaint.xLeft + 1
,rDC.m_vRclPaint.yTop - 1 ,impl->m_vRclPaint.yTop - 1
); );
rDC.SetPen(bSel ? vHiLitePen : vDarkShadowPen); rDC.SetPen(bSel ? vHiLitePen : vDarkShadowPen);
// bottom // bottom
rDC.DrawLine( rDC.m_vRclPaint.xLeft + 1 rDC.DrawLine( impl->m_vRclPaint.xLeft + 1
,rDC.m_vRclPaint.yTop - 1 ,impl->m_vRclPaint.yTop - 1
,rDC.m_vRclPaint.xRight - 1 ,impl->m_vRclPaint.xRight - 1
,rDC.m_vRclPaint.yTop - 1 ,impl->m_vRclPaint.yTop - 1
); );
// right // right
rDC.DrawLine( rDC.m_vRclPaint.xRight - 1 rDC.DrawLine( impl->m_vRclPaint.xRight - 1
,rDC.m_vRclPaint.yBottom + 1 ,impl->m_vRclPaint.yBottom + 1
,rDC.m_vRclPaint.xRight - 1 ,impl->m_vRclPaint.xRight - 1
,rDC.m_vRclPaint.yTop - 1 ,impl->m_vRclPaint.yTop - 1
); );
} // end of wxBitmapButton::DrawFace } // end of wxBitmapButton::DrawFace
@@ -229,29 +232,30 @@ void wxBitmapButton::DrawButtonFocus (
// Note: DrawLine expects wxWidgets coordinate system so swap // Note: DrawLine expects wxWidgets coordinate system so swap
// //
rDC.SetPen(vBlackPen); rDC.SetPen(vBlackPen);
wxPMDCImpl *impl = (wxPMDCImpl*) rDC.GetImpl();
// top // top
rDC.DrawLine( rDC.m_vRclPaint.xLeft rDC.DrawLine( impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
,rDC.m_vRclPaint.xRight ,impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
); );
// right // right
rDC.DrawLine( rDC.m_vRclPaint.xRight rDC.DrawLine( impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
,rDC.m_vRclPaint.xRight ,impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
); );
// bottom // bottom
rDC.DrawLine( rDC.m_vRclPaint.xRight rDC.DrawLine( impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
,rDC.m_vRclPaint.xLeft ,impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
); );
// left // left
rDC.DrawLine( rDC.m_vRclPaint.xLeft rDC.DrawLine( impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
,rDC.m_vRclPaint.xLeft ,impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
); );
} // end of wxBitmapButton::DrawButtonFocus } // end of wxBitmapButton::DrawButtonFocus
@@ -265,29 +269,30 @@ void wxBitmapButton::DrawButtonDisable( wxClientDC& rDC,
// Note: DrawLine expects wxWidgets coordinate system so swap // Note: DrawLine expects wxWidgets coordinate system so swap
// //
rDC.SetPen(vGreyPen); rDC.SetPen(vGreyPen);
wxPMDCImpl *impl = (wxPMDCImpl*) rDC.GetImpl();
// top // top
rDC.DrawLine( rDC.m_vRclPaint.xLeft rDC.DrawLine( impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
,rDC.m_vRclPaint.xRight ,impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
); );
// right // right
rDC.DrawLine( rDC.m_vRclPaint.xRight rDC.DrawLine( impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
,rDC.m_vRclPaint.xRight ,impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
); );
// bottom // bottom
rDC.DrawLine( rDC.m_vRclPaint.xRight rDC.DrawLine( impl->m_vRclPaint.xRight
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
,rDC.m_vRclPaint.xLeft ,impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
); );
// left // left
rDC.DrawLine( rDC.m_vRclPaint.xLeft rDC.DrawLine( impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yTop ,impl->m_vRclPaint.yTop
,rDC.m_vRclPaint.xLeft ,impl->m_vRclPaint.xLeft
,rDC.m_vRclPaint.yBottom ,impl->m_vRclPaint.yBottom
); );
wxDisableBitmap(rBmp, vGreyPen.GetColour().GetPixel()); wxDisableBitmap(rBmp, vGreyPen.GetColour().GetPixel());
} // end of wxBitmapButton::DrawButtonDisable } // end of wxBitmapButton::DrawButtonDisable

View File

@@ -33,6 +33,7 @@
#include "wx/font.h" #include "wx/font.h"
#endif #endif
#include "wx/os2/dc.h"
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
#define INCL_PM #define INCL_PM
@@ -112,7 +113,9 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
{ {
wxRect vRect = rRect; wxRect vRect = rRect;
::WinQueryWindowRect( m_pParent->GetHWND(), &rDc.m_vRclPaint );
wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
::WinQueryWindowRect( m_pParent->GetHWND(), &impl->m_vRclPaint );
if (IsChecked()) if (IsChecked())
eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked); eStat = (wxOwnerDrawn::wxODStatus)(eStat | wxOwnerDrawn::wxODChecked);
@@ -167,8 +170,8 @@ bool wxCheckListBoxItem::OnDrawItem ( wxDC& rDc,
// //
HBITMAP hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK ); HBITMAP hChkBmp = ::WinGetSysBitmap( HWND_DESKTOP, SBMP_MENUCHECK );
POINTL vPoint = {nX, nOldY + 3}; POINTL vPoint = {nX, nOldY + 3};
wxPMDCImpl *impl = (wxPMDCImpl*) rDc.GetImpl();
::WinDrawBitmap( rDc.GetHPS(), ::WinDrawBitmap( impl->GetHPS(),
hChkBmp, hChkBmp,
NULL, NULL,
&vPoint, &vPoint,

View File

@@ -29,6 +29,7 @@
#include "wx/window.h" #include "wx/window.h"
#endif #endif
#include "wx/os2/dcclient.h"
#include "wx/os2/private.h" #include "wx/os2/private.h"
#define INCL_M #define INCL_M
@@ -738,12 +739,13 @@ bool wxListBox::OS2OnDraw (
wxCHECK(pData, false ); wxCHECK(pData, false );
wxDC vDc; wxClientDC vDc(this);
wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop ); wxPoint pt1( pDrawStruct->rclItem.xLeft, pDrawStruct->rclItem.yTop );
wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom ); wxPoint pt2( pDrawStruct->rclItem.xRight, pDrawStruct->rclItem.yBottom );
wxRect vRect( pt1, pt2 ); wxRect vRect( pt1, pt2 );
vDc.SetHPS(pDrawStruct->hps); impl->SetHPS(pDrawStruct->hps);
if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld) if (pDrawStruct->fsAttribute == pDrawStruct->fsAttributeOld)
{ {

View File

@@ -27,6 +27,7 @@
#endif #endif
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
#include "wx/os2/dcclient.h"
// ============================================================================ // ============================================================================
// implementation of wxOwnerDrawn class // implementation of wxOwnerDrawn class
@@ -78,8 +79,8 @@ bool wxOwnerDrawn::OnMeasureItem( size_t* pWidth,
} }
vDC.SetFont(GetFont()); vDC.SetFont(GetFont());
vDC.GetTextExtent( sStr vDC.GetTextExtent( sStr
,(long *)pWidth ,(wxCoord *)pWidth
,(long *)pHeight ,(wxCoord *)pHeight
); );
if (!m_strAccel.empty()) if (!m_strAccel.empty())
{ {
@@ -155,8 +156,9 @@ bool wxOwnerDrawn::OnMeasureItem( size_t* pWidth,
// Make sure that this item is at least as // Make sure that this item is at least as
// tall as the user's system settings specify // tall as the user's system settings specify
// //
if (*pHeight < m_nMinHeight) const size_t heightStd = 6; // FIXME: get value from the system
*pHeight = m_nMinHeight; if ( *pHeight < heightStd )
*pHeight = heightStd;
m_nHeight = *pHeight; // remember height for use in OnDrawItem m_nHeight = *pHeight; // remember height for use in OnDrawItem
return true; return true;
} // end of wxOwnerDrawn::OnMeasureItem } // end of wxOwnerDrawn::OnMeasureItem
@@ -179,7 +181,8 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
// //
CHARBUNDLE vCbnd; CHARBUNDLE vCbnd;
HPS hPS= rDC.GetHPS(); wxPMDCImpl *impl = (wxPMDCImpl*) rDC.GetImpl();
HPS hPS= impl->GetHPS();
wxColour vColBack; wxColour vColBack;
wxColour vColText; wxColour vColText;
COLORREF vRef; COLORREF vRef;
@@ -333,13 +336,13 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
bFoundMnemonic = true; bFoundMnemonic = true;
sTmp.Remove(nIndex); sTmp.Remove(nIndex);
rDC.GetTextExtent( sTmp rDC.GetTextExtent( sTmp
,(long *)&nWidth ,(wxCoord *)&nWidth
,(long *)&nHeight ,(wxCoord *)&nHeight
); );
sTmp = sFullString[(size_t)(nIndex + 1)]; sTmp = sFullString[(size_t)(nIndex + 1)];
rDC.GetTextExtent( sTmp rDC.GetTextExtent( sTmp
,(long *)&nCharWidth ,(wxCoord *)&nCharWidth
,(long *)&nHeight ,(wxCoord *)&nHeight
); );
sFullString.Replace(sTgt.c_str(), wxEmptyString, true); sFullString.Replace(sTgt.c_str(), wxEmptyString, true);
} }
@@ -348,7 +351,7 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
// Draw the main item text sans the accel text // Draw the main item text sans the accel text
// //
POINTL vPntStart = {nX, rRect.y + 4}; POINTL vPntStart = {nX, rRect.y + 4};
::GpiCharStringAt( rDC.GetHPS() ::GpiCharStringAt( impl->GetHPS()
,&vPntStart ,&vPntStart
,sFullString.length() ,sFullString.length()
,sFullString.char_str() ,sFullString.char_str()
@@ -378,15 +381,15 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
size_t nHeight; size_t nHeight;
rDC.GetTextExtent( sAccel rDC.GetTextExtent( sAccel
,(long *)&nWidth ,(wxCoord *)&nWidth
,(long *)&nHeight ,(wxCoord *)&nHeight
); );
// //
// Back off the starting position from the right edge // Back off the starting position from the right edge
// //
vPntStart.x = rRect.width - (nWidth + 7); vPntStart.x = rRect.width - (nWidth + 7);
vPntStart.y = rRect.y + 4; vPntStart.y = rRect.y + 4;
::GpiCharStringAt( rDC.GetHPS() ::GpiCharStringAt( impl->GetHPS()
,&vPntStart ,&vPntStart
,sAccel.length() ,sAccel.length()
,sAccel.char_str() ,sAccel.char_str()

View File

@@ -26,6 +26,7 @@
#endif #endif
#include "wx/tooltip.h" #include "wx/tooltip.h"
#include "wx/os2/dcclient.h"
bool wxToolBar::m_bInitialized = false; bool wxToolBar::m_bInitialized = false;
@@ -601,7 +602,8 @@ void wxToolBar::OnPaint (
return; return;
nCount++; nCount++;
::WinFillRect(vDc.GetHPS(), &vDc.m_vRclPaint, GetBackgroundColour().GetPixel()); wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
::WinFillRect(impl->GetHPS(), &impl->m_vRclPaint, GetBackgroundColour().GetPixel());
for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
node; node;
node = node->GetNext() ) node = node->GetNext() )

View File

@@ -51,6 +51,8 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#include "wx/os2/dcclient.h"
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
#include "wx/ownerdrw.h" #include "wx/ownerdrw.h"
#endif #endif
@@ -121,7 +123,7 @@
QMSG s_currentMsg; QMSG s_currentMsg;
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
wxMenu* wxCurrentPopupMenu = NULL; extern wxMenu* wxCurrentPopupMenu;
#endif // wxUSE_MENUS_NATIVE #endif // wxUSE_MENUS_NATIVE
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -1784,10 +1786,6 @@ bool wxWindowOS2::DoPopupMenu( wxMenu* pMenu, int nX, int nY )
bool bIsWaiting = true; bool bIsWaiting = true;
int nHeight; int nHeight;
// Protect against recursion
if (wxCurrentPopupMenu)
return false;
pMenu->SetInvokingWindow(this); pMenu->SetInvokingWindow(this);
pMenu->UpdateUI(); pMenu->UpdateUI();
@@ -3204,7 +3202,7 @@ bool wxWindowOS2::OS2OnDrawItem( int vId,
WXDRAWITEMSTRUCT* pItemStruct ) WXDRAWITEMSTRUCT* pItemStruct )
{ {
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
wxDC vDc; wxClientDC vDc(this);
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
// //
@@ -3223,8 +3221,10 @@ bool wxWindowOS2::OS2OnDrawItem( int vId,
,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft ,pMeasureStruct->rclItem.xRight - pMeasureStruct->rclItem.xLeft
,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom ,pMeasureStruct->rclItem.yTop - pMeasureStruct->rclItem.yBottom
); );
vDc.SetHDC( hDC, false );
vDc.SetHPS( pMeasureStruct->hps ); wxPMDCImpl *impl = (wxPMDCImpl*) vDc.GetImpl();
impl->SetHDC( hDC, false );
impl->SetHPS( pMeasureStruct->hps );
// //
// Load the wxWidgets Pallete and set to RGB mode // Load the wxWidgets Pallete and set to RGB mode
// //
@@ -3485,7 +3485,7 @@ void wxWindow::OnPaint (
wxPaintEvent& rEvent wxPaintEvent& rEvent
) )
{ {
HDC hDC = (HDC)wxPaintDC::FindDCInCache((wxWindow*) rEvent.GetEventObject()); HDC hDC = (HDC)wxPaintDCImpl::FindDCInCache((wxWindow*) rEvent.GetEventObject());
if (hDC != 0) if (hDC != 0)
{ {
@@ -3670,10 +3670,10 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
if (vSwp.fl & SWP_MINIMIZE) if (vSwp.fl & SWP_MINIMIZE)
return true; return true;
wxDC vDC; wxClientDC vDC(this);
wxPMDCImpl *impl = (wxPMDCImpl*) vDC.GetImpl();
vDC.m_hPS = (HPS)hDC; // this is really a PS impl->SetHDC(hDC);
vDC.SetWindow((wxWindow*)this); impl->SetHPS((HPS)hDC); // this is really a PS
wxEraseEvent vEvent(m_windowId, &vDC); wxEraseEvent vEvent(m_windowId, &vDC);
@@ -3681,14 +3681,15 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC )
rc = HandleWindowEvent(vEvent); rc = HandleWindowEvent(vEvent);
vDC.m_hPS = NULLHANDLE; impl->SetHPS(NULLHANDLE);
return true; return true;
} // end of wxWindowOS2::HandleEraseBkgnd } // end of wxWindowOS2::HandleEraseBkgnd
void wxWindowOS2::OnEraseBackground(wxEraseEvent& rEvent) void wxWindowOS2::OnEraseBackground(wxEraseEvent& rEvent)
{ {
RECTL vRect; RECTL vRect;
HPS hPS = rEvent.GetDC()->GetHPS(); wxPMDCImpl *impl = (wxPMDCImpl*) rEvent.GetDC()->GetImpl();
HPS hPS = impl->GetHPS();
APIRET rc; APIRET rc;
LONG lColor = m_backgroundColour.GetPixel(); LONG lColor = m_backgroundColour.GetPixel();