2003-03-21 21:56:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2003-06-21 09:39:40 -04:00
|
|
|
// Name: wx/cocoa/icon.h
|
2003-03-21 21:56:04 -05:00
|
|
|
// Purpose: wxIcon class
|
2004-01-27 01:01:34 -05:00
|
|
|
// Author: David Elliott
|
2003-03-21 21:56:04 -05:00
|
|
|
// Modified by:
|
2004-01-27 01:01:34 -05:00
|
|
|
// Created: 2003/08/11
|
2003-03-21 21:56:04 -05:00
|
|
|
// RCS-ID: $Id$
|
2004-01-27 01:01:34 -05:00
|
|
|
// Copyright: (c) 2003 David Elliott
|
2006-10-17 10:44:52 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-03-21 21:56:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2004-01-27 01:01:34 -05:00
|
|
|
#ifndef _WX_COCOA_ICON_H__
|
|
|
|
#define _WX_COCOA_ICON_H__
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2004-01-27 01:01:34 -05:00
|
|
|
#include "wx/gdicmn.h"
|
|
|
|
#include "wx/gdiobj.h"
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2004-01-27 01:01:34 -05:00
|
|
|
// ========================================================================
|
|
|
|
// wxIcon
|
|
|
|
// ========================================================================
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject
|
2003-03-21 21:56:04 -05:00
|
|
|
{
|
|
|
|
public:
|
2004-01-27 01:01:34 -05:00
|
|
|
wxIcon();
|
|
|
|
|
2008-01-14 13:16:37 -05:00
|
|
|
wxIcon(const char* const* data) { CreateFromXpm(data); }
|
2004-01-27 01:01:34 -05:00
|
|
|
wxIcon(const char bits[], int width , int height );
|
2008-09-21 17:09:36 -04:00
|
|
|
wxIcon(const wxString& name, int flags = wxICON_DEFAULT_TYPE,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
2004-01-27 01:01:34 -05:00
|
|
|
wxIcon(const wxIconLocation& loc)
|
|
|
|
{
|
|
|
|
LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
|
|
|
|
}
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxIcon();
|
2004-01-27 01:01:34 -05:00
|
|
|
|
2008-09-21 17:09:36 -04:00
|
|
|
bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE,
|
|
|
|
int desiredWidth=-1, int desiredHeight=-1);
|
2004-01-27 01:01:34 -05:00
|
|
|
|
|
|
|
bool operator==(const wxIcon& icon) const
|
|
|
|
{ return m_refData == icon.m_refData; }
|
|
|
|
bool operator!=(const wxIcon& icon) const { return !(*this == icon); }
|
|
|
|
|
|
|
|
// create from bitmap (which should have a mask unless it's monochrome):
|
|
|
|
// there shouldn't be any implicit bitmap -> icon conversion (i.e. no
|
|
|
|
// ctors, assignment operators...), but it's ok to have such function
|
|
|
|
void CopyFromBitmap(const wxBitmap& bmp);
|
|
|
|
|
|
|
|
int GetWidth() const;
|
|
|
|
int GetHeight() const;
|
|
|
|
|
2010-10-23 17:47:22 -04:00
|
|
|
wxSize GetSize() const { return wxSize(GetWidth(), GetHeight()); }
|
|
|
|
|
2004-01-27 01:01:34 -05:00
|
|
|
WX_NSImage GetNSImage() const;
|
2008-01-14 13:16:37 -05:00
|
|
|
bool CreateFromXpm(const char* const* bits);
|
2007-12-15 12:54:20 -05:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual wxGDIRefData *CreateGDIRefData() const;
|
|
|
|
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
2003-03-21 21:56:04 -05:00
|
|
|
};
|
|
|
|
|
2007-12-15 12:54:20 -05:00
|
|
|
#endif // _WX_COCOA_ICON_H__
|