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
|
|
|
|
// 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
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// compatible (even if incorrect) behaviour by default: derive wxIcon from
|
|
|
|
// wxBitmap
|
|
|
|
#ifndef wxICON_IS_BITMAP
|
|
|
|
#define wxICON_IS_BITMAP 1
|
|
|
|
#endif
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
#if wxICON_IS_BITMAP
|
|
|
|
#include "wx/bitmap.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
#define wxIconRefDataBase wxBitmapRefData
|
|
|
|
#define wxIconBase wxBitmap
|
|
|
|
#else
|
|
|
|
#include "wx/os2/gdiimage.h"
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
#define wxIconRefDataBase wxGDIImageRefData
|
|
|
|
#define wxIconBase wxGDIImage
|
|
|
|
#endif
|
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();
|
|
|
|
|
|
|
|
// Copy constructors
|
|
|
|
inline wxIcon(const wxIcon& icon) { Ref(icon); }
|
|
|
|
|
|
|
|
wxIcon( const char bits[]
|
|
|
|
,int nWidth
|
|
|
|
,int nHeight
|
|
|
|
);
|
|
|
|
wxIcon( const wxString& rName
|
|
|
|
,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
,int nDesiredWidth = -1
|
|
|
|
,int nDesiredHeight = -1
|
|
|
|
);
|
|
|
|
~wxIcon();
|
|
|
|
|
|
|
|
bool LoadFile( const wxString& rName
|
|
|
|
,long lFlags = wxBITMAP_TYPE_ICO_RESOURCE
|
|
|
|
,int nDesiredWidth = -1
|
|
|
|
,int nDesiredHeight = -1
|
|
|
|
);
|
|
|
|
|
|
|
|
inline wxIcon& operator = (const wxIcon& rIcon)
|
|
|
|
{ if (*this == rIcon) Ref(rIcon); return *this; }
|
|
|
|
inline bool operator == (const wxIcon& rIcon)
|
|
|
|
{ return m_refData == rIcon.m_refData; }
|
|
|
|
inline bool operator != (const wxIcon& rIcon)
|
|
|
|
{ return m_refData != rIcon.m_refData; }
|
|
|
|
|
|
|
|
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
|
|
|
|
|
|
|
|
inline void SetHICON(WXHICON hIcon) { SetHandle((WXHANDLE)hIcon); }
|
|
|
|
inline WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual wxGDIImageRefData* CreateData() const
|
|
|
|
{
|
|
|
|
return new wxIconRefData;
|
|
|
|
}
|
1999-07-29 01:11:30 -04:00
|
|
|
|
1999-12-03 00:03:55 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
1999-07-29 01:11:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_ICON_H_
|