]>
Commit | Line | Data |
---|---|---|
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 | ||
36 | class wxMask; | |
37 | class wxBitmap; | |
38 | ||
39 | //----------------------------------------------------------------------------- | |
40 | // wxMask | |
41 | //----------------------------------------------------------------------------- | |
42 | ||
43 | class wxMask: public wxObject | |
44 | { | |
45 | DECLARE_DYNAMIC_CLASS(wxMask) | |
46 | ||
47 | public: | |
48 | ||
49 | wxMask(); | |
50 | wxMask( const wxBitmap& bitmap, const wxColour& colour ); | |
51 | wxMask( const wxBitmap& bitmap, int paletteIndex ); | |
52 | wxMask( const wxBitmap& bitmap ); | |
53 | ~wxMask(); | |
54 | ||
55 | private: | |
56 | ||
57 | friend wxBitmap; | |
58 | friend wxDC; | |
59 | friend wxPaintDC; | |
60 | friend wxToolBar; | |
61 | friend wxBitmapButton; | |
62 | friend wxStaticBitmap; | |
63 | friend wxFrame; | |
64 | ||
65 | GdkBitmap *GetBitmap() const; | |
66 | ||
67 | protected: | |
68 | ||
69 | GdkBitmap *m_bitmap; | |
70 | ||
71 | }; | |
72 | ||
73 | //----------------------------------------------------------------------------- | |
74 | // wxBitmap | |
75 | //----------------------------------------------------------------------------- | |
76 | ||
77 | // CMB 20/5/98: added xbm constructor and GetBitmap() method | |
78 | class wxBitmap: public wxObject | |
79 | { | |
80 | DECLARE_DYNAMIC_CLASS(wxBitmap) | |
81 | ||
82 | public: | |
83 | ||
84 | wxBitmap(); | |
85 | wxBitmap( int width, int height, int depth = -1 ); | |
86 | wxBitmap( const char bits[], int width, int height, int depth = 1 ); | |
87 | wxBitmap( char **bits ); | |
88 | wxBitmap( const wxBitmap& bmp ); | |
89 | wxBitmap( const wxBitmap* bmp ); | |
90 | wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM); | |
91 | ~wxBitmap(); | |
92 | wxBitmap& operator = ( const wxBitmap& bmp ); | |
93 | bool operator == ( const wxBitmap& bmp ); | |
94 | bool operator != ( const wxBitmap& bmp ); | |
95 | bool Ok() const; | |
96 | ||
97 | int GetHeight() const; | |
98 | int GetWidth() const; | |
99 | int GetDepth() const; | |
100 | void SetHeight( int height ); | |
101 | void SetWidth( int width ); | |
102 | void SetDepth( int depth ); | |
103 | ||
104 | wxMask *GetMask() const; | |
105 | void SetMask( wxMask *mask ); | |
106 | ||
107 | void Resize( int height, int width ); | |
108 | ||
109 | bool SaveFile( const wxString &name, int type, wxPalette *palette = NULL ); | |
110 | bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM); | |
111 | ||
112 | wxPalette *GetPalette() const; | |
113 | wxPalette *GetColourMap() const | |
114 | { return GetPalette(); }; | |
115 | ||
116 | private: | |
117 | ||
118 | friend wxDC; | |
119 | friend wxPaintDC; | |
120 | friend wxMemoryDC; | |
121 | friend wxToolBar; | |
122 | friend wxBitmapButton; | |
123 | friend wxStaticBitmap; | |
124 | friend wxFrame; | |
125 | ||
126 | GdkPixmap *GetPixmap() const; | |
127 | GdkBitmap *GetBitmap() const; | |
128 | ||
129 | void DestroyImage(); | |
130 | void RecreateImage(); | |
131 | void Render(); | |
132 | ||
133 | // no data :-) | |
134 | }; | |
135 | ||
136 | #endif // __GTKBITMAPH__ |