2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-04-27 22:08:57 -04:00
|
|
|
// Name: x11/bitmap.h
|
2002-02-05 11:34:33 -05:00
|
|
|
// Purpose: wxBitmap class
|
2002-02-13 03:38:54 -05:00
|
|
|
// Author: Julian Smart, Robert Roebling
|
2002-02-05 11:34:33 -05:00
|
|
|
// Modified by:
|
|
|
|
// Created: 17/09/98
|
|
|
|
// RCS-ID: $Id$
|
2002-02-13 03:38:54 -05:00
|
|
|
// Copyright: (c) Julian Smart, Robert Roebling
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2002-02-05 11:34:33 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_BITMAP_H_
|
|
|
|
#define _WX_BITMAP_H_
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
2002-02-05 11:34:33 -05:00
|
|
|
#include "wx/palette.h"
|
2002-02-13 03:38:54 -05:00
|
|
|
#include "wx/gdiobj.h"
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxMask;
|
|
|
|
class WXDLLIMPEXP_CORE wxBitmap;
|
|
|
|
class WXDLLIMPEXP_CORE wxImage;
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxMask
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxMask: public wxObject
|
2002-02-05 11:34:33 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxMask();
|
2002-02-13 03:38:54 -05:00
|
|
|
wxMask( const wxBitmap& bitmap, const wxColour& colour );
|
|
|
|
wxMask( const wxBitmap& bitmap, int paletteIndex );
|
|
|
|
wxMask( const wxBitmap& bitmap );
|
2002-02-05 11:34:33 -05:00
|
|
|
~wxMask();
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
bool Create( const wxBitmap& bitmap, const wxColour& colour );
|
|
|
|
bool Create( const wxBitmap& bitmap, int paletteIndex );
|
|
|
|
bool Create( const wxBitmap& bitmap );
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
// implementation
|
|
|
|
WXPixmap GetBitmap() const { return m_bitmap; }
|
|
|
|
void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
WXDisplay *GetDisplay() const { return m_display; }
|
|
|
|
void SetDisplay( WXDisplay *display ) { m_display = display; }
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
WXPixmap m_bitmap;
|
|
|
|
WXDisplay *m_display;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxMask)
|
2002-02-05 11:34:33 -05:00
|
|
|
};
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxBitmap
|
|
|
|
//-----------------------------------------------------------------------------
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2003-04-05 07:11:05 -05:00
|
|
|
class WXDLLEXPORT wxBitmapHandler : public wxBitmapHandlerBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxBitmapHandler() : wxBitmapHandlerBase() {}
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
|
|
|
};
|
|
|
|
|
2005-08-02 14:16:51 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
|
2002-02-05 11:34:33 -05:00
|
|
|
{
|
|
|
|
public:
|
2002-02-13 03:38:54 -05:00
|
|
|
wxBitmap();
|
|
|
|
wxBitmap( int width, int height, int depth = -1 );
|
|
|
|
wxBitmap( const char bits[], int width, int height, int depth = 1 );
|
|
|
|
wxBitmap( const char **bits ) { (void)CreateFromXpm(bits); }
|
|
|
|
wxBitmap( char **bits ) { (void)CreateFromXpm((const char **)bits); }
|
|
|
|
wxBitmap( const wxBitmap& bmp );
|
2003-04-05 07:11:05 -05:00
|
|
|
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
2003-04-27 22:08:57 -04:00
|
|
|
virtual ~wxBitmap();
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
wxBitmap& operator = ( const wxBitmap& bmp );
|
|
|
|
bool operator == ( const wxBitmap& bmp ) const;
|
|
|
|
bool operator != ( const wxBitmap& bmp ) const;
|
|
|
|
bool Ok() const;
|
|
|
|
|
2003-04-05 07:11:05 -05:00
|
|
|
static void InitStandardHandlers();
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
bool Create(int width, int height, int depth = -1);
|
2003-04-05 07:11:05 -05:00
|
|
|
bool Create(void* data, wxBitmapType type,
|
|
|
|
int width, int height, int depth = -1);
|
2003-05-07 13:24:11 -04:00
|
|
|
// create the wxBitmap using a _copy_ of the pixmap
|
|
|
|
bool Create(WXPixmap pixmap);
|
2003-04-05 07:11:05 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
int GetHeight() const;
|
|
|
|
int GetWidth() const;
|
|
|
|
int GetDepth() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
|
|
|
#if wxUSE_IMAGE
|
|
|
|
wxBitmap( const wxImage& image, int depth = -1 ) { (void)CreateFromImage(image, depth); }
|
2002-02-13 03:38:54 -05:00
|
|
|
wxImage ConvertToImage() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
bool CreateFromImage(const wxImage& image, int depth = -1);
|
|
|
|
#endif // wxUSE_IMAGE
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
// copies the contents and mask of the given (colour) icon to the bitmap
|
|
|
|
virtual bool CopyFromIcon(const wxIcon& icon);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
wxMask *GetMask() const;
|
|
|
|
void SetMask( wxMask *mask );
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
2002-02-08 12:44:23 -05:00
|
|
|
|
2003-04-05 07:11:05 -05:00
|
|
|
bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL ) const;
|
|
|
|
bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_TYPE_XPM );
|
2002-02-13 03:38:54 -05:00
|
|
|
|
|
|
|
wxPalette *GetPalette() const;
|
|
|
|
wxPalette *GetColourMap() const
|
|
|
|
{ return GetPalette(); };
|
2003-04-05 07:11:05 -05:00
|
|
|
virtual void SetPalette(const wxPalette& palette);
|
2002-02-13 03:38:54 -05:00
|
|
|
|
|
|
|
// implementation
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
void SetHeight( int height );
|
|
|
|
void SetWidth( int width );
|
|
|
|
void SetDepth( int depth );
|
|
|
|
void SetPixmap( WXPixmap pixmap );
|
|
|
|
void SetBitmap( WXPixmap bitmap );
|
|
|
|
|
|
|
|
WXPixmap GetPixmap() const;
|
|
|
|
WXPixmap GetBitmap() const;
|
2003-04-07 13:39:00 -04:00
|
|
|
|
|
|
|
WXPixmap GetDrawable() const;
|
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
WXDisplay *GetDisplay() const;
|
2003-04-27 22:08:57 -04:00
|
|
|
|
2002-02-05 11:34:33 -05:00
|
|
|
protected:
|
2002-02-13 03:38:54 -05:00
|
|
|
bool CreateFromXpm(const char **bits);
|
2002-02-05 11:34:33 -05:00
|
|
|
|
2002-02-13 03:38:54 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
|
|
|
};
|
2002-02-05 11:34:33 -05:00
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_BITMAP_H_
|