]> git.saurik.com Git - wxWidgets.git/commitdiff
Adopted OS/2 to DC reorganisation (r50348).
authorStefan Neis <Stefan.Neis@t-online.de>
Sun, 6 Jan 2008 22:37:10 +0000 (22:37 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sun, 6 Jan 2008 22:37:10 +0000 (22:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/dc.h
include/wx/os2/dcclient.h
include/wx/os2/dcmemory.h
include/wx/os2/dcprint.h
include/wx/os2/dcscreen.h
src/common/dcbase.cpp
src/os2/dc.cpp
src/os2/dcclient.cpp
src/os2/dcmemory.cpp
src/os2/dcprint.cpp
src/os2/dcscreen.cpp

index e3f48e3710530794e67b13a665ac00554d2d9709..edeb7d14893022c9ebbdefe0c64b6e324d6cb0de 100644 (file)
@@ -13,6 +13,7 @@
 #define _WX_DC_H_
 
 #include "wx/defs.h"
+#include "wx/dc.h"
 
 // ---------------------------------------------------------------------------
 // macros
@@ -94,13 +95,15 @@ public:
 }; // 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
     // ----------------------------------
@@ -124,13 +127,7 @@ public:
 
     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;
@@ -197,6 +194,39 @@ public:
 #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
@@ -322,6 +352,7 @@ protected:
     void InitializePalette(void);
 #endif // wxUSE_PALETTE
 
+protected:
     //
     // common part of DoDrawText() and DoDrawRotatedText()
     //
index fc18c8f8ae351b982c8b061a3e6e94431d68e0f1..b99eedcd11a2344c9899b198359332a486ea25d3 100644 (file)
@@ -17,6 +17,8 @@
 // ----------------------------------------------------------------------------
 
 #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);
@@ -98,7 +95,8 @@ protected:
     // 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
index 07927df52c99eb43cce26017beef2904ff6f3a08..194157da9e74c803ff4d1ff1945757c64e9969ac 100644 (file)
 #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_
index 0cf75b37b196e82e1e635ac208e72fc0e3dc2386..b742273bc93fda62f287791731c3a2f5cec43045 100644 (file)
 
 #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
@@ -63,7 +59,8 @@ protected:
 
     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
index 6ffaaf35b52d2d2c78ef07301683beaf467aa89b..ce33cf43caade785d15366a27228656b92e2a4d0 100644 (file)
@@ -9,36 +9,26 @@
 // 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_
-
index 6d16b4706fca63f188f09e69ec1d3ec5668ef590..09b466d07aefa55bc846cf83db9b6d443b7d33a1 100644 (file)
     #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"
index 3e6e349b6a5be78fd749103511c2ca87a40b8c20..aa54c8a48a377c1f3f542d887ebe3bcdcc74380f 100644 (file)
 
 #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.
@@ -156,8 +158,8 @@ int SetBkMode(
 // wxDCCacheEntry
 // ---------------------------------------------------------------------------
 
-wxList wxDC::m_svBitmapCache;
-wxList wxDC::m_svDCCache;
+wxList wxPMDCImpl::m_svBitmapCache;
+wxList wxPMDCImpl::m_svDCCache;
 
 wxDCCacheEntry::wxDCCacheEntry(
   WXHBITMAP                         hBitmap
@@ -193,7 +195,7 @@ wxDCCacheEntry::~wxDCCacheEntry()
         ::GpiDestroyPS(m_hPS);
 } // end of wxDCCacheEntry::~wxDCCacheEntry
 
-wxDCCacheEntry* wxDC::FindBitmapInCache(
+wxDCCacheEntry* wxPMDCImpl::FindBitmapInCache(
   HPS                               hPS
 , int                               nWidth
 , int                               nHeight
@@ -260,7 +262,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache(
     return pEntry;
 } // end of FindBitmapInCache
 
-wxDCCacheEntry* wxDC::FindDCInCache(
+wxDCCacheEntry* wxPMDCImpl::FindDCInCache(
   wxDCCacheEntry*                   pNotThis
 , HPS                               hPS
 )
@@ -289,23 +291,23 @@ wxDCCacheEntry* wxDC::FindDCInCache(
                                                                );
     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();
@@ -313,14 +315,14 @@ void wxDC::ClearCache()
     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)
@@ -334,28 +336,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
 // 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 )
     {
@@ -384,12 +372,12 @@ wxDC::~wxDC(void)
             }
         }
     }
-} // 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
 )
 {
@@ -419,7 +407,7 @@ void wxDC::SelectOldObjects(
     m_font            = wxNullFont;
     m_backgroundBrush = wxNullBrush;
     m_vSelectedBitmap = wxNullBitmap;
-} // end of wxDC::SelectOldObjects
+} // end of wxPMDCImpl::SelectOldObjects
 
 // ---------------------------------------------------------------------------
 // clipping
