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
|
2004-05-23 16:53:33 -04: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
|
|
|
|
1999-11-24 07:30:56 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-01-25 08:06:00 -05:00
|
|
|
#include "wx/msw/gdiimage.h"
|
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
|
2003-01-25 08:06:00 -05:00
|
|
|
class WXDLLEXPORT wxIconRefData : public wxGDIImageRefData
|
1999-11-24 07:30:56 -05:00
|
|
|
{
|
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
|
|
|
|
2003-01-25 08:06:00 -05:00
|
|
|
class WXDLLEXPORT wxIcon : public wxGDIImage
|
1999-11-24 07:30:56 -05:00
|
|
|
{
|
1998-05-20 10:12:05 -04:00
|
|
|
public:
|
2000-01-21 16:38:51 -05:00
|
|
|
// ctors
|
|
|
|
// default
|
|
|
|
wxIcon() { }
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2000-01-21 16:38:51 -05:00
|
|
|
// from raw data
|
1999-02-23 17:57:19 -05:00
|
|
|
wxIcon(const char bits[], int width, int height);
|
2003-06-21 09:39:40 -04:00
|
|
|
|
2000-01-21 16:38:51 -05:00
|
|
|
// from XPM data
|
2008-01-14 13:16:37 -05:00
|
|
|
wxIcon(const char* const* data) { CreateIconFromXpm(data); }
|
|
|
|
#ifdef wxNEEDS_CHARPP
|
|
|
|
wxIcon(char **data) { CreateIconFromXpm(wx_const_cast(const char* const*, data)); }
|
|
|
|
#endif
|
2000-01-21 16:38:51 -05:00
|
|
|
// from resource/file
|
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);
|
2000-01-21 16:38:51 -05:00
|
|
|
|
2003-06-21 09:39:40 -04:00
|
|
|
wxIcon(const wxIconLocation& loc);
|
|
|
|
|
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
|
|
|
|
2000-02-01 19:52:06 -05:00
|
|
|
// implementation only from now on
|
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
|
|
|
|
2000-02-01 19:52:06 -05:00
|
|
|
// 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);
|
|
|
|
|
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
|
|
|
|
2004-09-11 16:26:44 -04:00
|
|
|
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
|
|
|
|
2000-01-21 16:38:51 -05:00
|
|
|
// create from XPM data
|
2008-01-14 13:16:37 -05:00
|
|
|
void CreateIconFromXpm(const char* const* data);
|
2000-01-21 16:38:51 -05: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_
|