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
|
2004-05-23 16:53:33 -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
|
|
|
|
// ========================================================================
|
|
|
|
class WXDLLEXPORT wxIcon: public wxGDIObject
|
2003-03-21 21:56:04 -05:00
|
|
|
{
|
2004-01-27 01:01:34 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
2003-03-21 21:56:04 -05:00
|
|
|
public:
|
2004-01-27 01:01:34 -05:00
|
|
|
wxIcon();
|
|
|
|
|
|
|
|
// Copy constructors
|
|
|
|
wxIcon(const wxIcon& icon)
|
|
|
|
{ Ref(icon); }
|
|
|
|
|
|
|
|
wxIcon(const char **data) { CreateFromXpm(data); }
|
|
|
|
wxIcon(char **data) { CreateFromXpm((const char**)data); }
|
|
|
|
wxIcon(const char bits[], int width , int height );
|
|
|
|
wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
|
|
|
wxIcon(const wxIconLocation& loc)
|
|
|
|
{
|
|
|
|
LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON);
|
|
|
|
}
|
|
|
|
~wxIcon();
|
|
|
|
|
|
|
|
bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
|
|
|
|
int desiredWidth /* = -1 */ , int desiredHeight = -1);
|
|
|
|
bool LoadFile(const wxString& name, wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
|
|
|
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
|
|
|
|
|
|
|
wxIcon& operator=(const wxIcon& icon)
|
|
|
|
{ if (this != &icon) Ref(icon); return *this; }
|
|
|
|
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);
|
|
|
|
|
|
|
|
bool Ok() const;
|
|
|
|
int GetWidth() const;
|
|
|
|
int GetHeight() const;
|
|
|
|
|
|
|
|
WX_NSImage GetNSImage() const;
|
|
|
|
bool CreateFromXpm(const char **bits);
|
2003-03-21 21:56:04 -05:00
|
|
|
};
|
|
|
|
|
2004-01-27 01:01:34 -05:00
|
|
|
#endif // _WX_COCOA_ICON_H__
|