#define _WX_DC_H_
#include "wx/defs.h"
+#include "wx/dc.h"
// ---------------------------------------------------------------------------
// macros
}; // end of CLASS wxDCCacheEntry
#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)
public:
- wxDC(void);
- virtual ~wxDC();
+ wxPMDCImpl(wxDC *owner, WXHDC hDC);
+ virtual ~wxPMDCImpl();
// implement base class pure virtuals
// ----------------------------------
virtual wxCoord GetCharHeight(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 CanGetTextExtent(void) const;
virtual int GetDepth(void) const;
#endif
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
,wxCoord vY
,const wxColour& rCol
void InitializePalette(void);
#endif // wxUSE_PALETTE
+protected:
//
// common part of DoDrawText() and DoDrawRotatedText()
//
// ----------------------------------------------------------------------------
#include "wx/dc.h"
+#include "wx/os2/dc.h"
+#include "wx/dcclient.h"
#include "wx/dynarray.h"
// ----------------------------------------------------------------------------
// this one if used by wxPaintDC only
struct WXDLLIMPEXP_FWD_CORE wxPaintDCInfo;
-WX_DECLARE_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
+WX_DECLARE_EXPORTED_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
// ----------------------------------------------------------------------------
// DC classes
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxWindowDC : public wxDC
+class WXDLLEXPORT wxWindowDCImpl : public wxPMDCImpl
{
public:
- wxWindowDC();
+ // default ctor
+ wxWindowDCImpl( wxDC *owner );
- //
// Create a DC corresponding to the whole window
- //
- wxWindowDC(wxWindow* pWin);
+ wxWindowDCImpl( wxDC *owner, wxWindow *pWin );
+
+ virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected:
+ // initialize the newly created DC
void InitDC(void);
- //
- // Override some base class virtuals
- //
- virtual void DoGetSize( int* pWidth
- ,int* pHeight
- ) const;
-
private:
SIZEL m_PageSize;
- DECLARE_DYNAMIC_CLASS(wxWindowDC)
+ DECLARE_CLASS(wxWindowDCImpl)
+ DECLARE_NO_COPY_CLASS(wxWindowDCImpl)
}; // end of CLASS wxWindowDC
-class WXDLLEXPORT wxClientDC : public wxWindowDC
+class WXDLLEXPORT wxClientDCImpl : public wxWindowDCImpl
{
public:
- wxClientDC();
- virtual ~wxClientDC();
+ // default ctor
+ wxClientDCImpl( wxDC *owner );
+
+ // Create a DC corresponding to the client area of the window
+ wxClientDCImpl( wxDC *owner, wxWindow *pWin );
- wxClientDC(wxWindow *win);
+ virtual ~wxClientDCImpl();
+
+ virtual void DoGetSize(int *pWidth, int *pHeight) const;
protected:
void InitDC(void);
- //
- // Override some base class virtuals
- //
- virtual void DoGetSize( int* pWidth
- ,int* pHeight
- ) const;
-
private:
- DECLARE_DYNAMIC_CLASS(wxClientDC)
+ DECLARE_CLASS(wxClientDCImpl)
+ DECLARE_NO_COPY_CLASS(wxClientDCImpl)
}; // end of CLASS wxClientDC
-class WXDLLEXPORT wxPaintDC : public wxClientDC
+class WXDLLEXPORT wxPaintDCImpl : public wxClientDCImpl
{
public:
- wxPaintDC();
+ wxPaintDCImpl( wxDC *owner );
// 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)
static WXHDC FindDCInCache(wxWindow* pWin);
// find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo* FindInCache(size_t* pIndex = NULL) const;
private:
- DECLARE_DYNAMIC_CLASS(wxPaintDC)
+ DECLARE_CLASS(wxPaintDCImpl)
+ DECLARE_NO_COPY_CLASS(wxPaintDCImpl)
}; // end of wxPaintDC
#endif
#ifndef _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:
- wxMemoryDC() { CreateCompatible(NULL); Init(); }
- wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); }
- wxMemoryDC(wxDC* pDC); // Create compatible DC
+ wxMemoryDCImpl( wxMemoryDC *owner );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
+ wxMemoryDCImpl( wxMemoryDC *owner, wxDC* pDC); // Create compatible DC
-protected:
// override some base class virtuals
- virtual void DoGetSize( int* pWidth
- ,int* pHeight
- ) const;
+ virtual void DoGetSize(int* pWidth, int* pHeight) const;
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
bool CreateCompatible(wxDC* pDC);
// initialize the newly created DC
void Init(void);
private:
- DECLARE_DYNAMIC_CLASS(wxMemoryDC)
-}; // end of CLASS wxMemoryDC
+ DECLARE_CLASS(wxMemoryDCImpl)
+ DECLARE_NO_COPY_CLASS(wxMemoryDCImpl)
+}; // end of CLASS wxMemoryDCImpl
#endif
// _WX_DCMEMORY_H_
#include "wx/dc.h"
#include "wx/cmndata.h"
+#include "wx/os2/dc.h"
-class WXDLLEXPORT wxPrinterDC: public wxDC
+class WXDLLEXPORT wxPrinterDCImpl: public wxPMDCImpl
{
public:
- // Create a printer DC [obsolete]
- wxPrinterDC( const wxString& rsDriver
- ,const wxString& rsDevice
- ,const wxString& rsOutput
- ,bool bInteractive = TRUE
- ,int nOrientation = wxPORTRAIT
- );
+ // Create a printer DC
// Create from print data
- wxPrinterDC(const wxPrintData& rData);
- wxPrinterDC(WXHDC hTheDC);
+ wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& rData );
+ wxPrinterDCImpl( wxPrinterDC *owner, WXHDC hTheDC);
- bool StartDoc(const wxString& rsMessage);
- void EndDoc(void);
- void StartPage(void);
- void EndPage(void);
+ // override some base class virtuals
+ virtual bool StartDoc(const wxString& rsMessage);
+ virtual void EndDoc(void);
+ virtual void StartPage(void);
+ virtual void EndPage(void);
- wxRect GetPaperRect();
+ virtual wxRect GetPaperRect();
protected:
virtual void DoDrawBitmap( const wxBitmap& rBmp
wxPrintData m_printData;
private:
- DECLARE_CLASS(wxPrinterDC)
+ DECLARE_CLASS(wxPrinterDCImpl)
+ DECLARE_NO_COPY_CLASS(wxPrinterDCImpl)
}; // end of CLASS wxPrinterDC
// Gets an HDC for the specified printer configuration
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef _WX_DCSCREEN_H_
-#define _WX_DCSCREEN_H_
+#ifndef _WX_OS2_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:
- //
// Create a DC representing the whole screen
- //
- wxScreenDC();
+ wxScreenDCImpl( wxScreenDC *owner );
- //
- // 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
,int* pnHeight
) const;
private:
- DECLARE_DYNAMIC_CLASS(wxScreenDC)
+ DECLARE_CLASS(wxScreenDCImpl)
+ DECLARE_NO_COPY_CLASS(wxScreenDCImpl)
}; // end of CLASS wxScreenDC
#endif
// _WX_DCSCREEN_H_
-
#include "wx/mac/dcscreen.h"
#endif
+#ifdef __WXPM__
+ #include "wx/os2/dcclient.h"
+ #include "wx/os2/dcmemory.h"
+ #include "wx/os2/dcscreen.h"
+#endif
+
#ifdef __WXCOCOA__
#include "wx/cocoa/dcclient.h"
#include "wx/cocoa/dcmemory.h"
#include <string.h>
+#include "wx/os2/dc.h"
+#include "wx/os2/dcclient.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.
// wxDCCacheEntry
// ---------------------------------------------------------------------------
-wxList wxDC::m_svBitmapCache;
-wxList wxDC::m_svDCCache;
+wxList wxPMDCImpl::m_svBitmapCache;
+wxList wxPMDCImpl::m_svDCCache;
wxDCCacheEntry::wxDCCacheEntry(
WXHBITMAP hBitmap
::GpiDestroyPS(m_hPS);
} // end of wxDCCacheEntry::~wxDCCacheEntry
-wxDCCacheEntry* wxDC::FindBitmapInCache(
+wxDCCacheEntry* wxPMDCImpl::FindBitmapInCache(
HPS hPS
, int nWidth
, int nHeight
return pEntry;
} // end of FindBitmapInCache
-wxDCCacheEntry* wxDC::FindDCInCache(
+wxDCCacheEntry* wxPMDCImpl::FindDCInCache(
wxDCCacheEntry* pNotThis
, HPS hPS
)
);
AddToDCCache(pEntry);
return pEntry;
-} // end of wxDC::FindDCInCache
+} // end of wxPMDCImpl::FindDCInCache
-void wxDC::AddToBitmapCache(
+void wxPMDCImpl::AddToBitmapCache(
wxDCCacheEntry* pEntry
)
{
m_svBitmapCache.Append(pEntry);
-} // end of wxDC::AddToBitmapCache
+} // end of wxPMDCImpl::AddToBitmapCache
-void wxDC::AddToDCCache(
+void wxPMDCImpl::AddToDCCache(
wxDCCacheEntry* 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.Clear();
m_svDCCache.DeleteContents(true);
m_svDCCache.Clear();
m_svDCCache.DeleteContents(false);
-} // end of wxDC::ClearCache
+} // end of wxPMDCImpl::ClearCache
// Clean up cache at app exit
class wxDCModule : public wxModule
{
public:
virtual bool OnInit() { return true; }
- virtual void OnExit() { wxDC::ClearCache(); }
+ virtual void OnExit() { wxPMDCImpl::ClearCache(); }
private:
DECLARE_DYNAMIC_CLASS(wxDCModule)
// 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;
- 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)
+wxPMDCImpl::~wxPMDCImpl(void)
{
if ( m_hDC != 0 )
{
}
}
}
-} // end of wxDC::~wxDC
+} // end of wxPMDCImpl::~wxDC
// This will select current objects out of the DC,
// which is what you have to do before deleting the
// DC.
-void wxDC::SelectOldObjects(
+void wxPMDCImpl::SelectOldObjects(
WXHDC hPS
)
{
m_font = wxNullFont;
m_backgroundBrush = wxNullBrush;
m_vSelectedBitmap = wxNullBitmap;
-} // end of wxDC::SelectOldObjects
+} // end of wxPMDCImpl::SelectOldObjects
// ---------------------------------------------------------------------------
// clipping
m_clipY2 = (wxCoord) YDEV2LOG(rect.yBottom); \
}
-void wxDC::DoSetClippingRegion(
+void wxPMDCImpl::DoSetClippingRegion(
wxCoord vX
, wxCoord vY
, wxCoord vWidth
vRect.yBottom = vY;
::GpiIntersectClipRectangle(m_hPS, &vRect);
DO_SET_CLIPPING_BOX()
-} // end of wxDC::DoSetClippingRegion
+} // end of wxPMDCImpl::DoSetClippingRegion
-void wxDC::DoSetClippingRegionAsRegion(
+void wxPMDCImpl::DoSetClippingRegionAsRegion(
const wxRegion& rRegion
)
{
,&hRgnOld
);
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)
{
::GpiSetClipRegion(m_hPS, hRgn, &hRgnOld);
}
ResetClipping();
-} // end of wxDC::DestroyClippingRegion
+} // end of wxPMDCImpl::DestroyClippingRegion
// ---------------------------------------------------------------------------
// query capabilities
// ---------------------------------------------------------------------------
-bool wxDC::CanDrawBitmap() const
+bool wxPMDCImpl::CanDrawBitmap() const
{
return true;
}
-bool wxDC::CanGetTextExtent() const
+bool wxPMDCImpl::CanGetTextExtent() const
{
LONG lTechnology = 0L;
::DevQueryCaps(GetHDC(), CAPS_TECHNOLOGY, 1L, &lTechnology);
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];
int nBitsPerPixel = 0;
nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT];
}
return nBitsPerPixel;
-} // end of wxDC::GetDepth
+} // end of wxPMDCImpl::GetDepth
// ---------------------------------------------------------------------------
// drawing
// ---------------------------------------------------------------------------
-void wxDC::Clear()
+void wxPMDCImpl::Clear()
{
//
// If this is a canvas DC then just fill with the background color
}
else
::GpiErase(m_hPS);
-} // end of wxDC::Clear
+} // end of wxPMDCImpl::Clear
-bool wxDC::DoFloodFill(
+bool wxPMDCImpl::DoFloodFill(
wxCoord vX
, wxCoord vY
, const wxColour& rCol
bSuccess = true;
return bSuccess;
-} // end of wxDC::DoFloodFill
+} // end of wxPMDCImpl::DoFloodFill
-bool wxDC::DoGetPixel(
+bool wxPMDCImpl::DoGetPixel(
wxCoord vX
, wxCoord vY
, wxColour* pCol
,GetBValue(lColor)
);
return true;
-} // end of wxDC::DoGetPixel
+} // end of wxPMDCImpl::DoGetPixel
-void wxDC::DoCrossHair(
+void wxPMDCImpl::DoCrossHair(
wxCoord vX
, wxCoord vY
)
::GpiLine(m_hPS, &vPoint[3]);
CalcBoundingBox(vX1, vY1);
CalcBoundingBox(vX2, vY2);
-} // end of wxDC::DoCrossHair
+} // end of wxPMDCImpl::DoCrossHair
-void wxDC::DoDrawLine(
+void wxPMDCImpl::DoDrawLine(
wxCoord vX1
, wxCoord vY1
, wxCoord vX2
::GpiLine(m_hPS, &vPoint[1]);
CalcBoundingBox(vX1, vY1);
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)
// current brush for filling the shape. The arc is drawn in an anticlockwise
// direction from the start point to the end point.
//////////////////////////////////////////////////////////////////////////////
-void wxDC::DoDrawArc(
+void wxPMDCImpl::DoDrawArc(
wxCoord vX1
, wxCoord vY1
, wxCoord vX2
CalcBoundingBox( (wxCoord)(vXc + dRadius)
,(wxCoord)(vYc + dRadius)
);
-} // end of wxDC::DoDrawArc
+} // end of wxPMDCImpl::DoDrawArc
-void wxDC::DoDrawCheckMark(
+void wxPMDCImpl::DoDrawCheckMark(
wxCoord vX1
, wxCoord vY1
, wxCoord vWidth
CalcBoundingBox( vX2
,vY2
);
-} // end of wxDC::DoDrawCheckMark
+} // end of wxPMDCImpl::DoDrawCheckMark
-void wxDC::DoDrawPoint(
+void wxPMDCImpl::DoDrawPoint(
wxCoord vX
, wxCoord vY
)
CalcBoundingBox( vX
,vY
);
-} // end of wxDC::DoDrawPoint
+} // end of wxPMDCImpl::DoDrawPoint
-void wxDC::DoDrawPolygon( int n,
+void wxPMDCImpl::DoDrawPolygon( int n,
wxPoint vPoints[],
wxCoord vXoffset,
wxCoord vYoffset,
::GpiMove(m_hPS, &vPlgn.aPointl[0]);
lHits = ::GpiPolygons(m_hPS, ulCount, &vPlgn, flOptions, flModel);
free(vPlgn.aPointl);
-} // end of wxDC::DoDrawPolygon
+} // end of wxPMDCImpl::DoDrawPolygon
-void wxDC::DoDrawLines(
+void wxPMDCImpl::DoDrawLines(
int n
, wxPoint vPoints[]
, wxCoord vXoffset
::GpiLine(m_hPS, &vPoint);
}
}
-} // end of wxDC::DoDrawLines
+} // end of wxPMDCImpl::DoDrawLines
-void wxDC::DoDrawRectangle(
+void wxPMDCImpl::DoDrawRectangle(
wxCoord vX
, wxCoord vY
, wxCoord vWidth
}
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2);
-} // end of wxDC::DoDrawRectangle
+} // end of wxPMDCImpl::DoDrawRectangle
-void wxDC::DoDrawRoundedRectangle(
+void wxPMDCImpl::DoDrawRoundedRectangle(
wxCoord vX
, wxCoord vY
, wxCoord vWidth
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2);
-} // end of wxDC::DoDrawRoundedRectangle
+} // end of wxPMDCImpl::DoDrawRoundedRectangle
// Draw Ellipse within box (x,y) - (x+width, y+height)
-void wxDC::DoDrawEllipse(
+void wxPMDCImpl::DoDrawEllipse(
wxCoord vX
, wxCoord vY
, wxCoord vWidth
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2);
-} // end of wxDC::DoDrawEllipse
+} // end of wxPMDCImpl::DoDrawEllipse
-void wxDC::DoDrawEllipticArc(
+void wxPMDCImpl::DoDrawEllipticArc(
wxCoord vX
, wxCoord vY
, wxCoord vWidth
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX2, vY2);
-} // end of wxDC::DoDrawEllipticArc
+} // end of wxPMDCImpl::DoDrawEllipticArc
-void wxDC::DoDrawIcon(
+void wxPMDCImpl::DoDrawIcon(
const wxIcon& rIcon
, wxCoord vX
, wxCoord vY
}
CalcBoundingBox(vX, vY);
CalcBoundingBox(vX + rIcon.GetWidth(), vY + rIcon.GetHeight());
-} // end of wxDC::DoDrawIcon
+} // end of wxPMDCImpl::DoDrawIcon
-void wxDC::DoDrawBitmap(
+void wxPMDCImpl::DoDrawBitmap(
const wxBitmap& rBmp
, wxCoord vX
, wxCoord vY
//
// 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();
}
::GpiSetBackColor((HPS)GetHPS(), lOldBackGround);
}
}
-} // end of wxDC::DoDrawBitmap
+} // end of wxPMDCImpl::DoDrawBitmap
-void wxDC::DoDrawText(
+void wxPMDCImpl::DoDrawText(
const wxString& rsText
, wxCoord vX
, wxCoord vY
);
CalcBoundingBox(vX, vY);
- GetTextExtent(rsText, &vWidth, &vHeight);
+ GetOwner()->GetTextExtent(rsText, &vWidth, &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 vY )
{
SetBkMode( m_hPS
,m_backgroundMode
);
- GetTextExtent( rsText
- ,&vTextX
- ,&vTextY
- );
+ GetOwner()->GetTextExtent( rsText
+ ,&vTextX
+ ,&vTextY
+ );
vPtlStart.x = vX;
if (!(m_vRclPaint.yTop == 0 &&
m_vRclPaint.yBottom == 0 &&
);
}
-void wxDC::DoDrawRotatedText(
+void wxPMDCImpl::DoDrawRotatedText(
const wxString& rsText
, wxCoord vX
, wxCoord vY
// 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
if (!m_hOldPalette)
m_hOldPalette = (WXHPALETTE)hOldPal;
}
-} // end of wxDC::DoSelectPalette
+} // end of wxPMDCImpl::DoSelectPalette
-void wxDC::InitializePalette()
+void wxPMDCImpl::InitializePalette()
{
if (wxDisplayDepth() <= 8 )
{
DoSelectPalette();
}
}
-} // end of wxDC::InitializePalette
+} // end of wxPMDCImpl::InitializePalette
-void wxDC::SetPalette(
+void wxPMDCImpl::SetPalette(
const wxPalette& rPalette
)
{
HPALETTE hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE());
if (!m_hOldPalette)
m_hOldPalette = (WXHPALETTE)hOldPal;
-} // end of wxDC::SetPalette
+} // end of wxPMDCImpl::SetPalette
-void wxDC::SetFont(
+void wxPMDCImpl::SetFont(
const wxFont& rFont
)
{
HFONT hFont = m_font.GetResourceHandle();
if (hFont == (HFONT) NULL)
{
- wxLogDebug(wxT("::SelectObject failed in wxDC::SetFont."));
+ wxLogDebug(wxT("::SelectObject failed in wxPMDCImpl::SetFont."));
}
if (!m_hOldFont)
m_hOldFont = (WXHFONT) hFont;
}
-} // end of wxDC::SetFont
+} // end of wxPMDCImpl::SetFont
-void wxDC::SetPen(
+void wxPMDCImpl::SetPen(
const wxPen& rPen
)
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
-
if (m_pen == rPen)
return;
m_pen = rPen;
}
}
-void wxDC::SetBrush(
+void wxPMDCImpl::SetBrush(
const wxBrush& rBrush
)
{
- wxCHECK_RET( Ok(), wxT("invalid window dc") );
-
if (m_hOldBrush)
m_hOldBrush = 0L;
m_brush = rBrush;
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;
{
(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;
-} // end of wxDC::SetBackgroundMode
+} // end of wxPMDCImpl::SetBackgroundMode
-void wxDC::SetLogicalFunction(int nFunction)
+void wxPMDCImpl::SetLogicalFunction(int nFunction)
{
m_logicalFunction = nFunction;
SetRop((WXHDC)m_hDC);
-} // wxDC::SetLogicalFunction
+} // wxPMDCImpl::SetLogicalFunction
-void wxDC::SetRop(WXHDC hDC)
+void wxPMDCImpl::SetRop(WXHDC hDC)
{
if (!hDC || m_logicalFunction < 0)
return;
break;
}
::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.
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
// ---------------------------------------------------------------------------
-wxCoord wxDC::GetCharHeight() const
+wxCoord wxPMDCImpl::GetCharHeight() const
{
FONTMETRICS vFM; // metrics structure
return YDEV2LOGREL(vFM.lXHeight);
}
-wxCoord wxDC::GetCharWidth() const
+wxCoord wxPMDCImpl::GetCharWidth() const
{
FONTMETRICS vFM; // metrics structure
return XDEV2LOGREL(vFM.lAveCharWidth);
}
-void wxDC::DoGetTextExtent(
+void wxPMDCImpl::DoGetTextExtent(
const wxString& rsString
, wxCoord* pvX
, wxCoord* pvY
//
// 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
,l
,rsString.char_str()
sError = wxPMErrorToStr(vErrorCode);
// DEBUG
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
,wxICON_INFORMATION
);
*pvExternalLeading = vFM.lExternalLeading;
}
-void wxDC::SetMapMode(
+void wxPMDCImpl::SetMapMode(
int nMode
)
{
ComputeScaleAndOrigin();
-}; // end of wxDC::SetMapMode
+}; // end of wxPMDCImpl::SetMapMode
-void wxDC::SetUserScale( double dX,
+void wxPMDCImpl::SetUserScale( double dX,
double dY )
{
m_userScaleX = dX;
m_userScaleY = dY;
SetMapMode(m_mappingMode);
-} // end of wxDC::SetUserScale
+} // end of wxPMDCImpl::SetUserScale
-void wxDC::SetAxisOrientation( bool bXLeftRight,
+void wxPMDCImpl::SetAxisOrientation( bool bXLeftRight,
bool bYBottomUp )
{
m_signX = bXLeftRight ? 1 : -1;
m_signY = bYBottomUp ? -1 : 1;
SetMapMode(m_mappingMode);
-} // end of wxDC::SetAxisOrientation
+} // end of wxPMDCImpl::SetAxisOrientation
-void wxDC::SetLogicalOrigin(
+void wxPMDCImpl::SetLogicalOrigin(
wxCoord vX
, wxCoord vY
)
::GpiSetPageViewport( m_hPS
,&vRect
);
-}; // end of wxDC::SetLogicalOrigin
+}; // end of wxPMDCImpl::SetLogicalOrigin
-void wxDC::SetDeviceOrigin(
+void wxPMDCImpl::SetDeviceOrigin(
wxCoord vX
, wxCoord vY
)
::GpiSetPageViewport( m_hPS
,&vRect
);
-}; // end of wxDC::SetDeviceOrigin
+}; // end of wxPMDCImpl::SetDeviceOrigin
// ---------------------------------------------------------------------------
// bit blit
// ---------------------------------------------------------------------------
-bool wxDC::DoBlit( wxCoord vXdest,
+bool wxPMDCImpl::DoBlit( wxCoord vXdest,
wxCoord vYdest,
wxCoord vWidth,
wxCoord vHeight,
COLORREF vOldTextColor;
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)
{
- const wxBitmap& rBmp = pSource->m_vSelectedBitmap;
+ const wxBitmap& rBmp = pm_impl->GetSelectedBitmap();
pMask = rBmp.GetMask();
if (!(rBmp.Ok() && pMask && pMask->GetMaskBitmap()))
// create a temp buffer bitmap and DCs to access it and the mask
//
wxDCCacheEntry* pDCCacheEntry1 = FindDCInCache( NULL
- ,pSource->GetHPS()
+ ,pm_impl->GetHPS()
);
wxDCCacheEntry* pDCCacheEntry2 = FindDCInCache( pDCCacheEntry1
,GetHPS()
};
bSuccess = (::GpiBitBlt( m_hPS
- ,pSource->GetHPS()
+ ,pm_impl->GetHPS()
,4L
,aPoint
,lRop
return bSuccess;
}
-void wxDC::DoGetSize( int* pnWidth,
+void wxPMDCImpl::DoGetSize( int* pnWidth,
int* pnHeight ) const
{
LONG lArray[CAPS_HEIGHT];
*pnWidth = lArray[CAPS_WIDTH];
*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
{
LONG lArray[CAPS_VERTICAL_RESOLUTION];
*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];
int nWidth = 0;
}
wxSize ppisize(nWidth, nHeight);
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_logicalScaleY = dY;
-}; // end of wxDC::SetLogicalScale
+}; // end of wxPMDCImpl::SetLogicalScale
#include "wx/wxprec.h"
#include "wx/dcclient.h"
+#include "wx/os2/dcclient.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
struct WXDLLEXPORT wxPaintDCInfo
{
wxPaintDCInfo( wxWindow* pWin
- ,wxDC* pDC
+ ,wxPaintDCImpl* pDC
)
{
m_hWnd = pWin->GetHWND();
WX_DEFINE_OBJARRAY(wxArrayDCInfo);
-// ----------------------------------------------------------------------------
-// macros
-// ----------------------------------------------------------------------------
-
- IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
- IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
- IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
// ===========================================================================
// ----------------------------------------------------------------------------
-// wxWindowDC
+// wxWindowDCImpl
// ----------------------------------------------------------------------------
-wxWindowDC::wxWindowDC()
+IMPLEMENT_ABSTRACT_CLASS(wxWindowDCImpl, wxPMDCImpl)
+
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner ) :
+ wxPMDCImpl( owner )
{
- m_pCanvas = NULL;
m_PageSize.cx = m_PageSize.cy = 0;
-
}
-wxWindowDC::wxWindowDC(
- wxWindow* pTheCanvas
-)
+wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow* pTheCanvas) :
+ wxPMDCImpl( owner )
{
ERRORID vError;
wxString sError;
,&m_vRclPaint
);
InitDC();
-} // end of wxWindowDC::wxWindowDC
+} // end of wxWindowDCImpl::wxWindowDCImpl
-void wxWindowDC::InitDC()
+void wxWindowDCImpl::InitDC()
{
//
m_pen.SetColour(*wxBLACK);
m_brush.SetColour(*wxWHITE);
+ // since we are a window dc we need to grab the palette from the window
+#if wxUSE_PALETTE
InitializePalette();
+#endif
wxFont* pFont = new wxFont( 10, wxMODERN, wxNORMAL, wxBOLD );
SetFont(*pFont);
delete pFont;
//
::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* pnHeight
) const
m_pCanvas->GetSize( pnWidth
,pnHeight
);
-} // end of wxWindowDC::DoGetSize
+} // end of wxWindowDCImpl::DoGetSize
// ----------------------------------------------------------------------------
// wxClientDC
// ----------------------------------------------------------------------------
-wxClientDC::wxClientDC()
+IMPLEMENT_ABSTRACT_CLASS(wxClientDCImpl, wxWindowDCImpl)
+
+wxClientDCImpl::wxClientDCImpl( wxDC *owner ) :
+ wxWindowDCImpl( owner )
{
m_pCanvas = NULL;
}
-wxClientDC::wxClientDC(
- wxWindow* pTheCanvas
-)
+wxClientDCImpl::wxClientDCImpl( wxDC *owner, wxWindow *pTheCanvas) :
+ wxWindowDCImpl( owner )
{
SIZEL vSizl = { 0,0};
ERRORID vError;
//
// default under PM is that Window and Client DC's are the same
//
+
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(pTheCanvas));
+ printf("Got WindowDC %X for window handle %X\n", m_hDC, pTheCanvas);
+
m_hPS = ::GpiCreatePS( wxGetInstance()
,m_hDC
,&vSizl
,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
if (!::GpiCreateLogColorTable( m_hPS
,0L
,&m_vRclPaint
);
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
// performed by Windows for us
// clip the DC to avoid overwriting the non client area
SetClippingRegion(wxPoint(0, 0), m_pCanvas->GetClientSize());
#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* pnHeight
) const
m_pCanvas->GetClientSize( pnWidth
,pnHeight
);
-} // end of wxClientDC::DoGetSize
+} // end of wxClientDCImpl::DoGetSize
// ----------------------------------------------------------------------------
// 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_hDC = 0;
}
-wxPaintDC::wxPaintDC(
- wxWindow* pCanvas
-)
+wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *pCanvas) :
+ wxClientDCImpl( owner )
{
wxCHECK_RET(pCanvas, wxT("NULL canvas in wxPaintDC ctor"));
ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this));
}
InitDC();
-} // end of wxPaintDC::wxPaintDC
+} // end of wxPaintDCImpl::wxPaintDCImpl
-wxPaintDC::~wxPaintDC()
+wxPaintDCImpl::~wxPaintDCImpl()
{
if ( m_hDC )
{
}
}
-wxPaintDCInfo* wxPaintDC::FindInCache(
+wxPaintDCInfo* wxPaintDCImpl::FindInCache(
size_t* pIndex
) const
{
}
}
return pInfo;
-} // end of wxPaintDC::FindInCache
+} // end of wxPaintDCImpl::FindInCache
// find the entry for this DC in the cache (keyed by the window)
-WXHDC wxPaintDC::FindDCInCache(
+WXHDC wxPaintDCImpl::FindDCInCache(
wxWindow* pWin
)
{
}
}
return 0;
-} // end of wxPaintDC::FindInCache
+} // end of wxPaintDCImpl::FindInCache
#include "wx/wxprec.h"
#include "wx/dcmemory.h"
+#include "wx/os2/dcmemory.h"
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/os2/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl, wxPMDCImpl)
/////////////////////////////////////////////////////////////////////////////
// Memory DC
/////////////////////////////////////////////////////////////////////////////
-wxMemoryDC::wxMemoryDC(
- wxDC* pOldDC
-)
+wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner )
+ : 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);
Init();
} // end of wxMemoryDC::wxMemoryDC
-void wxMemoryDC::Init()
+void wxMemoryDCImpl::Init()
{
if (m_ok)
{
memset(&m_vRclPaint, 0, sizeof(m_vRclPaint));
} // end of wxMemoryDC::Init
-bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) )
+bool wxMemoryDCImpl::CreateCompatible( wxDC* WXUNUSED(pDC) )
{
HDC hDC;
HPS hPS;
return m_ok;
} // end of wxMemoryDC::CreateCompatible
-void wxMemoryDC::DoSelect(
+void wxMemoryDCImpl::DoSelect(
const wxBitmap& rBitmap
)
{
// Check for whether the bitmap is already selected into a device context
//
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)") );
WXHBITMAP hBmp = rBitmap.GetHBITMAP();
m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, NULLHANDLE);
return;
}
- m_vSelectedBitmap.SetSelectedInto(this);
+ m_vSelectedBitmap.SetSelectedInto(GetOwner());
m_hOldBitmap = (WXHBITMAP)::GpiSetBitmap(m_hPS, (HBITMAP)hBmp);
if (m_hOldBitmap == HBM_ERROR)
}
} // end of wxMemoryDC::SelectObject
-void wxMemoryDC::DoGetSize(
+void wxMemoryDCImpl::DoGetSize(
int* pWidth
, int* pHeight
) const
#if wxUSE_PRINTING_ARCHITECTURE
#include "wx/dcprint.h"
+#include "wx/os2/dcprint.h"
#define INCL_DEV
#define INCL_GPI
#include "wx/os2/private.h"
-IMPLEMENT_CLASS(wxPrinterDC, wxDC)
+IMPLEMENT_ABSTRACT_CLASS(wxPrinterDCImpl, wxPMDCImpl)
-
-// This form is deprecated
-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 )
+wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& rPrintData ) :
+ wxPMDCImpl( owner )
{
m_printData = rPrintData;
m_isInteractive = false;
SetPen(*wxBLACK_PEN);
} // end of wxPrinterDC::wxPrinterDC
-wxPrinterDC::wxPrinterDC( WXHDC hTheDC )
+wxPrinterDCImpl::wxPrinterDCImpl( wxPrinterDC *owner, WXHDC hTheDC ) :
+ wxPMDCImpl( owner )
{
m_isInteractive = false;
m_hDC = hTheDC;
SetPen(*wxBLACK_PEN);
} // end of wxPrinterDC::wxPrinterDC
-void wxPrinterDC::Init()
+void wxPrinterDCImpl::Init()
{
if (m_hDC)
{
}
} // end of wxPrinterDC::Init
-bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage))
+bool wxPrinterDCImpl::StartDoc(const wxString& WXUNUSED(rsMessage))
{
/* TODO: PM's implementation
DOCINFO docinfo;
return true;
} // end of wxPrinterDC::StartDoc
-void wxPrinterDC::EndDoc()
+void wxPrinterDCImpl::EndDoc()
{
// if (m_hDC) ::EndDoc((HDC) m_hDC);
} // end of wxPrinterDC::EndDoc
-void wxPrinterDC::StartPage()
+void wxPrinterDCImpl::StartPage()
{
// if (m_hDC)
// ::StartPage((HDC) m_hDC);
} // end of wxPrinterDC::StartPage
-void wxPrinterDC::EndPage()
+void wxPrinterDCImpl::EndPage()
{
// if (m_hDC)
// ::EndPage((HDC) m_hDC);
} // end of wxPrinterDC::EndPage
-wxRect wxPrinterDC::GetPaperRect()
+wxRect wxPrinterDCImpl::GetPaperRect()
{
// Use page rect if we can't get paper rect.
wxCoord w, h;
return (WXHDC) hDC;
} // end of wxGetPrinterDC
-void wxPrinterDC::DoDrawBitmap( const wxBitmap& rBmp,
- wxCoord WXUNUSED(vX),
- wxCoord WXUNUSED(vY),
- bool WXUNUSED(bUseMask))
+void wxPrinterDCImpl::DoDrawBitmap( const wxBitmap& rBmp,
+ wxCoord WXUNUSED(vX),
+ wxCoord WXUNUSED(vY),
+ bool WXUNUSED(bUseMask))
{
wxCHECK_RET( rBmp.Ok(), _T("invalid bitmap in wxPrinterDC::DrawBitmap") );
} // end of wxPrinterDC::DoDrawBitmap
-bool wxPrinterDC::DoBlit( wxCoord WXUNUSED(vXdest),
- wxCoord WXUNUSED(vYdest),
- wxCoord WXUNUSED(vWidth),
- wxCoord WXUNUSED(vHeight),
- wxDC* WXUNUSED(pSource),
- wxCoord WXUNUSED(vXsrc),
- wxCoord WXUNUSED(vYsrc),
- int WXUNUSED(nRop),
- bool WXUNUSED(bUseMask),
- wxCoord WXUNUSED(xsrcMask),
- wxCoord WXUNUSED(ysrcMask) )
+bool wxPrinterDCImpl::DoBlit( wxCoord WXUNUSED(vXdest),
+ wxCoord WXUNUSED(vYdest),
+ wxCoord WXUNUSED(vWidth),
+ wxCoord WXUNUSED(vHeight),
+ wxDC* WXUNUSED(pSource),
+ wxCoord WXUNUSED(vXsrc),
+ wxCoord WXUNUSED(vYsrc),
+ int WXUNUSED(nRop),
+ bool WXUNUSED(bUseMask),
+ wxCoord WXUNUSED(xsrcMask),
+ wxCoord WXUNUSED(ysrcMask) )
{
bool bSuccess = true;
// TODO:
return bSuccess;
-} // end of wxPrintDC::DoBlit
+} // end of wxPrintDCImpl::DoBlit
#endif //wxUSE_PRINTING_ARCHITECTURE
#define INCL_PM
#include<os2.h>
-#include "wx/dcscreen.h"
+#include "wx/os2/dcscreen.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/os2/private.h"
-IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
+IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxPMDCImpl)
// Create a DC representing the whole screen
-wxScreenDC::wxScreenDC()
+wxScreenDCImpl::wxScreenDCImpl( wxScreenDC *owner ) :
+ wxPMDCImpl( owner )
{
m_hDC = ::WinOpenWindowDC(HWND_DESKTOP);
m_hPS = ::WinGetScreenPS(HWND_DESKTOP);
::GpiSetBackMix(m_hPS, BM_LEAVEALONE);
} // end of wxScreenDC::wxScreenDC()
-void wxScreenDC::DoGetSize( int* pnWidth,
- int* pnHeight ) const
+void wxScreenDCImpl::DoGetSize( int* pnWidth,
+ int* pnHeight ) const
{
//
// Skip wxWindowDC version because it doesn't work without a valid m_canvas
// (which we don't have)
//
- wxDC::DoGetSize( pnWidth, pnHeight );
+ wxPMDCImpl::DoGetSize( pnWidth, pnHeight );
} // end of wxScreenDC::DoGetSize