4 * Copyright 2007 Johannes Anderwald <johannes.anderwald@reactos.org>
5 * Copyright 2016-2018 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 WINE_DEFAULT_DEBUG_CHANNEL (fprop
);
27 // CLASSKEY = HKEY_CLASSES_ROOT\CLSID\{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}
29 /////////////////////////////////////////////////////////////////////////////
33 LPCWSTR g_pszShell32
= L
"%SystemRoot%\\system32\\shell32.dll";
35 // the space characters
36 LPCWSTR g_pszSpace
= L
" \t\n\r\f\v";
38 /////////////////////////////////////////////////////////////////////////////
41 HBITMAP
Create24BppBitmap(HDC hDC
, INT cx
, INT cy
)
46 ZeroMemory(&bi
, sizeof(bi
));
47 bi
.bmiHeader
.biSize
= sizeof(BITMAPINFOHEADER
);
48 bi
.bmiHeader
.biWidth
= cx
;
49 bi
.bmiHeader
.biHeight
= cy
;
50 bi
.bmiHeader
.biPlanes
= 1;
51 bi
.bmiHeader
.biBitCount
= 24;
52 bi
.bmiHeader
.biCompression
= BI_RGB
;
54 HBITMAP hbm
= CreateDIBSection(hDC
, &bi
, DIB_RGB_COLORS
, &pvBits
, NULL
, 0);
58 HBITMAP
BitmapFromIcon(HICON hIcon
, INT cx
, INT cy
)
60 HDC hDC
= CreateCompatibleDC(NULL
);
64 HBITMAP hbm
= Create24BppBitmap(hDC
, cx
, cy
);
71 HGDIOBJ hbmOld
= SelectObject(hDC
, hbm
);
73 RECT rc
= { 0, 0, cx
, cy
};
74 FillRect(hDC
, &rc
, HBRUSH(COLOR_3DFACE
+ 1));
77 DrawIconEx(hDC
, 0, 0, hIcon
, cx
, cy
, 0, NULL
, DI_NORMAL
);
80 SelectObject(hDC
, hbmOld
);
86 HBITMAP
CreateCheckImage(HDC hDC
, BOOL bCheck
, BOOL bEnabled
)
88 INT cxSmallIcon
= GetSystemMetrics(SM_CXSMICON
);
89 INT cySmallIcon
= GetSystemMetrics(SM_CYSMICON
);
91 HBITMAP hbm
= Create24BppBitmap(hDC
, cxSmallIcon
, cySmallIcon
);
93 return NULL
; // failure
96 SetRect(&Rect
, 0, 0, cxSmallIcon
, cySmallIcon
);
98 InflateRect(&BoxRect
, -1, -1);
100 HGDIOBJ hbmOld
= SelectObject(hDC
, hbm
);
102 UINT uState
= DFCS_BUTTONCHECK
| DFCS_FLAT
| DFCS_MONO
;
104 uState
|= DFCS_CHECKED
;
106 uState
|= DFCS_INACTIVE
;
107 DrawFrameControl(hDC
, &BoxRect
, DFC_BUTTON
, uState
);
109 SelectObject(hDC
, hbmOld
);
111 return hbm
; // success
114 HBITMAP
CreateCheckMask(HDC hDC
)
116 INT cxSmallIcon
= GetSystemMetrics(SM_CXSMICON
);
117 INT cySmallIcon
= GetSystemMetrics(SM_CYSMICON
);
119 HBITMAP hbm
= CreateBitmap(cxSmallIcon
, cySmallIcon
, 1, 1, NULL
);
121 return NULL
; // failure
124 SetRect(&Rect
, 0, 0, cxSmallIcon
, cySmallIcon
);
126 InflateRect(&BoxRect
, -1, -1);
128 HGDIOBJ hbmOld
= SelectObject(hDC
, hbm
);
130 FillRect(hDC
, &Rect
, HBRUSH(GetStockObject(WHITE_BRUSH
)));
131 FillRect(hDC
, &BoxRect
, HBRUSH(GetStockObject(BLACK_BRUSH
)));
133 SelectObject(hDC
, hbmOld
);
135 return hbm
; // success
138 HBITMAP
CreateRadioImage(HDC hDC
, BOOL bCheck
, BOOL bEnabled
)
140 INT cxSmallIcon
= GetSystemMetrics(SM_CXSMICON
);
141 INT cySmallIcon
= GetSystemMetrics(SM_CYSMICON
);
143 HBITMAP hbm
= Create24BppBitmap(hDC
, cxSmallIcon
, cySmallIcon
);
145 return NULL
; // failure
148 SetRect(&Rect
, 0, 0, cxSmallIcon
, cySmallIcon
);
150 InflateRect(&BoxRect
, -1, -1);
152 HGDIOBJ hbmOld
= SelectObject(hDC
, hbm
);
154 UINT uState
= DFCS_BUTTONRADIOIMAGE
| DFCS_FLAT
| DFCS_MONO
;
156 uState
|= DFCS_CHECKED
;
158 uState
|= DFCS_INACTIVE
;
159 DrawFrameControl(hDC
, &BoxRect
, DFC_BUTTON
, uState
);
161 SelectObject(hDC
, hbmOld
);
163 return hbm
; // success
166 HBITMAP
CreateRadioMask(HDC hDC
)
168 INT cxSmallIcon
= GetSystemMetrics(SM_CXSMICON
);
169 INT cySmallIcon
= GetSystemMetrics(SM_CYSMICON
);
171 HBITMAP hbm
= CreateBitmap(cxSmallIcon
, cySmallIcon
, 1, 1, NULL
);
173 return NULL
; // failure
176 SetRect(&Rect
, 0, 0, cxSmallIcon
, cySmallIcon
);
178 InflateRect(&BoxRect
, -1, -1);
180 HGDIOBJ hbmOld
= SelectObject(hDC
, hbm
);
182 FillRect(hDC
, &Rect
, HBRUSH(GetStockObject(WHITE_BRUSH
)));
183 UINT uState
= DFCS_BUTTONRADIOMASK
| DFCS_FLAT
| DFCS_MONO
;
184 DrawFrameControl(hDC
, &BoxRect
, DFC_BUTTON
, uState
);
186 SelectObject(hDC
, hbmOld
);
188 return hbm
; // success
191 /////////////////////////////////////////////////////////////////////////////
193 // CMSGlobalFolderOptionsStub --- The owner window of Folder Options.
194 // This window hides taskbar button of Folder Options.
195 class CMSGlobalFolderOptionsStub
: public CWindowImpl
<CMSGlobalFolderOptionsStub
>
198 DECLARE_WND_CLASS_EX(_T("MSGlobalFolderOptionsStub"), 0, COLOR_WINDOWTEXT
)
200 BEGIN_MSG_MAP(CMSGlobalFolderOptionsStub
)
204 /////////////////////////////////////////////////////////////////////////////
206 EXTERN_C HPSXA WINAPI
SHCreatePropSheetExtArrayEx(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
, IDataObject
*pDataObj
);
209 ShowFolderOptionsDialog(HWND hWnd
, HINSTANCE hInst
)
211 PROPSHEETHEADERW pinfo
;
212 HPROPSHEETPAGE hppages
[3];
213 HPROPSHEETPAGE hpage
;
215 WCHAR szOptions
[100];
217 hpage
= SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_GENERAL
, FolderOptionsGeneralDlg
, 0, NULL
);
219 hppages
[num_pages
++] = hpage
;
221 hpage
= SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_VIEW
, FolderOptionsViewDlg
, 0, NULL
);
223 hppages
[num_pages
++] = hpage
;
225 hpage
= SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_FILETYPES
, FolderOptionsFileTypesDlg
, 0, NULL
);
227 hppages
[num_pages
++] = hpage
;
230 LoadStringW(shell32_hInstance
, IDS_FOLDER_OPTIONS
, szOptions
, _countof(szOptions
));
231 szOptions
[_countof(szOptions
) - 1] = 0;
233 // the stub window to hide taskbar button
234 DWORD style
= WS_DISABLED
| WS_CLIPSIBLINGS
| WS_CAPTION
;
235 DWORD exstyle
= WS_EX_WINDOWEDGE
| WS_EX_TOOLWINDOW
;
236 CMSGlobalFolderOptionsStub stub
;
237 if (!stub
.Create(NULL
, NULL
, NULL
, style
, exstyle
))
239 ERR("stub.Create failed\n");
243 memset(&pinfo
, 0x0, sizeof(PROPSHEETHEADERW
));
244 pinfo
.dwSize
= sizeof(PROPSHEETHEADERW
);
245 pinfo
.dwFlags
= PSH_NOCONTEXTHELP
;
246 pinfo
.hwndParent
= stub
;
247 pinfo
.nPages
= num_pages
;
248 pinfo
.phpage
= hppages
;
249 pinfo
.pszCaption
= szOptions
;
251 PropertySheetW(&pinfo
);
253 stub
.DestroyWindow();
257 Options_RunDLLCommon(HWND hWnd
, HINSTANCE hInst
, int fOptions
, DWORD nCmdShow
)
262 ShowFolderOptionsDialog(hWnd
, hInst
);
266 // show taskbar options dialog
267 FIXME("notify explorer to show taskbar options dialog");
268 //PostMessage(GetShellWindow(), WM_USER+22, fOptions, 0);
272 FIXME("unrecognized options id %d\n", fOptions
);
276 /*************************************************************************
277 * Options_RunDLL (SHELL32.@)
280 Options_RunDLL(HWND hWnd
, HINSTANCE hInst
, LPCSTR cmd
, DWORD nCmdShow
)
282 Options_RunDLLCommon(hWnd
, hInst
, StrToIntA(cmd
), nCmdShow
);
285 /*************************************************************************
286 * Options_RunDLLA (SHELL32.@)
289 Options_RunDLLA(HWND hWnd
, HINSTANCE hInst
, LPCSTR cmd
, DWORD nCmdShow
)
291 Options_RunDLLCommon(hWnd
, hInst
, StrToIntA(cmd
), nCmdShow
);
294 /*************************************************************************
295 * Options_RunDLLW (SHELL32.@)
298 Options_RunDLLW(HWND hWnd
, HINSTANCE hInst
, LPCWSTR cmd
, DWORD nCmdShow
)
300 Options_RunDLLCommon(hWnd
, hInst
, StrToIntW(cmd
), nCmdShow
);