]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/bitmap.h
Use wxGetTranslation() instead of _() in the public headers.
[wxWidgets.git] / include / wx / x11 / bitmap.h
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/x11/bitmap.h
83df96d6 3// Purpose: wxBitmap class
a11672a4 4// Author: Julian Smart, Robert Roebling
83df96d6
JS
5// Modified by:
6// Created: 17/09/98
a11672a4 7// Copyright: (c) Julian Smart, Robert Roebling
65571936 8// Licence: wxWindows licence
83df96d6
JS
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_BITMAP_H_
12#define _WX_BITMAP_H_
13
a11672a4
RR
14#include "wx/defs.h"
15#include "wx/object.h"
16#include "wx/string.h"
83df96d6 17#include "wx/palette.h"
a11672a4
RR
18#include "wx/gdiobj.h"
19
20//-----------------------------------------------------------------------------
21// classes
22//-----------------------------------------------------------------------------
23
b5dbe15d
VS
24class WXDLLIMPEXP_FWD_CORE wxMask;
25class WXDLLIMPEXP_FWD_CORE wxBitmap;
26class WXDLLIMPEXP_FWD_CORE wxImage;
83df96d6 27
a11672a4
RR
28//-----------------------------------------------------------------------------
29// wxMask
30//-----------------------------------------------------------------------------
31
968eb2ef 32class WXDLLIMPEXP_CORE wxMask: public wxObject
83df96d6 33{
83df96d6
JS
34public:
35 wxMask();
04a8da5f 36 wxMask(const wxMask& mask);
a11672a4
RR
37 wxMask( const wxBitmap& bitmap, const wxColour& colour );
38 wxMask( const wxBitmap& bitmap, int paletteIndex );
39 wxMask( const wxBitmap& bitmap );
d3c7fc99 40 virtual ~wxMask();
6298b8d0 41
a11672a4
RR
42 bool Create( const wxBitmap& bitmap, const wxColour& colour );
43 bool Create( const wxBitmap& bitmap, int paletteIndex );
44 bool Create( const wxBitmap& bitmap );
83df96d6 45
a11672a4
RR
46 // implementation
47 WXPixmap GetBitmap() const { return m_bitmap; }
48 void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
6298b8d0 49
a11672a4
RR
50 WXDisplay *GetDisplay() const { return m_display; }
51 void SetDisplay( WXDisplay *display ) { m_display = display; }
6298b8d0 52
a11672a4
RR
53private:
54 WXPixmap m_bitmap;
55 WXDisplay *m_display;
04a8da5f 56 wxSize m_size;
6298b8d0 57
a11672a4
RR
58private:
59 DECLARE_DYNAMIC_CLASS(wxMask)
83df96d6
JS
60};
61
a11672a4
RR
62//-----------------------------------------------------------------------------
63// wxBitmap
64//-----------------------------------------------------------------------------
83df96d6 65
968eb2ef 66class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
83df96d6 67{
83df96d6 68public:
732d8c74
FM
69 wxBitmap() {}
70 wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
71 wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
03647350 72
a11672a4 73 wxBitmap( const char bits[], int width, int height, int depth = 1 );
452418c4 74 wxBitmap( const char* const* bits );
459f812b 75#ifdef wxNEEDS_CHARPP
4a4bf7ee
SN
76 // needed for old GCC
77 wxBitmap(char** data)
78 {
5c33522f 79 *this = wxBitmap(const_cast<const char* const*>(data));
4a4bf7ee
SN
80 }
81#endif
cbea3ec6 82 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
6298b8d0
VZ
83 virtual ~wxBitmap();
84
62ad3cb3
MB
85 static void InitStandardHandlers();
86
732d8c74
FM
87 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
88 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
89 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
7f74897f
SC
90 bool Create(int width, int height, const wxDC& WXUNUSED(dc))
91 { return Create(width,height); }
732d8c74 92
452418c4 93 bool Create(const void* data, wxBitmapType type,
62ad3cb3 94 int width, int height, int depth = -1);
dd38c875
MB
95 // create the wxBitmap using a _copy_ of the pixmap
96 bool Create(WXPixmap pixmap);
62ad3cb3 97
a11672a4
RR
98 int GetHeight() const;
99 int GetWidth() const;
100 int GetDepth() const;
6298b8d0
VZ
101
102#if wxUSE_IMAGE
103 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
a11672a4 104 wxImage ConvertToImage() const;
6298b8d0
VZ
105 bool CreateFromImage(const wxImage& image, int depth = -1);
106#endif // wxUSE_IMAGE
83df96d6 107
a11672a4
RR
108 // copies the contents and mask of the given (colour) icon to the bitmap
109 virtual bool CopyFromIcon(const wxIcon& icon);
83df96d6 110
a11672a4
RR
111 wxMask *GetMask() const;
112 void SetMask( wxMask *mask );
6298b8d0 113
83df96d6 114 wxBitmap GetSubBitmap( const wxRect& rect ) const;
7266b672 115
d3b9f782 116 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const;
cbea3ec6 117 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
a11672a4
RR
118
119 wxPalette *GetPalette() const;
120 wxPalette *GetColourMap() const
6dd0883d 121 { return GetPalette(); }
62ad3cb3 122 virtual void SetPalette(const wxPalette& palette);
a11672a4
RR
123
124 // implementation
125 // --------------
126
127 void SetHeight( int height );
128 void SetWidth( int width );
129 void SetDepth( int depth );
130 void SetPixmap( WXPixmap pixmap );
131 void SetBitmap( WXPixmap bitmap );
132
133 WXPixmap GetPixmap() const;
134 WXPixmap GetBitmap() const;
a29c6824
MB
135
136 WXPixmap GetDrawable() const;
137
a11672a4 138 WXDisplay *GetDisplay() const;
6298b8d0 139
dd21c826 140protected:
8f884a0d
VZ
141 virtual wxGDIRefData *CreateGDIRefData() const;
142 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
dd21c826 143
a11672a4
RR
144private:
145 DECLARE_DYNAMIC_CLASS(wxBitmap)
146};
83df96d6 147
dd21c826 148#endif // _WX_BITMAP_H_