DC updates

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9726 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2001-04-11 18:04:54 +00:00
parent 2aeec9eccc
commit ac7fb818cc
5 changed files with 69 additions and 39 deletions

View File

@@ -319,11 +319,9 @@ public:
bool m_bOwnsDC:1; bool m_bOwnsDC:1;
// //
// our HDC and its usage count: we only free it when the usage count drops // our HDC
// to 0
// //
WXHDC m_hDC; WXHDC m_hDC;
int m_nDCCount;
// //
// Store all old GDI objects when do a SelectObject, so we can select them // Store all old GDI objects when do a SelectObject, so we can select them

View File

@@ -34,52 +34,53 @@ WX_DECLARE_OBJARRAY(wxPaintDCInfo, wxArrayDCInfo);
class WXDLLEXPORT wxWindowDC : public wxDC class WXDLLEXPORT wxWindowDC : public wxDC
{ {
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public: public:
wxWindowDC(); wxWindowDC();
// Create a DC corresponding to the whole window // Create a DC corresponding to the whole window
wxWindowDC(wxWindow *win); wxWindowDC(wxWindow* pWin);
virtual ~wxWindowDC(); protected:
void InitDC(void);
private: private:
HAB m_hab;
SIZEL m_PageSize; SIZEL m_PageSize;
}; DECLARE_DYNAMIC_CLASS(wxWindowDC)
}; // end of CLASS wxWindowDC
class WXDLLEXPORT wxClientDC : public wxWindowDC class WXDLLEXPORT wxClientDC : public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxClientDC)
public: public:
wxClientDC(); wxClientDC();
// Create a DC corresponding to the client area of the window // Create a DC corresponding to the client area of the window
wxClientDC(wxWindow *win); wxClientDC(wxWindow *win);
virtual ~wxClientDC(); private:
}; DECLARE_DYNAMIC_CLASS(wxClientDC)
}; // end of CLASS wxClientDC
class WXDLLEXPORT wxPaintDC : public wxWindowDC class WXDLLEXPORT wxPaintDC : public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxPaintDC)
public: public:
wxPaintDC(); wxPaintDC();
// Create a DC corresponding for painting the window in OnPaint() // Create a DC corresponding for painting the window in OnPaint()
wxPaintDC(wxWindow *win); wxPaintDC(wxWindow* pWin);
virtual ~wxPaintDC(); virtual ~wxPaintDC();
// find the entry for this DC in the cache (keyed by the window)
static WXHDC FindDCInCache(wxWindow* pWin);
protected: protected:
static wxArrayDCInfo ms_cache; static wxArrayDCInfo ms_cache;
// find the entry for this DC in the cache (keyed by the window) // find the entry for this DC in the cache (keyed by the window)
wxPaintDCInfo *FindInCache(size_t *index = NULL) const; wxPaintDCInfo* FindInCache(size_t* pIndex = NULL) const;
}; private:
DECLARE_DYNAMIC_CLASS(wxPaintDC)
}; // end of wxPaintDC
#endif #endif
// _WX_DCCLIENT_H_ // _WX_DCCLIENT_H_

View File

@@ -16,17 +16,28 @@
class WXDLLEXPORT wxMemoryDC: public wxDC class WXDLLEXPORT wxMemoryDC: public wxDC
{ {
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
public: public:
wxMemoryDC(void); wxMemoryDC(void);
wxMemoryDC(wxDC* pDC); // Create compatible DC wxMemoryDC(wxDC* pDC); // Create compatible DC
~wxMemoryDC(void);
virtual void SelectObject(const wxBitmap& rBitmap); virtual void SelectObject(const wxBitmap& rBitmap);
protected:
// override some base class virtuals
virtual void DoDrawRectangle( wxCoord vX
,wxCoord vY
,wxCoord vWidth
,wxCoord vHeight
);
virtual void DoGetSize( int* pWidth virtual void DoGetSize( int* pWidth
,int* pHeight ,int* pHeight
) const; ) const;
// 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 }; // end of CLASS wxMemoryDC
#endif #endif

View File

@@ -20,29 +20,50 @@
class WXDLLEXPORT wxPrinterDC: public wxDC class WXDLLEXPORT wxPrinterDC: public wxDC
{ {
public: public:
DECLARE_CLASS(wxPrinterDC) // 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 [obsolete] // Create from print data
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, int orientation = wxPORTRAIT); wxPrinterDC(const wxPrintData& rData);
wxPrinterDC(WXHDC hTheDC);
// Create from print data bool StartDoc(const wxString& rsMessage);
wxPrinterDC(const wxPrintData& data);
wxPrinterDC(WXHDC theDC);
~wxPrinterDC();
bool StartDoc(const wxString& message);
void EndDoc(void); void EndDoc(void);
void StartPage(void); void StartPage(void);
void EndPage(void); void EndPage(void);
protected: protected:
wxPrintData m_printData; virtual void DoDrawBitmap( const wxBitmap& rBmp
}; ,wxCoord vX
,wxCoord vY
,bool bUseMask = FALSE
);
virtual bool DoBlit( wxCoord vXdest
,wxCoord vYdest
,wxCoord vWidth
,wxCoord vHeight
,wxDC* pSource
,wxCoord vXsrc
,wxCoord vYsrc
,int nRop = wxCOPY
,bool bUseMask = FALSE
);
// init the dc
void Init(void);
wxPrintData m_printData;
private:
DECLARE_CLASS(wxPrinterDC)
}; // end of CLASS wxPrinterDC
// Gets an HDC for the specified printer configuration // Gets an HDC for the specified printer configuration
WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& data); WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& rData);
#endif // wxUSE_PRINTING_ARCHITECTURE #endif // wxUSE_PRINTING_ARCHITECTURE

View File

@@ -20,19 +20,18 @@
class WXDLLEXPORT wxScreenDC: public wxWindowDC class WXDLLEXPORT wxScreenDC: public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxScreenDC)
public: public:
// Create a DC representing the whole screen // Create a DC representing the whole screen
wxScreenDC(); wxScreenDC();
~wxScreenDC();
// Compatibility with X's requirements for // Compatibility with X's requirements for
// drawing on top of all windows // drawing on top of all windows
static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; } static bool StartDrawingOnTop(wxWindow* WXUNUSED(window)) { return TRUE; }
static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; } static bool StartDrawingOnTop(wxRect* WXUNUSED(rect) = NULL) { return TRUE; }
static bool EndDrawingOnTop() { return TRUE; } static bool EndDrawingOnTop() { return TRUE; }
}; private:
DECLARE_DYNAMIC_CLASS(wxScreenDC)
}; // end of CLASS wxScreenDC
#endif #endif
// _WX_DCSCREEN_H_ // _WX_DCSCREEN_H_