]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/x11/bitmap.h
don't draw borders for bitmap buttons with wxBORDER_NONE style
[wxWidgets.git] / include / wx / x11 / bitmap.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: x11/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#include "wx/defs.h"
16#include "wx/object.h"
17#include "wx/string.h"
18#include "wx/palette.h"
19#include "wx/gdiobj.h"
20
21//-----------------------------------------------------------------------------
22// classes
23//-----------------------------------------------------------------------------
24
25class WXDLLIMPEXP_FWD_CORE wxMask;
26class WXDLLIMPEXP_FWD_CORE wxBitmap;
27class WXDLLIMPEXP_FWD_CORE wxImage;
28
29//-----------------------------------------------------------------------------
30// wxMask
31//-----------------------------------------------------------------------------
32
33class WXDLLIMPEXP_CORE wxMask: public wxObject
34{
35public:
36 wxMask();
37 wxMask( const wxBitmap& bitmap, const wxColour& colour );
38 wxMask( const wxBitmap& bitmap, int paletteIndex );
39 wxMask( const wxBitmap& bitmap );
40 virtual ~wxMask();
41
42 bool Create( const wxBitmap& bitmap, const wxColour& colour );
43 bool Create( const wxBitmap& bitmap, int paletteIndex );
44 bool Create( const wxBitmap& bitmap );
45
46 // implementation
47 WXPixmap GetBitmap() const { return m_bitmap; }
48 void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
49
50 WXDisplay *GetDisplay() const { return m_display; }
51 void SetDisplay( WXDisplay *display ) { m_display = display; }
52
53private:
54 WXPixmap m_bitmap;
55 WXDisplay *m_display;
56
57private:
58 DECLARE_DYNAMIC_CLASS(wxMask)
59};
60
61//-----------------------------------------------------------------------------
62// wxBitmap
63//-----------------------------------------------------------------------------
64
65class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
66{
67public:
68 wxBitmap() {}
69 wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
70 wxBitmap( const wxSize& sz, int depth = -1 ) { Create( sz, depth ); }
71
72 wxBitmap( const char bits[], int width, int height, int depth = 1 );
73 wxBitmap( const char* const* bits );
74#ifdef wxNEEDS_CHARPP
75 // needed for old GCC
76 wxBitmap(char** data)
77 {
78 *this = wxBitmap(const_cast<const char* const*>(data));
79 }
80#endif
81 wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
82 virtual ~wxBitmap();
83
84 static void InitStandardHandlers();
85
86 bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
87 bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH)
88 { return Create(sz.GetWidth(), sz.GetHeight(), depth); }
89
90 bool Create(const void* data, wxBitmapType type,
91 int width, int height, int depth = -1);
92 // create the wxBitmap using a _copy_ of the pixmap
93 bool Create(WXPixmap pixmap);
94
95 int GetHeight() const;
96 int GetWidth() const;
97 int GetDepth() const;
98
99#if wxUSE_IMAGE
100 wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
101 wxImage ConvertToImage() const;
102 bool CreateFromImage(const wxImage& image, int depth = -1);
103#endif // wxUSE_IMAGE
104
105 // copies the contents and mask of the given (colour) icon to the bitmap
106 virtual bool CopyFromIcon(const wxIcon& icon);
107
108 wxMask *GetMask() const;
109 void SetMask( wxMask *mask );
110
111 wxBitmap GetSubBitmap( const wxRect& rect ) const;
112
113 bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = NULL ) const;
114 bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
115
116 wxPalette *GetPalette() const;
117 wxPalette *GetColourMap() const
118 { return GetPalette(); };
119 virtual void SetPalette(const wxPalette& palette);
120
121 // implementation
122 // --------------
123
124 void SetHeight( int height );
125 void SetWidth( int width );
126 void SetDepth( int depth );
127 void SetPixmap( WXPixmap pixmap );
128 void SetBitmap( WXPixmap bitmap );
129
130 WXPixmap GetPixmap() const;
131 WXPixmap GetBitmap() const;
132
133 WXPixmap GetDrawable() const;
134
135 WXDisplay *GetDisplay() const;
136
137protected:
138 virtual wxGDIRefData *CreateGDIRefData() const;
139 virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
140
141private:
142 DECLARE_DYNAMIC_CLASS(wxBitmap)
143};
144
145#endif // _WX_BITMAP_H_