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
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE 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
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE 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
|
|
|
|
);
|
2008-01-14 13:16:37 -05:00
|
|
|
wxIcon(const char* const* ppData) { CreateIconFromXpm(ppData); }
|
|
|
|
#ifdef wxNEEDS_CHARPP
|
2008-11-01 22:39:52 -04:00
|
|
|
wxIcon(char** ppData) { CreateIconFromXpm(const_cast<const char* const*>(ppData)); }
|
2008-01-14 13:16:37 -05:00
|
|
|
#endif
|
1999-12-03 00:03:55 -05:00
|
|
|
wxIcon( const wxString& rName
|
2008-09-21 17:09:36 -04:00
|
|
|
,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
|
1999-12-03 00:03:55 -05:00
|
|
|
,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
|
2008-09-21 17:09:36 -04:00
|
|
|
,wxBitmapType lFlags = wxICON_DEFAULT_TYPE
|
1999-12-03 00:03:55 -05:00
|
|
|
,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;
|
|
|
|
}
|
2008-01-14 13:16:37 -05:00
|
|
|
void CreateIconFromXpm(const char* const* 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_
|