]>
Commit | Line | Data |
---|---|---|
aaf7ab43 VZ |
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 | // RCS-ID: $Id$ | |
77ffb593 | 8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> |
65571936 | 9 | // Licence: wxWindows licence |
aaf7ab43 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_ICONLOC_H_ | |
13 | #define _WX_ICONLOC_H_ | |
14 | ||
15 | #include "wx/string.h" | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // wxIconLocation: describes the location of an icon | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
bddd7a8d | 21 | class WXDLLIMPEXP_BASE wxIconLocationBase |
aaf7ab43 VZ |
22 | { |
23 | public: | |
24 | // ctor takes the name of the file where the icon is | |
3e3362da VZ |
25 | wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString) |
26 | : m_filename(filename) { } | |
aaf7ab43 VZ |
27 | |
28 | // default copy ctor, assignment operator and dtor are ok | |
29 | ||
30 | ||
31 | // returns true if this object is valid/initialized | |
32 | bool IsOk() const { return !m_filename.empty(); } | |
33 | ||
34 | // set/get the icon file name | |
3e3362da | 35 | void SetFileName(const wxString& filename) { m_filename = filename; } |
aaf7ab43 VZ |
36 | const wxString& GetFileName() const { return m_filename; } |
37 | ||
38 | private: | |
39 | wxString m_filename; | |
40 | }; | |
41 | ||
bb5a9514 | 42 | // under Windows the same file may contain several icons so we also store the |
aaf7ab43 | 43 | // index of the icon |
bb5a9514 | 44 | #if defined(__WINDOWS__) |
aaf7ab43 | 45 | |
bddd7a8d | 46 | class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase |
aaf7ab43 VZ |
47 | { |
48 | public: | |
49 | // ctor takes the name of the file where the icon is and the icons index in | |
50 | // the file | |
3e3362da | 51 | wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0); |
aaf7ab43 VZ |
52 | |
53 | // set/get the icon index | |
54 | void SetIndex(int num) { m_index = num; } | |
55 | int GetIndex() const { return m_index; } | |
56 | ||
57 | private: | |
58 | int m_index; | |
59 | }; | |
60 | ||
61 | inline | |
62 | wxIconLocation::wxIconLocation(const wxString& file, int num) | |
63 | : wxIconLocationBase(file) | |
64 | { | |
65 | SetIndex(num); | |
66 | } | |
67 | ||
bb5a9514 | 68 | #else // !__WINDOWS__ |
aaf7ab43 | 69 | |
886dd7d2 | 70 | // must be a class because we forward declare it as class |
bddd7a8d | 71 | class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase |
886dd7d2 VZ |
72 | { |
73 | public: | |
74 | wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString) | |
75 | : wxIconLocationBase(filename) { } | |
76 | }; | |
aaf7ab43 VZ |
77 | |
78 | #endif // platform | |
79 | ||
80 | #endif // _WX_ICONLOC_H_ | |
81 |