2 * Copyright 2003 Martin Fuchs
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 // Martin Fuchs, 23.07.2003
29 /// management of file types
35 struct FileTypeManager
: public map
<String
, FileTypeInfo
>
37 typedef map
<String
, FileTypeInfo
> super
;
39 const FileTypeInfo
& operator[](String ext
);
81 Icon(ICON_ID id
, UINT nid
);
82 Icon(ICON_TYPE itype
, int id
, HICON hIcon
);
88 const Icon
& extract(String path
);
89 const Icon
& extract(LPCTSTR path
, int idx
);
90 const Icon
& extract(IExtractIcon
* pExtract
, LPCTSTR path
, int idx
);
92 const Icon
& add(HICON hIcon
, ICON_TYPE type
=IT_DYNAMIC
);
94 const Icon
& get_icon(int icon_id
);
95 HBITMAP
get_icon_bitmap(int icon_id
, HBRUSH hbrBkgnd
, HDC hdc
);
97 void free_icon(int icon_id
);
100 static int s_next_id
;
102 typedef map
<int, Icon
> IconMap
;
105 typedef map
<String
, ICON_ID
> PathMap
;
108 typedef pair
<String
, int> CachePair
;
109 typedef map
<CachePair
, ICON_ID
> PathIdxMap
;
110 PathIdxMap _pathIdxMap
;
114 /// create a bitmap from an icon
115 extern HBITMAP
create_bitmap_from_icon(HICON hIcon
, HBRUSH hbrush_bkgnd
, HDC hdc_wnd
);
118 /// structure containing global variables of Explorer
119 extern struct ExplorerGlobals
123 void init(HINSTANCE hInstance
);
125 HINSTANCE _hInstance
;
134 #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
135 DWORD(STDAPICALLTYPE
* _SHRestricted
)(RESTRICTIONS
);
138 FileTypeManager _ftype_mgr
;
139 IconCache _icon_cache
;
143 /// convenient loading of string resources
144 struct ResString
: public String
149 /// convenient loading of standard (32x32) icon resources
154 operator HICON() const {return _hIcon
;}
160 /// convenient loading of small (16x16) icon resources
165 operator HICON() const {return _hIcon
;}
171 /// convenient loading of icon resources with specified sizes
174 ResIconEx(UINT nid
, int w
, int h
);
176 operator HICON() const {return _hIcon
;}
182 /// set big and small icons out of the resources for a window
183 extern void SetWindowIcon(HWND hwnd
, UINT nid
);
185 /// convenient loading of bitmap resources
189 ~ResBitmap() {DeleteObject(_hBmp
);}
191 operator HBITMAP() const {return _hBmp
;}