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