]> git.saurik.com Git - wxWidgets.git/blame - src/qt/bitmap.cpp
Added stubs .cpp files.
[wxWidgets.git] / src / qt / bitmap.cpp
CommitLineData
7c78e7c7
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: bitmap.cpp
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#ifdef __GNUG__
12#pragma implementation "bitmap.h"
13#endif
14
15#include "wx/bitmap.h"
16
17
18//-----------------------------------------------------------------------------
19// wxMask
20//-----------------------------------------------------------------------------
21
22IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
23
24wxMask::wxMask(void)
25{
26};
27
28wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(colour) )
29{
30};
31
32wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), int WXUNUSED(paletteIndex) )
33{
34};
35
36wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
37{
38};
39
40wxMask::~wxMask(void)
41{
42};
43
44//-----------------------------------------------------------------------------
45// wxBitmap
46//-----------------------------------------------------------------------------
47
48class wxBitmapRefData: public wxObjectRefData
49{
50 public:
51
52 wxBitmapRefData(void);
53 ~wxBitmapRefData(void);
54
55 wxMask *m_mask;
56 int m_width;
57 int m_height;
58 int m_bpp;
59 wxPalette *m_palette;
60};
61
62wxBitmapRefData::wxBitmapRefData(void)
63{
64 m_mask = NULL;
65 m_width = 0;
66 m_height = 0;
67 m_bpp = 0;
68 m_palette = NULL;
69};
70
71wxBitmapRefData::~wxBitmapRefData(void)
72{
73 if (m_mask) delete m_mask;
74 if (m_palette) delete m_palette;
75};
76
77//-----------------------------------------------------------------------------
78
79#define M_BMPDATA ((wxBitmapRefData *)m_refData)
80
81IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
82
83wxBitmap::wxBitmap(void)
84{
85 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
86};
87
88wxBitmap::wxBitmap( int width, int height, int depth )
89{
90 m_refData = new wxBitmapRefData();
91 M_BMPDATA->m_mask = NULL;
92 M_BMPDATA->m_width = width;
93 M_BMPDATA->m_height = height;
94 M_BMPDATA->m_bpp = depth;
95
96 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
97};
98
99wxBitmap::wxBitmap( char **WXUNUSED(bits) )
100{
101 m_refData = new wxBitmapRefData();
102
103 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
104};
105
106wxBitmap::wxBitmap( const wxBitmap& bmp )
107{
108 Ref( bmp );
109
110 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
111};
112
113wxBitmap::wxBitmap( const wxBitmap* bmp )
114{
115 if (bmp) Ref( *bmp );
116
117 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
118};
119
120wxBitmap::wxBitmap( const wxString &filename, int type )
121{
122 LoadFile( filename, type );
123};
124
125wxBitmap::wxBitmap( const char WXUNUSED(bits)[], int width, int height, int WXUNUSED(depth))
126{
127 m_refData = new wxBitmapRefData();
128
129 M_BMPDATA->m_mask = NULL;
130 M_BMPDATA->m_width = width;
131 M_BMPDATA->m_height = height;
132 M_BMPDATA->m_bpp = 1;
133
134 if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
135}
136
137wxBitmap::~wxBitmap(void)
138{
139 if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
140};
141
142wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
143{
144 if (*this == bmp) return (*this);
145 Ref( bmp );
146 return *this;
147};
148
149bool wxBitmap::operator == ( const wxBitmap& bmp )
150{
151 return m_refData == bmp.m_refData;
152};
153
154bool wxBitmap::operator != ( const wxBitmap& bmp )
155{
156 return m_refData != bmp.m_refData;
157};
158
159bool wxBitmap::Ok(void) const
160{
161 return m_refData != NULL;
162};
163
164int wxBitmap::GetHeight(void) const
165{
166 if (!Ok()) return 0;
167 return M_BMPDATA->m_height;
168};
169
170int wxBitmap::GetWidth(void) const
171{
172 if (!Ok()) return 0;
173 return M_BMPDATA->m_width;
174};
175
176int wxBitmap::GetDepth(void) const
177{
178 if (!Ok()) return 0;
179 return M_BMPDATA->m_bpp;
180};
181
182void wxBitmap::SetHeight( int height )
183{
184 if (!Ok()) return;
185 M_BMPDATA->m_height = height;
186};
187
188void wxBitmap::SetWidth( int width )
189{
190 if (!Ok()) return;
191 M_BMPDATA->m_width = width;
192};
193
194void wxBitmap::SetDepth( int depth )
195{
196 if (!Ok()) return;
197 M_BMPDATA->m_bpp = depth;
198};
199
200wxMask *wxBitmap::GetMask(void) const
201{
202 if (!Ok()) return NULL;
203
204 return M_BMPDATA->m_mask;
205};
206
207void wxBitmap::SetMask( wxMask *mask )
208{
209 if (!Ok()) return;
210
211 if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
212 M_BMPDATA->m_mask = mask;
213};
214
215void wxBitmap::Resize( int WXUNUSED(height), int WXUNUSED(width) )
216{
217 if (!Ok()) return;
218
219};
220
221bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), int WXUNUSED(type),
222 wxPalette *WXUNUSED(palette) )
223{
224 return FALSE;
225};
226
227bool wxBitmap::LoadFile( const wxString &WXUNUSED(name), int WXUNUSED(type) )
228{
229 return FALSE;
230};
231
232wxPalette *wxBitmap::GetPalette(void) const
233{
234 if (!Ok()) return NULL;
235 return M_BMPDATA->m_palette;
236};
237