]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: bitmap.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
6f65e337 | 5 | // RCS-ID: $Id$ |
01111366 | 6 | // Copyright: (c) 1998 Robert Roebling |
f05df5a8 | 7 | // Licence: wxWindows licence |
c801d85f KB |
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" | |
58c837a4 | 22 | #include "wx/gdiobj.h" |
c801d85f KB |
23 | |
24 | //----------------------------------------------------------------------------- | |
25 | // classes | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
c801d85f KB |
28 | class wxMask; |
29 | class wxBitmap; | |
30 | ||
31 | //----------------------------------------------------------------------------- | |
32 | // wxMask | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
35 | class wxMask: public wxObject | |
36 | { | |
fd0eed64 | 37 | public: |
8636aed8 RR |
38 | wxMask(); |
39 | wxMask( const wxBitmap& bitmap, const wxColour& colour ); | |
40 | wxMask( const wxBitmap& bitmap, int paletteIndex ); | |
41 | wxMask( const wxBitmap& bitmap ); | |
42 | ~wxMask(); | |
91b8de8d | 43 | |
8636aed8 RR |
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) | |
c801d85f KB |
55 | }; |
56 | ||
57 | //----------------------------------------------------------------------------- | |
58 | // wxBitmap | |
59 | //----------------------------------------------------------------------------- | |
60 | ||
58c837a4 | 61 | class wxBitmap: public wxGDIObject |
c801d85f | 62 | { |
fd0eed64 | 63 | public: |
8636aed8 RR |
64 | wxBitmap(); |
65 | wxBitmap( int width, int height, int depth = -1 ); | |
66 | wxBitmap( const char bits[], int width, int height, int depth = 1 ); | |
e838cc14 VZ |
67 | wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); } |
68 | wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); } | |
8636aed8 RR |
69 | wxBitmap( const wxBitmap& bmp ); |
70 | wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); | |
71 | ~wxBitmap(); | |
72 | wxBitmap& operator = ( const wxBitmap& bmp ); | |
f6bcfd97 BP |
73 | bool operator == ( const wxBitmap& bmp ) const; |
74 | bool operator != ( const wxBitmap& bmp ) const; | |
8636aed8 RR |
75 | bool Ok() const; |
76 | ||
c826213d RR |
77 | bool Create(int width, int height, int depth = -1); |
78 | ||
8636aed8 RR |
79 | int GetHeight() const; |
80 | int GetWidth() const; | |
81 | int GetDepth() const; | |
82 | ||
83 | wxMask *GetMask() const; | |
84 | void SetMask( wxMask *mask ); | |
17bec151 RR |
85 | |
86 | wxBitmap GetSubBitmap( const wxRect& rect ) const; | |
8636aed8 RR |
87 | |
88 | bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL ); | |
89 | bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM ); | |
90 | ||
91 | wxPalette *GetPalette() const; | |
92 | wxPalette *GetColourMap() const | |
fd0eed64 | 93 | { return GetPalette(); }; |
8bbe427f | 94 | |
8636aed8 | 95 | // implementation |
20e05ffb | 96 | // -------------- |
c801d85f | 97 | |
8636aed8 RR |
98 | void SetHeight( int height ); |
99 | void SetWidth( int width ); | |
100 | void SetDepth( int depth ); | |
101 | void SetPixmap( GdkPixmap *pixmap ); | |
82ea63e6 | 102 | void SetBitmap( GdkBitmap *bitmap ); |
8bbe427f | 103 | |
8636aed8 RR |
104 | GdkPixmap *GetPixmap() const; |
105 | GdkBitmap *GetBitmap() const; | |
8636aed8 | 106 | |
e838cc14 VZ |
107 | protected: |
108 | bool CreateFromXpm(const char **bits); | |
109 | ||
8636aed8 RR |
110 | private: |
111 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
c801d85f KB |
112 | }; |
113 | ||
114 | #endif // __GTKBITMAPH__ |