]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/bitmap.h
Fixed to work with the new wxMacControl system.
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 class wxImage;
31
32 //-----------------------------------------------------------------------------
33 // wxMask
34 //-----------------------------------------------------------------------------
35
36 class wxMask: public wxObject
37 {
38 public:
39 wxMask();
40 wxMask( const wxBitmap& bitmap, const wxColour& colour );
41 wxMask( const wxBitmap& bitmap, int paletteIndex );
42 wxMask( const wxBitmap& bitmap );
43 ~wxMask();
44
45 bool Create( const wxBitmap& bitmap, const wxColour& colour );
46 bool Create( const wxBitmap& bitmap, int paletteIndex );
47 bool Create( const wxBitmap& bitmap );
48
49 // implementation
50 GdkBitmap *m_bitmap;
51
52 GdkBitmap *GetBitmap() const;
53
54 private:
55 DECLARE_DYNAMIC_CLASS(wxMask)
56 };
57
58 //-----------------------------------------------------------------------------
59 // wxBitmap
60 //-----------------------------------------------------------------------------
61
62 class wxBitmap: public wxGDIObject
63 {
64 public:
65 wxBitmap();
66 wxBitmap( int width, int height, int depth = -1 );
67 wxBitmap( const char bits[], int width, int height, int depth = 1 );
68 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
69 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
70 wxBitmap( const wxBitmap& bmp );
71 wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
72 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
73 ~wxBitmap();
74 wxBitmap& operator = ( const wxBitmap& bmp );
75 bool operator == ( const wxBitmap& bmp ) const;
76 bool operator != ( const wxBitmap& bmp ) const;
77 bool Ok() const;
78
79 bool Create(int width, int height, int depth = -1);
80
81 int GetHeight() const;
82 int GetWidth() const;
83 int GetDepth() const;
84
85 wxImage ConvertToImage() const;
86
87 // copies the contents and mask of the given (colour) icon to the bitmap
88 virtual bool CopyFromIcon(const wxIcon& icon);
89
90 wxMask *GetMask() const;
91 void SetMask( wxMask *mask );
92
93 wxBitmap GetSubBitmap( const wxRect& rect ) const;
94
95 bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
96 bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM );
97
98 wxPalette *GetPalette() const;
99 wxPalette *GetColourMap() const { return GetPalette(); };
100
101 static void InitStandardHandlers() { }
102 static void CleanUpHandlers() { }
103
104 // implementation
105 // --------------
106
107 void SetHeight( int height );
108 void SetWidth( int width );
109 void SetDepth( int depth );
110 void SetPixmap( GdkPixmap *pixmap );
111 void SetBitmap( GdkBitmap *bitmap );
112
113 GdkPixmap *GetPixmap() const;
114 GdkBitmap *GetBitmap() const;
115
116 // Basically, this corresponds to Win32 StretchBlt()
117 wxBitmap Rescale( int clipx, int clipy, int clipwidth, int clipheight, int width, int height );
118 protected:
119 bool CreateFromXpm(const char **bits);
120 bool CreateFromImage(const wxImage& image, int depth);
121
122 private:
123 DECLARE_DYNAMIC_CLASS(wxBitmap)
124 };
125
126 #endif // __GTKBITMAPH__