]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/iconloc.h
emulate scrolling in wxMSW header control; document the need to call ScrollWindow...
[wxWidgets.git] / include / wx / iconloc.h
... / ...
CommitLineData
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
21class WXDLLIMPEXP_BASE wxIconLocationBase
22{
23public:
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
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
46class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
47{
48public:
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
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
70// must be a class because we forward declare it as class
71class WXDLLIMPEXP_BASE wxIconLocation : public wxIconLocationBase
72{
73public:
74 wxEXPLICIT wxIconLocation(const wxString& filename = wxEmptyString)
75 : wxIconLocationBase(filename) { }
76};
77
78#endif // platform
79
80#endif // _WX_ICONLOC_H_
81