From 37690f6a83f2935292f28cdec8340c206a2f3aac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 7 Jul 2012 20:38:34 +0000 Subject: fix for top toolbar drawing in Clist Nicer & Clist Modern git-svn-id: http://svn.miranda-ng.org/main/trunk@838 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/modern_tbbutton.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/modern_tbbutton.cpp b/plugins/Clist_modern/modern_tbbutton.cpp index 2f38cc25e3..8b4941f69d 100644 --- a/plugins/Clist_modern/modern_tbbutton.cpp +++ b/plugins/Clist_modern/modern_tbbutton.cpp @@ -4,6 +4,7 @@ #include "hdr/modern_clcpaint.h" #include +#include #ifdef __MINGW32__ #include @@ -248,11 +249,8 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_DESTROY: xpt_FreeThemeForWindow(hwndDlg); WindowList_Remove(hButtonWindowList, hwndDlg); - if (lpSBData) { - if (lpSBData->hIconPrivate) - DestroyIcon(lpSBData->hIconPrivate); - free(lpSBData); // lpSBData was malloced by native malloc - } + if (lpSBData->hIconPrivate) + DestroyIcon(lpSBData->hIconPrivate); break; // DONT! fall thru case WM_SETTEXT: @@ -519,23 +517,29 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam return 0; } -void CustomizeButton(HWND hwnd) +static void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam) { MButtonCustomize Custom; Custom.cbLen = sizeof(TBBUTTONDATA); Custom.fnPainter = (pfnPainterFunc)PaintWorker; Custom.fnWindowProc = ToolbarButtonProc; - SendMessage(hwnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom); + SendMessage(hWnd, BUTTONSETCUSTOM, 0, (LPARAM)&Custom); - TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hwnd, 0); + TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0); p->nFontID = -1; p->hThemeButton = xpt_AddThemeHandle(p->hwnd, L"BUTTON"); p->hThemeToolbar = xpt_AddThemeHandle(p->hwnd, L"TOOLBAR"); - WindowList_Add(hButtonWindowList, hwnd, NULL); + WindowList_Add(hButtonWindowList, hWnd, NULL); } ///////////////////////////////////////////////////////////////////////////////////////// +int Buttons_ModuleLoaded(WPARAM wParam, LPARAM lParam) +{ + TopToolbar_SetCustomProc(CustomizeButton, 0); + return 0; +} + int Buttons_OnSkinModeSettingsChanged(WPARAM wParam, LPARAM lParam) { WindowList_BroadcastAsync(hButtonWindowList, MBM_UPDATETRANSPARENTFLAG,0,2); @@ -544,6 +548,8 @@ int Buttons_OnSkinModeSettingsChanged(WPARAM wParam, LPARAM lParam) HRESULT ToolbarButtonLoadModule() { + HookEvent(ME_SYSTEM_MODULESLOADED, Buttons_ModuleLoaded); + hButtonWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); hIconChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED,OnIconLibIconChanged); hBkgChangedHook = HookEvent(ME_BACKGROUNDCONFIG_CHANGED,Buttons_OnSkinModeSettingsChanged); -- cgit v1.2.3