]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/bitmap.h
DP: GetBitmap() added to wxImageList
[wxWidgets.git] / include / wx / gtk1 / bitmap.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: bitmap.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // RCS-ID: $Id$
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11
12 #ifndef __GTKBITMAPH__
13 #define __GTKBITMAPH__
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21 #include "wx/string.h"
22 #include "wx/palette.h"
23
24 //-----------------------------------------------------------------------------
25 // classes
26 //-----------------------------------------------------------------------------
27
28 class wxDC;
29 class wxPaintDC;
30 class wxMemoryDC;
31 class wxToolBar;
32 class wxBitmapButton;
33 class wxStaticBitmap;
34 class wxFrame;
35 class wxTreeCtrl;
36
37 class wxMask;
38 class wxBitmap;
39
40 //-----------------------------------------------------------------------------
41 // wxMask
42 //-----------------------------------------------------------------------------
43
44 class wxMask: public wxObject
45 {
46 DECLARE_DYNAMIC_CLASS(wxMask)
47
48 public:
49
50 wxMask();
51 wxMask( const wxBitmap& bitmap, const wxColour& colour );
52 wxMask( const wxBitmap& bitmap, int paletteIndex );
53 wxMask( const wxBitmap& bitmap );
54 ~wxMask();
55
56 private:
57
58 friend wxBitmap;
59 friend wxDC;
60 friend wxPaintDC;
61 friend wxToolBar;
62 friend wxBitmapButton;
63 friend wxStaticBitmap;
64 friend wxFrame;
65 friend wxTreeCtrl;
66
67 GdkBitmap *GetBitmap() const;
68
69 protected:
70
71 GdkBitmap *m_bitmap;
72
73 };
74
75 //-----------------------------------------------------------------------------
76 // wxBitmap
77 //-----------------------------------------------------------------------------
78
79 // CMB 20/5/98: added xbm constructor and GetBitmap() method
80 class wxBitmap: public wxObject
81 {
82 DECLARE_DYNAMIC_CLASS(wxBitmap)
83
84 public:
85
86 wxBitmap();
87 wxBitmap( int width, int height, int depth = -1 );
88 wxBitmap( const char bits[], int width, int height, int depth = 1 );
89 wxBitmap( char **bits );
90 wxBitmap( const wxBitmap& bmp );
91 wxBitmap( const wxBitmap* bmp );
92 wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM);
93 ~wxBitmap();
94 wxBitmap& operator = ( const wxBitmap& bmp );
95 bool operator == ( const wxBitmap& bmp );
96 bool operator != ( const wxBitmap& bmp );
97 bool Ok() const;
98
99 int GetHeight() const;
100 int GetWidth() const;
101 int GetDepth() const;
102 void SetHeight( int height );
103 void SetWidth( int width );
104 void SetDepth( int depth );
105
106 wxMask *GetMask() const;
107 void SetMask( wxMask *mask );
108
109 void Resize( int height, int width );
110
111 bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL );
112 bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM);
113
114 wxPalette *GetPalette() const;
115 wxPalette *GetColourMap() const
116 { return GetPalette(); };
117
118 private:
119
120 friend wxDC;
121 friend wxPaintDC;
122 friend wxMemoryDC;
123 friend wxToolBar;
124 friend wxBitmapButton;
125 friend wxStaticBitmap;
126 friend wxFrame;
127 friend wxTreeCtrl;
128
129 GdkPixmap *GetPixmap() const;
130 GdkBitmap *GetBitmap() const;
131
132 void DestroyImage();
133 void RecreateImage();
134 void Render();
135
136 // no data :-)
137 };
138
139 #endif // __GTKBITMAPH__