1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2006 - Stefan Kueng
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * Provides simplified access to the system icons. Only small system icons
28 * \note This class is implemented as a singleton.
29 * The singleton instance is created when first accessed. See SYS_IMAGE_LIST() function
30 * easy access of the singleton instance. All
32 class CSysImageList
: public CImageList
34 // Singleton constructor and destructor (private)
39 // Singleton specific operations
42 * Returns a reference to the one and only instance of this class.
44 static CSysImageList
& GetInstance();
46 * Frees all allocated resources (if necessary). Don't call this
47 * function when the image list is currently bound to any control!
49 static void Cleanup();
54 * Returns the icon index for a directory.
56 int GetDirIconIndex() const;
58 * Returns the icon index for a directory that's open (e.g. for a tree control)
60 int GetDirOpenIconIndex() const;
62 * Returns the icon index for a file which has no special icon associated.
64 int GetDefaultIconIndex() const;
66 * Returns the icon index for the specified \a file. Only the file extension
67 * is used to determine the file's icon.
69 int GetFileIconIndex(const CString
& file
) const;
72 * Get the index for a Git-style path file.
73 * Uses a cache to speed things up
75 int GetPathIconIndex(const CTGitPath
& file
) const;
78 static CSysImageList
*instance
;
80 typedef std::map
<CString
, int> IconIndexMap
;
81 mutable IconIndexMap m_indexCache
;
86 * \relates CSysImageList
87 * Singleton access for CSysImageList.
89 inline CSysImageList
& SYS_IMAGE_LIST() { return CSysImageList::GetInstance(); }