1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: icon.h
|
|
|
|
// Purpose: wxIcon class
|
1999-10-10 14:36:14 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-10 14:36:14 -04:00
|
|
|
// Created: 10/09/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-10 14:36:14 -04:00
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_ICON_H_
|
|
|
|
#define _WX_ICON_H_
|
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-05-06 17:47:16 -04:00
|
|
|
#include "wx/bitmap.h"
|
2004-11-11 13:59:51 -05:00
|
|
|
#include "wx/os2/gdiimage.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2004-11-11 13:59:51 -05:00
|
|
|
#define wxIconRefDataBase wxGDIImageRefData
|
|
|
|
#define wxIconBase wxGDIImage
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
class WXDLLEXPORT wxIconRefData: public wxIconRefDataBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-12-03 00:03:55 -05:00
|
|
|
wxIconRefData() { };
|
2000-02-27 23:40:52 -05:00
|
|
|
virtual ~wxIconRefData() { Free(); }
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
virtual void Free();
|
2000-02-27 23:40:52 -05:00
|
|
|
}; // end of
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Icon
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxIcon: public wxIconBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-12-03 00:03:55 -05:00
|
|
|
wxIcon();
|
|
|
|
|
|
|
|
wxIcon( const char bits[]
|
|
|
|
,int nWidth
|
|
|
|
,int nHeight
|
|
|
|
);
|
2001-01-29 00:46:06 -05:00
|
|
|
inline wxIcon(const char** ppData) { CreateIconFromXpm(ppData); }
|
|
|
|
inline wxIcon(char** ppData) { CreateIconFromXpm((const char**)ppData); }
|
1999-12-03 00:03:55 -05:00
|
|
|
wxIcon( const wxString& rName
|
|
|
|
,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
,int nDesiredWidth = -1
|
|
|
|
,int nDesiredHeight = -1
|
|
|
|
);
|
2003-06-21 09:39:40 -04:00
|
|
|
wxIcon(const wxIconLocation& loc)
|
|
|
|
{
|
|
|
|
LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICO);
|
|
|
|
}
|
|
|
|
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxIcon();
|
1999-12-03 00:03:55 -05:00
|
|
|
|
|
|
|
bool LoadFile( const wxString& rName
|
|
|
|
,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
,int nDesiredWidth = -1
|
|
|
|
,int nDesiredHeight = -1
|
|
|
|
);
|
|
|
|
|
|
|
|
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
|
|
|
|
|
|
|
|
inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
|
|
|
|
inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
|
2002-05-06 17:47:16 -04:00
|
|
|
inline bool IsXpm(void) const { return m_bIsXpm; };
|
|
|
|
inline const wxBitmap& GetXpmSrc(void) const { return m_vXpmSrc; }
|
1999-12-03 00:03:55 -05:00
|
|
|
|
2001-01-29 00:46:06 -05:00
|
|
|
void CopyFromBitmap(const wxBitmap& rBmp);
|
1999-12-03 00:03:55 -05:00
|
|
|
protected:
|
|
|
|
virtual wxGDIImageRefData* CreateData() const
|
|
|
|
{
|
|
|
|
return new wxIconRefData;
|
|
|
|
}
|
2001-01-29 00:46:06 -05:00
|
|
|
void CreateIconFromXpm(const char **ppData);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
private:
|
2002-05-06 17:47:16 -04:00
|
|
|
bool m_bIsXpm;
|
|
|
|
wxBitmap m_vXpmSrc;
|
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
1999-07-29 01:11:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_ICON_H_
|