summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-12 18:03:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-12 18:03:10 +0000
commitd9013df6a880f0bd7459f952d654ff476e480a90 (patch)
treed6547c07cc04da79368c3a98003f365b83835c7a /plugins/TabSRMM
parent58ff50e5bf8dbb6b28d54370423232dc0221cd53 (diff)
custom buttons in TabSRMM removed and based on the standard MButtonClass
git-svn-id: http://svn.miranda-ng.org/main/trunk@5661 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/res/msgwindow.rc10
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp697
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp26
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp15
-rw-r--r--plugins/TabSRMM/src/commonheaders.h2
-rw-r--r--plugins/TabSRMM/src/container.cpp6
-rw-r--r--plugins/TabSRMM/src/controls.cpp8
-rw-r--r--plugins/TabSRMM/src/functions.h2
-rw-r--r--plugins/TabSRMM/src/generic_msghandlers.cpp2
-rw-r--r--plugins/TabSRMM/src/globals.cpp1
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp6
-rw-r--r--plugins/TabSRMM/src/infopanel.h2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp48
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp10
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp6
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp25
-rw-r--r--plugins/TabSRMM/src/sidebar.h2
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp10
-rw-r--r--plugins/TabSRMM/src/themes.cpp10
-rw-r--r--plugins/TabSRMM/src/themes.h28
20 files changed, 334 insertions, 582 deletions
diff --git a/plugins/TabSRMM/res/msgwindow.rc b/plugins/TabSRMM/res/msgwindow.rc
index 99da819627..1ff6fde1be 100644
--- a/plugins/TabSRMM/res/msgwindow.rc
+++ b/plugins/TabSRMM/res/msgwindow.rc
@@ -41,14 +41,14 @@ BEGIN
WS_EX_STATICEDGE
CONTROL "",IDC_CONTACTPIC,"Button",BS_OWNERDRAW,155,48,34,31
CONTROL "",IDC_MULTISPLITTER,"Static",SS_ENHMETAFILE,186,0,2,30
- CONTROL "",IDC_RETRY,"TSButtonClass",WS_TABSTOP,26,10,55,12,0x18000000L
- CONTROL "",IDC_CANCELSEND,"TSButtonClass", WS_TABSTOP, 86,10,55,12,0x18000000L
- CONTROL "",IDC_MSGSENDLATER,"TSButtonClass",WS_TABSTOP,146,10,55,12,0x18000000L
+ CONTROL "",IDC_RETRY,"MButtonClass",WS_TABSTOP,26,10,55,12,0x18000000L
+ CONTROL "",IDC_CANCELSEND,"MButtonClass", WS_TABSTOP, 86,10,55,12,0x18000000L
+ CONTROL "",IDC_MSGSENDLATER,"MButtonClass",WS_TABSTOP,146,10,55,12,0x18000000L
CONTROL "",IDC_STATICTEXT,"Static",SS_OWNERDRAW | WS_GROUP,27,0,160,9
CONTROL "",IDC_STATICERRORICON,"Static",SS_OWNERDRAW,4,3,20,20
CONTROL "",IDC_LOG,"RichEdit20A",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP,0,0,188,30,WS_EX_STATICEDGE
- CONTROL "",IDC_ADD,"TSButtonClass",WS_TABSTOP,155,64,16,14,0x18000000L
- CONTROL "",IDC_CANCELADD,"TSButtonClass",WS_TABSTOP,171,64,16,14,0x18000000L
+ CONTROL "",IDC_ADD,"MButtonClass",WS_TABSTOP,155,64,16,14,0x18000000L
+ CONTROL "",IDC_CANCELADD,"MButtonClass",WS_TABSTOP,171,64,16,14,0x18000000L
CONTROL "",IDC_LOGFROZENTEXT,"Static",SS_OWNERDRAW | WS_GROUP,10,3,188,18
CONTROL "",IDC_PANELSPLITTER,"Static",SS_ENHMETAFILE,0,32,188,1,WS_EX_TRANSPARENT
END
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index da368c2fd7..22b4da3127 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -39,9 +39,6 @@
static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// External theme methods and properties
-
-static CRITICAL_SECTION csTips;
-static HWND hwndToolTips = NULL;
static BLENDFUNCTION bf_buttonglyph;
static HDC hdc_buttonglyph = 0;
static HBITMAP hbm_buttonglyph, hbm_buttonglyph_old;
@@ -50,60 +47,6 @@ static HBITMAP hbm_buttonglyph, hbm_buttonglyph_old;
#define BUTTON_POLLID 100
#define BUTTON_POLLDELAY 50
-#define MGPROC(x) GetProcAddress(themeAPIHandle,x)
-
-int TSAPI UnloadTSButtonModule()
-{
- DeleteCriticalSection(&csTips);
- if (hdc_buttonglyph) {
- SelectObject(hdc_buttonglyph, hbm_buttonglyph_old);
- DeleteObject(hbm_buttonglyph);
- DeleteDC(hdc_buttonglyph);
- }
- return 0;
-}
-
-int TSAPI LoadTSButtonModule(void)
-{
- WNDCLASSEX wc;
-
- ZeroMemory(&wc, sizeof(wc));
- wc.cbSize = sizeof(wc);
- wc.lpszClassName = _T("TSButtonClass");
- wc.lpfnWndProc = TSButtonWndProc;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.cbWndExtra = sizeof(MButtonCtrl*);
- wc.hbrBackground = 0;
- wc.style = CS_GLOBALCLASS | CS_PARENTDC;
- RegisterClassEx(&wc);
- InitializeCriticalSection(&csTips);
- return 0;
-}
-
-static void TSAPI DestroyTheme(MButtonCtrl *ctl)
-{
- if (M.isVSAPIState()) {
- if (ctl->hThemeButton) {
- CMimAPI::m_pfnCloseThemeData(ctl->hThemeButton);
- ctl->hThemeButton = NULL;
- }
- if (ctl->hThemeToolbar) {
- CMimAPI::m_pfnCloseThemeData(ctl->hThemeToolbar);
- ctl->hThemeToolbar = NULL;
- }
- }
-}
-
-static void TSAPI LoadTheme(MButtonCtrl *ctl)
-{
- if (M.isVSAPIState()) {
- DestroyTheme(ctl);
- ctl->hThemeButton = CMimAPI::m_pfnOpenThemeData(ctl->hwnd, L"BUTTON");
- ctl->hThemeToolbar = (M.isAero() || IsWinVerVistaPlus()) ? CMimAPI::m_pfnOpenThemeData(ctl->hwnd, L"MENU") : CMimAPI::m_pfnOpenThemeData(ctl->hwnd, L"TOOLBAR");
- ctl->bThemed = TRUE;
- }
-}
-
int TSAPI TBStateConvert2Flat(int state)
{
switch (state) {
@@ -121,6 +64,22 @@ int TSAPI TBStateConvert2Flat(int state)
return TS_NORMAL;
}
+int TSAPI RBStateConvert2Flat(int state)
+{
+ switch (state) {
+ case PBS_NORMAL:
+ return 1;
+ case PBS_HOT:
+ return 2;
+ case PBS_PRESSED:
+ return 3;
+ case PBS_DISABLED:
+ return 1;
+ case PBS_DEFAULTED:
+ return 1;
+ }
+ return 1;
+}
/**
* convert button state (hot, pressed, normal) to REBAR part state ids
@@ -129,24 +88,8 @@ int TSAPI TBStateConvert2Flat(int state)
*
* @return int: state item id
*/
-int TSAPI RBStateConvert2Flat(int state)
-{
- switch (state) {
- case PBS_NORMAL:
- return 1;
- case PBS_HOT:
- return 2;
- case PBS_PRESSED:
- return 3;
- case PBS_DISABLED:
- return 1;
- case PBS_DEFAULTED:
- return 1;
- }
- return 1;
-}
-static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
+static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint)
{
if (hdc_buttonglyph == 0) {
hdc_buttonglyph = CreateCompatibleDC(hdcPaint);
@@ -157,113 +100,78 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
bf_buttonglyph.BlendOp = AC_SRC_OVER;
bf_buttonglyph.AlphaFormat = 0;
}
- if (hdcPaint) {
- HDC hdcMem;
- HBITMAP hbmMem, hOld;
- RECT rcClient;
- RECT rcContent;
- bool fAero = M.isAero();
- bool fVSThemed = (!CSkin::m_skinEnabled && M.isVSThemed());
- HANDLE hbp = 0;
-
- TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
- GetClientRect(ctl->hwnd, const_cast<RECT *>(&rcClient));
- CopyRect(&rcContent, &rcClient);
-
- if (CMimAPI::m_haveBufferedPaint)
- hbp = CMimAPI::m_pfnBeginBufferedPaint(hdcPaint, &rcContent, BPBF_TOPDOWNDIB, NULL, &hdcMem);
- else {
- hdcMem = CreateCompatibleDC(hdcPaint);
- hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
- hOld = (HBITMAP)SelectObject(hdcMem, hbmMem);
- }
+
+ if (hdcPaint == NULL)
+ return;
+
+ HDC hdcMem;
+ HBITMAP hbmMem, hOld;
+ HANDLE hbp = 0;
+ bool bAero = M.isAero();
+
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA);
+
+ RECT rcClient, rcContent;
+ GetClientRect(ctl->hwnd, const_cast<RECT *>(&rcClient));
+ CopyRect(&rcContent, &rcClient);
+
+ if (CMimAPI::m_haveBufferedPaint)
+ hbp = CMimAPI::m_pfnBeginBufferedPaint(hdcPaint, &rcContent, BPBF_TOPDOWNDIB, NULL, &hdcMem);
+ else {
+ hdcMem = CreateCompatibleDC(hdcPaint);
+ hbmMem = CreateCompatibleBitmap(hdcPaint, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top);
+ hOld = (HBITMAP)SelectObject(hdcMem, hbmMem);
+ }
- CSkin::FillBack(hdcMem, &rcContent);
+ CSkin::FillBack(hdcMem, &rcContent);
- if (ctl->pushBtn && ctl->pbState)
- ctl->stateId = PBS_PRESSED;
+ if (ctl->bIsPushBtn && ctl->bIsPushed)
+ ctl->stateId = PBS_PRESSED;
- if (ctl->flatBtn) {
- if (ctl->pContainer && CSkin::m_skinEnabled) {
- CSkinItem *item, *realItem = 0;
- if (ctl->bTitleButton)
- item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)];
- else {
- item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
- realItem = item;
- }
- CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcContent, hdcMem);
- if (!item->IGNORED) {
- RECT rc1 = rcClient;
- rc1.left += item->MARGIN_LEFT;
- rc1.right -= item->MARGIN_RIGHT;
- rc1.top += item->MARGIN_TOP;
- rc1.bottom -= item->MARGIN_BOTTOM;
- CSkin::DrawItem(hdcMem, &rc1, item);
- } else
- goto flat_themed;
- } else {
+ if (ctl->bIsFlat) {
+ if (ctl->pContainer && CSkin::m_skinEnabled) {
+ CSkinItem *item, *realItem = 0;
+ if (ctl->bTitleButton)
+ item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)];
+ else {
+ item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
+ realItem = item;
+ }
+ CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcContent, hdcMem);
+ if (!item->IGNORED) {
+ RECT rc1 = rcClient;
+ rc1.left += item->MARGIN_LEFT;
+ rc1.right -= item->MARGIN_RIGHT;
+ rc1.top += item->MARGIN_TOP;
+ rc1.bottom -= item->MARGIN_BOTTOM;
+ CSkin::DrawItem(hdcMem, &rc1, item);
+ }
+ else goto flat_themed;
+ }
+ else {
flat_themed:
- int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
-
- if (ctl->bToolbarButton) {
- if (dat) {
- RECT rcWin;
- GetWindowRect(ctl->hwnd, &rcWin);
- POINT pt;
- pt.x = rcWin.left;
- ScreenToClient(dat->hwnd, &pt);
- BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
- }
- }
- if (ctl->hThemeToolbar && ctl->bThemed && 1 == dat->pContainer->bTBRenderingMode) {
- if (fAero || PluginConfig.m_WinVerMajor >= 6)
- CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, 8, RBStateConvert2Flat(state), &rcClient, &rcClient);
- else
- CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rcClient, &rcClient);
- } else {
- CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, state == PBS_HOT ? 220 : 180);
- if (state == PBS_HOT || state == PBS_PRESSED) {
- if (state == PBS_PRESSED) {
- RECT rc = rcClient;
- InflateRect(&rc, -1, -1);
- HBRUSH bBack = CreateSolidBrush(PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow : GetSysColor(COLOR_3DDKSHADOW));
- FillRect(hdcMem, &rc, bBack);
- DeleteObject(bBack);
- }
- CSkin::m_switchBarItem->Render(hdcMem, &rcClient, true);
- }
+ int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
+
+ if (ctl->bToolbarButton) {
+ if (dat) {
+ RECT rcWin;
+ GetWindowRect(ctl->hwnd, &rcWin);
+ POINT pt;
+ pt.x = rcWin.left;
+ ScreenToClient(dat->hwnd, &pt);
+ BitBlt(hdcMem, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ dat->pContainer->cachedToolbarDC, pt.x, 1, SRCCOPY);
}
}
- } else {
- if (ctl->pContainer && CSkin::m_skinEnabled) {
- CSkinItem *item, *realItem = 0;
- if (ctl->bTitleButton)
- item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)];
- else {
- item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
- realItem = item;
- }
- CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcClient, hdcMem);
- if (!item->IGNORED) {
- RECT rc1 = rcClient;
- rc1.left += item->MARGIN_LEFT;
- rc1.right -= item->MARGIN_RIGHT;
- rc1.top += item->MARGIN_TOP;
- rc1.bottom -= item->MARGIN_BOTTOM;
- CSkin::DrawItem(hdcMem, &rc1, item);
- } else
- goto nonflat_themed;
- } else {
-nonflat_themed:
- int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->defbutton ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
-
- if (ctl->hThemeButton && ctl->bThemed && 0 == PluginConfig.m_fillColor) {
- CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient);
- CMimAPI::m_pfnGetThemeBackgroundContentRect(ctl->hThemeToolbar, hdcMem, BP_PUSHBUTTON, PBS_NORMAL, &rcClient, &rcContent);
- } else {
- CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, state == PBS_NORMAL ? 140 : 240);
+ if (ctl->hThemeToolbar && ctl->bIsThemed && 1 == dat->pContainer->bTBRenderingMode) {
+ if (bAero || PluginConfig.m_WinVerMajor >= 6)
+ CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, 8, RBStateConvert2Flat(state), &rcClient, &rcClient);
+ else
+ CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rcClient, &rcClient);
+ }
+ else {
+ CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, state == PBS_HOT ? 220 : 180);
+ if (state == PBS_HOT || state == PBS_PRESSED) {
if (state == PBS_PRESSED) {
RECT rc = rcClient;
InflateRect(&rc, -1, -1);
@@ -273,199 +181,151 @@ nonflat_themed:
}
CSkin::m_switchBarItem->Render(hdcMem, &rcClient, true);
}
-
- // Draw focus rectangle if button has focus
- if (ctl->focus) {
- RECT focusRect = rcClient;
- InflateRect(&focusRect, -3, -3);
- DrawFocusRect(hdcMem, &focusRect);
- }
}
}
-
- /*
- * render content
- */
- if (ctl->arrow) {
- rcContent.top += 2;
- rcContent.bottom -= 2;
- rcContent.left = rcClient.right - 12;
- rcContent.right = rcContent.left;
-
- DrawIconEx(hdcMem, rcClient.right - 15, (rcClient.bottom - rcClient.top) / 2 - (PluginConfig.m_smcyicon / 2),
- PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, 0, DI_NORMAL);
+ }
+ else {
+ if (ctl->pContainer && CSkin::m_skinEnabled) {
+ CSkinItem *item, *realItem = 0;
+ if (ctl->bTitleButton)
+ item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)];
+ else {
+ item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)];
+ realItem = item;
+ }
+ CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcClient, hdcMem);
+ if (!item->IGNORED) {
+ RECT rc1 = rcClient;
+ rc1.left += item->MARGIN_LEFT;
+ rc1.right -= item->MARGIN_RIGHT;
+ rc1.top += item->MARGIN_TOP;
+ rc1.bottom -= item->MARGIN_BOTTOM;
+ CSkin::DrawItem(hdcMem, &rc1, item);
+ } else
+ goto nonflat_themed;
}
+ else {
+nonflat_themed:
+ int state = IsWindowEnabled(ctl->hwnd) ? (ctl->stateId == PBS_NORMAL && ctl->bIsDefault ? PBS_DEFAULTED : ctl->stateId) : PBS_DISABLED;
- if (ctl->hIcon || ctl->hIconPrivate) {
- int ix = (rcClient.right - rcClient.left) / 2 - 8;
- int iy = (rcClient.bottom - rcClient.top) / 2 - 8;
- HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon;
-
- if (ctl->stateId == PBS_PRESSED) {
- ix++;
- iy++;
+ if (ctl->hThemeButton && ctl->bIsThemed && 0 == PluginConfig.m_fillColor) {
+ CMimAPI::m_pfnDrawThemeBackground(ctl->hThemeButton, hdcMem, BP_PUSHBUTTON, state, &rcClient, &rcClient);
+ CMimAPI::m_pfnGetThemeBackgroundContentRect(ctl->hThemeToolbar, hdcMem, BP_PUSHBUTTON, PBS_NORMAL, &rcClient, &rcContent);
}
-
- if (ctl->arrow)
- ix -= 4;
-
- if (ctl->dimmed && PluginConfig.m_IdleDetect)
- CSkin::DrawDimmedIcon(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hIconNew, 180);
else {
- if (ctl->stateId != PBS_DISABLED || CMimAPI::m_MyAlphaBlend == 0) {
- DrawIconEx(hdcMem, ix, iy, hIconNew, 16, 16, 0, 0, DI_NORMAL);
- if (ctl->overlay)
- DrawIconEx(hdcMem, ix, iy, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
+ CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, state == PBS_NORMAL ? 140 : 240);
+ if (state == PBS_PRESSED) {
+ RECT rc = rcClient;
+ InflateRect(&rc, -1, -1);
+ HBRUSH bBack = CreateSolidBrush(PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow : GetSysColor(COLOR_3DDKSHADOW));
+ FillRect(hdcMem, &rc, bBack);
+ DeleteObject(bBack);
}
- else {
- BitBlt(hdc_buttonglyph, 0, 0, 16, 16, hdcMem, ix, iy, SRCCOPY);
- DrawIconEx(hdc_buttonglyph, 0, 0, hIconNew, 16, 16, 0, 0, DI_NORMAL);
- if (ctl->overlay)
- DrawIconEx(hdc_buttonglyph, 0, 0, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
- CMimAPI::m_MyAlphaBlend(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hdc_buttonglyph, 0, 0, 16, 16, bf_buttonglyph);
- }
- }
- } else if (GetWindowTextLength(ctl->hwnd)) {
- // Draw the text and optinally the arrow
- TCHAR szText[MAX_PATH];
- SIZE sz;
- RECT rcText;
- HFONT hOldFont;
-
- CopyRect(&rcText, &rcClient);
- GetWindowText(ctl->hwnd, szText, MAX_PATH - 1);
- SetBkMode(hdcMem, TRANSPARENT);
- hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
- if (ctl->pContainer && CSkin::m_skinEnabled)
- SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) ? CSkin::m_DefaultFontColor : GetSysColor(COLOR_GRAYTEXT));
- else {
- if (PluginConfig.m_genericTxtColor)
- SetTextColor(hdcMem, PluginConfig.m_genericTxtColor);
- else
- SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT));
+ CSkin::m_switchBarItem->Render(hdcMem, &rcClient, true);
}
- GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
- if (ctl->cHot) {
- SIZE szHot;
- GetTextExtentPoint32A(hdcMem, "&", 1, &szHot);
- sz.cx -= szHot.cx;
+ // Draw focus rectangle if button has focus
+ if (ctl->focus) {
+ RECT focusRect = rcClient;
+ InflateRect(&focusRect, -3, -3);
+ DrawFocusRect(hdcMem, &focusRect);
}
- if (ctl->arrow)
- DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
- SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, lstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
- SelectObject(hdcMem, hOldFont);
- }
- if (hbp)
- CMimAPI::m_pfnEndBufferedPaint(hbp, TRUE);
- else {
- BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY);
- SelectObject(hdcMem, hOld);
- DeleteObject(hbmMem);
- DeleteDC(hdcMem);
}
+ }
+ /*
+ * render content
+ */
+ if (ctl->arrow) {
+ rcContent.top += 2;
+ rcContent.bottom -= 2;
+ rcContent.left = rcClient.right - 12;
+ rcContent.right = rcContent.left;
+
+ DrawIconEx(hdcMem, rcClient.right - 15, (rcClient.bottom - rcClient.top) / 2 - (PluginConfig.m_smcyicon / 2),
+ PluginConfig.g_buttonBarIcons[ICON_DEFAULT_PULLDOWN], 16, 16, 0, 0, DI_NORMAL);
}
-}
-static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- MButtonCtrl* bct = (MButtonCtrl*)GetWindowLongPtr(hwndDlg, 0);
- switch (msg) {
- case WM_NCCREATE:
- SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW);
- bct = (MButtonCtrl*)mir_alloc(sizeof(MButtonCtrl));
- if (bct == NULL)
- return FALSE;
- {
- char *p = (char*)bct ;
- _DebugTraceA("MButtonCtrl allocated: crashes at %lp", p + offsetof(MButtonCtrl, cHot));
- }
- ZeroMemory(bct, sizeof(MButtonCtrl));
- bct->hwnd = hwndDlg;
- bct->stateId = PBS_NORMAL;
- bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
- LoadTheme(bct);
- SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)bct);
- if (((CREATESTRUCT *)lParam)->lpszName)
- SetWindowText(hwndDlg, ((CREATESTRUCT *)lParam)->lpszName);
- return TRUE;
+ if (ctl->hIcon || ctl->hIconPrivate) {
+ int ix = (rcClient.right - rcClient.left) / 2 - 8;
+ int iy = (rcClient.bottom - rcClient.top) / 2 - 8;
+ HICON hIconNew = ctl->hIconPrivate != 0 ? ctl->hIconPrivate : ctl->hIcon;
- case WM_DESTROY:
- if (bct) {
- mir_cslock lck(csTips);
- if (hwndToolTips) {
- TOOLINFO ti = { sizeof(ti) };
- ti.uFlags = TTF_IDISHWND;
- ti.hwnd = bct->hwnd;
- ti.uId = (UINT_PTR)bct->hwnd;
- if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti))
- SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
-
- if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) {
- DestroyWindow(hwndToolTips);
- hwndToolTips = NULL;
- }
- }
- if (bct->hIconPrivate)
- DestroyIcon(bct->hIconPrivate);
- DestroyTheme(bct);
+ if (ctl->stateId == PBS_PRESSED) {
+ ix++;
+ iy++;
}
- break; // DONT! fall thru
- case WM_NCDESTROY:
- mir_free(bct);
- SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)NULL);
- break;
+ if (ctl->arrow)
+ ix -= 4;
- case WM_SETTEXT:
- bct->cHot = 0;
- if ((TCHAR*)lParam) {
- TCHAR *tmp = (TCHAR*)lParam;
- while (*tmp) {
- if (*tmp == (TCHAR)'&' && *(tmp + 1)) {
- bct->cHot = _totlower(*(tmp + 1));
- break;
- }
- tmp++;
+ if (ctl->bDimmed && PluginConfig.m_IdleDetect)
+ CSkin::DrawDimmedIcon(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hIconNew, 180);
+ else {
+ if (ctl->stateId != PBS_DISABLED || CMimAPI::m_MyAlphaBlend == 0) {
+ DrawIconEx(hdcMem, ix, iy, hIconNew, 16, 16, 0, 0, DI_NORMAL);
+ if (ctl->overlay)
+ DrawIconEx(hdcMem, ix, iy, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
}
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- break;
-
- case WM_KEYUP:
- if (bct->stateId != PBS_DISABLED && wParam == VK_SPACE && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) {
- if (bct->pushBtn) {
- if (bct->pbState) bct->pbState = 0;
- else bct->pbState = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ else {
+ BitBlt(hdc_buttonglyph, 0, 0, 16, 16, hdcMem, ix, iy, SRCCOPY);
+ DrawIconEx(hdc_buttonglyph, 0, 0, hIconNew, 16, 16, 0, 0, DI_NORMAL);
+ if (ctl->overlay)
+ DrawIconEx(hdc_buttonglyph, 0, 0, ctl->overlay, 16, 16, 0, 0, DI_NORMAL);
+ CMimAPI::m_MyAlphaBlend(hdcMem, ix, iy, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hdc_buttonglyph, 0, 0, 16, 16, bf_buttonglyph);
}
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
- return 0;
}
- break;
+ }
+ else if (GetWindowTextLength(ctl->hwnd)) {
+ // Draw the text and optinally the arrow
+ RECT rcText;
+ CopyRect(&rcText, &rcClient);
+
+ TCHAR szText[MAX_PATH];
+ GetWindowText(ctl->hwnd, szText, MAX_PATH - 1);
+ SetBkMode(hdcMem, TRANSPARENT);
+ HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
+ if (ctl->pContainer && CSkin::m_skinEnabled)
+ SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) ? CSkin::m_DefaultFontColor : GetSysColor(COLOR_GRAYTEXT));
+ else {
+ if (PluginConfig.m_genericTxtColor)
+ SetTextColor(hdcMem, PluginConfig.m_genericTxtColor);
+ else
+ SetTextColor(hdcMem, IsWindowEnabled(ctl->hwnd) || !ctl->hThemeButton ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_GRAYTEXT));
+ }
- case WM_SYSKEYUP:
- if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) {
- if (bct->pushBtn) {
- if (bct->pbState) bct->pbState = 0;
- else bct->pbState = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
- return 0;
+ SIZE sz;
+ GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
+ if (ctl->cHot) {
+ SIZE szHot;
+ GetTextExtentPoint32A(hdcMem, "&", 1, &szHot);
+ sz.cx -= szHot.cx;
}
- break;
+ if (ctl->arrow)
+ DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
+ SelectObject(hdcMem, ctl->hFont);
+ DrawState(hdcMem, NULL, NULL, (LPARAM)szText, lstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
+ SelectObject(hdcMem, hOldFont);
+ }
- case WM_THEMECHANGED: // themed changed, reload theme object
- if (bct->bThemed)
- LoadTheme(bct);
- InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it
- break;
+ if (hbp)
+ CMimAPI::m_pfnEndBufferedPaint(hbp, TRUE);
+ else {
+ BitBlt(hdcPaint, 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, hdcMem, 0, 0, SRCCOPY);
+ SelectObject(hdcMem, hOld);
+ DeleteObject(hbmMem);
+ DeleteDC(hdcMem);
+ }
+}
- case WM_SETFONT: // remember the font so we can use it later
- bct->hFont = (HFONT)wParam; // maybe we should redraw?
+static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ TSButtonCtrl *bct = (TSButtonCtrl*)GetWindowLongPtr(hwndDlg, 0);
+ switch (msg) {
+ case WM_DESTROY:
+ if (bct)
+ if (bct->hIconPrivate)
+ DestroyIcon(bct->hIconPrivate);
break;
case WM_NCPAINT:
@@ -496,14 +356,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
BITMAP bm;
GetObject(ii.hbmColor, sizeof(bm), &bm);
if (bm.bmWidth != PluginConfig.m_smcxicon || bm.bmHeight != PluginConfig.m_smcyicon) {
- HIMAGELIST hImageList;
- hImageList = ImageList_Create(PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.m_bIsXP ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);
+ HIMAGELIST hImageList = ImageList_Create(PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.m_bIsXP ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0);
ImageList_AddIcon(hImageList, (HICON)lParam);
bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL);
ImageList_RemoveAll(hImageList);
ImageList_Destroy(hImageList);
bct->hIcon = 0;
- } else {
+ }
+ else {
bct->hIcon = (HICON)lParam;
bct->hIconPrivate = 0;
}
@@ -520,53 +380,15 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
bct->hIcon = bct->hIconPrivate = NULL;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
- break;
-
- case BM_SETCHECK:
- if (!bct->pushBtn) break;
- if (wParam == BST_CHECKED) {
- bct->pbState = 1;
- bct->stateId = PBS_PRESSED;
- }
- else if (wParam == BST_UNCHECKED) {
- bct->pbState = 0;
- bct->stateId = PBS_NORMAL;
- }
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case BM_GETCHECK:
- if (bct->pushBtn)
- return bct->pbState ? BST_CHECKED : BST_UNCHECKED;
-
return 0;
case BUTTONSETARROW: // turn arrow on/off
bct->arrow = (HICON)wParam;
InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case BUTTONSETDEFAULT:
- bct->defbutton = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case BUTTONSETASPUSHBTN:
- bct->pushBtn = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case BUTTONSETASFLATBTN:
- bct->flatBtn = (wParam != 0);
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case BUTTONSETASTHEMEDBTN:
- bct->bThemed = (wParam != 0);
- break;
+ return 0;
case BUTTONSETASDIMMED:
- bct->dimmed = (wParam != 0);
+ bct->bDimmed = (wParam != 0);
break;
case BUTTONSETCONTAINER:
@@ -586,7 +408,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
return bct->stateId;
case BUTTONSETASTOOLBARBUTTON:
- bct->bToolbarButton = wParam;
+ bct->bToolbarButton = (wParam != 0);
break;
case BUTTONSETASSIDEBARBUTTON:
@@ -597,49 +419,6 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
bct->overlay = (HICON)wParam;
break;
- case BUTTONADDTOOLTIP:
- if (wParam) {
- mir_cslock lck(csTips);
- if (!hwndToolTips)
- hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL);
-
- TOOLINFO ti = { sizeof(ti) };
- ti.uFlags = TTF_IDISHWND;
- ti.hwnd = bct->hwnd;
- ti.uId = (UINT_PTR)bct->hwnd;
- if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti))
- SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti);
-
- ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
- ti.uId = (UINT_PTR)bct->hwnd;
- ti.lpszText = (TCHAR*)wParam;
- SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti);
- SendMessage(hwndToolTips, TTM_SETMAXTIPWIDTH, 0, 300);
- }
- break;
-
- case WM_SETFOCUS: // set keybord focus and redraw
- bct->focus = 1;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case WM_KILLFOCUS: // kill focus and redraw
- bct->focus = 0;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case WM_ENABLE: // windows tells us to enable/disable
- bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- break;
-
- case WM_MOUSELEAVE: // faked by the WM_TIMER
- if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
- bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- break;
-
case WM_CONTEXTMENU:
if (bct->sitem)
bct->sitem->invokeContextMenu();
@@ -672,49 +451,23 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
}
InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- else if (bct->stateId != PBS_DISABLED) {
- bct->stateId = PBS_PRESSED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
+ return 0;
}
break;
- case WM_LBUTTONUP: {
- int showClick = 0;
-
+ case WM_LBUTTONUP:
if (bct->sitem) {
if (bct->sitem->testCloseButton() != -1) {
SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0);
return TRUE;
}
}
- if (bct->pushBtn) {
- if (bct->pbState) bct->pbState = 0;
- else bct->pbState = 1;
- }
- if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
- if (bct->stateId == PBS_PRESSED)
- showClick = 1;
- if (msg == WM_LBUTTONUP)
- bct->stateId = PBS_HOT;
- else
- bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- if (showClick)
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
break;
- }
+
case WM_MOUSEMOVE:
- if (bct->stateId == PBS_NORMAL) {
- bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- else if (bct->arrow && bct->stateId == PBS_HOT)
+ if (bct->arrow && bct->stateId == PBS_HOT)
InvalidateRect(bct->hwnd, NULL, TRUE);
- // Call timer, used to start cheesy TrackMouseEvent faker
- SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL);
if (bct->sitem) {
if (bct->sitem->testCloseButton() != -1) {
if (bct->sitem->m_sideBar->getHoveredClose() != bct->sitem) {
@@ -728,6 +481,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
}
break;
+
case WM_TIMER: // use a timer to check if they have did a mouseout
if (wParam == BUTTON_POLLID) {
RECT rc;
@@ -743,10 +497,25 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam,
}
}
}
- break;
+ return 0;
+ }
- case WM_ERASEBKGND:
- return 1;
+ return mir_callNextSubclass(hwndDlg, TSButtonWndProc, msg, wParam, lParam);
+}
+
+int TSAPI UnloadTSButtonModule()
+{
+ if (hdc_buttonglyph) {
+ SelectObject(hdc_buttonglyph, hbm_buttonglyph_old);
+ DeleteObject(hbm_buttonglyph);
+ DeleteDC(hdc_buttonglyph);
}
- return DefWindowProc(hwndDlg, msg, wParam, lParam);
+ return 0;
+}
+
+void CustomizeButton(HWND hwndButton)
+{
+ SendMessage(hwndButton, BUTTONSETCUSTOMPAINT, sizeof(TSButtonCtrl), 0);
+
+ mir_subclassWindow(hwndButton, TSButtonWndProc);
}
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index 0e878bcb93..afac6207cb 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -210,7 +210,7 @@ void CB_ChangeButton(HWND hwndDlg, TWindowData *dat, CustomButtonData* cbd)
if (cbd->hIcon)
SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
if (cbd->ptszTooltip)
- SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), 0);
+ SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), BATF_TCHAR);
SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
}
}
@@ -384,12 +384,8 @@ static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam)
hwndDlg = M.FindWindow((HANDLE)wParam);
if (hwndDlg && realbutton && bbdi->hIcon)
SendMessage(GetDlgItem(hwndDlg, tempCID), BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(bbdi->hIcon));
- if (hwndDlg && realbutton && bbdi->pszTooltip) {
- if (bbdi->bbbFlags&BBBF_ANSITOOLTIP)
- SendMessage(GetDlgItem(hwndDlg, tempCID), BUTTONADDTOOLTIP, (WPARAM)mir_a2u(bbdi->pszTooltip), 0);
- else
- SendMessage(GetDlgItem(hwndDlg, tempCID), BUTTONADDTOOLTIP, (WPARAM)bbdi->ptszTooltip, 0);
- }
+ if (hwndDlg && realbutton && bbdi->pszTooltip)
+ SendMessage(GetDlgItem(hwndDlg, tempCID), BUTTONADDTOOLTIP, (WPARAM)bbdi->ptszTooltip, (bbdi->bbbFlags & BBBF_ANSITOOLTIP) ? 0 : BATF_TCHAR);
if (hwndDlg && realbutton && bbdi->bbbFlags) {
Utils::showDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_HIDDEN) ? SW_HIDE : SW_SHOW);
Utils::enableDlgControl(hwndDlg, tempCID, (bbdi->bbbFlags&BBSF_DISABLED) ? 0 : 1);
@@ -561,15 +557,17 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
rwidth += cbd->iButtonWidth + gap;
if (!cbd->bHidden && !cbd->bCanBeHidden)
dat->iButtonBarReallyNeeds += cbd->iButtonWidth + gap;
- if (!cbd->bDummy && !GetDlgItem(hdlg, cbd->dwButtonCID))
- hwndBtn = CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, rect.right - rwidth + gap, splitterY, cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU) cbd->dwButtonCID, g_hInst, NULL);
+ if (!cbd->bDummy && !GetDlgItem(hdlg, cbd->dwButtonCID)) {
+ hwndBtn = CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, rect.right - rwidth + gap, splitterY, cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU) cbd->dwButtonCID, g_hInst, NULL);
+ CustomizeButton(hwndBtn);
+ }
if (!cbd->bDummy && hwndBtn) {
SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0);
SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, isThemed != 0, 0);
if (cbd->hIcon)
SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
if (cbd->ptszTooltip)
- SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), 0);
+ SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), BATF_TCHAR);
SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
@@ -594,9 +592,11 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
CustomButtonData* cbd = (CustomButtonData *)LButtonsList->items[i];
if (((dat->bType == SESSIONTYPE_IM && cbd->bIMButton)
|| (dat->bType == SESSIONTYPE_CHAT && cbd->bChatButton))) {
- if (!cbd->bDummy && !GetDlgItem(hdlg, cbd->dwButtonCID))
- hwndBtn = CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2 + lwidth, splitterY,
+ if (!cbd->bDummy && !GetDlgItem(hdlg, cbd->dwButtonCID)) {
+ hwndBtn = CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 2 + lwidth, splitterY,
cbd->iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU) cbd->dwButtonCID, g_hInst, NULL);
+ CustomizeButton(hwndBtn);
+ }
if (!cbd->bHidden)
lwidth += cbd->iButtonWidth + gap;
if (!cbd->bHidden && !cbd->bCanBeHidden)
@@ -607,7 +607,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat)
if (cbd->hIcon)
SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)Skin_GetIconByHandle(cbd->hIcon));
if (cbd->ptszTooltip)
- SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), 0);
+ SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(cbd->ptszTooltip), BATF_TCHAR);
SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 6e8359f036..0627872d04 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1953,8 +1953,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
DM_ThemeChanged(dat);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_HIDESELECTION, TRUE, 0);
- CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL);
+ CustomizeButton( CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
+ hwndDlg, (HMENU)IDC_CHAT_TOGGLESIDEBAR, g_hInst, NULL));
GetMYUIN(dat);
GetMyNick(dat);
@@ -1962,7 +1962,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASFLATBTN, FALSE, 0);
SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONSETASTOOLBARBUTTON, TRUE, 0);
- SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), 1);
+ SendDlgItemMessage(hwndDlg, IDC_CHAT_TOGGLESIDEBAR, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Expand or collapse the side bar"), BATF_TCHAR);
dat->hwndIEView = dat->hwndHPP = 0;
@@ -3215,10 +3215,9 @@ LABEL_SHOWWINDOW:
{
HDC hdc = (HDC)wParam;
RECT rcClient, rcWindow, rc;
- CSkinItem *item;
UINT item_ids[3] = {ID_EXTBKUSERLIST, ID_EXTBKHISTORY, ID_EXTBKINPUTAREA};
UINT ctl_ids[3] = {IDC_LIST, IDC_CHAT_LOG, IDC_CHAT_MESSAGE};
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
bool bInfoPanel = dat->Panel->isActive();
HANDLE hbp = 0;
HDC hdcMem = 0;
@@ -3236,10 +3235,10 @@ LABEL_SHOWWINDOW:
hbmOld = (HBITMAP)SelectObject(hdcMem, hbm);
}
- if (CSkin::m_skinEnabled && !fAero) {
+ if (CSkin::m_skinEnabled && !bAero) {
CSkin::SkinDrawBG(hwndDlg, dat->pContainer->hwnd, dat->pContainer, &rcClient, hdcMem);
for (int i=0; i < 3; i++) {
- item = &SkinItems[item_ids[i]];
+ CSkinItem *item = &SkinItems[item_ids[i]];
if (!item->IGNORED) {
GetWindowRect(GetDlgItem(hwndDlg, ctl_ids[i]), &rcWindow);
pt.x = rcWindow.left;
@@ -3265,7 +3264,7 @@ LABEL_SHOWWINDOW:
}
GetClientRect(hwndDlg, &rc);
- dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], fAero);
+ dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
dat->Panel->renderContent(hdcMem);
if (!CSkin::m_skinEnabled)
diff --git a/plugins/TabSRMM/src/commonheaders.h b/plugins/TabSRMM/src/commonheaders.h
index 25c138b382..a28e98eb6d 100644
--- a/plugins/TabSRMM/src/commonheaders.h
+++ b/plugins/TabSRMM/src/commonheaders.h
@@ -65,7 +65,7 @@
#include <m_imgsrvc.h>
#include <m_database.h>
#include <m_langpack.h>
-#include <m_button.h>
+#include <m_button_int.h>
#include <m_protosvc.h>
#include <m_skin.h>
#include <m_contacts.h>
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index e5e009636f..f2bdb639d3 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -572,7 +572,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
int i=0;
ButtonItem *pbItem;
HWND hwndButton = 0;
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
BOOL isFlat = M.GetByte("tbflat", 1);
BOOL isThemed = !M.GetByte("nlflat", 0);
@@ -1630,7 +1630,7 @@ panel_found:
HANDLE hContact = 0;
int i=0;
UINT sBarHeight;
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
ws = wsold = GetWindowLongPtr(hwndDlg, GWL_STYLE);
if (!CSkin::m_frameSkins) {
@@ -1654,7 +1654,7 @@ panel_found:
ex = exold = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE);
ex = (pContainer->dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? ex | WS_EX_LAYERED : ex & ~(WS_EX_LAYERED);
- //if (fAero && !pContainer->bSkinned && IsWinVerVistaPlus())
+ //if (bAero && !pContainer->bSkinned && IsWinVerVistaPlus())
// ex = ex | (WS_EX_COMPOSITED);//|WS_EX_LAYERED); // | WS_EX_COMPOSITED); // faster/smoother redrawing on Vista+, especially with skins
SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ex);
diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp
index 9a017aab4b..bce477db36 100644
--- a/plugins/TabSRMM/src/controls.cpp
+++ b/plugins/TabSRMM/src/controls.cpp
@@ -769,8 +769,8 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
CSkinItem * item = &SkinItems[ID_EXTBKSTATUSBARPANEL];
COLORREF clr = 0;
- BOOL fAero = M.isAero();
- HANDLE hTheme = fAero ? CMimAPI::m_pfnOpenThemeData(hWnd, L"ButtonStyle") : 0;
+ BOOL bAero = M.isAero();
+ HANDLE hTheme = bAero ? CMimAPI::m_pfnOpenThemeData(hWnd, L"ButtonStyle") : 0;
TWindowData *dat = 0;
if (pContainer)
@@ -794,7 +794,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
if (pContainer && CSkin::m_skinEnabled)
CSkin::SkinDrawBG(hWnd, GetParent(hWnd), pContainer, &rcClient, hdcMem);
- else if (fAero) {
+ else if (bAero) {
FillRect(hdcMem, &rcClient, CSkin::m_BrushBack);
CSkin::ApplyAeroEffect(hdcMem, &rcClient, CSkin::AERO_EFFECT_AREA_STATUSBAR);
} else {
@@ -811,7 +811,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR
}
for (i=0; i < (int)nParts; i++) {
SendMessage(hWnd, SB_GETRECT, (WPARAM)i, (LPARAM)&itemRect);
- if (!item->IGNORED && !fAero && pContainer && CSkin::m_skinEnabled)
+ if (!item->IGNORED && !bAero && pContainer && CSkin::m_skinEnabled)
CSkin::DrawItem(hdcMem, &itemRect, item);
if (i == 0)
diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h
index be64f0916d..e0496eaaca 100644
--- a/plugins/TabSRMM/src/functions.h
+++ b/plugins/TabSRMM/src/functions.h
@@ -147,10 +147,8 @@ int TSAPI RegisterTabCtrlClass(void);
// buttons
-int TSAPI LoadTSButtonModule(void);
int TSAPI UnloadTSButtonModule();
-
/*
* debugging support
*/
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp
index 364fa2a8ed..0721957573 100644
--- a/plugins/TabSRMM/src/generic_msghandlers.cpp
+++ b/plugins/TabSRMM/src/generic_msghandlers.cpp
@@ -1829,7 +1829,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam)
TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for User's Details\nClick dropdown to change this contact's favorite status."),
bHasName ? dat->cache->getUIN() : TranslateT("No UID"));
- SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, /*bHasName ?*/ (WPARAM)fulluin /*: (WPARAM)_T("")*/, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_TCHAR);
}
}
else lstrcpyn(newtitle, pszNewTitleEnd, SIZEOF(newtitle));
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index acd02d5f53..ea756220c5 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -107,7 +107,6 @@ void CGlobals::reloadSystemStartup()
m_bIsVista = IsWinVerVistaPlus();
m_bIsWin7 = IsWinVer7Plus();
- ::LoadTSButtonModule();
::RegisterTabCtrlClass();
CTip::registerClass();
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 3f76944e22..6febbaf43b 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -277,16 +277,16 @@ HFONT CInfoPanel::setUnderlinedFont(const HDC hdc, HFONT hFontOrig)
* @param hdc HDC: target device context
* @param rc RECT&: target rectangle
* @param item CSkinItem *: The item to render in non-aero mode
- * @param fAero bool: aero active
+ * @param bAero bool: aero active
*/
-void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool fAero, bool fAutoCalc) const
+void CInfoPanel::renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, bool fAutoCalc) const
{
if (!m_active)
return;
if (fAutoCalc)
rc.bottom = m_height + 1;
- if (fAero) {
+ if (bAero) {
RECT rcBlack = rc;
rc.bottom -= 2;
::FillRect(hdc, &rc, CSkin::m_BrushBack);
diff --git a/plugins/TabSRMM/src/infopanel.h b/plugins/TabSRMM/src/infopanel.h
index d17a5220a2..5d31750e56 100644
--- a/plugins/TabSRMM/src/infopanel.h
+++ b/plugins/TabSRMM/src/infopanel.h
@@ -162,7 +162,7 @@ public:
void Configure() const;
void showHide() const;
bool getVisibility();
- void renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool fAero, bool fAutoCalc = true) const;
+ void renderBG(const HDC hdc, RECT& rc, CSkinItem *item, bool bAero, bool fAutoCalc = true) const;
void renderContent(const HDC hdcMem);
void Invalidate(BOOL fErase = FALSE) const;
void trackMouse(POINT& pt);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 07eacac903..2e35476b3b 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -34,13 +34,13 @@
#define MS_HTTPSERVER_ADDFILENAME "HTTPServer/AddFileName"
-const TCHAR* pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
+const TCHAR *pszIDCSAVE_close = 0, *pszIDCSAVE_save = 0;
-static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
-static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE,IDC_FONTSTRIKEOUT };
-static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
-
-static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
+static const UINT sendControls[] = { IDC_MESSAGE, IDC_LOG };
+static const UINT formatControls[] = { IDC_SMILEYBTN, IDC_FONTBOLD, IDC_FONTITALIC, IDC_FONTUNDERLINE, IDC_FONTFACE,IDC_FONTSTRIKEOUT };
+static const UINT addControls[] = { IDC_ADD, IDC_CANCELADD };
+static const UINT btnControls[] = { IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER, IDC_ADD, IDC_CANCELADD };
+static const UINT errorControls[] = { IDC_STATICERRORICON, IDC_STATICTEXT, IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
static struct {
int id;
@@ -457,11 +457,8 @@ void TSAPI ShowMultipleControls(HWND hwndDlg, const UINT *controls, int cControl
void TSAPI SetDialogToType(HWND hwndDlg)
{
- TWindowData *dat;
- int showToolbar = 0;
-
- dat = (TWindowData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
+ TWindowData *dat = (TWindowData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ int showToolbar = dat->pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1;
if (dat->hContact) {
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) {
@@ -1321,14 +1318,17 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (dat->hContact && dat->szProto != NULL) {
dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
mir_sntprintf(dat->szStatus, SIZEOF(dat->szStatus), _T("%s"), (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, dat->szProto == NULL ? ID_STATUS_OFFLINE : dat->wStatus, GSMDF_TCHAR));
- } else
- dat->wStatus = ID_STATUS_OFFLINE;
+ }
+ else dat->wStatus = ID_STATUS_OFFLINE;
+
+ for (i=0; i < SIZEOF(btnControls); i++)
+ CustomizeButton( GetDlgItem(hwndDlg, btnControls[i]));
GetMYUIN(dat);
GetClientIcon(dat);
- CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
- hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL);
+ CustomizeButton( CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20),
+ hwndDlg, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL));
dat->hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, _T("Static"), _T(""), SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, hwndDlg, (HMENU)6000, NULL, NULL);
mir_subclassWindow(dat->hwndPanelPicParent, CInfoPanel::avatarParentSubclass);
@@ -1370,16 +1370,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
// load log option flags...
dat->dwFlags = dat->pContainer->theme.dwFlags;
/*
- * consider per-contact message setting overrides
- */
+ * consider per-contact message setting overrides
+ */
if (M.GetDword(dat->hContact, "mwmask", 0))
if (dat->hContact)
LoadLocalFlags(hwndDlg, dat);
/*
- * allow disabling emoticons per contact (note: currently unused feature)
- */
+ * allow disabling emoticons per contact (note: currently unused feature)
+ */
dwLocalSmAdd = (int)M.GetByte(dat->hContact, "doSmileys", 0xff);
if (dwLocalSmAdd != 0xffffffff)
@@ -1433,13 +1433,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_OPENING, 0);
for (i=0; i < SIZEOF(tooltips); i++)
- SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(tooltips[i].text), 0);
+ SendDlgItemMessage(hwndDlg, tooltips[i].id, BUTTONADDTOOLTIP, (WPARAM)TranslateTS(tooltips[i].text), BATF_TCHAR);
SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, dat->bNotOnList ? TranslateT("Contact not on list. You may add it...") :
TranslateT("Autoscrolling is disabled (press F12 to enable it)"));
- SendMessage(GetDlgItem(hwndDlg, IDC_SAVE), BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_PROTOCOL), BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SAVE), BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
+ SendMessage(GetDlgItem(hwndDlg, IDC_PROTOCOL), BUTTONADDTOOLTIP, (WPARAM)TranslateT("Click for contact menu\nClick dropdown for window settings"), BATF_TCHAR);
SetWindowText(GetDlgItem(hwndDlg, IDC_RETRY), TranslateT("Retry"));
@@ -1634,7 +1634,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
}
bool bInfoPanel = dat->Panel->isActive();
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
if (CSkin::m_skinEnabled) {
CSkinItem *item;
@@ -1686,7 +1686,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
*/
GetClientRect(hwndDlg, &rc);
- dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], fAero);
+ dat->Panel->renderBG(hdcMem, rc, &SkinItems[ID_EXTBKINFOPANELBG], bAero);
/*
* draw aero related stuff
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 2c734a008d..4cc2f2d67e 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -1676,7 +1676,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat)
if (!dat)
return 0;
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
HWND hwndDlg = dat->hwnd;
if (dis->CtlType == ODT_MENU && dis->hwndItem == (HWND)GetSubMenu(PluginConfig.g_hMenuContext, 7)) {
@@ -1864,9 +1864,9 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat)
hbmDraw = CreateCompatibleBitmap(dis->hDC, cx, cy);
hbmOld = (HBITMAP)SelectObject(hdcDraw, hbmDraw);
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
- hOldBrush = (HBRUSH)SelectObject(hdcDraw, fAero ? (HBRUSH)GetStockObject(HOLLOW_BRUSH) : GetSysColorBrush(COLOR_3DFACE));
+ hOldBrush = (HBRUSH)SelectObject(hdcDraw, bAero ? (HBRUSH)GetStockObject(HOLLOW_BRUSH) : GetSysColorBrush(COLOR_3DFACE));
rcFrame = rcClient;
if (!bPanelPic) {
@@ -1880,7 +1880,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat)
DeleteObject(br);
}
else {
- if (fAero && CSkin::m_pCurrentAeroEffect) {
+ if (bAero && CSkin::m_pCurrentAeroEffect) {
COLORREF clr = PluginConfig.m_tbBackgroundHigh ? PluginConfig.m_tbBackgroundHigh :
(CSkin::m_pCurrentAeroEffect ? CSkin::m_pCurrentAeroEffect->m_clrToolbar : 0xf0f0f0);
@@ -1954,7 +1954,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat)
/*
* paint avatar using ACC
*/
- SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, fAero ? TRUE : FALSE);
+ SendMessage(dat->hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, bAero ? TRUE : FALSE);
SetWindowPos(dat->hwndPanelPic, HWND_TOP, rcFrame.left + border_off, rcFrame.top + border_off,
rb.max_width, rb.max_height, SWP_SHOWWINDOW | SWP_ASYNCWINDOWPOS | SWP_DEFERERASE | SWP_NOSENDCHANGING);
}
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index abdb49aba1..d228173c73 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -598,13 +598,13 @@ void SendQueue::UpdateSaveAndSendButton(TWindowData *dat)
if (len) { // looks complex but avoids flickering on the button while typing.
if (!(dat->dwFlags & MWF_SAVEBTN_SAV)) {
SendDlgItemMessage(hwndDlg, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_SAVE]);
- SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_save, 0);
+ SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_save, BATF_TCHAR);
dat->dwFlags |= MWF_SAVEBTN_SAV;
}
}
else {
SendDlgItemMessage(hwndDlg, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]);
- SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, 0);
+ SendDlgItemMessage(hwndDlg, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
dat->dwFlags &= ~MWF_SAVEBTN_SAV;
}
dat->textLen = len;
@@ -833,7 +833,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, HANDLE hContact, boo
if (dat->pContainer->hwndActive == dat->hwnd)
UpdateReadChars(dat);
SendDlgItemMessage(dat->hwnd, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_BUTTON_CANCEL]);
- SendDlgItemMessage(dat->hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, 0);
+ SendDlgItemMessage(dat->hwnd, IDC_SAVE, BUTTONADDTOOLTIP, (WPARAM)pszIDCSAVE_close, BATF_TCHAR);
dat->dwFlags &= ~MWF_SAVEBTN_SAV;
mir_free(utfText);
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index d304d8965a..18e44fe8df 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -100,15 +100,15 @@ void CSideBarButton::_create()
m_isTopAligned = true;
m_sz.cx = m_sz.cy = 0;
- m_hwnd = ::CreateWindowEx(0, _T("TSButtonClass"), _T(""), WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
+ m_hwnd = ::CreateWindowEx(0, _T("MButtonClass"), _T(""), WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast<HMENU>(m_id), g_hInst, NULL);
-
if (m_hwnd) {
+ CustomizeButton(m_hwnd);
::SendMessage(m_hwnd, BUTTONSETASSIDEBARBUTTON, (WPARAM)this, 0);
::SendMessage(m_hwnd, BUTTONSETASFLATBTN, FALSE, 0);
::SendMessage(m_hwnd, BUTTONSETASTHEMEDBTN, TRUE, 0);
::SendMessage(m_hwnd, BUTTONSETCONTAINER, (LPARAM)m_sideBar->getContainer(), 0);
- m_buttonControl = (MButtonCtrl *)::GetWindowLongPtr(m_hwnd, 0);
+ m_buttonControl = (TSButtonCtrl *)::GetWindowLongPtr(m_hwnd, 0);
}
else
delete this;
@@ -170,7 +170,7 @@ const SIZE& CSideBarButton::measureItem()
/**
* Render the button item. Callback from the button window procedure
*
- * @param ctl MButtonCtrl *: pointer to the private button data structure
+ * @param ctl TSButtonCtrl *: pointer to the private button data structure
* @param hdc HDC: device context for painting
*/
void CSideBarButton::RenderThis(const HDC hdc) const
@@ -987,18 +987,17 @@ LRESULT CALLBACK CSideBar::wndProcStub(HWND hwnd, UINT msg, WPARAM wParam, LPARA
* @param rc RECT*: target rectangle
* @param stateId the state identifier (normal, pressed, hot, disabled etc.)
*/
-void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc,
- const CSideBarButton *item)
+void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT *rc, const CSideBarButton *item)
{
- UINT id = item->getID();
- int stateId = item->m_buttonControl->stateId;
- bool fIsActiveItem = (item->m_sideBar->getActiveItem() == item);
+ UINT id = item->getID();
+ int stateId = item->m_buttonControl->stateId;
+ bool fIsActiveItem = (item->m_sideBar->getActiveItem() == item);
if (CSkin::m_skinEnabled) {
- TContainerData* pContainer = const_cast<TContainerData *>(item->m_sideBar->getContainer());
- int id = stateId == PBS_PRESSED || fIsActiveItem ? ID_EXTBKBUTTONSPRESSED : (stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSNPRESSED);
- CSkinItem* skinItem = &SkinItems[id];
- HWND hwnd;
+ TContainerData *pContainer = const_cast<TContainerData *>(item->m_sideBar->getContainer());
+ int id = stateId == PBS_PRESSED || fIsActiveItem ? ID_EXTBKBUTTONSPRESSED : (stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSNPRESSED);
+ CSkinItem *skinItem = &SkinItems[id];
+ HWND hwnd;
if (id == IDC_SIDEBARUP)
hwnd = item->m_sideBar->getScrollUp()->m_buttonControl->hwnd;
diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h
index 32fd8669ea..6b5fac5d29 100644
--- a/plugins/TabSRMM/src/sidebar.h
+++ b/plugins/TabSRMM/src/sidebar.h
@@ -89,7 +89,7 @@ public:
public:
CSideBar* m_sideBar;
- const MButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
+ const TSButtonCtrl* m_buttonControl; // private data struct of the Win32 button object
private:
void _create();
private:
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 8fc0c9d176..b47cf211c1 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -403,20 +403,20 @@ static int DWordAlign(int n)
static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int iPartId, int iStateId, LPRECT prcBox, TWindowData *dat)
{
HRESULT hResult = 0;
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
if (tabdat->fAeroTabs) {
if (tabdat->dwStyle & TCS_BOTTOM)
- prcBox->top += (fAero ? 2 : iStateId == PBS_PRESSED ? (M.isVSThemed() ? 1 : -1) : 0);
- else if (!fAero)
+ prcBox->top += (bAero ? 2 : iStateId == PBS_PRESSED ? (M.isVSThemed() ? 1 : -1) : 0);
+ else if (!bAero)
prcBox->bottom -= (iStateId == PBS_PRESSED ? (M.isVSThemed() ? 1 : -1) : 0);
- if (fAero)
+ if (bAero)
FillRect(hDC, prcBox, CSkin::m_BrushBack);
else if (dat)
FillTabBackground(hDC, iStateId, dat, prcBox);
- tabdat->helperItem->setAlphaFormat(AC_SRC_ALPHA, iStateId == PBS_PRESSED ? 255 : (fAero ? 240 : 255));
+ tabdat->helperItem->setAlphaFormat(AC_SRC_ALPHA, iStateId == PBS_PRESSED ? 255 : (bAero ? 240 : 255));
tabdat->helperItem->Render(hDC, prcBox, true);
tabdat->helperGlowItem->setAlphaFormat(AC_SRC_ALPHA, iStateId == PBS_PRESSED ? 220 : 180);
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 6f0113ae75..b879ed95c4 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1987,7 +1987,7 @@ void CSkin::MY_AlphaBlend(HDC hdcDraw, DWORD left, DWORD top, int width, int he
}
/**
- * draw an icon "dimmed" (small amount of transparency applied)
+ * draw an icon "bDimmed" (small amount of transparency applied)
*/
void CSkin::DrawDimmedIcon(HDC hdc, LONG left, LONG top, LONG dx, LONG dy, HICON hIcon, BYTE alpha)
@@ -2303,10 +2303,10 @@ void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindo
if (dat->pContainer->dwFlags & CNT_HIDETOOLBAR)
return;
- bool fAero = M.isAero();
+ bool bAero = M.isAero();
bool fTbColorsValid = PluginConfig.m_tbBackgroundHigh && PluginConfig.m_tbBackgroundLow;
BYTE bAlphaOffset = 0;
- BOOL fMustDrawNonThemed = ((fAero || fTbColorsValid) && !M.GetByte(SRMSGMOD_T, "forceThemedToolbar", 0));
+ BOOL fMustDrawNonThemed = ((bAero || fTbColorsValid) && !M.GetByte(SRMSGMOD_T, "forceThemedToolbar", 0));
RECT rc, rcToolbar;;
POINT pt;
@@ -2374,9 +2374,9 @@ void CSkin::RenderToolbarBG(const TWindowData *dat, HDC hdc, const RECT &rcWindo
else {
dat->pContainer->bTBRenderingMode = (M.isVSThemed() ? 1 : 0);
m_tmp_tb_high = PluginConfig.m_tbBackgroundHigh ? PluginConfig.m_tbBackgroundHigh :
- ((fAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar : ::GetSysColor(COLOR_3DFACE));
+ ((bAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar : ::GetSysColor(COLOR_3DFACE));
m_tmp_tb_low = PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow :
- ((fAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar2 : ::GetSysColor(COLOR_3DFACE));
+ ((bAero && m_pCurrentAeroEffect) ? m_pCurrentAeroEffect->m_clrToolbar2 : ::GetSysColor(COLOR_3DFACE));
bAlphaOffset = PluginConfig.m_tbBackgroundHigh ? 40 : 0;
::DrawAlpha(dat->pContainer->cachedToolbarDC, &rcCachedToolbar, m_tmp_tb_high, 55 + bAlphaOffset, m_tmp_tb_low, 0, 9, 0, 0, 0);
diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h
index afd29288fa..e96e62146d 100644
--- a/plugins/TabSRMM/src/themes.h
+++ b/plugins/TabSRMM/src/themes.h
@@ -41,31 +41,19 @@ HBITMAP IMG_LoadLogo(const TCHAR *szName);
class CSideBarButton;
-struct MButtonCtrl
+struct TSButtonCtrl : public MButtonCtrl
{
- HWND hwnd;
- int stateId; // button state
- int focus; // has focus (1 or 0)
- HFONT hFont; // font
- HICON arrow; // uses down arrow
- int defbutton; // default button
- HICON hIcon, hIconPrivate;
- HBITMAP hBitmap;
- int pushBtn;
- int pbState;
- HANDLE hThemeButton;
- HANDLE hThemeToolbar;
- BOOL bThemed;
- BOOL bToolbarButton; // is a toolbar button (important for aero background rendering)
- BOOL bTitleButton;
- TCHAR cHot;
- int flatBtn;
- int dimmed;
- HICON overlay;
+ HICON hIconPrivate, overlay;
+ bool bToolbarButton; // is a toolbar button (important for aero background rendering)
+ bool bTitleButton;
+ bool bDimmed;
+
TContainerData *pContainer;
CSideBarButton *sitem;
};
+void CustomizeButton(HWND hwndButton);
+
#define BUTTONSETASDIMMED (BUTTONSETASFLATBTN + 11)
#define BUTTONSETCONTAINER (BUTTONSETASFLATBTN + 12)
#define BUTTONSETASTITLE (BUTTONSETASFLATBTN + 13)