Author: hbelusca
Date: Tue Oct 27 21:22:17 2015
New Revision: 69723
URL:
http://svn.reactos.org/svn/reactos?rev=69723&view=rev
Log:
[MSCONFIG_NEW]
Enable Win7-like theming when applicable.
Added:
trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c (with props)
trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.h (with props)
Modified:
trunk/reactos/base/applications/msconfig_new/CMakeLists.txt
trunk/reactos/base/applications/msconfig_new/msconfig.c
trunk/reactos/base/applications/msconfig_new/srvpage.cpp
trunk/reactos/base/applications/msconfig_new/toolspage.cpp
Modified: trunk/reactos/base/applications/msconfig_new/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/CMakeLists.txt [iso-8859-1] Tue Oct 27
21:22:17 2015
@@ -11,6 +11,7 @@
list(APPEND C_SOURCE
comctl32ex/listviewfuncs.c
+ comctl32ex/uxthemesupp.c
fileextractdialog.c
fileutils.c
freeldrpage.c
Added: trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c (added)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c [iso-8859-1] Tue
Oct 27 21:22:17 2015
@@ -0,0 +1,84 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/comctl32ex/uxthemesupp.c
+ * PURPOSE: UX Theming helpers.
+ * COPYRIGHT: Copyright 2015 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#include "precomp.h"
+#include "uxthemesupp.h"
+
+static HMODULE hUxTheme = NULL;
+
+static BOOL
+InitUxTheme(VOID)
+{
+ static BOOL Initialized = FALSE;
+
+ if (Initialized) return TRUE;
+
+ hUxTheme = LoadLibraryW(L"uxtheme.dll");
+ if (hUxTheme == NULL) return FALSE;
+
+ Initialized = TRUE;
+ return TRUE;
+}
+
+static VOID
+CleanupUxTheme(VOID)
+{
+ FreeLibrary(hUxTheme);
+ hUxTheme = NULL;
+ // Initialized = FALSE;
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Taken from WinSpy++ 1.7
+//
http://www.catch22.net/software/winspy
+// Copyright (c) 2002 by J Brown
+//
+
+typedef HRESULT (WINAPI* ETDTProc)(HWND, DWORD);
+
+HRESULT
+WINAPI
+EnableThemeDialogTexture(_In_ HWND hwnd,
+ _In_ DWORD dwFlags)
+{
+ ETDTProc fnEnableThemeDialogTexture;
+
+ if (!InitUxTheme())
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ fnEnableThemeDialogTexture =
+ (ETDTProc)GetProcAddress(hUxTheme, "EnableThemeDialogTexture");
+ if (!fnEnableThemeDialogTexture)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ return fnEnableThemeDialogTexture(hwnd, dwFlags);
+}
+
+
+typedef HRESULT (WINAPI* SWTProc)(HWND, LPCWSTR, LPCWSTR);
+
+HRESULT
+WINAPI
+SetWindowTheme(_In_ HWND hwnd,
+ _In_ LPCWSTR pszSubAppName,
+ _In_ LPCWSTR pszSubIdList)
+{
+ SWTProc fnSetWindowTheme;
+
+ if (!InitUxTheme())
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ fnSetWindowTheme =
+ (SWTProc)GetProcAddress(hUxTheme, "SetWindowTheme");
+ if (!fnSetWindowTheme)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ return fnSetWindowTheme(hwnd, pszSubAppName, pszSubIdList);
+}
Propchange: trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.h (added)
+++ trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.h [iso-8859-1] Tue
Oct 27 21:22:17 2015
@@ -0,0 +1,48 @@
+/*
+ * PROJECT: ReactOS Applications
+ * LICENSE: LGPL - See COPYING in the top level directory
+ * FILE: base/applications/msconfig_new/comctl32ex/uxthemesupp.c
+ * PURPOSE: UX Theming helpers.
+ * COPYRIGHT: Copyright 2015 Hermes BELUSCA - MAITO <hermes.belusca(a)sfr.fr>
+ */
+
+#ifndef _UXTHEMESUPP_H_
+#define _UXTHEMESUPP_H_
+
+#pragma once
+
+#if defined(_UXTHEME_H) || defined(_UXTHEME_H_) // First one is our headers from
Wine/MinGW, second one is MS PSDK
+#warning "PSDK header uxtheme.h is already included, you might think about using it
instead!"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// Copied from uxtheme.h
+// If you have this new header, then delete these and
+// #include <uxtheme.h> instead!
+//
+
+#define ETDT_DISABLE 0x00000001
+#define ETDT_ENABLE 0x00000002
+#define ETDT_USETABTEXTURE 0x00000004
+#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
+
+HRESULT
+WINAPI
+EnableThemeDialogTexture(_In_ HWND hwnd,
+ _In_ DWORD dwFlags);
+
+HRESULT
+WINAPI
+SetWindowTheme(_In_ HWND hwnd,
+ _In_ LPCWSTR pszSubAppName,
+ _In_ LPCWSTR pszSubIdList);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _UXTHEMESUPP_H_
Propchange: trunk/reactos/base/applications/msconfig_new/comctl32ex/uxthemesupp.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/base/applications/msconfig_new/msconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/msconfig.c [iso-8859-1] Tue Oct 27
21:22:17 2015
@@ -45,61 +45,6 @@
HICON hIcon = NULL;
WNDPROC wpOrigEditProc = NULL;
-
-////////////////////////////////////////////////////////////////////////////////
-// Taken from WinSpy++ 1.7
-//
http://www.catch22.net/software/winspy
-// Copyright (c) 2002 by J Brown
-//
-
-//
-// Copied from uxtheme.h
-// If you have this new header, then delete these and
-// #include <uxtheme.h> instead!
-//
-#define ETDT_DISABLE 0x00000001
-#define ETDT_ENABLE 0x00000002
-#define ETDT_USETABTEXTURE 0x00000004
-#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
-
-//
-typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
-
-//
-// Try to call EnableThemeDialogTexture, if uxtheme.dll is present
-//
-BOOL EnableDialogTheme(HWND hwnd)
-{
- HMODULE hUXTheme;
- ETDTProc fnEnableThemeDialogTexture;
-
- hUXTheme = LoadLibrary(_T("uxtheme.dll"));
-
- if(hUXTheme)
- {
- fnEnableThemeDialogTexture =
- (ETDTProc)GetProcAddress(hUXTheme, "EnableThemeDialogTexture");
-
- if(fnEnableThemeDialogTexture)
- {
- fnEnableThemeDialogTexture(hwnd, ETDT_ENABLETAB);
-
- FreeLibrary(hUXTheme);
- return TRUE;
- }
- else
- {
- // Failed to locate API!
- FreeLibrary(hUXTheme);
- return FALSE;
- }
- }
- else
- {
- // Not running under XP? Just fail gracefully
- return FALSE;
- }
-}
/* About Box dialog */
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Modified: trunk/reactos/base/applications/msconfig_new/srvpage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/srvpage.cpp [iso-8859-1] Tue Oct 27
21:22:17 2015
@@ -10,10 +10,11 @@
#include "precomp.h"
#include "utils.h"
-#include "listviewfuncs.h"
#include "regutils.h"
#include "stringutils.h"
// #include "CmdLineParser.h"
+#include "listviewfuncs.h"
+#include "uxthemesupp.h"
#include <winsvc.h>
@@ -666,7 +667,7 @@
//
DWORD dwStyle = ListView_GetExtendedListViewStyle(hServicesListCtrl);
ListView_SetExtendedListViewStyle(hServicesListCtrl, dwStyle |
LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
- /** SetWindowTheme(hServicesListCtrl, _T("Explorer"), NULL); //
TODO: activate this only if Windows >= XP **/
+ SetWindowTheme(hServicesListCtrl, L"Explorer", NULL);
//
// Initialize the application page's controls.
Modified: trunk/reactos/base/applications/msconfig_new/toolspage.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/msconfig…
==============================================================================
--- trunk/reactos/base/applications/msconfig_new/toolspage.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/msconfig_new/toolspage.cpp [iso-8859-1] Tue Oct 27
21:22:17 2015
@@ -11,6 +11,7 @@
#include "xmldomparser.hpp"
#include "utils.h"
#include "listviewfuncs.h"
+#include "uxthemesupp.h"
static HWND hToolsPage = NULL;
static HWND hToolsListCtrl = NULL;
@@ -330,7 +331,7 @@
//
DWORD dwStyle = ListView_GetExtendedListViewStyle(hToolsListCtrl);
ListView_SetExtendedListViewStyle(hToolsListCtrl, dwStyle |
LVS_EX_FULLROWSELECT);
- /** SetWindowTheme(hToolsListCtrl, _T("Explorer"), NULL); // TODO:
activate this only if Windows >= XP **/
+ SetWindowTheme(hToolsListCtrl, L"Explorer", NULL);
//
// Initialize the application page's controls.