Menu

[r131]: / trunk / src / SysImageList.h  Maximize  Restore  History

Download this file

66 lines (57 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#pragma once
#include <string>
using namespace std;
/**
* Provides simplified access to the system icons. Only small system icons
* are supported.
*
* \note This class is implemented as a singleton.
* The singleton instance is created when first accessed. See SYS_IMAGE_LIST() function
* easy access of the singleton instance. All
*/
class CSysImageList
{
// Singleton constructor and destructor (private)
private:
CSysImageList();
~CSysImageList();
// Singleton specific operations
public:
/**
* Returns a reference to the one and only instance of this class.
*/
static CSysImageList& GetInstance();
/**
* Frees all allocated resources (if necessary). Don't call this
* function when the image list is currently bound to any control!
*/
static void Cleanup();
// Operations
public:
/**
* Returns the icon index for a directory.
*/
int GetDirIconIndex() const;
/**
* Returns the icon index for a directory that's open (e.g. for a tree control)
*/
int GetDirOpenIconIndex() const;
/**
* Returns the icon index for a file which has no special icon associated.
*/
int GetDefaultIconIndex() const;
/**
* Returns the icon index for the specified \a file. Only the file extension
* is used to determine the file's icon.
*/
int GetFileIconIndex(const wstring& file) const;
operator HIMAGELIST() {return m_hSystemImageList;}
private:
static CSysImageList *instance;
HIMAGELIST m_hSystemImageList;
};
/**
* \relates CSysImageList
* Singleton access for CSysImageList.
*/
inline CSysImageList& SYS_IMAGE_LIST() { return CSysImageList::GetInstance(); }
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.