icon.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/motif/icon.h
  3. // Purpose: wxIcon class
  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_ICON_H_
  11. #define _WX_ICON_H_
  12. #include "wx/bitmap.h"
  13. // Icon
  14. class WXDLLIMPEXP_CORE wxIcon : public wxBitmap
  15. {
  16. public:
  17. wxIcon();
  18. // Initialize with XBM data
  19. wxIcon(const char bits[], int width, int height);
  20. // Initialize with XPM data
  21. wxIcon(const char* const* data);
  22. #ifdef wxNEEDS_CHARPP
  23. wxIcon(char **data);
  24. #endif
  25. wxIcon(const wxString& name, wxBitmapType type = wxICON_DEFAULT_TYPE,
  26. int desiredWidth = -1, int desiredHeight = -1)
  27. {
  28. LoadFile(name, type, desiredWidth, desiredHeight);
  29. }
  30. wxIcon(const wxIconLocation& loc)
  31. {
  32. LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ANY);
  33. }
  34. virtual ~wxIcon();
  35. bool LoadFile(const wxString& name, wxBitmapType type,
  36. int desiredWidth, int desiredHeight);
  37. // unhide the base class version
  38. virtual bool LoadFile(const wxString& name,
  39. wxBitmapType flags = wxICON_DEFAULT_TYPE)
  40. { return LoadFile(name, flags); }
  41. // create from bitmap (which should have a mask unless it's monochrome):
  42. // there shouldn't be any implicit bitmap -> icon conversion (i.e. no
  43. // ctors, assignment operators...), but it's ok to have such function
  44. void CopyFromBitmap(const wxBitmap& bmp);
  45. DECLARE_DYNAMIC_CLASS(wxIcon)
  46. };
  47. #endif // _WX_ICON_H_