1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: icon.h
|
|
|
|
// Purpose: wxIcon class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
1998-08-07 23:52:45 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
1999-02-23 22:57:19 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_ICON_H_
|
|
|
|
#define _WX_ICON_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-02-23 22:57:19 +00:00
|
|
|
#pragma interface "icon.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/bitmap.h"
|
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// icon data
|
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
|
|
|
|
{
|
|
|
|
friend class WXDLLEXPORT wxBitmap;
|
|
|
|
friend class WXDLLEXPORT wxIcon;
|
1999-02-23 22:57:19 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-02-23 22:57:19 +00:00
|
|
|
wxIconRefData();
|
|
|
|
~wxIconRefData();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
public:
|
1999-02-23 22:57:19 +00:00
|
|
|
WXHICON m_hIcon;
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define M_ICONDATA ((wxIconRefData *)m_refData)
|
|
|
|
#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
|
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
1998-05-20 14:12:05 +00:00
|
|
|
// Icon
|
1999-02-23 22:57:19 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
class WXDLLEXPORT wxIcon : public wxBitmap
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-02-23 22:57:19 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxIcon)
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
public:
|
1999-02-23 22:57:19 +00:00
|
|
|
wxIcon();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
// Copy constructors
|
|
|
|
wxIcon(const wxIcon& icon) { Ref(icon); }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
wxIcon(const char bits[], int width, int height);
|
|
|
|
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
|
|
|
~wxIcon();
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
wxIcon& operator = (const wxIcon& icon)
|
|
|
|
{ if (*this == icon) return (*this); Ref(icon); return *this; }
|
|
|
|
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 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
void SetHICON(WXHICON ico);
|
|
|
|
WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
bool Ok() const { return (m_refData != NULL && M_ICONDATA->m_hIcon != 0) ; }
|
1998-05-20 14:12:05 +00:00
|
|
|
|
1999-02-23 22:57:19 +00:00
|
|
|
bool FreeResource(bool force = FALSE);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Put these in separate, private header
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
|
|
|
|
{
|
1999-02-23 22:57:19 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-02-23 22:57:19 +00:00
|
|
|
wxICOFileHandler()
|
|
|
|
{
|
|
|
|
m_name = "ICO icon file";
|
|
|
|
m_extension = "ico";
|
|
|
|
m_type = wxBITMAP_TYPE_ICO;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
|
|
|
|
{
|
1999-02-23 22:57:19 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
|
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
public:
|
1999-02-23 22:57:19 +00:00
|
|
|
wxICOResourceHandler()
|
|
|
|
{
|
|
|
|
m_name = "ICO resource";
|
|
|
|
m_extension = "ico";
|
|
|
|
m_type = wxBITMAP_TYPE_ICO_RESOURCE;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
|
|
|
int desiredWidth = -1, int desiredHeight = -1);
|
1998-05-20 14:12:05 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_ICON_H_
|