]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/x11/bitmap.h
A few tweaks and cleanups
[wxWidgets.git] / include / wx / x11 / bitmap.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: bitmap.h
3// Purpose: wxBitmap class
4// Author: Julian Smart, Robert Roebling
5// Modified by:
6// Created: 17/09/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart, Robert Roebling
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
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/string.h"
22#include "wx/palette.h"
23#include "wx/gdiobj.h"
24
25//-----------------------------------------------------------------------------
26// classes
27//-----------------------------------------------------------------------------
28
29class wxMask;
30class wxBitmap;
31class wxImage;
32
33//-----------------------------------------------------------------------------
34// wxMask
35//-----------------------------------------------------------------------------
36
37class wxMask: public wxObject
38{
39public:
40 wxMask();
41 wxMask( const wxBitmap& bitmap, const wxColour& colour );
42 wxMask( const wxBitmap& bitmap, int paletteIndex );
43 wxMask( const wxBitmap& bitmap );
44 ~wxMask();
45
46 bool Create( const wxBitmap& bitmap, const wxColour& colour );
47 bool Create( const wxBitmap& bitmap, int paletteIndex );
48 bool Create( const wxBitmap& bitmap );
49
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)
63};
64
65//-----------------------------------------------------------------------------
66// wxBitmap
67//-----------------------------------------------------------------------------
68
69class wxBitmap: public wxGDIObject
70{
71public:
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);
87
88 int GetHeight() const;
89 int GetWidth() const;
90 int GetDepth() const;
91
92 wxImage ConvertToImage() const;
93
94 // copies the contents and mask of the given (colour) icon to the bitmap
95 virtual bool CopyFromIcon(const wxIcon& icon);
96
97 wxMask *GetMask() const;
98 void SetMask( wxMask *mask );
99
100 wxBitmap GetSubBitmap( const wxRect& rect ) const;
101
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;
120
121 WXDisplay *GetDisplay() const;
122
123protected:
124 bool CreateFromXpm(const char **bits);
125 bool CreateFromImage(const wxImage& image, int depth = -1);
126
127private:
128 DECLARE_DYNAMIC_CLASS(wxBitmap)
129};
130
131#endif
132// _WX_BITMAP_H_