another blind fix for wxX11 compilation
[wxWidgets.git] / include / wx / x11 / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #ifdef __GNUG__
16 #pragma interface "bitmap.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/palette.h"
23 #include "wx/gdiobj.h"
24
25 //-----------------------------------------------------------------------------
26 // classes
27 //-----------------------------------------------------------------------------
28
29 class wxMask;
30 class wxBitmap;
31 class wxImage;
32
33 //-----------------------------------------------------------------------------
34 // wxMask
35 //-----------------------------------------------------------------------------
36
37 class wxMask: public wxObject
38 {
39 public:
40 wxMask();
41 wxMask( const wxBitmap& bitmap, const wxColour& colour );
42 wxMask( const wxBitmap& bitmap, int paletteIndex );
43 wxMask( const wxBitmap& bitmap );
44 ~wxMask();
45
46 bool Create( const wxBitmap& bitmap, const wxColour& colour );
47 bool Create( const wxBitmap& bitmap, int paletteIndex );
48 bool Create( const wxBitmap& bitmap );
49
50 // implementation
51 WXPixmap GetBitmap() const { return m_bitmap; }
52 void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
53
54 WXDisplay *GetDisplay() const { return m_display; }
55 void SetDisplay( WXDisplay *display ) { m_display = display; }
56
57 private:
58 WXPixmap m_bitmap;
59 WXDisplay *m_display;
60
61 private:
62 DECLARE_DYNAMIC_CLASS(wxMask)
63 };
64
65 //-----------------------------------------------------------------------------
66 // wxBitmap
67 //-----------------------------------------------------------------------------
68
69 class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase
70 {
71 public:
72 wxBitmapHandler() : wxBitmapHandlerBase() {}
73 private:
74 DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
75 };
76
77 class wxBitmap: public wxBitmapBase
78 {
79 public:
80 wxBitmap();
81 wxBitmap( int width, int height, int depth = -1 );
82 wxBitmap( const char bits[], int width, int height, int depth = 1 );
83 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
84 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
85 wxBitmap( const wxBitmap& bmp );
86 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
87 virtual ~wxBitmap();
88
89 wxBitmap& operator = ( const wxBitmap& bmp );
90 bool operator == ( const wxBitmap& bmp ) const;
91 bool operator != ( const wxBitmap& bmp ) const;
92 bool Ok() const;
93
94 static void InitStandardHandlers();
95
96 bool Create(int width, int height, int depth = -1);
97 bool Create(void* data, wxBitmapType type,
98 int width, int height, int depth = -1);
99
100 int GetHeight() const;
101 int GetWidth() const;
102 int GetDepth() const;
103
104 #if wxUSE_IMAGE
105 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
106 wxImage ConvertToImage() const;
107 bool CreateFromImage(const wxImage& image, int depth = -1);
108 #endif // wxUSE_IMAGE
109
110 // copies the contents and mask of the given (colour) icon to the bitmap
111 virtual bool CopyFromIcon(const wxIcon& icon);
112
113 wxMask *GetMask() const;
114 void SetMask( wxMask *mask );
115
116 wxBitmap GetSubBitmap( const wxRect& rect ) const;
117
118 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const;
119 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM );
120
121 wxPalette *GetPalette() const;
122 wxPalette *GetColourMap() const
123 { return GetPalette(); };
124 virtual void SetPalette(const wxPalette& palette);
125
126 // implementation
127 // --------------
128
129 void SetHeight( int height );
130 void SetWidth( int width );
131 void SetDepth( int depth );
132 void SetPixmap( WXPixmap pixmap );
133 void SetBitmap( WXPixmap bitmap );
134
135 WXPixmap GetPixmap() const;
136 WXPixmap GetBitmap() const;
137
138 WXPixmap GetDrawable() const;
139
140 WXDisplay *GetDisplay() const;
141
142 protected:
143 bool CreateFromXpm(const char **bits);
144
145 private:
146 DECLARE_DYNAMIC_CLASS(wxBitmap)
147 };
148
149 #endif
150 // _WX_BITMAP_H_