]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/bitmap.h
RemoveChild added for correct disposal of scrollbar
[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
a11672a4 69class wxBitmap: public wxGDIObject
83df96d6 70{
83df96d6 71public:
a11672a4
RR
72 wxBitmap();
73 wxBitmap( int width, int height, int depth = -1 );
74 wxBitmap( const char bits[], int width, int height, int depth = 1 );
75 wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
76 wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
77 wxBitmap( const wxBitmap& bmp );
78 wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
79 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
80 ~wxBitmap();
81 wxBitmap& operator = ( const wxBitmap& bmp );
82 bool operator == ( const wxBitmap& bmp ) const;
83 bool operator != ( const wxBitmap& bmp ) const;
84 bool Ok() const;
85
86 bool Create(int width, int height, int depth = -1);
83df96d6 87
a11672a4
RR
88 int GetHeight() const;
89 int GetWidth() const;
90 int GetDepth() const;
83df96d6 91
a11672a4 92 wxImage ConvertToImage() const;
83df96d6 93
a11672a4
RR
94 // copies the contents and mask of the given (colour) icon to the bitmap
95 virtual bool CopyFromIcon(const wxIcon& icon);
83df96d6 96
a11672a4
RR
97 wxMask *GetMask() const;
98 void SetMask( wxMask *mask );
83df96d6
JS
99
100 wxBitmap GetSubBitmap( const wxRect& rect ) const;
7266b672 101
a11672a4
RR
102 bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
103 bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM );
104
105 wxPalette *GetPalette() const;
106 wxPalette *GetColourMap() const
107 { return GetPalette(); };
108
109 // implementation
110 // --------------
111
112 void SetHeight( int height );
113 void SetWidth( int width );
114 void SetDepth( int depth );
115 void SetPixmap( WXPixmap pixmap );
116 void SetBitmap( WXPixmap bitmap );
117
118 WXPixmap GetPixmap() const;
119 WXPixmap GetBitmap() const;
83df96d6 120
a11672a4 121 WXDisplay *GetDisplay() const;
83df96d6
JS
122
123protected:
a11672a4 124 bool CreateFromXpm(const char **bits);
c79a329d 125 bool CreateFromImage(const wxImage& image, int depth = -1);
83df96d6 126
a11672a4
RR
127private:
128 DECLARE_DYNAMIC_CLASS(wxBitmap)
129};
83df96d6
JS
130
131#endif
132// _WX_BITMAP_H_