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