1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/generic/icon.h
3 // Purpose:     wxIcon implementation for ports where it's same as wxBitmap
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     17/09/98
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _WX_GENERIC_ICON_H_
12 #define _WX_GENERIC_ICON_H_
13 
14 #include "wx/bitmap.h"
15 
16 //-----------------------------------------------------------------------------
17 // wxIcon
18 //-----------------------------------------------------------------------------
19 
20 class WXDLLIMPEXP_CORE wxIcon: public wxBitmap
21 {
22 public:
23     wxIcon();
24 
25     wxIcon(const char* const* bits);
26 
27     // For compatibility with wxMSW where desired size is sometimes required to
28     // distinguish between multiple icons in a resource.
29     wxIcon( const wxString& filename,
30             wxBitmapType type = wxICON_DEFAULT_TYPE,
31             int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) :
wxBitmap(filename,type)32         wxBitmap(filename, type)
33     {
34     }
35 
wxIcon(const wxIconLocation & loc)36     wxIcon(const wxIconLocation& loc)
37         : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY)
38     {
39     }
40 
LoadFile(const wxString & name,wxBitmapType flags,int WXUNUSED (desiredWidth),int WXUNUSED (desiredHeight))41     bool LoadFile(const wxString& name, wxBitmapType flags,
42                   int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
43         { return wxBitmap::LoadFile(name, flags); }
44 
45     // unhide the base class version
46     virtual bool LoadFile(const wxString& name,
47                           wxBitmapType flags = wxICON_DEFAULT_TYPE) wxOVERRIDE
48         { return wxBitmap::LoadFile(name, flags); }
49 
50     // create from bitmap (which should have a mask unless it's monochrome):
51     // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
52     // ctors, assignment operators...), but it's ok to have such function
53     void CopyFromBitmap(const wxBitmap& bmp);
54 
55 private:
56     wxDECLARE_DYNAMIC_CLASS(wxIcon);
57 };
58 
59 #endif // _WX_GENERIC_ICON_H_
60