]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/bitmap.h
Remove unnecessary Mac-specific TOOLKIT_LOWERCASE setting.
[wxWidgets.git] / include / wx / gtk / bitmap.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
0b04c4e0 2// Name: wx/gtk/bitmap.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
6f65e337 5// RCS-ID: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
0416c418
PC
10#ifndef _WX_GTK_BITMAP_H_
11#define _WX_GTK_BITMAP_H_
c801d85f 12
feac7937 13typedef struct _GdkPixbuf GdkPixbuf;
b5dbe15d 14class WXDLLIMPEXP_FWD_CORE wxPixelDataBase;
f383c5b8 15
c801d85f
KB
16//-----------------------------------------------------------------------------
17// wxMask
18//-----------------------------------------------------------------------------
19
60a3d1c6 20class WXDLLIMPEXP_CORE wxMask: public wxMaskBase
c801d85f 21{
fd0eed64 22public:
8636aed8
RR
23 wxMask();
24 wxMask( const wxBitmap& bitmap, const wxColour& colour );
0b04c4e0 25#if wxUSE_PALETTE
8636aed8 26 wxMask( const wxBitmap& bitmap, int paletteIndex );
0b04c4e0 27#endif // wxUSE_PALETTE
8636aed8 28 wxMask( const wxBitmap& bitmap );
d3c7fc99 29 virtual ~wxMask();
0b04c4e0 30
8636aed8
RR
31 // implementation
32 GdkBitmap *m_bitmap;
8636aed8 33 GdkBitmap *GetBitmap() const;
0b04c4e0 34
60a3d1c6
PC
35protected:
36 virtual void FreeData();
37 virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour);
38 virtual bool InitFromMonoBitmap(const wxBitmap& bitmap);
39
8636aed8 40 DECLARE_DYNAMIC_CLASS(wxMask)
c801d85f
KB
41};
42
43//-----------------------------------------------------------------------------
44// wxBitmap
45//-----------------------------------------------------------------------------
46
20123d49 47class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
c801d85f 48{
fd0eed64 49public:
23656673 50 wxBitmap() { }
03647350 51 wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH )
732d8c74 52 { Create(width, height, depth); }
03647350 53 wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH )
732d8c74 54 { Create(sz, depth); }
8636aed8 55 wxBitmap( const char bits[], int width, int height, int depth = 1 );
452418c4 56 wxBitmap( const char* const* bits );
459f812b 57#ifdef wxNEEDS_CHARPP
4a4bf7ee
SN
58 // needed for old GCC
59 wxBitmap(char** data)
732d8c74 60 { *this = wxBitmap(const_cast<const char* const*>(data)); }
4a4bf7ee 61#endif
cbea3ec6 62 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
c0521644 63#if wxUSE_IMAGE
e86f2cc8
FM
64 wxBitmap( const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH )
65 { (void)CreateFromImage(image, depth); }
c0521644 66#endif // wxUSE_IMAGE
d3c7fc99 67 virtual ~wxBitmap();
8636aed8 68
e86f2cc8 69 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
732d8c74
FM
70 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
71 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
0b04c4e0 72
8f884a0d
VZ
73 virtual int GetHeight() const;
74 virtual int GetWidth() const;
75 virtual int GetDepth() const;
0b04c4e0 76
c0521644 77#if wxUSE_IMAGE
fd859211 78 wxImage ConvertToImage() const;
c0521644 79#endif // wxUSE_IMAGE
8636aed8 80
db0aec83
VS
81 // copies the contents and mask of the given (colour) icon to the bitmap
82 virtual bool CopyFromIcon(const wxIcon& icon);
83
8636aed8
RR
84 wxMask *GetMask() const;
85 void SetMask( wxMask *mask );
0b04c4e0 86
17bec151 87 wxBitmap GetSubBitmap( const wxRect& rect ) const;
8636aed8 88
4611dd06 89 bool SaveFile(const wxString &name, wxBitmapType type,
d3b9f782 90 const wxPalette *palette = NULL) const;
cbea3ec6 91 bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE);
8636aed8 92
4611dd06 93#if wxUSE_PALETTE
8636aed8 94 wxPalette *GetPalette() const;
4611dd06 95 void SetPalette(const wxPalette& palette);
55e90a2e 96 wxPalette *GetColourMap() const { return GetPalette(); };
4611dd06 97#endif // wxUSE_PALETTE
55e90a2e 98
4b61c88d 99 static void InitStandardHandlers();
8bbe427f 100
8636aed8 101 // implementation
20e05ffb 102 // --------------
c801d85f 103
8636aed8
RR
104 void SetHeight( int height );
105 void SetWidth( int width );
106 void SetDepth( int depth );
107 void SetPixmap( GdkPixmap *pixmap );
23656673 108 void SetPixbuf(GdkPixbuf* pixbuf, int depth = 0);
8bbe427f 109
8636aed8 110 GdkPixmap *GetPixmap() const;
feac7937 111 bool HasPixmap() const;
feac7937
VS
112 bool HasPixbuf() const;
113 GdkPixbuf *GetPixbuf() const;
0b04c4e0 114
284f2b59
RR
115 // raw bitmap access support functions
116 void *GetRawData(wxPixelDataBase& data, int bpp);
117 void UngetRawData(wxPixelDataBase& data);
118
0ff2a74d 119 bool HasAlpha() const;
d2400c3f 120
e838cc14 121protected:
c0521644 122#if wxUSE_IMAGE
fd859211 123 bool CreateFromImage(const wxImage& image, int depth);
c0521644 124#endif // wxUSE_IMAGE
e838cc14 125
8f884a0d
VZ
126 virtual wxGDIRefData* CreateGDIRefData() const;
127 virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const;
4c44e0d0 128
8636aed8 129private:
c0521644 130#if wxUSE_IMAGE
feac7937 131 // to be called from CreateFromImage only!
5ac1d44a 132 bool CreateFromImageAsPixmap(const wxImage& image, int depth);
feac7937 133 bool CreateFromImageAsPixbuf(const wxImage& image);
c0521644 134#endif // wxUSE_IMAGE
feac7937 135
ab171e95
RR
136public:
137 // implementation only
feac7937
VS
138 enum Representation
139 {
140 Pixmap,
141 Pixbuf
142 };
143 // removes other representations from memory, keeping only 'keep'
144 // (wxBitmap may keep same bitmap e.g. as both pixmap and pixbuf):
145 void PurgeOtherRepresentations(Representation keep);
146
0b04c4e0 147private:
8636aed8 148 DECLARE_DYNAMIC_CLASS(wxBitmap)
c801d85f
KB
149};
150
0416c418 151#endif // _WX_GTK_BITMAP_H_