]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/bitmap.h
Fixed MinGW/configure/Unicode compilation: MinGW/MSVCRT vswprintf does not
[wxWidgets.git] / include / wx / gtk1 / bitmap.h
CommitLineData
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
ab7ce33c 14#if defined(__GNUG__) && !defined(__APPLE__)
c801d85f
KB
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
28class wxMask;
29class wxBitmap;
fd859211 30class wxImage;
c801d85f
KB
31
32//-----------------------------------------------------------------------------
33// wxMask
34//-----------------------------------------------------------------------------
35
36class wxMask: public wxObject
37{
fd0eed64 38public:
8636aed8
RR
39 wxMask();
40 wxMask( const wxBitmap& bitmap, const wxColour& colour );
41 wxMask( const wxBitmap& bitmap, int paletteIndex );
42 wxMask( const wxBitmap& bitmap );
43 ~wxMask();
91b8de8d 44
8636aed8
RR
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
54private:
55 DECLARE_DYNAMIC_CLASS(wxMask)
c801d85f
KB
56};
57
58//-----------------------------------------------------------------------------
59// wxBitmap
60//-----------------------------------------------------------------------------
61
58c837a4 62class wxBitmap: public wxGDIObject
c801d85f 63{
fd0eed64 64public:
8636aed8
RR
65 wxBitmap();
66 wxBitmap( int width, int height, int depth = -1 );
67 wxBitmap( const char bits[], int width, int height, int depth = 1 );
e838cc14
VZ
68 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
69 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
8636aed8
RR
70 wxBitmap( const wxBitmap& bmp );
71 wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
fd859211 72 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
8636aed8
RR
73 ~wxBitmap();
74 wxBitmap& operator = ( const wxBitmap& bmp );
f6bcfd97
BP
75 bool operator == ( const wxBitmap& bmp ) const;
76 bool operator != ( const wxBitmap& bmp ) const;
8636aed8
RR
77 bool Ok() const;
78
c826213d
RR
79 bool Create(int width, int height, int depth = -1);
80
8636aed8
RR
81 int GetHeight() const;
82 int GetWidth() const;
83 int GetDepth() const;
fd859211
VS
84
85 wxImage ConvertToImage() const;
8636aed8 86
db0aec83
VS
87 // copies the contents and mask of the given (colour) icon to the bitmap
88 virtual bool CopyFromIcon(const wxIcon& icon);
89
8636aed8
RR
90 wxMask *GetMask() const;
91 void SetMask( wxMask *mask );
17bec151
RR
92
93 wxBitmap GetSubBitmap( const wxRect& rect ) const;
8636aed8
RR
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
fd0eed64 100 { return GetPalette(); };
8bbe427f 101
8636aed8 102 // implementation
20e05ffb 103 // --------------
c801d85f 104
8636aed8
RR
105 void SetHeight( int height );
106 void SetWidth( int width );
107 void SetDepth( int depth );
108 void SetPixmap( GdkPixmap *pixmap );
82ea63e6 109 void SetBitmap( GdkBitmap *bitmap );
8bbe427f 110
8636aed8
RR
111 GdkPixmap *GetPixmap() const;
112 GdkBitmap *GetBitmap() const;
8636aed8 113
e838cc14
VZ
114protected:
115 bool CreateFromXpm(const char **bits);
fd859211 116 bool CreateFromImage(const wxImage& image, int depth);
e838cc14 117
8636aed8
RR
118private:
119 DECLARE_DYNAMIC_CLASS(wxBitmap)
c801d85f
KB
120};
121
122#endif // __GTKBITMAPH__