Context Trace Outputs for Exceptions
[reactos.git] / reactos / subsys / system / explorer / globals.h
1 /*
2 * Copyright 2003 Martin Fuchs
3 *
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.
8 *
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.
13 *
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
17 */
18
19
20 //
21 // Explorer clone
22 //
23 // globals.h
24 //
25 // Martin Fuchs, 23.07.2003
26 //
27
28
29 /// structure containing global variable of Explorer
30 extern struct ExplorerGlobals
31 {
32 ExplorerGlobals();
33
34 HINSTANCE _hInstance;
35 ATOM _hframeClass;
36 UINT _cfStrFName;
37 HWND _hMainWnd;
38 bool _prescan_nodes;
39 bool _desktop_mode;
40
41 FILE* _log;
42
43 #ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
44 DWORD(STDAPICALLTYPE* _SHRestricted)(RESTRICTIONS);
45 #endif
46 } g_Globals;
47
48 #undef LOG
49
50 #define LOG(x) \
51 { \
52 if (g_Globals._log) _ftprintf(g_Globals._log, TEXT("%s\n"), (LPCTSTR)(x)); \
53 OutputDebugString(FmtString(TEXT("%s\n"), (LPCTSTR)(x))); \
54 }
55
56
57 /// convenient loading of string resources
58 struct ResString : public String
59 {
60 ResString(UINT nid);
61 };
62
63 /// convenient loading of standard (32x32) icon resources
64 struct ResIcon
65 {
66 ResIcon(UINT nid);
67
68 operator HICON() const {return _hIcon;}
69
70 protected:
71 HICON _hIcon;
72 };
73
74 /// convenient loading of small (16x16) icon resources
75 struct SmallIcon
76 {
77 SmallIcon(UINT nid);
78
79 operator HICON() const {return _hIcon;}
80
81 protected:
82 HICON _hIcon;
83 };
84
85 /// convenient loading of icon resources with specified sizes
86 struct ResIconEx
87 {
88 ResIconEx(UINT nid, int w, int h);
89
90 operator HICON() const {return _hIcon;}
91
92 protected:
93 HICON _hIcon;
94 };
95
96 /// set big and small icons out of the resources for a window
97 extern void SetWindowIcon(HWND hwnd, UINT nid);
98
99 /// convenient loading of bitmap resources
100 struct ResBitmap
101 {
102 ResBitmap(UINT nid);
103 ~ResBitmap() {DeleteObject(_hBmp);}
104
105 operator HBITMAP() const {return _hBmp;}
106
107 protected:
108 HBITMAP _hBmp;
109 };