Adopted OS/2 to DC reorganisation (r50348).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2008-01-06 22:37:10 +00:00
parent b5343e065a
commit 2c24e7adf0
11 changed files with 373 additions and 409 deletions

View File

@@ -13,6 +13,7 @@
#define _WX_DC_H_ #define _WX_DC_H_
#include "wx/defs.h" #include "wx/defs.h"
#include "wx/dc.h"
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// macros // macros
@@ -94,13 +95,15 @@ public:
}; // end of CLASS wxDCCacheEntry }; // end of CLASS wxDCCacheEntry
#endif #endif
class WXDLLEXPORT wxDC : public wxDCBase // this is an ABC: use one of the derived classes to create a DC associated
// with a window, screen, printer and so on
class WXDLLEXPORT wxPMDCImpl : public wxDCImpl
{ {
DECLARE_DYNAMIC_CLASS(wxDC) DECLARE_DYNAMIC_CLASS(wxDC)
public: public:
wxDC(void); wxPMDCImpl(wxDC *owner, WXHDC hDC);
virtual ~wxDC(); virtual ~wxPMDCImpl();
// implement base class pure virtuals // implement base class pure virtuals
// ---------------------------------- // ----------------------------------
@@ -124,13 +127,7 @@ public:
virtual wxCoord GetCharHeight(void) const; virtual wxCoord GetCharHeight(void) const;
virtual wxCoord GetCharWidth(void) const; virtual wxCoord GetCharWidth(void) const;
virtual void DoGetTextExtent( const wxString& rsString
,wxCoord* pX
,wxCoord* pY
,wxCoord* pDescent = NULL
,wxCoord* pExternalLeading = NULL
,const wxFont* pTheFont = NULL
) const;
virtual bool CanDrawBitmap(void) const; virtual bool CanDrawBitmap(void) const;
virtual bool CanGetTextExtent(void) const; virtual bool CanGetTextExtent(void) const;
virtual int GetDepth(void) const; virtual int GetDepth(void) const;
@@ -197,6 +194,39 @@ public:
#endif #endif
protected: protected:
void Init()
{
m_pCanvas = NULL;
m_hOldBitmap = 0;
m_hOldPen = 0;
m_hOldBrush = 0;
m_hOldFont = 0;
#if wxUSE_PALETTE
m_hOldPalette = 0;
#endif // wxUSE_PALETTE
m_bOwnsDC = false;
m_hDC = 0;
m_hOldPS = NULL;
m_hPS = NULL;
m_bIsPaintTime = false; // True at Paint Time
m_pen.SetColour(*wxBLACK);
m_brush.SetColour(*wxWHITE);
}
// create an uninitialized DC: this should be only used by the derived
// classes
wxPMDCImpl( wxDC *owner ) : wxDCImpl( owner ) { Init(); }
public:
virtual void DoGetTextExtent( const wxString& rsString
,wxCoord* pX
,wxCoord* pY
,wxCoord* pDescent = NULL
,wxCoord* pExternalLeading = NULL
,const wxFont* pTheFont = NULL
) const;
virtual bool DoFloodFill( wxCoord vX virtual bool DoFloodFill( wxCoord vX
,wxCoord vY ,wxCoord vY
,const wxColour& rCol ,const wxColour& rCol
@@ -322,6 +352,7 @@ protected:
void InitializePalette(void); void InitializePalette(void);
#endif // wxUSE_PALETTE #endif // wxUSE_PALETTE
protected:
// //
// common part of DoDrawText() and DoDrawRotatedText() // common part of DoDrawText() and DoDrawRotatedText()
// //

View File

@@ -17,6 +17,8 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/os2/dc.h"
#include "wx/dcclient.h"
#include "wx/dynarray.h" #include "wx/dynarray.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -26,68 +28,63 @@
// this one if used by wxPaintDC only // this one if used by wxPaintDC only
struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo; struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo;
WX_DECLARE_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo); WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// DC classes // DC classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class WXDLLEXPORT wxWindowDC : public wxDC class WXDLLEXPORT wxWindowDCImpl : public wxPMDCImpl
{ {
public: public:
wxWindowDC(); // default ctor
wxWindowDCImpl( wxDC *owner );
//
// Create a DC corresponding to the whole window // Create a DC corresponding to the whole window
// wxWindowDCImpl( wxDC *owner, wxWindow *pWin );
wxWindowDC(wxWindow* pWin);
virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected: protected:
// initialize the newly created DC
void InitDC(void); void InitDC(void);
//
// Override some base class virtuals
//
virtual void DoGetSize( int* pWidth
,int* pHeight
) const;
private: private:
SIZEL m_PageSize; SIZEL m_PageSize;
DECLARE_DYNAMIC_CLASS(wxWindowDC) DECLARE_CLASS(wxWindowDCImpl)
DECLARE_NO_COPY_CLASS(wxWindowDCImpl)
}; // end of CLASS wxWindowDC }; // end of CLASS wxWindowDC
class WXDLLEXPORT wxClientDC : public wxWindowDC class WXDLLEXPORT wxClientDCImpl : public wxWindowDCImpl
{ {
public: public:
wxClientDC(); // default ctor
virtual ~wxClientDC(); wxClientDCImpl( wxDC *owner );
wxClientDC(wxWindow *win); // Create a DC corresponding to the client area of the window
wxClientDCImpl( wxDC *owner, wxWindow *pWin );
virtual ~wxClientDCImpl();
virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected: protected:
void InitDC(void); void InitDC(void);
//
// Override some base class virtuals
//
virtual void DoGetSize( int* pWidth
,int* pHeight
) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxClientDC) DECLARE_CLASS(wxClientDCImpl)
DECLARE_NO_COPY_CLASS(wxClientDCImpl)
}; // end of CLASS wxClientDC }; // end of CLASS wxClientDC
class WXDLLEXPORT wxPaintDC : public wxClientDC class WXDLLEXPORT wxPaintDCImpl : public wxClientDCImpl
{ {
public: public:
wxPaintDC(); wxPaintDCImpl( wxDC *owner );
// Create a DC corresponding for painting the window in OnPaint() // Create a DC corresponding for painting the window in OnPaint()
wxPaintDC(wxWindow* pWin); wxPaintDCImpl( wxDC *owner, wxWindow *pWin );
virtual ~wxPaintDC(); virtual ~wxPaintDCImpl();
// find the entry for this DC in the cache (keyed by the window) // find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* pWin); static WXHDC FindDCInCache(wxWindow* pWin);
@@ -98,7 +95,8 @@ protected:
// find the entry for this DC in the cache (keyed by the window) // find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo* FindInCache(size_t* pIndex = NULL) const; wxPaintDCInfo* FindInCache(size_t* pIndex = NULL) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxPaintDC) DECLARE_CLASS(wxPaintDCImpl)
DECLARE_NO_COPY_CLASS(wxPaintDCImpl)
}; // end of wxPaintDC }; // end of wxPaintDC
#endif #endif

View File

@@ -12,30 +12,33 @@
#ifndef _WX_DCMEMORY_H_ #ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_ #define _WX_DCMEMORY_H_
#include "wx/dcclient.h" #include "wx/dcmemory.h"
#include "wx/os2/dc.h"
class WXDLLEXPORT wxMemoryDC: public wxDC, public wxMemoryDCBase class WXDLLEXPORT wxMemoryDCImpl: public wxPMDCImpl
{ {
public: public:
wxMemoryDC() { CreateCompatible(NULL); Init(); } wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDC(wxDC* pDC); // Create compatible DC wxMemoryDCImpl( wxMemoryDC *owner, wxDC* pDC); // Create compatible DC
protected:
// override some base class virtuals // override some base class virtuals
virtual void DoGetSize( int* pWidth virtual void DoGetSize(int* pWidth, int* pHeight) const;
,int* pHeight
) const;
virtual void DoSelect(const wxBitmap& bitmap); virtual void DoSelect(const wxBitmap& bitmap);
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const
{ return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect);}
protected:
// create DC compatible with the given one or screen if dc == NULL // create DC compatible with the given one or screen if dc == NULL
bool CreateCompatible(wxDC* pDC); bool CreateCompatible(wxDC* pDC);
// initialize the newly created DC // initialize the newly created DC
void Init(void); void Init(void);
private: private:
DECLARE_DYNAMIC_CLASS(wxMemoryDC) DECLARE_CLASS(wxMemoryDCImpl)
}; // end of CLASS wxMemoryDC DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
}; // end of CLASS wxMemoryDCImpl
#endif #endif
// _WX_DCMEMORY_H_ // _WX_DCMEMORY_H_

View File

@@ -16,28 +16,24 @@
#include "wx/dc.h" #include "wx/dc.h"
#include "wx/cmndata.h" #include "wx/cmndata.h"
#include "wx/os2/dc.h"
class WXDLLEXPORT wxPrinterDC: public wxDC class WXDLLEXPORT wxPrinterDCImpl: public wxPMDCImpl
{ {
public: public:
// Create a printer DC [obsolete] // Create a printer DC
wxPrinterDC( const wxString& rsDriver
,const wxString& rsDevice
,const wxString& rsOutput
,bool bInteractive = TRUE
,int nOrientation = wxPORTRAIT
);
// Create from print data // Create from print data
wxPrinterDC(const wxPrintData& rData); wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& rData );
wxPrinterDC(WXHDC hTheDC); wxPrinterDCImpl( wxPrinterDC *owner, WXHDC hTheDC);
bool StartDoc(const wxString& rsMessage); // override some base class virtuals
void EndDoc(void); virtual bool StartDoc(const wxString& rsMessage);
void StartPage(void); virtual void EndDoc(void);
void EndPage(void); virtual void StartPage(void);
virtual void EndPage(void);
wxRect GetPaperRect(); virtual wxRect GetPaperRect();
protected: protected:
virtual void DoDrawBitmap( const wxBitmap& rBmp virtual void DoDrawBitmap( const wxBitmap& rBmp
@@ -63,7 +59,8 @@ protected:
wxPrintData m_printData; wxPrintData m_printData;
private: private:
DECLARE_CLASS(wxPrinterDC) DECLARE_CLASS(wxPrinterDCImpl)
DECLARE_NO_COPY_CLASS(wxPrinterDCImpl)
}; // end of CLASS wxPrinterDC }; // end of CLASS wxPrinterDC
// Gets an HDC for the specified printer configuration // Gets an HDC for the specified printer configuration

View File

@@ -9,36 +9,26 @@
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCSCREEN_H_ #ifndef _WX_OS2_DCSCREEN_H_
#define _WX_DCSCREEN_H_ #define _WX_OS2_DCSCREEN_H_
#include "wx/dcclient.h" #include "wx/dcscreen.h"
#include "wx/os2/dc.h"
class WXDLLEXPORT wxScreenDC: public wxWindowDC class WXDLLEXPORT wxScreenDCImpl: public wxPMDCImpl
{ {
public: public:
//
// Create a DC representing the whole screen // Create a DC representing the whole screen
// wxScreenDCImpl( wxScreenDC *owner );
wxScreenDC();
//
// Compatibility with X's requirements for
// drawing on top of all windows
//
static bool StartDrawingOnTop(wxWindow* WXUNUSED(pWindow)) { return TRUE; }
static bool StartDrawingOnTop(wxRect* WXUNUSED(prect) = NULL) { return TRUE; }
static bool EndDrawingOnTop() { return TRUE; }
protected:
virtual void DoGetSize( int* pnWidth virtual void DoGetSize( int* pnWidth
,int* pnHeight ,int* pnHeight
) const; ) const;
private: private:
DECLARE_DYNAMIC_CLASS(wxScreenDC) DECLARE_CLASS(wxScreenDCImpl)
DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
}; // end of CLASS wxScreenDC }; // end of CLASS wxScreenDC
#endif #endif
// _WX_DCSCREEN_H_ // _WX_DCSCREEN_H_

View File

@@ -58,6 +58,12 @@
#include "wx/mac/dcscreen.h" #include "wx/mac/dcscreen.h"
#endif #endif
#ifdef __WXPM__
#include "wx/os2/dcclient.h"
#include "wx/os2/dcmemory.h"
#include "wx/os2/dcscreen.h"
#endif
#ifdef __WXCOCOA__ #ifdef __WXCOCOA__
#include "wx/cocoa/dcclient.h" #include "wx/cocoa/dcclient.h"
#include "wx/cocoa/dcmemory.h" #include "wx/cocoa/dcmemory.h"

View File

@@ -30,9 +30,11 @@
#include <string.h> #include <string.h>
#include "wx/os2/dc.h"
#include "wx/os2/dcclient.h"
#include "wx/os2/private.h" #include "wx/os2/private.h"
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxPMDCImpl, wxDCImpl)
// //
// wxWidgets uses the Microsoft convention that the origin is the UPPER left. // wxWidgets uses the Microsoft convention that the origin is the UPPER left.
@@ -156,8 +158,8 @@ int SetBkMode(
// wxDCCacheEntry // wxDCCacheEntry
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
wxList wxDC::m_svBitmapCache; wxList wxPMDCImpl::m_svBitmapCache;
wxList wxDC::m_svDCCache; wxList wxPMDCImpl::m_svDCCache;
wxDCCacheEntry::wxDCCacheEntry( wxDCCacheEntry::wxDCCacheEntry(
WXHBITMAP hBitmap WXHBITMAP hBitmap
@@ -193,7 +195,7 @@ wxDCCacheEntry::~wxDCCacheEntry()
::GpiDestroyPS(m_hPS); ::GpiDestroyPS(m_hPS);
} // end of wxDCCacheEntry::~wxDCCacheEntry } // end of wxDCCacheEntry::~wxDCCacheEntry
wxDCCacheEntry* wxDC::FindBitmapInCache( wxDCCacheEntry* wxPMDCImpl::FindBitmapInCache(
HPS hPS HPS hPS
, int nWidth , int nWidth
, int nHeight , int nHeight
@@ -260,7 +262,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache(
return pEntry; return pEntry;
} // end of FindBitmapInCache } // end of FindBitmapInCache
wxDCCacheEntry* wxDC::FindDCInCache( wxDCCacheEntry* wxPMDCImpl::FindDCInCache(
wxDCCacheEntry* pNotThis wxDCCacheEntry* pNotThis
, HPS hPS , HPS hPS
) )
@@ -289,23 +291,23 @@ wxDCCacheEntry* wxDC::FindDCInCache(
); );
AddToDCCache(pEntry); AddToDCCache(pEntry);
return pEntry; return pEntry;
} // end of wxDC::FindDCInCache } // end of wxPMDCImpl::FindDCInCache
void wxDC::AddToBitmapCache( void wxPMDCImpl::AddToBitmapCache(
wxDCCacheEntry* pEntry wxDCCacheEntry* pEntry
) )
{ {
m_svBitmapCache.Append(pEntry); m_svBitmapCache.Append(pEntry);
} // end of wxDC::AddToBitmapCache } // end of wxPMDCImpl::AddToBitmapCache
void wxDC::AddToDCCache( void wxPMDCImpl::AddToDCCache(
wxDCCacheEntry* pEntry wxDCCacheEntry* pEntry
) )
{ {
m_svDCCache.Append(pEntry); m_svDCCache.Append(pEntry);
} // end of wxDC::AddToDCCache } // end of wxPMDCImpl::AddToDCCache
void wxDC::ClearCache() void wxPMDCImpl::ClearCache()
{ {
m_svBitmapCache.DeleteContents(true); m_svBitmapCache.DeleteContents(true);
m_svBitmapCache.Clear(); m_svBitmapCache.Clear();
@@ -313,14 +315,14 @@ void wxDC::ClearCache()
m_svDCCache.DeleteContents(true); m_svDCCache.DeleteContents(true);
m_svDCCache.Clear(); m_svDCCache.Clear();
m_svDCCache.DeleteContents(false); m_svDCCache.DeleteContents(false);
} // end of wxDC::ClearCache } // end of wxPMDCImpl::ClearCache
// Clean up cache at app exit // Clean up cache at app exit
class wxDCModule : public wxModule class wxDCModule : public wxModule
{ {
public: public:
virtual bool OnInit() { return true; } virtual bool OnInit() { return true; }
virtual void OnExit() { wxDC::ClearCache(); } virtual void OnExit() { wxPMDCImpl::ClearCache(); }
private: private:
DECLARE_DYNAMIC_CLASS(wxDCModule) DECLARE_DYNAMIC_CLASS(wxDCModule)
@@ -334,28 +336,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
// wxDC // wxDC
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
wxDC::wxDC(void) wxPMDCImpl::wxPMDCImpl( wxDC *owner, WXHDC hDC ) :
wxDCImpl( owner )
{ {
m_pCanvas = NULL; Init();
m_hDC = hDC;
} // end of wxPMDCImpl::wxPMDCImpl
m_hOldBitmap = 0; wxPMDCImpl::~wxPMDCImpl(void)
m_hOldPen = 0;
m_hOldBrush = 0;
m_hOldFont = 0;
m_hOldPalette = 0;
m_bOwnsDC = false;
m_hDC = 0;
m_hOldPS = NULL;
m_hPS = NULL;
m_bIsPaintTime = false; // True at Paint Time
m_pen.SetColour(*wxBLACK);
m_brush.SetColour(*wxWHITE);
} // end of wxDC::wxDC
wxDC::~wxDC(void)
{ {
if ( m_hDC != 0 ) if ( m_hDC != 0 )
{ {
@@ -384,12 +372,12 @@ wxDC::~wxDC(void)
} }
} }
} }
} // end of wxDC::~wxDC } // end of wxPMDCImpl::~wxDC
// This will select current objects out of the DC, // This will select current objects out of the DC,
// which is what you have to do before deleting the // which is what you have to do before deleting the
// DC. // DC.
void wxDC::SelectOldObjects( void wxPMDCImpl::SelectOldObjects(
WXHDC hPS WXHDC hPS
) )
{ {
@@ -419,7 +407,7 @@ void wxDC::SelectOldObjects(
m_font = wxNullFont; m_font = wxNullFont;
m_backgroundBrush = wxNullBrush; m_backgroundBrush = wxNullBrush;
m_vSelectedBitmap = wxNullBitmap; m_vSelectedBitmap = wxNullBitmap;
} // end of wxDC::SelectOldObjects } // end of wxPMDCImpl::SelectOldObjects
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// clipping // clipping
@@ -437,7 +425,7 @@ void wxDC::SelectOldObjects(
m_clipY2 = (wxCoord) YDEV2LOG(rect.yBottom); \ m_clipY2 = (wxCoord) YDEV2LOG(rect.yBottom); \
} }
void wxDC::DoSetClippingRegion( void wxPMDCImpl::DoSetClippingRegion(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxCoord vWidth , wxCoord vWidth
@@ -454,9 +442,9 @@ void wxDC::DoSetClippingRegion(
vRect.yBottom = vY; vRect.yBottom = vY;
::GpiIntersectClipRectangle(m_hPS, &vRect); ::GpiIntersectClipRectangle(m_hPS, &vRect);
DO_SET_CLIPPING_BOX() DO_SET_CLIPPING_BOX()
} // end of wxDC::DoSetClippingRegion } // end of wxPMDCImpl::DoSetClippingRegion
void wxDC::DoSetClippingRegionAsRegion( void wxPMDCImpl::DoSetClippingRegionAsRegion(
const wxRegion& rRegion const wxRegion& rRegion
) )
{ {
@@ -469,9 +457,9 @@ void wxDC::DoSetClippingRegionAsRegion(
,&hRgnOld ,&hRgnOld
); );
DO_SET_CLIPPING_BOX() DO_SET_CLIPPING_BOX()
} // end of wxDC::DoSetClippingRegionAsRegion } // end of wxPMDCImpl::DoSetClippingRegionAsRegion
void wxDC::DestroyClippingRegion(void) void wxPMDCImpl::DestroyClippingRegion(void)
{ {
if (m_clipping && m_hPS) if (m_clipping && m_hPS)
{ {
@@ -492,26 +480,26 @@ void wxDC::DestroyClippingRegion(void)
::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld); ::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld);
} }
ResetClipping(); ResetClipping();
} // end of wxDC::DestroyClippingRegion } // end of wxPMDCImpl::DestroyClippingRegion
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// query capabilities // query capabilities
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
bool wxDC::CanDrawBitmap() const bool wxPMDCImpl::CanDrawBitmap() const
{ {
return true; return true;
} }
bool wxDC::CanGetTextExtent() const bool wxPMDCImpl::CanGetTextExtent() const
{ {
LONG lTechnology = 0L; LONG lTechnology = 0L;
::DevQueryCaps(GetHDC(), CAPS_TECHNOLOGY, 1L, &lTechnology); ::DevQueryCaps(GetHDC(), CAPS_TECHNOLOGY, 1L, &lTechnology);
return (lTechnology == CAPS_TECH_RASTER_DISPLAY) || (lTechnology == CAPS_TECH_RASTER_PRINTER); return (lTechnology == CAPS_TECH_RASTER_DISPLAY) || (lTechnology == CAPS_TECH_RASTER_PRINTER);
} // end of wxDC::CanGetTextExtent } // end of wxPMDCImpl::CanGetTextExtent
int wxDC::GetDepth() const int wxPMDCImpl::GetDepth() const
{ {
LONG lArray[CAPS_COLOR_BITCOUNT]; LONG lArray[CAPS_COLOR_BITCOUNT];
int nBitsPerPixel = 0; int nBitsPerPixel = 0;
@@ -525,13 +513,13 @@ int wxDC::GetDepth() const
nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT]; nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT];
} }
return nBitsPerPixel; return nBitsPerPixel;
} // end of wxDC::GetDepth } // end of wxPMDCImpl::GetDepth
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// drawing // drawing
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void wxDC::Clear() void wxPMDCImpl::Clear()
{ {
// //
// If this is a canvas DC then just fill with the background color // If this is a canvas DC then just fill with the background color
@@ -546,9 +534,9 @@ void wxDC::Clear()
} }
else else
::GpiErase(m_hPS); ::GpiErase(m_hPS);
} // end of wxDC::Clear } // end of wxPMDCImpl::Clear
bool wxDC::DoFloodFill( bool wxPMDCImpl::DoFloodFill(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, const wxColour& rCol , const wxColour& rCol
@@ -573,9 +561,9 @@ bool wxDC::DoFloodFill(
bSuccess = true; bSuccess = true;
return bSuccess; return bSuccess;
} // end of wxDC::DoFloodFill } // end of wxPMDCImpl::DoFloodFill
bool wxDC::DoGetPixel( bool wxPMDCImpl::DoGetPixel(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxColour* pCol , wxColour* pCol
@@ -597,9 +585,9 @@ bool wxDC::DoGetPixel(
,GetBValue(lColor) ,GetBValue(lColor)
); );
return true; return true;
} // end of wxDC::DoGetPixel } // end of wxPMDCImpl::DoGetPixel
void wxDC::DoCrossHair( void wxPMDCImpl::DoCrossHair(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
) )
@@ -631,9 +619,9 @@ void wxDC::DoCrossHair(
::GpiLine(m_hPS, &vPoint[3]); ::GpiLine(m_hPS, &vPoint[3]);
CalcBoundingBox(vX1, vY1); CalcBoundingBox(vX1, vY1);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoCrossHair } // end of wxPMDCImpl::DoCrossHair
void wxDC::DoDrawLine( void wxPMDCImpl::DoDrawLine(
wxCoord vX1 wxCoord vX1
, wxCoord vY1 , wxCoord vY1
, wxCoord vX2 , wxCoord vX2
@@ -677,7 +665,7 @@ void wxDC::DoDrawLine(
::GpiLine(m_hPS, &vPoint[1]); ::GpiLine(m_hPS, &vPoint[1]);
CalcBoundingBox(vX1, vY1); CalcBoundingBox(vX1, vY1);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoDrawLine } // end of wxPMDCImpl::DoDrawLine
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1) // Draws an arc of a circle, centred on (xc, yc), with starting point (x1, y1)
@@ -685,7 +673,7 @@ void wxDC::DoDrawLine(
// current brush for filling the shape. The arc is drawn in an anticlockwise // current brush for filling the shape. The arc is drawn in an anticlockwise
// direction from the start point to the end point. // direction from the start point to the end point.
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
void wxDC::DoDrawArc( void wxPMDCImpl::DoDrawArc(
wxCoord vX1 wxCoord vX1
, wxCoord vY1 , wxCoord vY1
, wxCoord vX2 , wxCoord vX2
@@ -775,9 +763,9 @@ void wxDC::DoDrawArc(
CalcBoundingBox( (wxCoord)(vXc + dRadius) CalcBoundingBox( (wxCoord)(vXc + dRadius)
,(wxCoord)(vYc + dRadius) ,(wxCoord)(vYc + dRadius)
); );
} // end of wxDC::DoDrawArc } // end of wxPMDCImpl::DoDrawArc
void wxDC::DoDrawCheckMark( void wxPMDCImpl::DoDrawCheckMark(
wxCoord vX1 wxCoord vX1
, wxCoord vY1 , wxCoord vY1
, wxCoord vWidth , wxCoord vWidth
@@ -824,9 +812,9 @@ void wxDC::DoDrawCheckMark(
CalcBoundingBox( vX2 CalcBoundingBox( vX2
,vY2 ,vY2
); );
} // end of wxDC::DoDrawCheckMark } // end of wxPMDCImpl::DoDrawCheckMark
void wxDC::DoDrawPoint( void wxPMDCImpl::DoDrawPoint(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
) )
@@ -845,9 +833,9 @@ void wxDC::DoDrawPoint(
CalcBoundingBox( vX CalcBoundingBox( vX
,vY ,vY
); );
} // end of wxDC::DoDrawPoint } // end of wxPMDCImpl::DoDrawPoint
void wxDC::DoDrawPolygon( int n, void wxPMDCImpl::DoDrawPolygon( int n,
wxPoint vPoints[], wxPoint vPoints[],
wxCoord vXoffset, wxCoord vXoffset,
wxCoord vYoffset, wxCoord vYoffset,
@@ -911,9 +899,9 @@ void wxDC::DoDrawPolygon( int n,
::GpiMove(m_hPS, &vPlgn.aPointl[0]); ::GpiMove(m_hPS, &vPlgn.aPointl[0]);
lHits = ::GpiPolygons(m_hPS, ulCount, &vPlgn, flOptions, flModel); lHits = ::GpiPolygons(m_hPS, ulCount, &vPlgn, flOptions, flModel);
free(vPlgn.aPointl); free(vPlgn.aPointl);
} // end of wxDC::DoDrawPolygon } // end of wxPMDCImpl::DoDrawPolygon
void wxDC::DoDrawLines( void wxPMDCImpl::DoDrawLines(
int n int n
, wxPoint vPoints[] , wxPoint vPoints[]
, wxCoord vXoffset , wxCoord vXoffset
@@ -961,9 +949,9 @@ void wxDC::DoDrawLines(
::GpiLine(m_hPS, &vPoint); ::GpiLine(m_hPS, &vPoint);
} }
} }
} // end of wxDC::DoDrawLines } // end of wxPMDCImpl::DoDrawLines
void wxDC::DoDrawRectangle( void wxPMDCImpl::DoDrawRectangle(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxCoord vWidth , wxCoord vWidth
@@ -1050,9 +1038,9 @@ void wxDC::DoDrawRectangle(
} }
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoDrawRectangle } // end of wxPMDCImpl::DoDrawRectangle
void wxDC::DoDrawRoundedRectangle( void wxPMDCImpl::DoDrawRoundedRectangle(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxCoord vWidth , wxCoord vWidth
@@ -1143,10 +1131,10 @@ void wxDC::DoDrawRoundedRectangle(
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoDrawRoundedRectangle } // end of wxPMDCImpl::DoDrawRoundedRectangle
// Draw Ellipse within box (x,y) - (x+width, y+height) // Draw Ellipse within box (x,y) - (x+width, y+height)
void wxDC::DoDrawEllipse( void wxPMDCImpl::DoDrawEllipse(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxCoord vWidth , wxCoord vWidth
@@ -1186,9 +1174,9 @@ void wxDC::DoDrawEllipse(
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoDrawEllipse } // end of wxPMDCImpl::DoDrawEllipse
void wxDC::DoDrawEllipticArc( void wxPMDCImpl::DoDrawEllipticArc(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
, wxCoord vWidth , wxCoord vWidth
@@ -1245,9 +1233,9 @@ void wxDC::DoDrawEllipticArc(
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);
} // end of wxDC::DoDrawEllipticArc } // end of wxPMDCImpl::DoDrawEllipticArc
void wxDC::DoDrawIcon( void wxPMDCImpl::DoDrawIcon(
const wxIcon& rIcon const wxIcon& rIcon
, wxCoord vX , wxCoord vX
, wxCoord vY , wxCoord vY
@@ -1270,9 +1258,9 @@ void wxDC::DoDrawIcon(
} }
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
CalcBoundingBox(vX + rIcon.GetWidth(), vY + rIcon.GetHeight()); CalcBoundingBox(vX + rIcon.GetWidth(), vY + rIcon.GetHeight());
} // end of wxDC::DoDrawIcon } // end of wxPMDCImpl::DoDrawIcon
void wxDC::DoDrawBitmap( void wxPMDCImpl::DoDrawBitmap(
const wxBitmap& rBmp const wxBitmap& rBmp
, wxCoord vX , wxCoord vX
, wxCoord vY , wxCoord vY
@@ -1365,9 +1353,9 @@ void wxDC::DoDrawBitmap(
// //
// Need to get a background color for mask blitting // Need to get a background color for mask blitting
// //
if (IsKindOf(CLASSINFO(wxWindowDC))) if (IsKindOf(CLASSINFO(wxWindowDCImpl)))
{ {
wxWindowDC* pWindowDC = wxDynamicCast(this, wxWindowDC); wxWindowDCImpl* pWindowDC = wxDynamicCast(this, wxWindowDCImpl);
lColor = pWindowDC->m_pCanvas->GetBackgroundColour().GetPixel(); lColor = pWindowDC->m_pCanvas->GetBackgroundColour().GetPixel();
} }
@@ -1675,9 +1663,9 @@ void wxDC::DoDrawBitmap(
::GpiSetBackColor((HPS)GetHPS(), lOldBackGround); ::GpiSetBackColor((HPS)GetHPS(), lOldBackGround);
} }
} }
} // end of wxDC::DoDrawBitmap } // end of wxPMDCImpl::DoDrawBitmap
void wxDC::DoDrawText( void wxPMDCImpl::DoDrawText(
const wxString& rsText const wxString& rsText
, wxCoord vX , wxCoord vX
, wxCoord vY , wxCoord vY
@@ -1692,11 +1680,11 @@ void wxDC::DoDrawText(
); );
CalcBoundingBox(vX, vY); CalcBoundingBox(vX, vY);
GetTextExtent(rsText, &vWidth, &vHeight); GetOwner()->GetTextExtent(rsText, &vWidth, &vHeight);
CalcBoundingBox((vX + vWidth), (vY + vHeight)); CalcBoundingBox((vX + vWidth), (vY + vHeight));
} // end of wxDC::DoDrawText } // end of wxPMDCImpl::DoDrawText
void wxDC::DrawAnyText( const wxString& rsText, void wxPMDCImpl::DrawAnyText( const wxString& rsText,
wxCoord vX, wxCoord vX,
wxCoord vY ) wxCoord vY )
{ {
@@ -1729,10 +1717,10 @@ void wxDC::DrawAnyText( const wxString& rsText,
SetBkMode( m_hPS SetBkMode( m_hPS
,m_backgroundMode ,m_backgroundMode
); );
GetTextExtent( rsText GetOwner()->GetTextExtent( rsText
,&vTextX ,&vTextX
,&vTextY ,&vTextY
); );
vPtlStart.x = vX; vPtlStart.x = vX;
if (!(m_vRclPaint.yTop == 0 && if (!(m_vRclPaint.yTop == 0 &&
m_vRclPaint.yBottom == 0 && m_vRclPaint.yBottom == 0 &&
@@ -1777,7 +1765,7 @@ void wxDC::DrawAnyText( const wxString& rsText,
); );
} }
void wxDC::DoDrawRotatedText( void wxPMDCImpl::DoDrawRotatedText(
const wxString& rsText const wxString& rsText
, wxCoord vX , wxCoord vX
, wxCoord vY , wxCoord vY
@@ -1848,7 +1836,7 @@ void wxDC::DoDrawRotatedText(
// set GDI objects // set GDI objects
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
void wxDC::DoSelectPalette( bool WXUNUSED(bRealize) ) void wxPMDCImpl::DoSelectPalette( bool WXUNUSED(bRealize) )
{ {
// //
// Set the old object temporarily, in case the assignment deletes an object // Set the old object temporarily, in case the assignment deletes an object
@@ -1867,9 +1855,9 @@ void wxDC::DoSelectPalette( bool WXUNUSED(bRealize) )
if (!m_hOldPalette) if (!m_hOldPalette)
m_hOldPalette = (WXHPALETTE)hOldPal; m_hOldPalette = (WXHPALETTE)hOldPal;
} }
} // end of wxDC::DoSelectPalette } // end of wxPMDCImpl::DoSelectPalette
void wxDC::InitializePalette() void wxPMDCImpl::InitializePalette()
{ {
if (wxDisplayDepth() <= 8 ) if (wxDisplayDepth() <= 8 )
{ {
@@ -1890,9 +1878,9 @@ void wxDC::InitializePalette()
DoSelectPalette(); DoSelectPalette();
} }
} }
} // end of wxDC::InitializePalette } // end of wxPMDCImpl::InitializePalette
void wxDC::SetPalette( void wxPMDCImpl::SetPalette(
const wxPalette& rPalette const wxPalette& rPalette
) )
{ {
@@ -1911,9 +1899,9 @@ void wxDC::SetPalette(
HPALETTE hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE()); HPALETTE hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE());
if (!m_hOldPalette) if (!m_hOldPalette)
m_hOldPalette = (WXHPALETTE)hOldPal; m_hOldPalette = (WXHPALETTE)hOldPal;
} // end of wxDC::SetPalette } // end of wxPMDCImpl::SetPalette
void wxDC::SetFont( void wxPMDCImpl::SetFont(
const wxFont& rFont const wxFont& rFont
) )
{ {
@@ -1938,19 +1926,17 @@ void wxDC::SetFont(
HFONT hFont = m_font.GetResourceHandle(); HFONT hFont = m_font.GetResourceHandle();
if (hFont == (HFONT) NULL) if (hFont == (HFONT) NULL)
{ {
wxLogDebug(wxT("::SelectObject failed in wxDC::SetFont.")); wxLogDebug(wxT("::SelectObject failed in wxPMDCImpl::SetFont."));
} }
if (!m_hOldFont) if (!m_hOldFont)
m_hOldFont = (WXHFONT) hFont; m_hOldFont = (WXHFONT) hFont;
} }
} // end of wxDC::SetFont } // end of wxPMDCImpl::SetFont
void wxDC::SetPen( void wxPMDCImpl::SetPen(
const wxPen& rPen const wxPen& rPen
) )
{ {
wxCHECK_RET( Ok(), wxT("invalid window dc") );
if (m_pen == rPen) if (m_pen == rPen)
return; return;
m_pen = rPen; m_pen = rPen;
@@ -1982,12 +1968,10 @@ void wxDC::SetPen(
} }
} }
void wxDC::SetBrush( void wxPMDCImpl::SetBrush(
const wxBrush& rBrush const wxBrush& rBrush
) )
{ {
wxCHECK_RET( Ok(), wxT("invalid window dc") );
if (m_hOldBrush) if (m_hOldBrush)
m_hOldBrush = 0L; m_hOldBrush = 0L;
m_brush = rBrush; m_brush = rBrush;
@@ -2016,9 +2000,9 @@ void wxDC::SetBrush(
m_hOldBrush = (WXHWND)m_brush.GetPS(); m_hOldBrush = (WXHWND)m_brush.GetPS();
} }
} }
} // end of wxDC::SetBrush } // end of wxPMDCImpl::SetBrush
void wxDC::SetBackground(const wxBrush& rBrush) void wxPMDCImpl::SetBackground(const wxBrush& rBrush)
{ {
m_backgroundBrush = rBrush; m_backgroundBrush = rBrush;
@@ -2026,20 +2010,20 @@ void wxDC::SetBackground(const wxBrush& rBrush)
{ {
(void)::GpiSetBackColor((HPS)m_hPS, m_backgroundBrush.GetColour().GetPixel()); (void)::GpiSetBackColor((HPS)m_hPS, m_backgroundBrush.GetColour().GetPixel());
} }
} // end of wxDC::SetBackground } // end of wxPMDCImpl::SetBackground
void wxDC::SetBackgroundMode(int nMode) void wxPMDCImpl::SetBackgroundMode(int nMode)
{ {
m_backgroundMode = nMode; m_backgroundMode = nMode;
} // end of wxDC::SetBackgroundMode } // end of wxPMDCImpl::SetBackgroundMode
void wxDC::SetLogicalFunction(int nFunction) void wxPMDCImpl::SetLogicalFunction(int nFunction)
{ {
m_logicalFunction = nFunction; m_logicalFunction = nFunction;
SetRop((WXHDC)m_hDC); SetRop((WXHDC)m_hDC);
} // wxDC::SetLogicalFunction } // wxPMDCImpl::SetLogicalFunction
void wxDC::SetRop(WXHDC hDC) void wxPMDCImpl::SetRop(WXHDC hDC)
{ {
if (!hDC || m_logicalFunction < 0) if (!hDC || m_logicalFunction < 0)
return; return;
@@ -2099,31 +2083,31 @@ void wxDC::SetRop(WXHDC hDC)
break; break;
} }
::GpiSetMix((HPS)hDC, lCRop); ::GpiSetMix((HPS)hDC, lCRop);
} // end of wxDC::SetRop } // end of wxPMDCImpl::SetRop
bool wxDC::StartDoc( const wxString& WXUNUSED(rsMessage) ) bool wxPMDCImpl::StartDoc( const wxString& WXUNUSED(rsMessage) )
{ {
// We might be previewing, so return true to let it continue. // We might be previewing, so return true to let it continue.
return true; return true;
} // end of wxDC::StartDoc } // end of wxPMDCImpl::StartDoc
void wxDC::EndDoc() void wxPMDCImpl::EndDoc()
{ {
} // end of wxDC::EndDoc } // end of wxPMDCImpl::EndDoc
void wxDC::StartPage() void wxPMDCImpl::StartPage()
{ {
} // end of wxDC::StartPage } // end of wxPMDCImpl::StartPage
void wxDC::EndPage() void wxPMDCImpl::EndPage()
{ {
} // end of wxDC::EndPage } // end of wxPMDCImpl::EndPage
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// text metrics // text metrics
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
wxCoord wxDC::GetCharHeight() const wxCoord wxPMDCImpl::GetCharHeight() const
{ {
FONTMETRICS vFM; // metrics structure FONTMETRICS vFM; // metrics structure
@@ -2134,7 +2118,7 @@ wxCoord wxDC::GetCharHeight() const
return YDEV2LOGREL(vFM.lXHeight); return YDEV2LOGREL(vFM.lXHeight);
} }
wxCoord wxDC::GetCharWidth() const wxCoord wxPMDCImpl::GetCharWidth() const
{ {
FONTMETRICS vFM; // metrics structure FONTMETRICS vFM; // metrics structure
@@ -2145,7 +2129,7 @@ wxCoord wxDC::GetCharWidth() const
return XDEV2LOGREL(vFM.lAveCharWidth); return XDEV2LOGREL(vFM.lAveCharWidth);
} }
void wxDC::DoGetTextExtent( void wxPMDCImpl::DoGetTextExtent(
const wxString& rsString const wxString& rsString
, wxCoord* pvX , wxCoord* pvX
, wxCoord* pvY , wxCoord* pvY
@@ -2174,6 +2158,14 @@ void wxDC::DoGetTextExtent(
// //
// In world coordinates. // In world coordinates.
// //
if (!m_hPS)
{
(void)wxMessageBox( _T("wxWidgets core library")
,"Using uninitialized DC for measuring text!\n"
,wxICON_INFORMATION
);
}
bRc = ::GpiQueryTextBox( m_hPS bRc = ::GpiQueryTextBox( m_hPS
,l ,l
,rsString.char_str() ,rsString.char_str()
@@ -2186,7 +2178,7 @@ void wxDC::DoGetTextExtent(
sError = wxPMErrorToStr(vErrorCode); sError = wxPMErrorToStr(vErrorCode);
// DEBUG // DEBUG
wxSprintf(zMsg, _T("GpiQueryTextBox for %s: failed with Error: %lx - %s"), rsString.c_str(), vErrorCode, sError.c_str()); wxSprintf(zMsg, _T("GpiQueryTextBox for %s: failed with Error: %lx - %s"), rsString.c_str(), vErrorCode, sError.c_str());
(void)wxMessageBox( _T("wxWidgets Menu sample") (void)wxMessageBox( _T("wxWidgets core library")
,zMsg ,zMsg
,wxICON_INFORMATION ,wxICON_INFORMATION
); );
@@ -2218,7 +2210,7 @@ void wxDC::DoGetTextExtent(
*pvExternalLeading = vFM.lExternalLeading; *pvExternalLeading = vFM.lExternalLeading;
} }
void wxDC::SetMapMode( void wxPMDCImpl::SetMapMode(
int nMode int nMode
) )
{ {
@@ -2297,27 +2289,27 @@ void wxDC::SetMapMode(
ComputeScaleAndOrigin(); ComputeScaleAndOrigin();
}; // end of wxDC::SetMapMode }; // end of wxPMDCImpl::SetMapMode
void wxDC::SetUserScale( double dX, void wxPMDCImpl::SetUserScale( double dX,
double dY ) double dY )
{ {
m_userScaleX = dX; m_userScaleX = dX;
m_userScaleY = dY; m_userScaleY = dY;
SetMapMode(m_mappingMode); SetMapMode(m_mappingMode);
} // end of wxDC::SetUserScale } // end of wxPMDCImpl::SetUserScale
void wxDC::SetAxisOrientation( bool bXLeftRight, void wxPMDCImpl::SetAxisOrientation( bool bXLeftRight,
bool bYBottomUp ) bool bYBottomUp )
{ {
m_signX = bXLeftRight ? 1 : -1; m_signX = bXLeftRight ? 1 : -1;
m_signY = bYBottomUp ? -1 : 1; m_signY = bYBottomUp ? -1 : 1;
SetMapMode(m_mappingMode); SetMapMode(m_mappingMode);
} // end of wxDC::SetAxisOrientation } // end of wxPMDCImpl::SetAxisOrientation
void wxDC::SetLogicalOrigin( void wxPMDCImpl::SetLogicalOrigin(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
) )
@@ -2334,9 +2326,9 @@ void wxDC::SetLogicalOrigin(
::GpiSetPageViewport( m_hPS ::GpiSetPageViewport( m_hPS
,&vRect ,&vRect
); );
}; // end of wxDC::SetLogicalOrigin }; // end of wxPMDCImpl::SetLogicalOrigin
void wxDC::SetDeviceOrigin( void wxPMDCImpl::SetDeviceOrigin(
wxCoord vX wxCoord vX
, wxCoord vY , wxCoord vY
) )
@@ -2355,13 +2347,13 @@ void wxDC::SetDeviceOrigin(
::GpiSetPageViewport( m_hPS ::GpiSetPageViewport( m_hPS
,&vRect ,&vRect
); );
}; // end of wxDC::SetDeviceOrigin }; // end of wxPMDCImpl::SetDeviceOrigin
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// bit blit // bit blit
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
bool wxDC::DoBlit( wxCoord vXdest, bool wxPMDCImpl::DoBlit( wxCoord vXdest,
wxCoord vYdest, wxCoord vYdest,
wxCoord vWidth, wxCoord vWidth,
wxCoord vHeight, wxCoord vHeight,
@@ -2378,9 +2370,18 @@ bool wxDC::DoBlit( wxCoord vXdest,
COLORREF vOldTextColor; COLORREF vOldTextColor;
COLORREF vOldBackground = ::GpiQueryBackColor(m_hPS); COLORREF vOldBackground = ::GpiQueryBackColor(m_hPS);
wxDCImpl *impl = pSource->GetImpl();
wxPMDCImpl *pm_impl = wxDynamicCast( impl, wxPMDCImpl );
if (!pm_impl)
{
// TODO: Do we want to be able to blit
// from other DCs too?
return false;
}
if (bUseMask) if (bUseMask)
{ {
const wxBitmap& rBmp = pSource->m_vSelectedBitmap; const wxBitmap& rBmp = pm_impl->GetSelectedBitmap();
pMask = rBmp.GetMask(); pMask = rBmp.GetMask();
if (!(rBmp.Ok() && pMask && pMask->GetMaskBitmap())) if (!(rBmp.Ok() && pMask && pMask->GetMaskBitmap()))
@@ -2470,7 +2471,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
// create a temp buffer bitmap and DCs to access it and the mask // create a temp buffer bitmap and DCs to access it and the mask
// //
wxDCCacheEntry* pDCCacheEntry1 = FindDCInCache( NULL wxDCCacheEntry* pDCCacheEntry1 = FindDCInCache( NULL
,pSource->GetHPS() ,pm_impl->GetHPS()
); );
wxDCCacheEntry* pDCCacheEntry2 = FindDCInCache( pDCCacheEntry1 wxDCCacheEntry* pDCCacheEntry2 = FindDCInCache( pDCCacheEntry1
,GetHPS() ,GetHPS()
@@ -2631,7 +2632,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
}; };
bSuccess = (::GpiBitBlt( m_hPS bSuccess = (::GpiBitBlt( m_hPS
,pSource->GetHPS() ,pm_impl->GetHPS()
,4L ,4L
,aPoint ,aPoint
,lRop ,lRop
@@ -2653,7 +2654,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
return bSuccess; return bSuccess;
} }
void wxDC::DoGetSize( int* pnWidth, void wxPMDCImpl::DoGetSize( int* pnWidth,
int* pnHeight ) const int* pnHeight ) const
{ {
LONG lArray[CAPS_HEIGHT]; LONG lArray[CAPS_HEIGHT];
@@ -2667,9 +2668,9 @@ void wxDC::DoGetSize( int* pnWidth,
*pnWidth = lArray[CAPS_WIDTH]; *pnWidth = lArray[CAPS_WIDTH];
*pnHeight = lArray[CAPS_HEIGHT]; *pnHeight = lArray[CAPS_HEIGHT];
} }
}; // end of wxDC::DoGetSize( }; // end of wxPMDCImpl::DoGetSize(
void wxDC::DoGetSizeMM( int* pnWidth, void wxPMDCImpl::DoGetSizeMM( int* pnWidth,
int* pnHeight ) const int* pnHeight ) const
{ {
LONG lArray[CAPS_VERTICAL_RESOLUTION]; LONG lArray[CAPS_VERTICAL_RESOLUTION];
@@ -2694,9 +2695,9 @@ void wxDC::DoGetSizeMM( int* pnWidth,
*pnHeight = (nVertRes/1000) * nHeight; *pnHeight = (nVertRes/1000) * nHeight;
} }
} }
}; // end of wxDC::DoGetSizeMM }; // end of wxPMDCImpl::DoGetSizeMM
wxSize wxDC::GetPPI() const wxSize wxPMDCImpl::GetPPI() const
{ {
LONG lArray[CAPS_VERTICAL_RESOLUTION]; LONG lArray[CAPS_VERTICAL_RESOLUTION];
int nWidth = 0; int nWidth = 0;
@@ -2722,10 +2723,10 @@ wxSize wxDC::GetPPI() const
} }
wxSize ppisize(nWidth, nHeight); wxSize ppisize(nWidth, nHeight);
return ppisize; return ppisize;
} // end of wxDC::GetPPI } // end of wxPMDCImpl::GetPPI
void wxDC::SetLogicalScale( double dX, double dY ) void wxPMDCImpl::SetLogicalScale( double dX, double dY )
{ {
m_logicalScaleX = dX; m_logicalScaleX = dX;
m_logicalScaleY = dY; m_logicalScaleY = dY;
}; // end of wxDC::SetLogicalScale }; // end of wxPMDCImpl::SetLogicalScale

View File

@@ -21,6 +21,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/os2/dcclient.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
@@ -38,7 +39,7 @@
struct WXDLLEXPORT wxPaintDCInfo struct WXDLLEXPORT wxPaintDCInfo
{ {
wxPaintDCInfo( wxWindow* pWin wxPaintDCInfo( wxWindow* pWin
,wxDC* pDC ,wxPaintDCImpl* pDC
) )
{ {
m_hWnd = pWin->GetHWND(); m_hWnd = pWin->GetHWND();
@@ -55,14 +56,6 @@ struct WXDLLEXPORT wxPaintDCInfo
WX_DEFINE_OBJARRAY(wxArrayDCInfo); WX_DEFINE_OBJARRAY(wxArrayDCInfo);
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// global variables // global variables
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -82,19 +75,19 @@ static RECT g_paintStruct;
// =========================================================================== // ===========================================================================
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWindowDC // wxWindowDCImpl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxWindowDC::wxWindowDC() IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxPMDCImpl)
{
m_pCanvas = NULL;
m_PageSize.cx = m_PageSize.cy = 0;
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) :
wxPMDCImpl( owner )
{
m_PageSize.cx = m_PageSize.cy = 0;
} }
wxWindowDC::wxWindowDC( wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow* pTheCanvas) :
wxWindow* pTheCanvas wxPMDCImpl( owner )
)
{ {
ERRORID vError; ERRORID vError;
wxString sError; wxString sError;
@@ -152,9 +145,9 @@ wxWindowDC::wxWindowDC(
,&m_vRclPaint ,&m_vRclPaint
); );
InitDC(); InitDC();
} // end of wxWindowDC::wxWindowDC } // end of wxWindowDCImpl::wxWindowDCImpl
void wxWindowDC::InitDC() void wxWindowDCImpl::InitDC()
{ {
// //
@@ -170,7 +163,10 @@ void wxWindowDC::InitDC()
m_pen.SetColour(*wxBLACK); m_pen.SetColour(*wxBLACK);
m_brush.SetColour(*wxWHITE); m_brush.SetColour(*wxWHITE);
// since we are a window dc we need to grab the palette from the window
#if wxUSE_PALETTE
InitializePalette(); InitializePalette();
#endif
wxFont* pFont = new wxFont( 10, wxMODERN, wxNORMAL, wxBOLD ); wxFont* pFont = new wxFont( 10, wxMODERN, wxNORMAL, wxBOLD );
SetFont(*pFont); SetFont(*pFont);
delete pFont; delete pFont;
@@ -179,9 +175,9 @@ void wxWindowDC::InitDC()
// //
::GpiSetTextAlignment((HPS)GetHPS(), TA_NORMAL_HORIZ, TA_BOTTOM); ::GpiSetTextAlignment((HPS)GetHPS(), TA_NORMAL_HORIZ, TA_BOTTOM);
} // end of wxWindowDC::InitDC } // end of wxWindowDCImpl::InitDC
void wxWindowDC::DoGetSize( void wxWindowDCImpl::DoGetSize(
int* pnWidth int* pnWidth
, int* pnHeight , int* pnHeight
) const ) const
@@ -190,20 +186,22 @@ void wxWindowDC::DoGetSize(
m_pCanvas->GetSize( pnWidth m_pCanvas->GetSize( pnWidth
,pnHeight ,pnHeight
); );
} // end of wxWindowDC::DoGetSize } // end of wxWindowDCImpl::DoGetSize
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxClientDC // wxClientDC
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxClientDC::wxClientDC() IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
wxClientDCImpl::wxClientDCImpl( wxDC *owner ) :
wxWindowDCImpl( owner )
{ {
m_pCanvas = NULL; m_pCanvas = NULL;
} }
wxClientDC::wxClientDC( wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *pTheCanvas) :
wxWindow* pTheCanvas wxWindowDCImpl( owner )
)
{ {
SIZEL vSizl = { 0,0}; SIZEL vSizl = { 0,0};
ERRORID vError; ERRORID vError;
@@ -214,13 +212,19 @@ wxClientDC::wxClientDC(
// //
// default under PM is that Window and Client DC's are the same // default under PM is that Window and Client DC's are the same
// //
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(pTheCanvas)); m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(pTheCanvas));
printf("Got WindowDC %X for window handle %X\n", m_hDC, pTheCanvas);
m_hPS = ::GpiCreatePS( wxGetInstance() m_hPS = ::GpiCreatePS( wxGetInstance()
,m_hDC ,m_hDC
,&vSizl ,&vSizl
,PU_PELS | GPIF_LONG | GPIA_ASSOC ,PU_PELS | GPIF_LONG | GPIA_ASSOC
); );
::GpiAssociate(m_hPS, NULLHANDLE);
::GpiAssociate(m_hPS, m_hDC);
printf("Got m_hPS %X\n", m_hPS);
// Set the wxWidgets color table // Set the wxWidgets color table
if (!::GpiCreateLogColorTable( m_hPS if (!::GpiCreateLogColorTable( m_hPS
,0L ,0L
@@ -248,11 +252,11 @@ wxClientDC::wxClientDC(
,&m_vRclPaint ,&m_vRclPaint
); );
InitDC(); InitDC();
} // end of wxClientDC::wxClientDC } // end of wxClientDCImpl::wxClientDCImpl
void wxClientDC::InitDC() void wxClientDCImpl::InitDC()
{ {
wxWindowDC::InitDC(); wxWindowDCImpl::InitDC();
// in wxUniv build we must manually do some DC adjustments usually // in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us // performed by Windows for us
@@ -267,13 +271,13 @@ void wxClientDC::InitDC()
// clip the DC to avoid overwriting the non client area // clip the DC to avoid overwriting the non client area
SetClippingRegion(wxPoint(0, 0), m_pCanvas->GetClientSize()); SetClippingRegion(wxPoint(0, 0), m_pCanvas->GetClientSize());
#endif // __WXUNIVERSAL__ #endif // __WXUNIVERSAL__
} // end of wxClientDC::InitDC } // end of wxClientDCImpl::InitDC
wxClientDC::~wxClientDC() wxClientDCImpl::~wxClientDCImpl()
{ {
} // end of wxClientDC::~wxClientDC } // end of wxClientDCImpl::~wxClientDCImpl
void wxClientDC::DoGetSize( void wxClientDCImpl::DoGetSize(
int* pnWidth int* pnWidth
, int* pnHeight , int* pnHeight
) const ) const
@@ -282,23 +286,25 @@ void wxClientDC::DoGetSize(
m_pCanvas->GetClientSize( pnWidth m_pCanvas->GetClientSize( pnWidth
,pnHeight ,pnHeight
); );
} // end of wxClientDC::DoGetSize } // end of wxClientDCImpl::DoGetSize
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxPaintDC // wxPaintDC
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
wxArrayDCInfo wxPaintDC::ms_cache; IMPLEMENT_ABSTRACT_CLASS(wxPaintDCImpl, wxWindowDCImpl)
wxPaintDC::wxPaintDC() wxArrayDCInfo wxPaintDCImpl::ms_cache;
wxPaintDCImpl::wxPaintDCImpl( wxDC *owner ) :
wxClientDCImpl( owner )
{ {
m_pCanvas = NULL; m_pCanvas = NULL;
m_hDC = 0; m_hDC = 0;
} }
wxPaintDC::wxPaintDC( wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *pCanvas) :
wxWindow* pCanvas wxClientDCImpl( owner )
)
{ {
wxCHECK_RET(pCanvas, wxT("NULL canvas in wxPaintDC ctor")); wxCHECK_RET(pCanvas, wxT("NULL canvas in wxPaintDC ctor"));
@@ -361,9 +367,9 @@ wxPaintDC::wxPaintDC(
ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this)); ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this));
} }
InitDC(); InitDC();
} // end of wxPaintDC::wxPaintDC } // end of wxPaintDCImpl::wxPaintDCImpl
wxPaintDC::~wxPaintDC() wxPaintDCImpl::~wxPaintDCImpl()
{ {
if ( m_hDC ) if ( m_hDC )
{ {
@@ -388,7 +394,7 @@ wxPaintDC::~wxPaintDC()
} }
} }
wxPaintDCInfo* wxPaintDC::FindInCache( wxPaintDCInfo* wxPaintDCImpl::FindInCache(
size_t* pIndex size_t* pIndex
) const ) const
{ {
@@ -406,10 +412,10 @@ wxPaintDCInfo* wxPaintDC::FindInCache(
} }
} }
return pInfo; return pInfo;
} // end of wxPaintDC::FindInCache } // end of wxPaintDCImpl::FindInCache
// find the entry for this DC in the cache (keyed by the window) // find the entry for this DC in the cache (keyed by the window)
WXHDC wxPaintDC::FindDCInCache( WXHDC wxPaintDCImpl::FindDCInCache(
wxWindow* pWin wxWindow* pWin
) )
{ {
@@ -425,4 +431,4 @@ WXHDC wxPaintDC::FindDCInCache(
} }
} }
return 0; return 0;
} // end of wxPaintDC::FindInCache } // end of wxPaintDCImpl::FindInCache

View File

@@ -13,6 +13,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
#include "wx/os2/dcmemory.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/utils.h" #include "wx/utils.h"
@@ -22,21 +23,37 @@
#include "wx/os2/private.h" #include "wx/os2/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxPMDCImpl)
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Memory DC // Memory DC
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
wxMemoryDC::wxMemoryDC( wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
wxDC* pOldDC : wxPMDCImpl( owner )
)
{ {
CreateCompatible(NULL);
Init();
}
wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap )
: wxPMDCImpl( owner )
{
CreateCompatible(NULL);
Init();
DoSelect(bitmap);
}
wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *pOldDC)
: wxPMDCImpl( owner )
{
wxCHECK_RET( pOldDC, _T("NULL dc in wxMemoryDC ctor") );
CreateCompatible(pOldDC); CreateCompatible(pOldDC);
Init(); Init();
} // end of wxMemoryDC::wxMemoryDC } // end of wxMemoryDC::wxMemoryDC
void wxMemoryDC::Init() void wxMemoryDCImpl::Init()
{ {
if (m_ok) if (m_ok)
{ {
@@ -50,7 +67,7 @@ void wxMemoryDC::Init()
memset(&m_vRclPaint, 0, sizeof(m_vRclPaint)); memset(&m_vRclPaint, 0, sizeof(m_vRclPaint));
} // end of wxMemoryDC::Init } // end of wxMemoryDC::Init
bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) ) bool wxMemoryDCImpl::CreateCompatible( wxDC* WXUNUSED(pDC) )
{ {
HDC hDC; HDC hDC;
HPS hPS; HPS hPS;
@@ -112,7 +129,7 @@ bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) )
return m_ok; return m_ok;
} // end of wxMemoryDC::CreateCompatible } // end of wxMemoryDC::CreateCompatible
void wxMemoryDC::DoSelect( void wxMemoryDCImpl::DoSelect(
const wxBitmap& rBitmap const wxBitmap& rBitmap
) )
{ {
@@ -133,7 +150,7 @@ void wxMemoryDC::DoSelect(
// Check for whether the bitmap is already selected into a device context // Check for whether the bitmap is already selected into a device context
// //
wxCHECK_RET( !rBitmap.GetSelectedInto() || wxCHECK_RET( !rBitmap.GetSelectedInto() ||
(rBitmap.GetSelectedInto() == this), (rBitmap.GetSelectedInto() == GetOwner()),
wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") ); wxT("Bitmap is selected in another wxMemoryDC, delete the first wxMemoryDC or use SelectObject(NULL)") );
WXHBITMAP hBmp = rBitmap.GetHBITMAP(); WXHBITMAP hBmp = rBitmap.GetHBITMAP();
@@ -169,7 +186,7 @@ void wxMemoryDC::DoSelect(
m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, NULLHANDLE); m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, NULLHANDLE);
return; return;
} }
m_vSelectedBitmap.SetSelectedInto(this); m_vSelectedBitmap.SetSelectedInto(GetOwner());
m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, (HBITMAP)hBmp); m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, (HBITMAP)hBmp);
if (m_hOldBitmap == HBM_ERROR) if (m_hOldBitmap == HBM_ERROR)
@@ -179,7 +196,7 @@ void wxMemoryDC::DoSelect(
} }
} // end of wxMemoryDC::SelectObject } // end of wxMemoryDC::SelectObject
void wxMemoryDC::DoGetSize( void wxMemoryDCImpl::DoGetSize(
int* pWidth int* pWidth
, int* pHeight , int* pHeight
) const ) const

View File

@@ -15,6 +15,7 @@
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dcprint.h" #include "wx/dcprint.h"
#include "wx/os2/dcprint.h"
#define INCL_DEV #define INCL_DEV
#define INCL_GPI #define INCL_GPI
@@ -31,98 +32,10 @@
#include "wx/os2/private.h" #include "wx/os2/private.h"
IMPLEMENT_CLASS(wxPrinterDC, wxDC) IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxPMDCImpl)
wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& rPrintData ) :
// This form is deprecated wxPMDCImpl( owner )
wxPrinterDC::wxPrinterDC( const wxString& rsDriverName,
const wxString& rsDeviceName,
const wxString& rsFile,
bool bInteractive,
int nOrientation )
{
DEVOPENSTRUC vDevOpen = { (char*)rsDeviceName.wx_str()
,(char*)rsDriverName.wx_str()
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
};
m_isInteractive = bInteractive;
if (!rsFile.IsNull() && !rsFile.empty())
m_printData.SetFilename(rsFile);
/*
Implement PM's version of this
#if wxUSE_COMMON_DIALOGS
if (interactive)
{
PRINTDLG pd;
pd.lStructSize = sizeof( PRINTDLG );
pd.hwndOwner=(HWND) NULL;
pd.hDevMode=(HANDLE)NULL;
pd.hDevNames=(HANDLE)NULL;
pd.Flags=PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS;
pd.nFromPage=0;
pd.nToPage=0;
pd.nMinPage=0;
pd.nMaxPage=0;
pd.nCopies=1;
pd.hInstance=(HINSTANCE)NULL;
if ( PrintDlg( &pd ) != 0 )
{
m_hDC = (WXHDC) pd.hDC;
m_ok = true;
}
else
{
m_ok = false;
return;
}
}
else
#endif
*/
if ( !rsDriverName.empty() &&
!rsDeviceName.empty() &&
!rsFile.empty() )
{
m_hDC = (WXHDC) ::DevOpenDC( vHabmain
,OD_QUEUED
,"*"
,5L
,(PDEVOPENDATA)&vDevOpen
,NULLHANDLE
);
m_ok = m_hDC ? true: false;
}
else
{
wxPrintData vPrintData;
vPrintData.SetOrientation(nOrientation);
m_hDC = wxGetPrinterDC(vPrintData);
m_ok = m_hDC ? true: false;
}
if (m_hDC)
{
// int width = GetDeviceCaps(m_hDC, VERTRES);
// int height = GetDeviceCaps(m_hDC, HORZRES);
SetMapMode(wxMM_TEXT);
}
SetBrush(*wxBLACK_BRUSH);
SetPen(*wxBLACK_PEN);
} // end of wxPrinterDC::wxPrinterDC
wxPrinterDC::wxPrinterDC( const wxPrintData& rPrintData )
{ {
m_printData = rPrintData; m_printData = rPrintData;
m_isInteractive = false; m_isInteractive = false;
@@ -134,7 +47,8 @@ wxPrinterDC::wxPrinterDC( const wxPrintData& rPrintData )
SetPen(*wxBLACK_PEN); SetPen(*wxBLACK_PEN);
} // end of wxPrinterDC::wxPrinterDC } // end of wxPrinterDC::wxPrinterDC
wxPrinterDC::wxPrinterDC( WXHDC hTheDC ) wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, WXHDC hTheDC ) :
wxPMDCImpl( owner )
{ {
m_isInteractive = false; m_isInteractive = false;
m_hDC = hTheDC; m_hDC = hTheDC;
@@ -147,7 +61,7 @@ wxPrinterDC::wxPrinterDC( WXHDC hTheDC )
SetPen(*wxBLACK_PEN); SetPen(*wxBLACK_PEN);
} // end of wxPrinterDC::wxPrinterDC } // end of wxPrinterDC::wxPrinterDC
void wxPrinterDC::Init() void wxPrinterDCImpl::Init()
{ {
if (m_hDC) if (m_hDC)
{ {
@@ -158,7 +72,7 @@ void wxPrinterDC::Init()
} }
} // end of wxPrinterDC::Init } // end of wxPrinterDC::Init
bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage)) bool wxPrinterDCImpl::StartDoc(const wxString& WXUNUSED(rsMessage))
{ {
/* TODO: PM's implementation /* TODO: PM's implementation
DOCINFO docinfo; DOCINFO docinfo;
@@ -207,24 +121,24 @@ bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage))
return true; return true;
} // end of wxPrinterDC::StartDoc } // end of wxPrinterDC::StartDoc
void wxPrinterDC::EndDoc() void wxPrinterDCImpl::EndDoc()
{ {
// if (m_hDC) ::EndDoc((HDC) m_hDC); // if (m_hDC) ::EndDoc((HDC) m_hDC);
} // end of wxPrinterDC::EndDoc } // end of wxPrinterDC::EndDoc
void wxPrinterDC::StartPage() void wxPrinterDCImpl::StartPage()
{ {
// if (m_hDC) // if (m_hDC)
// ::StartPage((HDC) m_hDC); // ::StartPage((HDC) m_hDC);
} // end of wxPrinterDC::StartPage } // end of wxPrinterDC::StartPage
void wxPrinterDC::EndPage() void wxPrinterDCImpl::EndPage()
{ {
// if (m_hDC) // if (m_hDC)
// ::EndPage((HDC) m_hDC); // ::EndPage((HDC) m_hDC);
} // end of wxPrinterDC::EndPage } // end of wxPrinterDC::EndPage
wxRect wxPrinterDC::GetPaperRect() wxRect wxPrinterDCImpl::GetPaperRect()
{ {
// Use page rect if we can't get paper rect. // Use page rect if we can't get paper rect.
wxCoord w, h; wxCoord w, h;
@@ -342,10 +256,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC( const wxPrintData& WXUNUSED(rPrintDataConst) )
return (WXHDC) hDC; return (WXHDC) hDC;
} // end of wxGetPrinterDC } // end of wxGetPrinterDC
void wxPrinterDC::DoDrawBitmap( const wxBitmap& rBmp, void wxPrinterDCImpl::DoDrawBitmap( const wxBitmap& rBmp,
wxCoord WXUNUSED(vX), wxCoord WXUNUSED(vX),
wxCoord WXUNUSED(vY), wxCoord WXUNUSED(vY),
bool WXUNUSED(bUseMask)) bool WXUNUSED(bUseMask))
{ {
wxCHECK_RET( rBmp.Ok(), _T("invalid bitmap in wxPrinterDC::DrawBitmap") ); wxCHECK_RET( rBmp.Ok(), _T("invalid bitmap in wxPrinterDC::DrawBitmap") );
@@ -356,23 +270,23 @@ void wxPrinterDC::DoDrawBitmap( const wxBitmap& rBmp,
} // end of wxPrinterDC::DoDrawBitmap } // end of wxPrinterDC::DoDrawBitmap
bool wxPrinterDC::DoBlit( wxCoord WXUNUSED(vXdest), bool wxPrinterDCImpl::DoBlit( wxCoord WXUNUSED(vXdest),
wxCoord WXUNUSED(vYdest), wxCoord WXUNUSED(vYdest),
wxCoord WXUNUSED(vWidth), wxCoord WXUNUSED(vWidth),
wxCoord WXUNUSED(vHeight), wxCoord WXUNUSED(vHeight),
wxDC* WXUNUSED(pSource), wxDC* WXUNUSED(pSource),
wxCoord WXUNUSED(vXsrc), wxCoord WXUNUSED(vXsrc),
wxCoord WXUNUSED(vYsrc), wxCoord WXUNUSED(vYsrc),
int WXUNUSED(nRop), int WXUNUSED(nRop),
bool WXUNUSED(bUseMask), bool WXUNUSED(bUseMask),
wxCoord WXUNUSED(xsrcMask), wxCoord WXUNUSED(xsrcMask),
wxCoord WXUNUSED(ysrcMask) ) wxCoord WXUNUSED(ysrcMask) )
{ {
bool bSuccess = true; bool bSuccess = true;
// TODO: // TODO:
return bSuccess; return bSuccess;
} // end of wxPrintDC::DoBlit } // end of wxPrintDCImpl::DoBlit
#endif //wxUSE_PRINTING_ARCHITECTURE #endif //wxUSE_PRINTING_ARCHITECTURE

View File

@@ -17,7 +17,7 @@
#define INCL_PM #define INCL_PM
#include<os2.h> #include<os2.h>
#include "wx/dcscreen.h" #include "wx/os2/dcscreen.h"
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx/string.h" #include "wx/string.h"
@@ -26,23 +26,24 @@
#include "wx/os2/private.h" #include "wx/os2/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxPMDCImpl)
// Create a DC representing the whole screen // Create a DC representing the whole screen
wxScreenDC::wxScreenDC() wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) :
wxPMDCImpl( owner )
{ {
m_hDC = ::WinOpenWindowDC(HWND_DESKTOP); m_hDC = ::WinOpenWindowDC(HWND_DESKTOP);
m_hPS = ::WinGetScreenPS(HWND_DESKTOP); m_hPS = ::WinGetScreenPS(HWND_DESKTOP);
::GpiSetBackMix(m_hPS, BM_LEAVEALONE); ::GpiSetBackMix(m_hPS, BM_LEAVEALONE);
} // end of wxScreenDC::wxScreenDC() } // end of wxScreenDC::wxScreenDC()
void wxScreenDC::DoGetSize( int* pnWidth, void wxScreenDCImpl::DoGetSize( int* pnWidth,
int* pnHeight ) const int* pnHeight ) const
{ {
// //
// Skip wxWindowDC version because it doesn't work without a valid m_canvas // Skip wxWindowDC version because it doesn't work without a valid m_canvas
// (which we don't have) // (which we don't have)
// //
wxDC::DoGetSize( pnWidth, pnHeight ); wxPMDCImpl::DoGetSize( pnWidth, pnHeight );
} // end of wxScreenDC::DoGetSize } // end of wxScreenDC::DoGetSize