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);
#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 ++)
DrawField(dc, i);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -26,6 +26,7 @@
#endif
#include "wx/tooltip.h"
#include "wx/os2/dcclient.h"
bool wxToolBar::m_bInitialized = false;
@ -601,7 +602,8 @@ void wxToolBar::OnPaint (
return;
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();
node;
node = node->GetNext() )

View File

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