]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/bitmap.h
Win64 compilation fixes: define SIZEOF_SIZE_T, added wxUIntPtr
[wxWidgets.git] / include / wx / x11 / bitmap.h
CommitLineData
83df96d6 1/////////////////////////////////////////////////////////////////////////////
6298b8d0 2// Name: 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
7// RCS-ID: $Id$
a11672a4 8// Copyright: (c) Julian Smart, Robert Roebling
6298b8d0 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_BITMAP_H_
13#define _WX_BITMAP_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
83df96d6
JS
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();
6298b8d0 45
a11672a4
RR
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; }
6298b8d0 53
a11672a4
RR
54 WXDisplay *GetDisplay() const { return m_display; }
55 void SetDisplay( WXDisplay *display ) { m_display = display; }
6298b8d0 56
a11672a4
RR
57private:
58 WXPixmap m_bitmap;
59 WXDisplay *m_display;
6298b8d0 60
a11672a4
RR
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 );
6298b8d0
VZ
87 virtual ~wxBitmap();
88
a11672a4
RR
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);
dd38c875
MB
99 // create the wxBitmap using a _copy_ of the pixmap
100 bool Create(WXPixmap pixmap);
62ad3cb3 101
a11672a4
RR
102 int GetHeight() const;
103 int GetWidth() const;
104 int GetDepth() const;
6298b8d0
VZ
105
106#if wxUSE_IMAGE
107 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
a11672a4 108 wxImage ConvertToImage() const;
6298b8d0
VZ
109 bool CreateFromImage(const wxImage& image, int depth = -1);
110#endif // wxUSE_IMAGE
83df96d6 111
a11672a4
RR
112 // copies the contents and mask of the given (colour) icon to the bitmap
113 virtual bool CopyFromIcon(const wxIcon& icon);
83df96d6 114
a11672a4
RR
115 wxMask *GetMask() const;
116 void SetMask( wxMask *mask );
6298b8d0 117
83df96d6 118 wxBitmap GetSubBitmap( const wxRect& rect ) const;
7266b672 119
62ad3cb3
MB
120 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const;
121 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM );
a11672a4
RR
122
123 wxPalette *GetPalette() const;
124 wxPalette *GetColourMap() const
125 { return GetPalette(); };
62ad3cb3 126 virtual void SetPalette(const wxPalette& palette);
a11672a4
RR
127
128 // implementation
129 // --------------
130
131 void SetHeight( int height );
132 void SetWidth( int width );
133 void SetDepth( int depth );
134 void SetPixmap( WXPixmap pixmap );
135 void SetBitmap( WXPixmap bitmap );
136
137 WXPixmap GetPixmap() const;
138 WXPixmap GetBitmap() const;
a29c6824
MB
139
140 WXPixmap GetDrawable() const;
141
a11672a4 142 WXDisplay *GetDisplay() const;
6298b8d0 143
83df96d6 144protected:
a11672a4 145 bool CreateFromXpm(const char **bits);
83df96d6 146
a11672a4
RR
147private:
148 DECLARE_DYNAMIC_CLASS(wxBitmap)
149};
83df96d6
JS
150
151#endif
152// _WX_BITMAP_H_