]> git.saurik.com Git - wxWidgets.git/blob - include/wx/iconloc.h
Fix wxOSX warnings about int-to-void* casts.
[wxWidgets.git] / include / wx / iconloc.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/iconloc.h
3 // Purpose: declaration of wxIconLocation class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 21.06.2003
7 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_ICONLOC_H_
12 #define _WX_ICONLOC_H_
13
14 #include "wx/string.h"
15
16 // ----------------------------------------------------------------------------
17 // wxIconLocation: describes the location of an icon
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_BASE wxIconLocationBase
21 {
22 public:
23 // ctor takes the name of the file where the icon is
24 wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString)
25 : m_filename(filename) { }
26
27 // default copy ctor, assignment operator and dtor are ok
28
29
30 // returns true if this object is valid/initialized
31 bool IsOk() const { return !m_filename.empty(); }
32
33 // set/get the icon file name
34 void SetFileName(const wxString& filename) { m_filename = filename; }
35 const wxString& GetFileName() const { return m_filename; }
36
37 private:
38 wxString m_filename;
39 };
40
41 // under Windows the same file may contain several icons so we also store the
42 // index of the icon
43 #if defined(__WINDOWS__)
44
45 class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
46 {
47 public:
48 // ctor takes the name of the file where the icon is and the icons index in
49 // the file
50 wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0);
51
52 // set/get the icon index
53 void SetIndex(int num) { m_index = num; }
54 int GetIndex() const { return m_index; }
55
56 private:
57 int m_index;
58 };
59
60 inline
61 wxIconLocation::wxIconLocation(const wxString& file, int num)
62 : wxIconLocationBase(file)
63 {
64 SetIndex(num);
65 }
66
67 #else // !__WINDOWS__
68
69 // must be a class because we forward declare it as class
70 class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
71 {
72 public:
73 wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString)
74 : wxIconLocationBase(filename) { }
75 };
76
77 #endif // platform
78
79 #endif // _WX_ICONLOC_H_
80