1///////////////////////////////////////////////////////////////////////////// 2// Name: wx/cocoa/icon.h 3// Purpose: wxIcon class 4// Author: David Elliott 5// Modified by: 6// Created: 2003/08/11 7// RCS-ID: $Id: icon.h 42077 2006-10-17 14:44:52Z ABX $ 8// Copyright: (c) 2003 David Elliott 9// Licence: wxWindows licence 10///////////////////////////////////////////////////////////////////////////// 11 12#ifndef _WX_COCOA_ICON_H__ 13#define _WX_COCOA_ICON_H__ 14 15#include "wx/gdicmn.h" 16#include "wx/gdiobj.h" 17 18// ======================================================================== 19// wxIcon 20// ======================================================================== 21class WXDLLEXPORT wxIcon: public wxGDIObject 22{ 23 DECLARE_DYNAMIC_CLASS(wxIcon) 24public: 25 wxIcon(); 26 27 wxIcon(const char **data) { CreateFromXpm(data); } 28 wxIcon(char **data) { CreateFromXpm((const char**)data); } 29 wxIcon(const char bits[], int width , int height ); 30 wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE, 31 int desiredWidth = -1, int desiredHeight = -1); 32 wxIcon(const wxIconLocation& loc) 33 { 34 LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); 35 } 36 virtual ~wxIcon(); 37 38 bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ , 39 int desiredWidth /* = -1 */ , int desiredHeight = -1); 40 bool LoadFile(const wxString& name, wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE ) 41 { return LoadFile( name , flags , -1 , -1 ) ; } 42 43 bool operator==(const wxIcon& icon) const 44 { return m_refData == icon.m_refData; } 45 bool operator!=(const wxIcon& icon) const { return !(*this == icon); } 46 47 // create from bitmap (which should have a mask unless it's monochrome): 48 // there shouldn't be any implicit bitmap -> icon conversion (i.e. no 49 // ctors, assignment operators...), but it's ok to have such function 50 void CopyFromBitmap(const wxBitmap& bmp); 51 52 bool Ok() const { return IsOk(); } 53 bool IsOk() const; 54 int GetWidth() const; 55 int GetHeight() const; 56 57 WX_NSImage GetNSImage() const; 58 bool CreateFromXpm(const char **bits); 59}; 60 61#endif 62 // _WX_COCOA_ICON_H__ 63