]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/bitmap.h
added wxStaticCast, moved wxConstCast from wx/object.h to wx/defs.h for consistency
[wxWidgets.git] / include / wx / gtk / 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
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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;
55e90a2e
VZ
99 wxPalette *GetColourMap() const { return GetPalette(); };
100
101 static void InitStandardHandlers() { }
102 static void CleanUpHandlers() { }
8bbe427f 103
8636aed8 104 // implementation
20e05ffb 105 // --------------
c801d85f 106
8636aed8
RR
107 void SetHeight( int height );
108 void SetWidth( int width );
109 void SetDepth( int depth );
110 void SetPixmap( GdkPixmap *pixmap );
82ea63e6 111 void SetBitmap( GdkBitmap *bitmap );
8bbe427f 112
8636aed8
RR
113 GdkPixmap *GetPixmap() const;
114 GdkBitmap *GetBitmap() const;
8636aed8 115
783da845
RR
116 // Basically, this corresponds to Win32 StretchBlt()
117 wxBitmap Rescale( int clipx, int clipy, int clipwidth, int clipheight, int width, int height );
e838cc14
VZ
118protected:
119 bool CreateFromXpm(const char **bits);
fd859211 120 bool CreateFromImage(const wxImage& image, int depth);
e838cc14 121
8636aed8
RR
122private:
123 DECLARE_DYNAMIC_CLASS(wxBitmap)
c801d85f
KB
124};
125
126#endif // __GTKBITMAPH__