1///////////////////////////////////////////////////////////////////////////// 2// Name: wx/msw/dcmemory.h 3// Purpose: wxMemoryDC class 4// Author: Julian Smart 5// Modified by: 6// Created: 01/02/97 7// RCS-ID: $Id: dcmemory.h 48236 2007-08-20 23:43:32Z KO $ 8// Copyright: (c) Julian Smart 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_DCMEMORY_H_ 13#define _WX_DCMEMORY_H_ 14 15#include "wx/dcclient.h" 16 17class WXDLLEXPORT wxMemoryDC : public wxDC, public wxMemoryDCBase 18{ 19public: 20 wxMemoryDC() { CreateCompatible(NULL); Init(); } 21 wxMemoryDC(wxBitmap& bitmap) { CreateCompatible(NULL); Init(); SelectObject(bitmap); } 22 wxMemoryDC(wxDC *dc); // Create compatible DC 23 24 25protected: 26 // override some base class virtuals 27 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); 28 virtual void DoGetSize(int* width, int* height) const; 29 virtual void DoSelect(const wxBitmap& bitmap); 30 31 virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const 32 { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmapOfHDC(*subrect, GetHDC() );} 33 34 // create DC compatible with the given one or screen if dc == NULL 35 bool CreateCompatible(wxDC *dc); 36 37 // initialize the newly created DC 38 void Init(); 39 40private: 41 DECLARE_DYNAMIC_CLASS_NO_COPY(wxMemoryDC) 42}; 43 44#endif 45 // _WX_DCMEMORY_H_ 46