1///////////////////////////////////////////////////////////////////////////// 2// Name: icon.h 3// Purpose: wxIcon class 4// Author: Stefan Csomor 5// Modified by: 6// Created: 1998-01-01 7// RCS-ID: $Id: icon.h 41020 2006-09-05 20:47:48Z VZ $ 8// Copyright: (c) Stefan Csomor 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_ICON_H_ 13#define _WX_ICON_H_ 14 15#include "wx/bitmap.h" 16 17// Icon 18class WXDLLEXPORT wxIcon: public wxBitmap 19{ 20public: 21 wxIcon(); 22 23 wxIcon(const char **data); 24 wxIcon(char **data); 25 wxIcon(const char bits[], int width , int height ); 26 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, 27 int desiredWidth = -1, int desiredHeight = -1); 28 wxIcon(const wxIconLocation& loc) 29 { 30 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); 31 } 32 virtual ~wxIcon(); 33 34 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , 35 int desiredWidth /* = -1 */ , int desiredHeight = -1); 36 bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) 37 { return LoadFile( name , flags , -1 , -1 ) ; } 38 39 bool operator==(const wxIcon& icon) const { return m_refData == icon.m_refData; } 40 bool operator!=(const wxIcon& icon) const { return !(*this == icon); } 41 42 // create from bitmap (which should have a mask unless it's monochrome): 43 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no 44 // ctors, assignment operators...), but it's ok to have such function 45 void CopyFromBitmap(const wxBitmap& bmp); 46 47 DECLARE_DYNAMIC_CLASS(wxIcon) 48}; 49 50/* 51class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler 52{ 53 DECLARE_DYNAMIC_CLASS(wxICONFileHandler) 54public: 55 inline wxICONFileHandler() 56 { 57 m_name = "ICO icon file"; 58 m_extension = "ico"; 59 m_type = wxBITMAP_TYPE_ICO; 60 }; 61 62 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, 63 int desiredWidth = -1, int desiredHeight = -1); 64}; 65*/ 66 67class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler 68{ 69 DECLARE_DYNAMIC_CLASS(wxICONResourceHandler) 70public: 71 inline wxICONResourceHandler() 72 { 73 m_name = wxT("ICON resource"); 74 m_extension = wxEmptyString; 75 m_type = wxBITMAP_TYPE_ICON_RESOURCE; 76 }; 77 78 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, 79 int desiredWidth = -1, int desiredHeight = -1); 80 81}; 82 83#endif 84 // _WX_ICON_H_ 85