Mercurial > dwindows
comparison win/XBrowseForFolder.cpp @ 1971:d39f4f9bed26
Win: Change to allow dark mode for the folder browser window.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 05 Aug 2019 15:38:21 +0000 |
parents | f8d1da63fb77 |
children | 709f8bfa711f |
comparison
equal
deleted
inserted
replaced
1970:8cf330e1e331 | 1971:d39f4f9bed26 |
---|---|
209 rectTree.right = rectDlg.right - hMargin; | 209 rectTree.right = rectDlg.right - hMargin; |
210 MoveWindowX(hwndTree, rectTree, FALSE); | 210 MoveWindowX(hwndTree, rectTree, FALSE); |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 #ifdef AEROGLASS | |
215 extern "C" { | |
216 /* Include necessary variables and prototypes from dw.c */ | |
217 extern int _DW_DARK_MODE_SUPPORTED; | |
218 extern int _DW_DARK_MODE_ENABLED; | |
219 extern BOOL (WINAPI * _ShouldAppsUseDarkMode)(VOID); | |
220 | |
221 BOOL IsHighContrast(VOID); | |
222 BOOL IsColorSchemeChangeMessage(LPARAM lParam); | |
223 void RefreshTitleBarThemeColor(HWND window); | |
224 BOOL CALLBACK _dw_set_child_window_theme(HWND window, LPARAM lParam); | |
225 } | |
226 #endif | |
227 | |
214 /////////////////////////////////////////////////////////////////////////////// | 228 /////////////////////////////////////////////////////////////////////////////// |
215 // BrowseCallbackProc - SHBrowseForFolder callback function | 229 // BrowseCallbackProc - SHBrowseForFolder callback function |
216 static int CALLBACK BrowseCallbackProc(HWND hWnd, // Window handle to the browse dialog box | 230 static int CALLBACK BrowseCallbackProc(HWND hWnd, // Window handle to the browse dialog box |
217 UINT uMsg, // Value identifying the event | 231 UINT uMsg, // Value identifying the event |
218 LPARAM lParam, // Value dependent upon the message | 232 LPARAM lParam, // Value dependent upon the message |
220 // specified in the lParam member of the | 234 // specified in the lParam member of the |
221 // BROWSEINFO structure | 235 // BROWSEINFO structure |
222 { | 236 { |
223 switch (uMsg) | 237 switch (uMsg) |
224 { | 238 { |
239 #ifdef AEROGLASS | |
240 case WM_SETTINGCHANGE: | |
241 { | |
242 if(_DW_DARK_MODE_SUPPORTED && IsColorSchemeChangeMessage(lpData)) | |
243 { | |
244 _DW_DARK_MODE_ENABLED = _ShouldAppsUseDarkMode() && !IsHighContrast(); | |
245 | |
246 RefreshTitleBarThemeColor(hWnd); | |
247 _dw_set_child_window_theme(hWnd, 0); | |
248 EnumChildWindows(hWnd, _dw_set_child_window_theme, 0); | |
249 } | |
250 } | |
251 break; | |
252 #endif | |
225 case BFFM_INITIALIZED: // sent when the browse dialog box has finished initializing. | 253 case BFFM_INITIALIZED: // sent when the browse dialog box has finished initializing. |
226 { | 254 { |
227 // remove context help button from dialog caption | 255 // remove context help button from dialog caption |
228 LONG lStyle = ::GetWindowLong(hWnd, GWL_STYLE); | 256 LONG lStyle = ::GetWindowLong(hWnd, GWL_STYLE); |
229 lStyle &= ~DS_CONTEXTHELP; | 257 lStyle &= ~DS_CONTEXTHELP; |
246 // set window caption | 274 // set window caption |
247 ::SetWindowText(hWnd, fp->lpszTitle); | 275 ::SetWindowText(hWnd, fp->lpszTitle); |
248 } | 276 } |
249 } | 277 } |
250 | 278 |
279 #ifdef AEROGLASS | |
280 if(_DW_DARK_MODE_SUPPORTED) | |
281 { | |
282 _dw_set_child_window_theme(hWnd, 0); | |
283 EnumChildWindows(hWnd, _dw_set_child_window_theme, 0); | |
284 RefreshTitleBarThemeColor(hWnd); | |
285 } | |
286 #endif | |
251 SizeBrowseDialog(hWnd, fp); | 287 SizeBrowseDialog(hWnd, fp); |
252 } | 288 } |
253 break; | 289 break; |
254 | 290 |
255 case BFFM_SELCHANGED: // sent when the selection has changed | 291 case BFFM_SELCHANGED: // sent when the selection has changed |