- wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; };
-
- virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
- virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
- int desiredWidth, int desiredHeight);
- virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
-
- inline void SetName(const wxString& name) { m_name = name; }
- inline void SetExtension(const wxString& ext) { m_extension = ext; }
- inline void SetType(long type) { m_type = type; }
- inline wxString GetName() const { return m_name; }
- inline wxString GetExtension() const { return m_extension; }
- inline long GetType() const { return m_type; }
-protected:
- wxString m_name;
- wxString m_extension;
- long m_type;
-};
+ // default ctor creates an invalid bitmap, you must Create() it later
+ wxBitmap() { Init(); }
+
+ // Copy constructors
+ inline wxBitmap(const wxBitmap& rBitmap)
+ { Init(); Ref(rBitmap); }
+
+ // Initialize with raw data
+ wxBitmap( const char bits[]
+ ,int nWidth
+ ,int nHeight
+ ,int nDepth = 1
+ );
+
+ // Initialize with XPM data
+ wxBitmap( char** ppData
+ ,wxControl* pAnItem = NULL
+ );
+
+ // Load a file or resource
+ wxBitmap( const wxString& rName
+ ,long lType = wxBITMAP_TYPE_BMP_RESOURCE
+ );
+
+ // New constructor for generalised creation from data
+ wxBitmap( void* pData
+ ,long lType
+ ,int nWidth
+ ,int nHeight
+ ,int nDepth = 1
+ );
+
+ // If depth is omitted, will create a bitmap compatible with the display
+ wxBitmap( int nWidth
+ ,int nHeight
+ ,int nDepth = -1
+ );
+
+ // we must have this, otherwise icons are silently copied into bitmaps using
+ // the copy ctor but the resulting bitmap is invalid!
+ inline wxBitmap(const wxIcon& rIcon)
+ { Init(); CopyFromIcon(rIcon); }
+
+ wxBitmap& operator=(const wxBitmap& rBitmap)
+ {
+ if ( m_refData != rBitmap.m_refData )
+ Ref(rBitmap);
+ return(*this);
+ }
+
+ wxBitmap& operator=(const wxIcon& rIcon)
+ {
+ (void)CopyFromIcon(rIcon);
+
+ return(*this);
+ }
+
+ wxBitmap& operator=(const wxCursor& rCursor)
+ {
+ (void)CopyFromCursor(rCursor);
+ return (*this);
+ }
+
+ virtual ~wxBitmap();
+
+ // copies the contents and mask of the given (colour) icon to the bitmap
+ bool CopyFromIcon(const wxIcon& rIcon);
+
+ // copies the contents and mask of the given cursor to the bitmap
+ bool CopyFromCursor(const wxCursor& rCursor);
+
+ virtual bool Create( int nWidth
+ ,int nHeight
+ ,int nDepth = -1
+ );
+ virtual bool Create( void* pData
+ ,long lType
+ ,int nWidth
+ ,int nHeight
+ ,int nDepth = 1
+ );
+ virtual bool LoadFile( const wxString& rName
+ ,long lType = wxBITMAP_TYPE_BMP_RESOURCE
+ );
+ virtual bool SaveFile( const wxString& rName
+ ,int lType
+ ,const wxPalette* pCmap = NULL
+ );
+
+ inline wxBitmapRefData* GetBitmapData() const
+ { return (wxBitmapRefData *)m_refData; }
+
+ inline int GetQuality() const
+ { return (GetBitmapData() ? GetBitmapData()->m_nQuality : 0); }
+
+ void SetQuality(int nQ);
+
+ wxPalette* GetPalette() const
+ { return (GetBitmapData() ? (& GetBitmapData()->m_vBitmapPalette) : (wxPalette*) NULL); }
+
+ void SetPalette(const wxPalette& rPalette);
+
+ inline wxMask* GetMask() const
+ { return (GetBitmapData() ? GetBitmapData()->m_pBitmapMask : (wxMask*) NULL); }
+
+ void SetMask(wxMask* pMask) ;
+
+ inline bool operator==(const wxBitmap& rBitmap)
+ { return m_refData == rBitmap.m_refData; }
+
+ inline bool operator!=(const wxBitmap& rBitmap)
+ { return m_refData != rBitmap.m_refData; }
+
+#if WXWIN_COMPATIBILITY_2
+ void SetOk(bool bIsOk);
+#endif // WXWIN_COMPATIBILITY_2