Permalink
Browse files

Fixed config property sheet themes per Worstje commit 9b3d8e5

  • Loading branch information...
1 parent a258f7f commit c2d77b0deac9bdefe9a8556470f90a6c187a4688 @nickgammon committed Sep 26, 2010
Showing with 75 additions and 0 deletions.
  1. +1 −0 MUSHclient.vcxproj
  2. +3 −0 dialogs/world_prefs/TreePropertySheet.cpp
  3. +71 −0 dialogs/world_prefs/themeglue.h
View
1 MUSHclient.vcxproj
@@ -1404,6 +1404,7 @@
<ClInclude Include="luacom\tLuaVector.h" />
<ClInclude Include="luacom\tStringBuffer.h" />
<ClInclude Include="luacom\tUtil.h" />
+ <ClInclude Include="themeglue.h" />
</ItemGroup>
<ItemGroup>
<None Include="res\cursor1.cur" />
View
3 dialogs/world_prefs/TreePropertySheet.cpp
@@ -3,6 +3,7 @@
#include "stdafx.h"
#include "TreePropertySheet.h"
+#include "themeglue.h"
#ifdef _DEBUG
//#define new DEBUG_NEW
@@ -261,6 +262,8 @@ BOOL CTreePropertySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
+ ThemeGlue_EnableThemeDialogTexture(m_hWnd, ETDT_ENABLETAB);
+
if(m_bSpecialCaption) {
CRect rcWindow;
View
71 dialogs/world_prefs/themeglue.h
@@ -0,0 +1,71 @@
+/* Visual C++ 6 does not have support for the uxtheme library, nor
+ * is MUSHclient willing to drop support for pre-XP platforms.
+ * Thus, we need an 'optional' alternative to the uxtheme.lib
+ * library.
+ *
+ * Sadly, stdafx.h includes a whole lot of MFC libraries,
+ * which include uxtheme.h on their own, yet do not seem to use it.
+ *
+ * Thus, I cannot (easily) create dynamically linked functions to
+ * interface with uxtheme.dll as they are already defined, yet using
+ * the already defined uxtheme.h functions requires linking against
+ * uxtheme.lib. -JW
+ */
+
+
+#ifndef __THEMEGLUE_H__
+#define __THEMEGLUE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+
+HMODULE HModUXT = NULL;
+
+#define THEMEGLUE_FUNC(FuncStr, params, result, FuncName, formal_params) \
+result FuncName formal_params \
+{ \
+ /* Gotta load UxTheme.dll to find the function we want. */ \
+ if (HModUXT == NULL) \
+ HModUXT = LoadLibrary("UxTheme.dll"); \
+ \
+ if (HModUXT != NULL) \
+ { \
+ typedef result (WINAPI *FuncPtr) formal_params ; \
+ FuncPtr FuncCall = (FuncPtr) GetProcAddress(HModUXT, FuncStr); \
+ if (FuncCall != NULL) \
+ return FuncCall params ; \
+ } \
+ /* No real failure possible, all is optional. */ \
+ return S_OK ; \
+}
+
+
+/* THEMEGLUE_FUNC Format is: EntryPointString, SuppliedParameters, ResultType, FunctionName, FormalParameters */
+
+THEMEGLUE_FUNC("EnableThemeDialogTexture", (hwnd, dwFlags), HRESULT, ThemeGlue_EnableThemeDialogTexture, (HWND hwnd, DWORD dwFlags))
+
+
+/* 2010-09-26: Yes, all this work for a single function. =)
+ * But we might need more in the future, so I made it relatively easy to expand upon.
+ * TODO: support for static linking against uxtheme.lib, but ideally we refactor
+ * stdafx.h a bit and get rid of that include alltogether.
+ * -JW
+ */
+
+
+#ifndef _UXTHEME_H_
+/* We need some of these with EnableThemeDialogTexture, make sure we have them. */
+#define ETDT_DISABLE 0x00000001
+#define ETDT_ENABLE 0x00000002
+#define ETDT_USETABTEXTURE 0x00000004
+#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
+#endif
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif

0 comments on commit c2d77b0

Please sign in to comment.