summaryrefslogtreecommitdiff
path: root/plugins/Scriver/src/richutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Scriver/src/richutil.cpp')
-rw-r--r--plugins/Scriver/src/richutil.cpp57
1 files changed, 12 insertions, 45 deletions
diff --git a/plugins/Scriver/src/richutil.cpp b/plugins/Scriver/src/richutil.cpp
index baf0e5c2dc..8cd9eb4abc 100644
--- a/plugins/Scriver/src/richutil.cpp
+++ b/plugins/Scriver/src/richutil.cpp
@@ -45,20 +45,6 @@ static int RichUtil_CmpVal(void *p1, void *p2)
return (int)((INT_PTR)tp1->hwnd - (INT_PTR)tp2->hwnd);
}
-// UxTheme Stuff
-HMODULE mTheme;
-
-HANDLE (WINAPI *MyOpenThemeData)(HWND, LPCWSTR);
-HRESULT (WINAPI *MyCloseThemeData)(HANDLE);
-BOOL (WINAPI *MyIsThemeActive)(VOID);
-HRESULT (WINAPI *MyDrawThemeBackground)(HANDLE, HDC, int, int, LPCRECT, LPCRECT);
-HRESULT (WINAPI *MyGetThemeBackgroundContentRect)(HANDLE, HDC, int, int, LPCRECT, LPRECT);
-HRESULT (WINAPI *MyDrawThemeParentBackground)(HWND, HDC, LPRECT);
-BOOL (WINAPI *MyIsThemeBackgroundPartiallyTransparent)(HANDLE, int, int);
-HRESULT (WINAPI *MyDrawThemeText)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, LPCRECT);
-HRESULT (WINAPI *MyEnableThemeDialogTexture)(HWND, DWORD);
-BOOL (WINAPI *MyIsAppThemed)(VOID);
-
static CRITICAL_SECTION csRich;
static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -70,31 +56,12 @@ void RichUtil_Load(void)
sListInt.sortFunc = RichUtil_CmpVal;
InitializeCriticalSection(&csRich);
-
- mTheme = IsWinVerXPPlus() ? GetModuleHandleA("uxtheme") : 0;
- if (!mTheme)
- return;
-
- MyOpenThemeData = (HANDLE (WINAPI *)(HWND, LPCWSTR))GetProcAddress(mTheme, "OpenThemeData");
- MyCloseThemeData = (HRESULT (WINAPI *)(HANDLE))GetProcAddress(mTheme, "CloseThemeData");
- MyIsThemeActive = (BOOL (WINAPI *)())GetProcAddress(mTheme, "IsThemeActive");
- MyIsAppThemed = (BOOL (WINAPI *)(VOID))GetProcAddress(mTheme, "IsAppThemed");
- MyDrawThemeBackground = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT*, const RECT *))GetProcAddress(mTheme, "DrawThemeBackground");
- MyGetThemeBackgroundContentRect = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, const RECT *, RECT *))GetProcAddress(mTheme, "GetThemeBackgroundContentRect");
- MyDrawThemeParentBackground = (HRESULT (WINAPI *)(HWND, HDC, RECT*))GetProcAddress(mTheme, "DrawThemeParentBackground");
- MyIsThemeBackgroundPartiallyTransparent = (BOOL (WINAPI *)(HANDLE, int, int))GetProcAddress(mTheme, "IsThemeBackgroundPartiallyTransparent");
- MyDrawThemeText = (HRESULT (WINAPI *)(HANDLE, HDC, int, int, LPCWSTR, int, DWORD, DWORD, const RECT *))GetProcAddress(mTheme, "DrawThemeText");
- MyEnableThemeDialogTexture = (HRESULT (WINAPI *)(HWND, DWORD))GetProcAddress(mTheme, "EnableThemeDialogTexture");
- if (!MyOpenThemeData || !MyCloseThemeData || !MyIsThemeActive || !MyDrawThemeBackground ||
- !MyGetThemeBackgroundContentRect || !MyDrawThemeParentBackground || !MyIsThemeBackgroundPartiallyTransparent)
- mTheme = NULL;
}
void RichUtil_Unload(void)
{
List_Destroy(&sListInt);
DeleteCriticalSection(&csRich);
- mTheme = NULL;
}
int RichUtil_SubClass(HWND hwndEdit)
@@ -140,9 +107,9 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case WM_NCPAINT:
ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
- if (ru->hasUglyBorder && MyIsThemeActive())
+ if (ru->hasUglyBorder && IsThemeActive())
{
- HANDLE hTheme = MyOpenThemeData(ru->hwnd, L"EDIT");
+ HANDLE hTheme = OpenThemeData(ru->hwnd, L"EDIT");
if (hTheme)
{
@@ -161,8 +128,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
rcClient.bottom -= ru->rect.bottom;
ExcludeClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
- if (MyIsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
- MyDrawThemeParentBackground(hwnd, hdc, &rcBorder);
+ if (IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
+ DrawThemeParentBackground(hwnd, hdc, &rcBorder);
if (!IsWindowEnabled(hwnd))
nState = ETS_DISABLED;
@@ -170,8 +137,8 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
nState = ETS_READONLY;
else nState = ETS_NORMAL;
- MyDrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
- MyCloseThemeData(hTheme);
+ DrawThemeBackground(hTheme, hdc, EP_EDITTEXT, nState, &rcBorder, NULL);
+ CloseThemeData(hTheme);
ReleaseDC(hwnd, hdc);
return 0;
}
@@ -183,25 +150,25 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
ret = mir_callNextSubclass(hwnd, RichUtil_Proc, msg, wParam, lParam);
NCCALCSIZE_PARAMS *ncsParam = (NCCALCSIZE_PARAMS*)lParam;
- if (ru->hasUglyBorder && MyIsThemeActive()) {
- HANDLE hTheme = MyOpenThemeData(hwnd, L"EDIT");
+ if (ru->hasUglyBorder && IsThemeActive()) {
+ HANDLE hTheme = OpenThemeData(hwnd, L"EDIT");
if (hTheme) {
RECT rcClient ={0};
HDC hdc = GetDC(GetParent(hwnd));
- if (MyGetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
+ if (GetThemeBackgroundContentRect(hTheme, hdc, EP_EDITTEXT, ETS_NORMAL, &ncsParam->rgrc[0], &rcClient) == S_OK) {
ru->rect.left = rcClient.left-ncsParam->rgrc[0].left;
ru->rect.top = rcClient.top-ncsParam->rgrc[0].top;
ru->rect.right = ncsParam->rgrc[0].right-rcClient.right;
ru->rect.bottom = ncsParam->rgrc[0].bottom-rcClient.bottom;
ncsParam->rgrc[0] = rcClient;
- MyCloseThemeData(hTheme);
+ CloseThemeData(hTheme);
ReleaseDC(GetParent(hwnd), hdc);
return WVR_REDRAW;
}
ReleaseDC(GetParent(hwnd), hdc);
- MyCloseThemeData(hTheme);
+ CloseThemeData(hTheme);
}
}
}
@@ -229,7 +196,7 @@ static LRESULT CALLBACK RichUtil_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
static void RichUtil_ClearUglyBorder(TRichUtil *ru)
{
- if (mTheme && MyIsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) {
+ if (IsThemeActive() && GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) & WS_EX_STATICEDGE) {
ru->hasUglyBorder = 1;
SetWindowLongPtr(ru->hwnd, GWL_EXSTYLE, GetWindowLongPtr(ru->hwnd, GWL_EXSTYLE) ^ WS_EX_STATICEDGE);
}