icon.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #ifndef _WX_GENERIC_ICON_H_
  11. #define _WX_GENERIC_ICON_H_
  12. #include "wx/bitmap.h"
  13. //-----------------------------------------------------------------------------
  14. // wxIcon
  15. //-----------------------------------------------------------------------------
  16. class WXDLLIMPEXP_CORE wxIcon: public wxBitmap
  17. {
  18. public:
  19. wxIcon();
  20. wxIcon(const char* const* bits);
  21. #ifdef wxNEEDS_CHARPP
  22. wxIcon(char **bits);
  23. #endif
  24. // For compatibility with wxMSW where desired size is sometimes required to
  25. // distinguish between multiple icons in a resource.
  26. wxIcon( const wxString& filename,
  27. wxBitmapType type = wxICON_DEFAULT_TYPE,
  28. int WXUNUSED(desiredWidth)=-1, int WXUNUSED(desiredHeight)=-1 ) :
  29. wxBitmap(filename, type)
  30. {
  31. }
  32. wxIcon(const wxIconLocation& loc)
  33. : wxBitmap(loc.GetFileName(), wxBITMAP_TYPE_ANY)
  34. {
  35. }
  36. bool LoadFile(const wxString& name, wxBitmapType flags,
  37. int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
  38. { return wxBitmap::LoadFile(name, flags); }
  39. // unhide the base class version
  40. virtual bool LoadFile(const wxString& name,
  41. wxBitmapType flags = wxICON_DEFAULT_TYPE)
  42. { return wxBitmap::LoadFile(name, flags); }
  43. // create from bitmap (which should have a mask unless it's monochrome):
  44. // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
  45. // ctors, assignment operators...), but it's ok to have such function
  46. void CopyFromBitmap(const wxBitmap& bmp);
  47. private:
  48. DECLARE_DYNAMIC_CLASS(wxIcon)
  49. };
  50. #endif // _WX_GENERIC_ICON_H_