]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dcmemory.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // RCS-ID: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_GTK_DCMEMORY_H_ | |
11 | #define _WX_GTK_DCMEMORY_H_ | |
12 | ||
13 | #include "wx/dcclient.h" | |
14 | ||
15 | //----------------------------------------------------------------------------- | |
16 | // wxMemoryDC | |
17 | //----------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxMemoryDC : public wxWindowDC, public wxMemoryDCBase | |
20 | { | |
21 | public: | |
22 | wxMemoryDC() : wxWindowDC() { Init(); } | |
23 | wxMemoryDC(wxBitmap& bitmap) : wxWindowDC() { Init(); SelectObject(bitmap); } | |
24 | wxMemoryDC( wxDC *dc ); // Create compatible DC | |
25 | virtual ~wxMemoryDC(); | |
26 | ||
27 | // these get reimplemented for mono-bitmaps to behave | |
28 | // more like their Win32 couterparts. They now interpret | |
29 | // wxWHITE, wxWHITE_BRUSH and wxWHITE_PEN as drawing 0 | |
30 | // and everything else as drawing 1. | |
31 | virtual void SetPen( const wxPen &pen ); | |
32 | virtual void SetBrush( const wxBrush &brush ); | |
33 | virtual void SetBackground( const wxBrush &brush ); | |
34 | virtual void SetTextForeground( const wxColour &col ); | |
35 | virtual void SetTextBackground( const wxColour &col ); | |
36 | ||
37 | // implementation | |
38 | virtual wxBitmap GetSelectedBitmap() const { return m_selected; } | |
39 | wxBitmap m_selected; | |
40 | ||
41 | protected: | |
42 | void DoGetSize( int *width, int *height ) const; | |
43 | virtual void DoSelect(const wxBitmap& bitmap); | |
44 | virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const | |
45 | { return subrect == NULL ? GetSelectedBitmap() : GetSelectedBitmap().GetSubBitmap(*subrect); } | |
46 | ||
47 | private: | |
48 | void Init(); | |
49 | ||
50 | DECLARE_DYNAMIC_CLASS(wxMemoryDC) | |
51 | }; | |
52 | ||
53 | #endif // _WX_GTK_DCMEMORY_H_ |