From 61e43dca25a80a451cf2b7dbbc4931a8f2a96d80 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 20 Sep 2013 12:59:56 +0000 Subject: using Uxtheme git-svn-id: http://svn.miranda-ng.org/main/trunk@6137 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Popup/src/actions.cpp | 13 +++---- plugins/Popup/src/headers.h | 1 + plugins/Popup/src/opt_contacts.cpp | 3 +- plugins/Popup/src/opt_gen.cpp | 15 +------ plugins/Popup/src/opt_skins.cpp | 6 +-- plugins/Popup/src/popup_wnd2.cpp | 80 ++++++++++++++++++-------------------- 6 files changed, 47 insertions(+), 71 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 9b5fd8fda8..28b9a781f2 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -221,7 +221,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_CHECKBOXES|LVS_EX_LABELTIP); - HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | (IsWinVerXPPlus()? ILC_COLOR32 : ILC_COLOR16), 10, 1); + HIMAGELIST hImgList = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 10, 1); ListView_SetImageList(hwndList, hImgList, LVSIL_SMALL); LVCOLUMN column = {0}; @@ -230,8 +230,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM column.cx = 175; ListView_InsertColumn(hwndList, 0, &column); - if (IsWinVerXPPlus()) - ListView_EnableGroupView(hwndList, TRUE); + ListView_EnableGroupView(hwndList, TRUE); LIST groups(1, strcmp); @@ -244,7 +243,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int grpId = 0; - if (IsWinVerXPPlus() && ((grpId = groups.getIndex(szGroup)) < 0)) + if ((grpId = groups.getIndex(szGroup)) < 0) { LVGROUP group = {0}; group.cbSize = sizeof(group); @@ -265,10 +264,8 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM item.pszText = TranslateTS(tszName); item.iImage = ImageList_AddIcon(hImgList, gActions[i]->lchIcon); item.lParam = i; - if (IsWinVerXPPlus()) { - item.mask |= LVIF_GROUPID; - item.iGroupId = grpId; - } + item.mask |= LVIF_GROUPID; + item.iGroupId = grpId; item.iIndent = 0; ListView_InsertItemW(hwndList, &item); diff --git a/plugins/Popup/src/headers.h b/plugins/Popup/src/headers.h index e24116d5b2..9ef40481fd 100644 --- a/plugins/Popup/src/headers.h +++ b/plugins/Popup/src/headers.h @@ -60,6 +60,7 @@ http://miranda-ng.org/distr/ #include #include #include +#include #include #include diff --git a/plugins/Popup/src/opt_contacts.cpp b/plugins/Popup/src/opt_contacts.cpp index 3d7f976c1e..da4b535f21 100644 --- a/plugins/Popup/src/opt_contacts.cpp +++ b/plugins/Popup/src/opt_contacts.cpp @@ -37,8 +37,7 @@ INT_PTR CALLBACK DlgProcContactOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l SendMessage(GetDlgItem(hwnd, IDC_ICO_FULLSCREEN), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_FULLSCREEN,0), 0); SendMessage(GetDlgItem(hwnd, IDC_ICO_BLOCK), STM_SETICON, (WPARAM)IcoLib_GetIcon(ICO_OPT_BLOCK,0), 0); { - HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON), - (IsWinVerXPPlus()?ILC_COLOR32:ILC_COLOR16)|ILC_MASK,5,5); + HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 5); ImageList_AddIcon(hIml, LoadSkinnedIcon(SKINICON_OTHER_SMALLDOT)); ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_DEF,0)); ImageList_AddIcon(hIml, IcoLib_GetIcon(ICO_OPT_FAV,0)); diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 5652e8dc0c..f6287bf1bf 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -607,19 +607,6 @@ void Check_ReorderPopups(HWND hwnd) { if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups); } -void ThemeDialogBackground(HWND hwnd) -{ - if (IsWinVerXPPlus()) { - static HMODULE hThemeAPI = NULL; - if (!hThemeAPI) hThemeAPI = GetModuleHandleA("uxtheme"); - if (hThemeAPI) { - HRESULT (STDAPICALLTYPE *MyEnableThemeDialogTexture)(HWND,DWORD) = (HRESULT (STDAPICALLTYPE*)(HWND,DWORD))GetProcAddress(hThemeAPI,"EnableThemeDialogTexture"); - if (MyEnableThemeDialogTexture) - MyEnableThemeDialogTexture(hwnd,0x00000002|0x00000004); //0x00000002|0x00000004=ETDT_ENABLETAB - } - } -} - INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { LOGFONT lf; @@ -627,7 +614,7 @@ INT_PTR CALLBACK PositionBoxDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (msg) { case WM_INITDIALOG: - ThemeDialogBackground(hwndDlg); + EnableThemeDialogTexture(hwndDlg, ETDT_ENABLETAB); GetObject((HFONT)SendMessage(GetDlgItem(hwndDlg, IDC_TITLE), WM_GETFONT, 0, 0), sizeof(lf), &lf); lf.lfWeight = FW_BOLD; diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 5b3c656684..b9ad9c726d 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -34,7 +34,7 @@ void RegisterOptPrevBox() WNDCLASSEX wcl; wcl.cbSize = sizeof(wcl); wcl.lpfnWndProc = (WNDPROC)BoxPreviewWndProc; - wcl.style = IsWinVerXPPlus() ? CS_DROPSHADOW : 0; + wcl.style = CS_DROPSHADOW; wcl.cbClsExtra = 0; wcl.cbWndExtra = 0; wcl.hInstance = hInst; @@ -57,7 +57,7 @@ void RegisterOptPrevBox() GetClassInfoEx(hInst, _T("#32770"), &wcl); wcl.hInstance = hInst; wcl.lpszClassName = _T("PopupPlusDlgBox"); - wcl.style |= IsWinVerXPPlus() ? CS_DROPSHADOW : 0; + wcl.style |= CS_DROPSHADOW; g_wndClass.cPopupPlusDlgBox = RegisterClassEx(&wcl); err = GetLastError(); if (!g_wndClass.cPopupPlusDlgBox) { @@ -219,12 +219,10 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, bCheck = PopupOptions.DisplayTime; break; case 1: - if (!IsWinVerXPPlus()) continue; *dwGlobalOptions |= PopupOptions.DropShadow ? (1 << i) : 0; bCheck = PopupOptions.DropShadow; break; case 2: - if (!IsWinVerXPPlus()) continue; *dwGlobalOptions |= PopupOptions.EnableFreeformShadows ? (1 << i) : 0; bCheck = PopupOptions.EnableFreeformShadows; break; diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 1616aa3f4a..f6d493138d 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -76,40 +76,36 @@ bool LoadPopupWnd2() } // register custom class for edit box with drop-shadow attribute - if (IsWinVerXPPlus()) - { - - #define MyRegisterClassExW RegisterClassExW - #define MyGetClassInfoExW GetClassInfoExW - - WNDCLASSEXW wclw = {0}; - wclw.cbSize = sizeof(wclw); - if (!MyGetClassInfoExW(NULL, L"EDIT", &wclw)) - MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class.")); - wclw.hInstance = hInst; - wclw.lpszClassName = L"PopupEditBox"; - wclw.style |= CS_DROPSHADOW; - g_wndClass.cPopupEditBox = MyRegisterClassExW(&wclw); - err = GetLastError(); - if (!g_wndClass.cPopupEditBox) { - TCHAR msg[2048]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), - wclw.cbSize, //UINT cbSize; - wclw.style, //UINT style; - wclw.lpfnWndProc, //WNDPROC lpfnWndProc; - wclw.cbClsExtra, //int cbClsExtra; - wclw.cbWndExtra, //int cbWndExtra; - wclw.hInstance, //HINSTANCE hInstance; - wclw.hIcon, //HICON hIcon; - wclw.hCursor, //HCURSOR hCursor; - wclw.hbrBackground, //HBRUSH hbrBackground; - wclw.lpszMenuName, //LPCWSTR lpszMenuName; - wclw.lpszClassName, //LPCWSTR lpszClassName; - wclw.hIconSm //HICON hIconSm; - ); - - MSGERROR(msg); - } + #define MyRegisterClassExW RegisterClassExW + #define MyGetClassInfoExW GetClassInfoExW + + WNDCLASSEXW wclw = {0}; + wclw.cbSize = sizeof(wclw); + if (!MyGetClassInfoExW(NULL, L"EDIT", &wclw)) + MSGERROR(TranslateT("Failed to GetClassInfoExW from EDIT class.")); + wclw.hInstance = hInst; + wclw.lpszClassName = L"PopupEditBox"; + wclw.style |= CS_DROPSHADOW; + g_wndClass.cPopupEditBox = MyRegisterClassExW(&wclw); + err = GetLastError(); + if (!g_wndClass.cPopupEditBox) { + TCHAR msg[2048]; + mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to register custom edit box window class.\r\n\r\ncbSize: %i\r\nstyle: %p\r\nlpfnWndProc: %i\r\ncbClsExtra: %i\r\ncbWndExtra: %i\r\nhInstance: %i\r\nhIcon: %i\r\nhCursor: %i\r\nhbrBackground: %i\r\nlpszMenuName: %s\r\nlpszClassName: %s\r\nhIconSm: %i\r\n"), + wclw.cbSize, //UINT cbSize; + wclw.style, //UINT style; + wclw.lpfnWndProc, //WNDPROC lpfnWndProc; + wclw.cbClsExtra, //int cbClsExtra; + wclw.cbWndExtra, //int cbWndExtra; + wclw.hInstance, //HINSTANCE hInstance; + wclw.hIcon, //HICON hIcon; + wclw.hCursor, //HCURSOR hCursor; + wclw.hbrBackground, //HBRUSH hbrBackground; + wclw.lpszMenuName, //LPCWSTR lpszMenuName; + wclw.lpszClassName, //LPCWSTR lpszClassName; + wclw.hIconSm //HICON hIconSm; + ); + + MSGERROR(msg); } ZeroMemory(&wcl, sizeof(wcl)); @@ -207,15 +203,13 @@ void PopupWnd2::create() (LPVOID)this); // Shadows - if (IsWinVerXPPlus()) { - ULONG_PTR style = GetClassLongPtr(m_hwnd, GCL_STYLE); - if (m_options->DropShadow && !(style & CS_DROPSHADOW)) - style |= CS_DROPSHADOW; - else if (!m_options->DropShadow && (style & CS_DROPSHADOW)) - style &= ~CS_DROPSHADOW; - - SetClassLongPtr(m_hwnd, GCL_STYLE, style); - } + ULONG_PTR style = GetClassLongPtr(m_hwnd, GCL_STYLE); + if (m_options->DropShadow && !(style & CS_DROPSHADOW)) + style |= CS_DROPSHADOW; + else if (!m_options->DropShadow && (style & CS_DROPSHADOW)) + style &= ~CS_DROPSHADOW; + + SetClassLongPtr(m_hwnd, GCL_STYLE, style); // tooltips m_hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, -- cgit v1.2.3