]> git.saurik.com Git - wxWidgets.git/blame - include/wx/qt/icon.h
converted to 16 colors
[wxWidgets.git] / include / wx / qt / icon.h
CommitLineData
7c78e7c7
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: icon.h
01b2eeec
KB
3// Purpose: wxIcon class
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
7c78e7c7
RR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
01b2eeec
KB
12#ifndef _WX_ICON_H_
13#define _WX_ICON_H_
7c78e7c7
RR
14
15#ifdef __GNUG__
01b2eeec 16#pragma interface "icon.h"
7c78e7c7
RR
17#endif
18
7c78e7c7
RR
19#include "wx/bitmap.h"
20
01b2eeec
KB
21class WXDLLEXPORT wxIconRefData: public wxBitmapRefData
22{
23 friend class WXDLLEXPORT wxBitmap;
24 friend class WXDLLEXPORT wxIcon;
25public:
26 wxIconRefData();
27 ~wxIconRefData();
7c78e7c7 28
01b2eeec
KB
29public:
30/* TODO: whatever your actual icon handle is
31 WXHICON m_hIcon;
32*/
33};
7c78e7c7 34
01b2eeec
KB
35#define M_ICONDATA ((wxIconRefData *)m_refData)
36#define M_ICONHANDLERDATA ((wxIconRefData *)bitmap->GetRefData())
7c78e7c7 37
01b2eeec
KB
38// Icon
39class WXDLLEXPORT wxIcon: public wxBitmap
7c78e7c7
RR
40{
41 DECLARE_DYNAMIC_CLASS(wxIcon)
42
43public:
01b2eeec 44 wxIcon();
7c78e7c7 45
01b2eeec 46 // Copy constructors
7c78e7c7
RR
47 inline wxIcon(const wxIcon& icon) { Ref(icon); }
48 inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); }
01b2eeec
KB
49
50 wxIcon(const char bits[], int width, int height);
51 wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
52 int desiredWidth = -1, int desiredHeight = -1);
53 ~wxIcon();
54
55 bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_ICO_RESOURCE,
56 int desiredWidth = -1, int desiredHeight = -1);
57
7c78e7c7
RR
58 inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
59 inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
60 inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
01b2eeec
KB
61
62/* TODO: implementation
63 void SetHICON(WXHICON ico);
64 inline WXHICON GetHICON() const { return (M_ICONDATA ? M_ICONDATA->m_hIcon : 0); }
65*/
66
67/* TODO */
68 virtual bool Ok() const { return (m_refData != NULL) ; }
69};
70
71/* Example handlers. TODO: write your own handlers for relevant types.
72
73class WXDLLEXPORT wxICOFileHandler: public wxBitmapHandler
74{
75 DECLARE_DYNAMIC_CLASS(wxICOFileHandler)
76public:
77 inline wxICOFileHandler()
78 {
79 m_name = "ICO icon file";
80 m_extension = "ico";
81 m_type = wxBITMAP_TYPE_ICO;
82 };
83
84 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
85 int desiredWidth = -1, int desiredHeight = -1);
86};
87
88class WXDLLEXPORT wxICOResourceHandler: public wxBitmapHandler
89{
90 DECLARE_DYNAMIC_CLASS(wxICOResourceHandler)
91public:
92 inline wxICOResourceHandler()
93 {
94 m_name = "ICO resource";
95 m_extension = "ico";
96 m_type = wxBITMAP_TYPE_ICO_RESOURCE;
97 };
98
99 virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
100 int desiredWidth = -1, int desiredHeight = -1);
101
7c78e7c7
RR
102};
103
01b2eeec 104*/
7c78e7c7 105
01b2eeec
KB
106#endif
107 // _WX_ICON_H_