]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/bitmap.h
black now denotes 0 on mono-bitmaps.
[wxWidgets.git] / include / wx / gtk1 / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: bitmap.h
3 // Purpose:
4 // Author: Robert Roebling
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKBITMAPH__
12 #define __GTKBITMAPH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/palette.h"
22 #include "wx/gdiobj.h"
23
24 //-----------------------------------------------------------------------------
25 // classes
26 //-----------------------------------------------------------------------------
27
28 class wxMask;
29 class wxBitmap;
30
31 //-----------------------------------------------------------------------------
32 // wxMask
33 //-----------------------------------------------------------------------------
34
35 class wxMask: public wxObject
36 {
37 public:
38 wxMask();
39 wxMask( const wxBitmap& bitmap, const wxColour& colour );
40 wxMask( const wxBitmap& bitmap, int paletteIndex );
41 wxMask( const wxBitmap& bitmap );
42 ~wxMask();
43
44 bool Create( const wxBitmap& bitmap, const wxColour& colour );
45 bool Create( const wxBitmap& bitmap, int paletteIndex );
46 bool Create( const wxBitmap& bitmap );
47
48 // implementation
49 GdkBitmap *m_bitmap;
50
51 GdkBitmap *GetBitmap() const;
52
53 private:
54 DECLARE_DYNAMIC_CLASS(wxMask)
55 };
56
57 //-----------------------------------------------------------------------------
58 // wxBitmap
59 //-----------------------------------------------------------------------------
60
61 class wxBitmap: public wxGDIObject
62 {
63 public:
64 wxBitmap();
65 wxBitmap( int width, int height, int depth = -1 );
66 wxBitmap( const char bits[], int width, int height, int depth = 1 );
67 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
68 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
69 wxBitmap( const wxBitmap& bmp );
70 wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
71 ~wxBitmap();
72 wxBitmap& operator = ( const wxBitmap& bmp );
73 bool operator == ( const wxBitmap& bmp );
74 bool operator != ( const wxBitmap& bmp );
75 bool Ok() const;
76
77 int GetHeight() const;
78 int GetWidth() const;
79 int GetDepth() const;
80
81 wxMask *GetMask() const;
82 void SetMask( wxMask *mask );
83
84 wxBitmap GetSubBitmap( const wxRect& rect ) const;
85
86 bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
87 bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM );
88
89 wxPalette *GetPalette() const;
90 wxPalette *GetColourMap() const
91 { return GetPalette(); };
92
93 // implementation
94 // --------------
95
96 void SetHeight( int height );
97 void SetWidth( int width );
98 void SetDepth( int depth );
99 void SetPixmap( GdkPixmap *pixmap );
100 void SetBitmap( GdkBitmap *bitmap );
101
102 GdkPixmap *GetPixmap() const;
103 GdkBitmap *GetBitmap() const;
104
105 protected:
106 bool CreateFromXpm(const char **bits);
107
108 private:
109 DECLARE_DYNAMIC_CLASS(wxBitmap)
110 };
111
112 #endif // __GTKBITMAPH__