]>
Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org> | |
9 | // Licence: wxWindows licence | |
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 | ||
21 | class WXDLLIMPEXP_BASE wxIconLocationBase | |
22 | { | |
23 | public: | |
24 | // ctor takes the name of the file where the icon is | |
25 | wxEXPLICIT wxIconLocationBase(const wxString& filename = wxEmptyString) | |
26 | : m_filename(filename) { } | |
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 | |
35 | void SetFileName(const wxString& filename) { m_filename = filename; } | |
36 | const wxString& GetFileName() const { return m_filename; } | |
37 | ||
38 | private: | |
39 | wxString m_filename; | |
40 | }; | |
41 | ||
42 | // under Windows the same file may contain several icons so we also store the | |
43 | // index of the icon | |
44 | #if defined(__WINDOWS__) | |
45 | ||
46 | class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase | |
47 | { | |
48 | public: | |
49 | // ctor takes the name of the file where the icon is and the icons index in | |
50 | // the file | |
51 | wxEXPLICIT wxIconLocation(const wxString& file = wxEmptyString, int num = 0); | |
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 | ||
68 | #else // !__WINDOWS__ | |
69 | ||
70 | // must be a class because we forward declare it as class | |
71 | class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase | |
72 | { | |
73 | public: | |
74 | wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString) | |
75 | : wxIconLocationBase(filename) { } | |
76 | }; | |
77 | ||
78 | #endif // platform | |
79 | ||
80 | #endif // _WX_ICONLOC_H_ | |
81 |