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