]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/bitmap.h
renamed GlobalHandle class to GlobalPtr to avoid conflict with the Win32 function
[wxWidgets.git] / include / wx / x11 / bitmap.h
CommitLineData
83df96d6
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: bitmap.h
3// Purpose: wxBitmap class
a11672a4 4// Author: Julian Smart, Robert Roebling
83df96d6
JS
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
a11672a4 8// Copyright: (c) Julian Smart, Robert Roebling
83df96d6
JS
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BITMAP_H_
13#define _WX_BITMAP_H_
14
15#ifdef __GNUG__
16#pragma interface "bitmap.h"
17#endif
18
a11672a4
RR
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/string.h"
83df96d6 22#include "wx/palette.h"
a11672a4
RR
23#include "wx/gdiobj.h"
24
25//-----------------------------------------------------------------------------
26// classes
27//-----------------------------------------------------------------------------
28
29class wxMask;
30class wxBitmap;
31class wxImage;
83df96d6 32
a11672a4
RR
33//-----------------------------------------------------------------------------
34// wxMask
35//-----------------------------------------------------------------------------
36
37class wxMask: public wxObject
83df96d6 38{
83df96d6
JS
39public:
40 wxMask();
a11672a4
RR
41 wxMask( const wxBitmap& bitmap, const wxColour& colour );
42 wxMask( const wxBitmap& bitmap, int paletteIndex );
43 wxMask( const wxBitmap& bitmap );
83df96d6 44 ~wxMask();
a11672a4
RR
45
46 bool Create( const wxBitmap& bitmap, const wxColour& colour );
47 bool Create( const wxBitmap& bitmap, int paletteIndex );
48 bool Create( const wxBitmap& bitmap );
83df96d6 49
a11672a4
RR
50 // implementation
51 WXPixmap GetBitmap() const { return m_bitmap; }
52 void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
53
54 WXDisplay *GetDisplay() const { return m_display; }
55 void SetDisplay( WXDisplay *display ) { m_display = display; }
56
57private:
58 WXPixmap m_bitmap;
59 WXDisplay *m_display;
60
61private:
62 DECLARE_DYNAMIC_CLASS(wxMask)
83df96d6
JS
63};
64
a11672a4
RR
65//-----------------------------------------------------------------------------
66// wxBitmap
67//-----------------------------------------------------------------------------
83df96d6 68
62ad3cb3
MB
69class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase
70{
71public:
72 wxBitmapHandler() : wxBitmapHandlerBase() {}
73private:
74 DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
75};
76
77class wxBitmap: public wxBitmapBase
83df96d6 78{
83df96d6 79public:
a11672a4
RR
80 wxBitmap();
81 wxBitmap( int width, int height, int depth = -1 );
82 wxBitmap( const char bits[], int width, int height, int depth = 1 );
83 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
84 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
85 wxBitmap( const wxBitmap& bmp );
62ad3cb3 86 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
a11672a4
RR
87 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
88 ~wxBitmap();
89 wxBitmap& operator = ( const wxBitmap& bmp );
90 bool operator == ( const wxBitmap& bmp ) const;
91 bool operator != ( const wxBitmap& bmp ) const;
92 bool Ok() const;
93
62ad3cb3
MB
94 static void InitStandardHandlers();
95
a11672a4 96 bool Create(int width, int height, int depth = -1);
62ad3cb3
MB
97 bool Create(void* data, wxBitmapType type,
98 int width, int height, int depth = -1);
99
a11672a4
RR
100 int GetHeight() const;
101 int GetWidth() const;
102 int GetDepth() const;
83df96d6 103
a11672a4 104 wxImage ConvertToImage() const;
83df96d6 105
a11672a4
RR
106 // copies the contents and mask of the given (colour) icon to the bitmap
107 virtual bool CopyFromIcon(const wxIcon& icon);
83df96d6 108
a11672a4
RR
109 wxMask *GetMask() const;
110 void SetMask( wxMask *mask );
83df96d6
JS
111
112 wxBitmap GetSubBitmap( const wxRect& rect ) const;
7266b672 113
62ad3cb3
MB
114 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const;
115 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM );
a11672a4
RR
116
117 wxPalette *GetPalette() const;
118 wxPalette *GetColourMap() const
119 { return GetPalette(); };
62ad3cb3 120 virtual void SetPalette(const wxPalette& palette);
a11672a4
RR
121
122 // implementation
123 // --------------
124
125 void SetHeight( int height );
126 void SetWidth( int width );
127 void SetDepth( int depth );
128 void SetPixmap( WXPixmap pixmap );
129 void SetBitmap( WXPixmap bitmap );
130
131 WXPixmap GetPixmap() const;
132 WXPixmap GetBitmap() const;
a29c6824
MB
133
134 WXPixmap GetDrawable() const;
135
a11672a4 136 WXDisplay *GetDisplay() const;
83df96d6
JS
137
138protected:
a11672a4 139 bool CreateFromXpm(const char **bits);
c79a329d 140 bool CreateFromImage(const wxImage& image, int depth = -1);
83df96d6 141
a11672a4
RR
142private:
143 DECLARE_DYNAMIC_CLASS(wxBitmap)
144};
83df96d6
JS
145
146#endif
147// _WX_BITMAP_H_