1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1999-11-24 07:30:56 -05:00
|
|
|
// Name: wx/msw/icon.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxIcon class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 19:52:45 -04:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-02-23 17:57:19 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_ICON_H_
|
|
|
|
#define _WX_ICON_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-02-23 17:57:19 -05:00
|
|
|
#pragma interface "icon.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// compatible (even if incorrect) behaviour by default: derive wxIcon from
|
|
|
|
// wxBitmap
|
|
|
|
#ifndef wxICON_IS_BITMAP
|
|
|
|
#define wxICON_IS_BITMAP 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if wxICON_IS_BITMAP
|
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
|
|
|
#define wxIconRefDataBase wxBitmapRefData
|
|
|
|
#define wxIconBase wxBitmap
|
|
|
|
#else
|
|
|
|
#include "wx/msw/gdiimage.h"
|
|
|
|
|
|
|
|
#define wxIconRefDataBase wxGDIImageRefData
|
|
|
|
#define wxIconBase wxGDIImage
|
|
|
|
#endif
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-23 17:57:19 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// icon data
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
// notice that although wxIconRefData inherits from wxBitmapRefData, it is not
|
|
|
|
// a valid wxBitmapRefData
|
|
|
|
class WXDLLEXPORT wxIconRefData : public wxIconRefDataBase
|
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
1999-11-24 07:30:56 -05:00
|
|
|
wxIconRefData() { }
|
|
|
|
virtual ~wxIconRefData() { Free(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
virtual void Free();
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
1999-02-23 17:57:19 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
// Icon
|
1999-02-23 17:57:19 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
class WXDLLEXPORT wxIcon : public wxIconBase
|
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
1999-02-23 17:57:19 -05:00
|
|
|
wxIcon();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-23 17:57:19 -05:00
|
|
|
// Copy constructors
|
|
|
|
wxIcon(const wxIcon& icon) { Ref(icon); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-23 17:57:19 -05:00
|
|
|
wxIcon(const char bits[], int width, int height);
|
1999-11-24 07:30:56 -05:00
|
|
|
wxIcon(const wxString& name,
|
|
|
|
long type = wxBITMAP_TYPE_ICO_RESOURCE,
|
1999-02-23 17:57:19 -05:00
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
1999-11-24 07:30:56 -05:00
|
|
|
virtual ~wxIcon();
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
virtual bool LoadFile(const wxString& name,
|
|
|
|
long type = wxBITMAP_TYPE_ICO_RESOURCE,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-02-23 17:57:19 -05:00
|
|
|
wxIcon& operator = (const wxIcon& icon)
|
1999-11-24 07:30:56 -05:00
|
|
|
{ if ( *this != icon ) Ref(icon); return *this; }
|
1999-02-23 17:57:19 -05:00
|
|
|
bool operator == (const wxIcon& icon) const
|
|
|
|
{ return m_refData == icon.m_refData; }
|
|
|
|
bool operator != (const wxIcon& icon) const
|
|
|
|
{ return m_refData != icon.m_refData; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
wxIconRefData *GetIconData() const { return (wxIconRefData *)m_refData; }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
void SetHICON(WXHICON icon) { SetHandle((WXHANDLE)icon); }
|
|
|
|
WXHICON GetHICON() const { return (WXHICON)GetHandle(); }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
protected:
|
|
|
|
virtual wxGDIImageRefData *CreateData() const
|
1999-02-23 17:57:19 -05:00
|
|
|
{
|
1999-11-24 07:30:56 -05:00
|
|
|
return new wxIconRefData;
|
|
|
|
}
|
1998-05-20 10:12:05 -04:00
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
private:
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_ICON_H_
|