Skip to content

Commit c2d77b0

Browse files
committed
Fixed config property sheet themes per Worstje commit 9b3d8e5
1 parent a258f7f commit c2d77b0

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

MUSHclient.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,7 @@
14041404
<ClInclude Include="luacom\tLuaVector.h" />
14051405
<ClInclude Include="luacom\tStringBuffer.h" />
14061406
<ClInclude Include="luacom\tUtil.h" />
1407+
<ClInclude Include="themeglue.h" />
14071408
</ItemGroup>
14081409
<ItemGroup>
14091410
<None Include="res\cursor1.cur" />

dialogs/world_prefs/TreePropertySheet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "stdafx.h"
55
#include "TreePropertySheet.h"
6+
#include "themeglue.h"
67

78
#ifdef _DEBUG
89
//#define new DEBUG_NEW
@@ -261,6 +262,8 @@ BOOL CTreePropertySheet::OnInitDialog()
261262
{
262263
CPropertySheet::OnInitDialog();
263264

265+
ThemeGlue_EnableThemeDialogTexture(m_hWnd, ETDT_ENABLETAB);
266+
264267
if(m_bSpecialCaption) {
265268
CRect rcWindow;
266269

dialogs/world_prefs/themeglue.h

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* Visual C++ 6 does not have support for the uxtheme library, nor
2+
* is MUSHclient willing to drop support for pre-XP platforms.
3+
* Thus, we need an 'optional' alternative to the uxtheme.lib
4+
* library.
5+
*
6+
* Sadly, stdafx.h includes a whole lot of MFC libraries,
7+
* which include uxtheme.h on their own, yet do not seem to use it.
8+
*
9+
* Thus, I cannot (easily) create dynamically linked functions to
10+
* interface with uxtheme.dll as they are already defined, yet using
11+
* the already defined uxtheme.h functions requires linking against
12+
* uxtheme.lib. -JW
13+
*/
14+
15+
16+
#ifndef __THEMEGLUE_H__
17+
#define __THEMEGLUE_H__
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif
22+
23+
#include <windows.h>
24+
25+
HMODULE HModUXT = NULL;
26+
27+
#define THEMEGLUE_FUNC(FuncStr, params, result, FuncName, formal_params) \
28+
result FuncName formal_params \
29+
{ \
30+
/* Gotta load UxTheme.dll to find the function we want. */ \
31+
if (HModUXT == NULL) \
32+
HModUXT = LoadLibrary("UxTheme.dll"); \
33+
\
34+
if (HModUXT != NULL) \
35+
{ \
36+
typedef result (WINAPI *FuncPtr) formal_params ; \
37+
FuncPtr FuncCall = (FuncPtr) GetProcAddress(HModUXT, FuncStr); \
38+
if (FuncCall != NULL) \
39+
return FuncCall params ; \
40+
} \
41+
/* No real failure possible, all is optional. */ \
42+
return S_OK ; \
43+
}
44+
45+
46+
/* THEMEGLUE_FUNC Format is: EntryPointString, SuppliedParameters, ResultType, FunctionName, FormalParameters */
47+
48+
THEMEGLUE_FUNC("EnableThemeDialogTexture", (hwnd, dwFlags), HRESULT, ThemeGlue_EnableThemeDialogTexture, (HWND hwnd, DWORD dwFlags))
49+
50+
51+
/* 2010-09-26: Yes, all this work for a single function. =)
52+
* But we might need more in the future, so I made it relatively easy to expand upon.
53+
* TODO: support for static linking against uxtheme.lib, but ideally we refactor
54+
* stdafx.h a bit and get rid of that include alltogether.
55+
* -JW
56+
*/
57+
58+
59+
#ifndef _UXTHEME_H_
60+
/* We need some of these with EnableThemeDialogTexture, make sure we have them. */
61+
#define ETDT_DISABLE 0x00000001
62+
#define ETDT_ENABLE 0x00000002
63+
#define ETDT_USETABTEXTURE 0x00000004
64+
#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
65+
#endif
66+
67+
#ifdef __cplusplus
68+
} // extern "C"
69+
#endif
70+
71+
#endif

0 commit comments

Comments
 (0)