Skip to content

Commit

Permalink
Fixed config property sheet themes per Worstje commit 9b3d8e5
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Sep 26, 2010
1 parent a258f7f commit c2d77b0
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions MUSHclient.vcxproj
Expand Up @@ -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" />
Expand Down
3 changes: 3 additions & 0 deletions dialogs/world_prefs/TreePropertySheet.cpp
Expand Up @@ -3,6 +3,7 @@

#include "stdafx.h"
#include "TreePropertySheet.h"
#include "themeglue.h"

#ifdef _DEBUG
//#define new DEBUG_NEW
Expand Down Expand Up @@ -261,6 +262,8 @@ BOOL CTreePropertySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();

ThemeGlue_EnableThemeDialogTexture(m_hWnd, ETDT_ENABLETAB);

if(m_bSpecialCaption) {
CRect rcWindow;

Expand Down
71 changes: 71 additions & 0 deletions 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.