@@ -437,7 +425,7 @@ void wxDC::SelectOldObjects(
     m_clipY2 = (wxCoord) YDEV2LOG(rect.yBottom); \
 }
 
-void wxDC::DoSetClippingRegion(
+void wxPMDCImpl::DoSetClippingRegion(
   wxCoord                           vX
 , wxCoord                           vY
 , wxCoord                           vWidth
@@ -454,9 +442,9 @@ void wxDC::DoSetClippingRegion(
     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
 )
 {
@@ -469,9 +457,9 @@ void wxDC::DoSetClippingRegionAsRegion(
                         ,&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)
     {
@@ -492,26 +480,26 @@ void wxDC::DestroyClippingRegion(void)
          ::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;
@@ -525,13 +513,13 @@ int wxDC::GetDepth() const
         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
@@ -546,9 +534,9 @@ void wxDC::Clear()
     }
     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
@@ -573,9 +561,9 @@ bool wxDC::DoFloodFill(
         bSuccess = true;
 
     return bSuccess;
-} // end of wxDC::DoFloodFill
+} // end of wxPMDCImpl::DoFloodFill
 
-bool wxDC::DoGetPixel(
+bool wxPMDCImpl::DoGetPixel(
   wxCoord                           vX
 , wxCoord                           vY
 , wxColour*                         pCol
@@ -597,9 +585,9 @@ bool wxDC::DoGetPixel(
                   ,GetBValue(lColor)
                  );
     return true;
-} // end of wxDC::DoGetPixel
+} // end of wxPMDCImpl::DoGetPixel
 
-void wxDC::DoCrossHair(
+void wxPMDCImpl::DoCrossHair(
   wxCoord                           vX
 , wxCoord                           vY
 )
@@ -631,9 +619,9 @@ void wxDC::DoCrossHair(
     ::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
@@ -677,7 +665,7 @@ void wxDC::DoDrawLine(
     ::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)
@@ -685,7 +673,7 @@ void wxDC::DoDrawLine(
 // 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
@@ -775,9 +763,9 @@ void wxDC::DoDrawArc(
     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
@@ -824,9 +812,9 @@ void wxDC::DoDrawCheckMark(
     CalcBoundingBox( vX2
                     ,vY2
                    );
-} // end of wxDC::DoDrawCheckMark
+} // end of wxPMDCImpl::DoDrawCheckMark
 
-void wxDC::DoDrawPoint(
+void wxPMDCImpl::DoDrawPoint(
   wxCoord                           vX
 , wxCoord                           vY
 )
@@ -845,9 +833,9 @@ void wxDC::DoDrawPoint(
     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,
@@ -911,9 +899,9 @@ void wxDC::DoDrawPolygon( int n,
     ::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
@@ -961,9 +949,9 @@ void wxDC::DoDrawLines(
             ::GpiLine(m_hPS, &vPoint);
         }
     }
-} // end of wxDC::DoDrawLines
+} // end of wxPMDCImpl::DoDrawLines
 
-void wxDC::DoDrawRectangle(
+void wxPMDCImpl::DoDrawRectangle(
   wxCoord                           vX
 , wxCoord                           vY
 , wxCoord                           vWidth
@@ -1050,9 +1038,9 @@ void wxDC::DoDrawRectangle(
     }
     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
@@ -1143,10 +1131,10 @@ void wxDC::DoDrawRoundedRectangle(
 
     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
@@ -1186,9 +1174,9 @@ void wxDC::DoDrawEllipse(
 
     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
@@ -1245,9 +1233,9 @@ void wxDC::DoDrawEllipticArc(
 
     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
@@ -1270,9 +1258,9 @@ void wxDC::DoDrawIcon(
     }
     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
@@ -1365,9 +1353,9 @@ void wxDC::DoDrawBitmap(
                 //
                 // 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();
                 }
@@ -1675,9 +1663,9 @@ void wxDC::DoDrawBitmap(
             ::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
@@ -1692,11 +1680,11 @@ void wxDC::DoDrawText(
                );
 
     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 )
 {
@@ -1729,10 +1717,10 @@ void wxDC::DrawAnyText( const wxString& rsText,
     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 &&
@@ -1777,7 +1765,7 @@ void wxDC::DrawAnyText( const wxString& rsText,
              );
 }
 
-void wxDC::DoDrawRotatedText(
+void wxPMDCImpl::DoDrawRotatedText(
   const wxString&                   rsText
 , wxCoord                           vX
 , wxCoord                           vY
@@ -1848,7 +1836,7 @@ void wxDC::DoDrawRotatedText(
 // 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
@@ -1867,9 +1855,9 @@ void wxDC::DoSelectPalette( bool WXUNUSED(bRealize) )
         if (!m_hOldPalette)
             m_hOldPalette = (WXHPALETTE)hOldPal;
     }
-} // end of wxDC::DoSelectPalette
+} // end of wxPMDCImpl::DoSelectPalette
 
-void wxDC::InitializePalette()
+void wxPMDCImpl::InitializePalette()
 {
     if (wxDisplayDepth() <= 8 )
     {
@@ -1890,9 +1878,9 @@ void wxDC::InitializePalette()
             DoSelectPalette();
         }
     }
-} // end of wxDC::InitializePalette
+} // end of wxPMDCImpl::InitializePalette
 
-void wxDC::SetPalette(
+void wxPMDCImpl::SetPalette(
   const wxPalette&                  rPalette
 )
 {
@@ -1911,9 +1899,9 @@ void wxDC::SetPalette(
     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
 )
 {
@@ -1938,19 +1926,17 @@ void wxDC::SetFont(
         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;
@@ -1982,12 +1968,10 @@ void wxDC::SetPen(
     }
 }
 
-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;
@@ -2016,9 +2000,9 @@ void wxDC::SetBrush(
                 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;
 
@@ -2026,20 +2010,20 @@ void wxDC::SetBackground(const wxBrush& 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;
@@ -2099,31 +2083,31 @@ void wxDC::SetRop(WXHDC hDC)
             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
 
@@ -2134,7 +2118,7 @@ wxCoord wxDC::GetCharHeight() const
     return YDEV2LOGREL(vFM.lXHeight);
 }
 
-wxCoord wxDC::GetCharWidth() const
+wxCoord wxPMDCImpl::GetCharWidth() const
 {
     FONTMETRICS                     vFM; // metrics structure
 
@@ -2145,7 +2129,7 @@ wxCoord wxDC::GetCharWidth() const
     return XDEV2LOGREL(vFM.lAveCharWidth);
 }
 
-void wxDC::DoGetTextExtent(
+void wxPMDCImpl::DoGetTextExtent(
   const wxString&                   rsString
 , wxCoord*                          pvX
 , wxCoord*                          pvY
@@ -2174,6 +2158,14 @@ void wxDC::DoGetTextExtent(
     //
     // 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()
@@ -2186,7 +2178,7 @@ void wxDC::DoGetTextExtent(
        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
                          );
@@ -2218,7 +2210,7 @@ void wxDC::DoGetTextExtent(
         *pvExternalLeading = vFM.lExternalLeading;
 }
 
-void wxDC::SetMapMode(
+void wxPMDCImpl::SetMapMode(
   int                               nMode
 )
 {
@@ -2297,27 +2289,27 @@ void wxDC::SetMapMode(
     
     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
 )
@@ -2334,9 +2326,9 @@ void wxDC::SetLogicalOrigin(
     ::GpiSetPageViewport( m_hPS
                          ,&vRect
                         );
-}; // end of wxDC::SetLogicalOrigin
+}; // end of wxPMDCImpl::SetLogicalOrigin
 
-void wxDC::SetDeviceOrigin(
+void wxPMDCImpl::SetDeviceOrigin(
   wxCoord                           vX
 , wxCoord                           vY
 )
@@ -2355,13 +2347,13 @@ void wxDC::SetDeviceOrigin(
     ::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,
@@ -2378,9 +2370,18 @@ bool wxDC::DoBlit( wxCoord vXdest,
     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()))
@@ -2470,7 +2471,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
             // 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()
@@ -2631,7 +2632,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
                                                     };
 
         bSuccess = (::GpiBitBlt( m_hPS
-                                ,pSource->GetHPS()
+                                ,pm_impl->GetHPS()
                                 ,4L
                                 ,aPoint
                                 ,lRop
@@ -2653,7 +2654,7 @@ bool wxDC::DoBlit( wxCoord vXdest,
     return bSuccess;
 }
 
-void wxDC::DoGetSize( int* pnWidth,
+void wxPMDCImpl::DoGetSize( int* pnWidth,
                       int* pnHeight ) const
 {
     LONG lArray[CAPS_HEIGHT];
@@ -2667,9 +2668,9 @@ void wxDC::DoGetSize( int* pnWidth,
         *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];
@@ -2694,9 +2695,9 @@ void wxDC::DoGetSizeMM( int* pnWidth,
             *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;
@@ -2722,10 +2723,10 @@ wxSize wxDC::GetPPI() const
     }
     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
index b811e9a8df439eaf4b8c6ed84840f070eaaa5a6f..11160fbf97b95d9d4eb7ca7bf63aeb554a769d67 100644 (file)
@@ -21,6 +21,7 @@
 #include "wx/wxprec.h"
 
 #include "wx/dcclient.h"
+#include "wx/os2/dcclient.h"
 
 #ifndef WX_PRECOMP
     #include "wx/string.h"
@@ -38,7 +39,7 @@
 struct WXDLLEXPORT wxPaintDCInfo
 {
     wxPaintDCInfo( wxWindow* pWin
-                  ,wxDC*     pDC
+                  ,wxPaintDCImpl*     pDC
                  )
     {
         m_hWnd = pWin->GetHWND();
@@ -55,14 +56,6 @@ struct WXDLLEXPORT wxPaintDCInfo
 
 WX_DEFINE_OBJARRAY(wxArrayDCInfo);
 
-// ----------------------------------------------------------------------------
-// macros
-// ----------------------------------------------------------------------------
-
-    IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
-    IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
-    IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-
 // ----------------------------------------------------------------------------
 // global variables
 // ----------------------------------------------------------------------------
@@ -82,19 +75,19 @@ static RECT        g_paintStruct;
 // ===========================================================================
 
 // ----------------------------------------------------------------------------
-// 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;
@@ -152,9 +145,9 @@ wxWindowDC::wxWindowDC(
                          ,&m_vRclPaint
                         );
     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_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;
@@ -179,9 +175,9 @@ void wxWindowDC::InitDC()
     //
     ::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
@@ -190,20 +186,22 @@ void wxWindowDC::DoGetSize(
     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;
@@ -214,13 +212,19 @@ wxClientDC::wxClientDC(
     //
     // 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
@@ -248,11 +252,11 @@ wxClientDC::wxClientDC(
                          ,&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
@@ -267,13 +271,13 @@ void wxClientDC::InitDC()
     // 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
@@ -282,23 +286,25 @@ void wxClientDC::DoGetSize(
     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"));
 
@@ -361,9 +367,9 @@ wxPaintDC::wxPaintDC(
         ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this));
     }
     InitDC();
-} // end of wxPaintDC::wxPaintDC
+} // end of wxPaintDCImpl::wxPaintDCImpl
 
-wxPaintDC::~wxPaintDC()
+wxPaintDCImpl::~wxPaintDCImpl()
 {
     if ( m_hDC )
     {
@@ -388,7 +394,7 @@ wxPaintDC::~wxPaintDC()
     }
 }
 
-wxPaintDCInfo* wxPaintDC::FindInCache(
+wxPaintDCInfo* wxPaintDCImpl::FindInCache(
   size_t*                           pIndex
 ) const
 {
@@ -406,10 +412,10 @@ wxPaintDCInfo* wxPaintDC::FindInCache(
         }
     }
     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
 )
 {
@@ -425,4 +431,4 @@ WXHDC wxPaintDC::FindDCInCache(
         }
     }
     return 0;
-} // end of wxPaintDC::FindInCache
+} // end of wxPaintDCImpl::FindInCache
index 1332c9d2fbb91bbd0cbfa09e4ff64cd6b2b80edc..d4d5ec937cb7321b0db4d1a9d577543ea486c539 100644 (file)
@@ -13,6 +13,7 @@
 #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)
     {
@@ -50,7 +67,7 @@ void wxMemoryDC::Init()
     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;
@@ -112,7 +129,7 @@ bool wxMemoryDC::CreateCompatible( wxDC* WXUNUSED(pDC) )
     return m_ok;
 } // end of wxMemoryDC::CreateCompatible
 
-void wxMemoryDC::DoSelect(
+void wxMemoryDCImpl::DoSelect(
   const wxBitmap&                   rBitmap
 )
 {
@@ -133,7 +150,7 @@ void wxMemoryDC::DoSelect(
     // 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();
@@ -169,7 +186,7 @@ void wxMemoryDC::DoSelect(
         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)
@@ -179,7 +196,7 @@ void wxMemoryDC::DoSelect(
     }
 } // end of wxMemoryDC::SelectObject
 
-void wxMemoryDC::DoGetSize(
+void wxMemoryDCImpl::DoGetSize(
   int*                              pWidth
 , int*                              pHeight
 ) const
index 1c4a11c248532c2686c41a3b6f1a14321291d8e7..a861f3363dfb37847f78cd5aa416c22fcdaac81b 100644 (file)
@@ -15,6 +15,7 @@
 #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;
@@ -134,7 +47,8 @@ wxPrinterDC::wxPrinterDC( const wxPrintData& rPrintData )
     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;
@@ -147,7 +61,7 @@ wxPrinterDC::wxPrinterDC( WXHDC hTheDC )
     SetPen(*wxBLACK_PEN);
 } // end of wxPrinterDC::wxPrinterDC
 
-void wxPrinterDC::Init()
+void wxPrinterDCImpl::Init()
 {
     if (m_hDC)
     {
@@ -158,7 +72,7 @@ void wxPrinterDC::Init()
     }
 } // end of wxPrinterDC::Init
 
-bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage))
+bool wxPrinterDCImpl::StartDoc(const wxString& WXUNUSED(rsMessage))
 {
 /* TODO:  PM's implementation
    DOCINFO docinfo;
@@ -207,24 +121,24 @@ bool wxPrinterDC::StartDoc(const wxString& WXUNUSED(rsMessage))
     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;
@@ -342,10 +256,10 @@ WXHDC WXDLLEXPORT wxGetPrinterDC( const wxPrintData& WXUNUSED(rPrintDataConst) )
     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") );
 
@@ -356,23 +270,23 @@ void wxPrinterDC::DoDrawBitmap( const wxBitmap& rBmp,
 
 } // 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
index 2fa80efcef84997caaec905f9fadaf61a6ab3890..ce428ed8cd290fbb190c8d4ffd0eb0199625bcd7 100644 (file)
@@ -17,7 +17,7 @@
 #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