]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/bitmap.h
Add wxDocManager::GetPageSetupDialogData() accessor.
[wxWidgets.git] / include / wx / x11 / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/bitmap.h
3 // Purpose: wxBitmap class
4 // Author: Julian Smart, Robert Roebling
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart, Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_BITMAP_H_
13 #define _WX_BITMAP_H_
14
15 #include "wx/defs.h"
16 #include "wx/object.h"
17 #include "wx/string.h"
18 #include "wx/palette.h"
19 #include "wx/gdiobj.h"
20
21 //-----------------------------------------------------------------------------
22 // classes
23 //-----------------------------------------------------------------------------
24
25 class WXDLLIMPEXP_FWD_CORE wxMask;
26 class WXDLLIMPEXP_FWD_CORE wxBitmap;
27 class WXDLLIMPEXP_FWD_CORE wxImage;
28
29 //-----------------------------------------------------------------------------
30 // wxMask
31 //-----------------------------------------------------------------------------
32
33 class WXDLLIMPEXP_CORE wxMask: public wxObject
34 {
35 public:
36 wxMask();
37 wxMask(const wxMask& mask);
38 wxMask( const wxBitmap& bitmap, const wxColour& colour );
39 wxMask( const wxBitmap& bitmap, int paletteIndex );
40 wxMask( const wxBitmap& bitmap );
41 virtual ~wxMask();
42
43 bool Create( const wxBitmap& bitmap, const wxColour& colour );
44 bool Create( const wxBitmap& bitmap, int paletteIndex );
45 bool Create( const wxBitmap& bitmap );
46
47 // implementation
48 WXPixmap GetBitmap() const { return m_bitmap; }
49 void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
50
51 WXDisplay *GetDisplay() const { return m_display; }
52 void SetDisplay( WXDisplay *display ) { m_display = display; }
53
54 private:
55 WXPixmap m_bitmap;
56 WXDisplay *m_display;
57 wxSize m_size;
58
59 private:
60 DECLARE_DYNAMIC_CLASS(wxMask)
61 };
62
63 //-----------------------------------------------------------------------------
64 // wxBitmap
65 //-----------------------------------------------------------------------------
66
67 class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
68 {
69 public:
70 wxBitmap() {}
71 wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
72 wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
73
74 wxBitmap( const char bits[], int width, int height, int depth = 1 );
75 wxBitmap( const char* const* bits );
76 #ifdef wxNEEDS_CHARPP
77 // needed for old GCC
78 wxBitmap(char** data)
79 {
80 *this = wxBitmap(const_cast<const char* const*>(data));
81 }
82 #endif
83 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
84 virtual ~wxBitmap();
85
86 static void InitStandardHandlers();
87
88 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
89 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
90 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
91
92 bool Create(const void* data, wxBitmapType type,
93 int width, int height, int depth = -1);
94 // create the wxBitmap using a _copy_ of the pixmap
95 bool Create(WXPixmap pixmap);
96
97 int GetHeight() const;
98 int GetWidth() const;
99 int GetDepth() const;
100
101 #if wxUSE_IMAGE
102 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
103 wxImage ConvertToImage() const;
104 bool CreateFromImage(const wxImage& image, int depth = -1);
105 #endif // wxUSE_IMAGE
106
107 // copies the contents and mask of the given (colour) icon to the bitmap
108 virtual bool CopyFromIcon(const wxIcon& icon);
109
110 wxMask *GetMask() const;
111 void SetMask( wxMask *mask );
112
113 wxBitmap GetSubBitmap( const wxRect& rect ) const;
114
115 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const;
116 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
117
118 wxPalette *GetPalette() const;
119 wxPalette *GetColourMap() const
120 { return GetPalette(); };
121 virtual void SetPalette(const wxPalette& palette);
122
123 // implementation
124 // --------------
125
126 void SetHeight( int height );
127 void SetWidth( int width );
128 void SetDepth( int depth );
129 void SetPixmap( WXPixmap pixmap );
130 void SetBitmap( WXPixmap bitmap );
131
132 WXPixmap GetPixmap() const;
133 WXPixmap GetBitmap() const;
134
135 WXPixmap GetDrawable() const;
136
137 WXDisplay *GetDisplay() const;
138
139 protected:
140 virtual wxGDIRefData *CreateGDIRefData() const;
141 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
142
143 private:
144 DECLARE_DYNAMIC_CLASS(wxBitmap)
145 };
146
147 #endif // _WX_BITMAP_H_