]>
Commit | Line | Data |
---|---|---|
a24aff65 | 1 | ///////////////////////////////////////////////////////////////////////////// |
aaf7ab43 | 2 | // Name: wx/cocoa/icon.h |
a24aff65 | 3 | // Purpose: wxIcon class |
b5df4fc7 | 4 | // Author: David Elliott |
a24aff65 | 5 | // Modified by: |
b5df4fc7 | 6 | // Created: 2003/08/11 |
a24aff65 | 7 | // RCS-ID: $Id$ |
b5df4fc7 | 8 | // Copyright: (c) 2003 David Elliott |
1b88201f | 9 | // Licence: wxWindows licence |
a24aff65 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
b5df4fc7 DE |
12 | #ifndef _WX_COCOA_ICON_H__ |
13 | #define _WX_COCOA_ICON_H__ | |
a24aff65 | 14 | |
b5df4fc7 DE |
15 | #include "wx/gdicmn.h" |
16 | #include "wx/gdiobj.h" | |
a24aff65 | 17 | |
b5df4fc7 DE |
18 | // ======================================================================== |
19 | // wxIcon | |
20 | // ======================================================================== | |
53a2db12 | 21 | class WXDLLIMPEXP_CORE wxIcon : public wxGDIObject |
a24aff65 | 22 | { |
a24aff65 | 23 | public: |
b5df4fc7 DE |
24 | wxIcon(); |
25 | ||
e45080c1 | 26 | wxIcon(const char* const* data) { CreateFromXpm(data); } |
b5df4fc7 | 27 | wxIcon(const char bits[], int width , int height ); |
c48d0d37 FM |
28 | wxIcon(const wxString& name, int flags = wxICON_DEFAULT_TYPE, |
29 | int desiredWidth = -1, int desiredHeight = -1); | |
b5df4fc7 DE |
30 | wxIcon(const wxIconLocation& loc) |
31 | { | |
32 | LoadFile(loc.GetFileName(), wxBITMAP_TYPE_ICON); | |
33 | } | |
d3c7fc99 | 34 | virtual ~wxIcon(); |
b5df4fc7 | 35 | |
c48d0d37 FM |
36 | bool LoadFile(const wxString& name, wxBitmapType flags = wxICON_DEFAULT_TYPE, |
37 | int desiredWidth=-1, int desiredHeight=-1); | |
b5df4fc7 | 38 | |
b5df4fc7 DE |
39 | bool operator==(const wxIcon& icon) const |
40 | { return m_refData == icon.m_refData; } | |
41 | bool operator!=(const wxIcon& icon) const { return !(*this == icon); } | |
42 | ||
43 | // create from bitmap (which should have a mask unless it's monochrome): | |
44 | // there shouldn't be any implicit bitmap -> icon conversion (i.e. no | |
45 | // ctors, assignment operators...), but it's ok to have such function | |
46 | void CopyFromBitmap(const wxBitmap& bmp); | |
47 | ||
b5df4fc7 DE |
48 | int GetWidth() const; |
49 | int GetHeight() const; | |
50 | ||
51 | WX_NSImage GetNSImage() const; | |
e45080c1 | 52 | bool CreateFromXpm(const char* const* bits); |
8f884a0d VZ |
53 | |
54 | protected: | |
55 | virtual wxGDIRefData *CreateGDIRefData() const; | |
56 | virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const; | |
57 | ||
58 | private: | |
59 | DECLARE_DYNAMIC_CLASS(wxIcon) | |
a24aff65 DE |
60 | }; |
61 | ||
8f884a0d | 62 | #endif // _WX_COCOA_ICON_H__ |