]> git.saurik.com Git - wxWidgets.git/blame - include/wx/iconloc.h
wxID_PREFERENCES added for the preferences menu item
[wxWidgets.git] / include / wx / iconloc.h
CommitLineData
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$
8// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.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
bddd7a8d 21class WXDLLIMPEXP_BASE wxIconLocationBase
aaf7ab43
VZ
22{
23public:
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
38private:
39 wxString m_filename;
40};
41
42// under MSW the same file may contain several icons so we also store the
43// index of the icon
44#if defined(__WXMSW__)
45
bddd7a8d 46class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
aaf7ab43
VZ
47{
48public:
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
57private:
58 int m_index;
59};
60
61inline
62wxIconLocation::wxIconLocation(const wxString& file, int num)
63 : wxIconLocationBase(file)
64{
65 SetIndex(num);
66}
67
68#else // !MSW
69
886dd7d2 70// must be a class because we forward declare it as class
bddd7a8d 71class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
886dd7d2
VZ
72{
73public:
74 wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString)
75 : wxIconLocationBase(filename) { }
76};
aaf7ab43
VZ
77
78#endif // platform
79
80#endif // _WX_ICONLOC_H_
81