diff options
-rw-r--r-- | include/m_button.h | 27 | ||||
-rw-r--r-- | include/m_button_int.h | 15 | ||||
-rw-r--r-- | plugins/Clist_modern/src/m_api/m_skinbutton.h | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_tbbutton.cpp | 79 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/CLCButton.cpp | 96 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/Include/clc.h | 3 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/clui.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/viewmodes.cpp | 2 | ||||
-rw-r--r-- | src/modules/button/button.cpp | 21 |
9 files changed, 113 insertions, 136 deletions
diff --git a/include/m_button.h b/include/m_button.h index c3b0dfabd7..e743bd61c9 100644 --- a/include/m_button.h +++ b/include/m_button.h @@ -27,38 +27,37 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MIRANDABUTTONCLASS _T("MButtonClass") // Class of the control
-
// Sets whether a dropdown arrow is used
// wParam = TRUE/FALSE turns arrow on or off
-// lParam = not used
-// Usage: SendMessage(hwndbutton, BUTTONSETARROW, 1, 0);
+// lParam = 0 (unused)
+// Usage: SendMessage(hwndbutton, BUTTONSETARROW, TRUE, 0);
// Only works on MButtonClass buttons
#define BUTTONSETARROW (WM_USER+1)
// Sets whether the button is a default button
// wParam = TRUE/FALSE default on/off
-// lParam = not used
-// Usage: SendMessage(hwndbutton, BUTTONSETDEFAULT, 1, 0);
+// lParam = 0 (unused)
+// Usage: SendMessage(hwndbutton, BUTTONSETDEFAULT, TRUE, 0);
// Only works on MButtonClass buttons
#define BUTTONSETDEFAULT (WM_USER+2)
// Sets the button as a push button
// wParam = TRUE/FALSE default on/off
-// lParam = not used
-// Usage: SendMessage(hwndbutton, BUTTONSETASPUSHBTN, 1, 0);
+// lParam = 0 (unused)
+// Usage: SendMessage(hwndbutton, BUTTONSETASPUSHBTN, TRUE, 0);
// Only works on MButtonClass buttons
#define BUTTONSETASPUSHBTN (WM_USER+3)
// Sets the button type as a flat button without borders v0.3.3+
// wParam = TRUE/FALSE default on/off
-// lParam = not used
-// Usage: SendMessage(hwndbutton, BUTTONSETASFLATBTN, 1, 0);
+// lParam = 0 (unused)
+// Usage: SendMessage(hwndbutton, BUTTONSETASFLATBTN, TRUE, 0);
// Only works on MButtonClass buttons
#define BUTTONSETASFLATBTN (WM_USER+4)
// Sets a tooltip for the button v0.3.3+
// wParam = (WPARAM)(char *)szTip
-// lParam = not used
+// lParam = 0 (unused)
// Usage: SendMessage(hwndButton, BUTTONADDTOOLTIP, (WPARAM)"My Tip", BATF_* flags);
#define BATF_UNICODE 1
#if defined(_UNICODE)
@@ -72,7 +71,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Applies themes to a button
// wParam = TRUE/FALSE default on/off
// lParam = not used
-// Usage: SendMessage(hwndbutton, BUTTONSETASTHEMEDBTN, 1, 0);
+// Usage: SendMessage(hwndbutton, BUTTONSETASTHEMEDBTN, TRUE, 0);
// Only works on MButtonClass buttons
#define BUTTONSETASTHEMEDBTN (WM_USER+6)
@@ -83,4 +82,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Only works on MButtonClass buttons
#define BUTTONSETCUSTOMPAINT (WM_USER+7)
+// Forces a button to send clicks on push
+// wParam = TRUE/FALSE default on/off
+// lParam = 0 (unused)
+// Usage: SendMessage(hwndbutton, BUTTONSETSENDONDOWN, TRUE, 0);
+#define BUTTONSETSENDONDOWN (WM_USER+8)
+
#endif // M_BUTTON_H__
diff --git a/include/m_button_int.h b/include/m_button_int.h index f40a83ced7..9bdd651731 100644 --- a/include/m_button_int.h +++ b/include/m_button_int.h @@ -44,13 +44,14 @@ struct MButtonCtrl TCHAR cHot;
HWND hwndToolTips;
- bool bIsPushBtn, // button has two states
- bIsPushed, // is button pushed or not
- bIsDefault, // default button
- bIsFlat, // flat button
- bIsThemed, // themed button
- bIsSkinned; // skinned button
-
+ bool bIsPushBtn, // button has two states
+ bIsPushed, // is button pushed or not
+ bIsDefault, // default button
+ bIsFlat, // flat button
+ bIsThemed, // themed button
+ bIsSkinned, // skinned button
+ bSendOnDown; // sends BN_CLICKED on WM_LBUTTONDOWN
+
pfnPainterFunc fnPainter; // custom button painter
IAccPropServices* pAccPropServices;
diff --git a/plugins/Clist_modern/src/m_api/m_skinbutton.h b/plugins/Clist_modern/src/m_api/m_skinbutton.h index 43a3167ce3..1ca5c38e6d 100644 --- a/plugins/Clist_modern/src/m_api/m_skinbutton.h +++ b/plugins/Clist_modern/src/m_api/m_skinbutton.h @@ -7,8 +7,6 @@ #define BUTTONSETID WM_USER+55
#define BUTTONDRAWINPARENT WM_USER+56
#define BUTTONSETMARGINS WM_USER+57
-#define BUTTONSETSENDONDOWN WM_USER+58
-
#define SBF_ALIGN_TL_RIGHT 1
#define SBF_ALIGN_TL_HCENTER 2
diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index a82696884e..9d55684139 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -19,18 +19,15 @@ void CustomizeToolbar(HWND); struct TBBUTTONDATA : public MButtonCtrl
{
char *szButtonID; // button id
- BOOL fSendOnDown; // send event on button pushed
- BOOL fHotMark; // button is hot marked (e.g. current state)
- BOOL fFocused;
+ bool bHotMark; // button is hot marked (e.g. current state)
+ bool bFocused;
int nFontID; // internal font ID
- HANDLE ttbID; // control ID
TCHAR szText[128]; // text on the button
RECT rcMargins; // margins of inner content
- HANDLE hIcolibHandle; // handle of icon in iconlib
+ HANDLE hIcolibHandle; // handle of icon in iconlib
- XPTHANDLE hThemeButton;
- XPTHANDLE hThemeToolbar;
+ XPTHANDLE hThemeButton, hThemeToolbar;
};
static CRITICAL_SECTION csTips;
@@ -109,7 +106,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint , POINT *pOffset) bct->szButtonID, // ID
b2str(bct->stateId == PBS_HOT), // Hovered
b2str(bct->stateId == PBS_PRESSED || bct->bIsPushed == TRUE), // Pressed
- b2str(bct->fFocused)); // Focused
+ b2str(bct->bFocused)); // Focused
SkinDrawGlyph(hdcMem,&rcClient,&rcClient,szRequest);
}
@@ -154,7 +151,7 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint , POINT *pOffset) FillRect(hdcMem, &rcClient, hbr);
DeleteObject(hbr);
}
- if (bct->stateId == PBS_HOT || bct->fFocused) {
+ if (bct->stateId == PBS_HOT || bct->bFocused) {
if (bct->bIsPushed)
DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT);
else
@@ -234,16 +231,16 @@ static void PaintWorker(TBBUTTONDATA *bct, HDC hdcPaint , POINT *pOffset) static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- TBBUTTONDATA *bct = (TBBUTTONDATA *) GetWindowLongPtr(hwndDlg, 0);
+ TBBUTTONDATA *bct = (TBBUTTONDATA*)GetWindowLongPtr(hwndDlg, 0);
+
switch (msg) {
case WM_DESTROY:
xpt_FreeThemeForWindow(hwndDlg);
WindowList_Remove(hButtonWindowList, hwndDlg);
- break; // DONT! fall thru
+ break;
case WM_SETTEXT:
- lstrcpyn(bct->szText, (TCHAR *)lParam, SIZEOF(bct->szText)-1);
- bct->szText[SIZEOF(bct->szText)-1] = '\0';
+ _tcsncpy_s(bct->szText, SIZEOF(bct->szText), (TCHAR*)lParam, _TRUNCATE);
break;
case WM_SETFONT:
@@ -252,10 +249,6 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam bct->nFontID = (int)lParam - 1;
break;
- case BUTTONSETSENDONDOWN:
- bct->fSendOnDown = (BOOL)lParam;
- break;
-
case BUTTONSETMARGINS:
if (lParam) bct->rcMargins = *(RECT*)lParam;
else {
@@ -270,7 +263,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case BUTTONDRAWINPARENT:
if (IsWindowVisible(hwndDlg))
- PaintWorker(bct, (HDC) wParam, (POINT*) lParam);
+ PaintWorker(bct, (HDC)wParam, (POINT*)lParam);
break;
case WM_NCPAINT:
@@ -301,15 +294,15 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam RECT rcClient;
GetClientRect(bct->hwnd, &rcClient);
if ( !PtInRect(&rcClient, ptMouse)) {
- bct->fHotMark = FALSE;
+ bct->bHotMark = false;
ReleaseCapture();
}
else {
if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) {
bct->stateId = PBS_PRESSED;
- bct->fHotMark = TRUE;
+ bct->bHotMark = true;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
- if (bct->fSendOnDown) {
+ if (bct->bSendOnDown) {
SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM) hwndDlg);
bct->stateId = PBS_NORMAL;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
@@ -321,14 +314,14 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam return 0;
case WM_LBUTTONUP:
- if ( GetCapture() == bct->hwnd ) {
+ if (GetCapture() == bct->hwnd) {
POINT ptMouse = UNPACK_POINT(lParam);
RECT rcClient;
GetClientRect(bct->hwnd, &rcClient);
if ( !PtInRect(&rcClient, ptMouse)) {
- bct->fHotMark = FALSE;
+ bct->bHotMark = false;
ReleaseCapture();
break;
}
@@ -341,44 +334,45 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam bct->stateId = PBS_HOT;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
- if ( !bct->fSendOnDown) {
- bct->fHotMark = FALSE;
+ if ( !bct->bSendOnDown) {
+ bct->bHotMark = false;
SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg);
}
}
- else bct->fHotMark = FALSE;
+ else bct->bHotMark = false;
return 0;
case WM_MOUSEMOVE:
{
- RECT rc;
- POINT pt;
BOOL bPressed = (wParam & MK_LBUTTON) != 0;
- if ( bPressed && !bct->fHotMark )
+ if (bPressed && !bct->bHotMark)
break;
+
+ RECT rc;
+ POINT pt;
GetWindowRect(hwndDlg, &rc);
GetCursorPos(&pt);
BOOL inClient = PtInRect(&rc, pt);
- if ( inClient ) {
- SetCapture( bct->hwnd );
- if ( bct->stateId == PBS_NORMAL ) {
+ if (inClient) {
+ SetCapture(bct->hwnd);
+ if (bct->stateId == PBS_NORMAL) {
bct->stateId = PBS_HOT;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
}
- if ( !inClient && bct->stateId == PBS_PRESSED ) {
+ if (!inClient && bct->stateId == PBS_PRESSED) {
bct->stateId = PBS_HOT;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
- else if ( inClient && bct->stateId == PBS_HOT && bPressed ) {
- if ( bct->fHotMark ) {
+ else if (inClient && bct->stateId == PBS_HOT && bPressed) {
+ if (bct->bHotMark) {
bct->stateId = PBS_PRESSED;
InvalidateParentRect(bct->hwnd, NULL, TRUE);
}
}
else if ( !inClient && !bPressed) {
- bct->fHotMark = FALSE;
+ bct->bHotMark = false;
ReleaseCapture();
}
}
@@ -401,6 +395,16 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam InvalidateRect(bct->hwnd, NULL, TRUE);
return 0;
+ case WM_SETFOCUS: // set keyboard focus and redraw
+ bct->bFocused = true;
+ InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ break;
+
+ case WM_KILLFOCUS: // kill focus and redraw
+ bct->bFocused = false;
+ InvalidateParentRect(bct->hwnd, NULL, TRUE);
+ break;
+
case WM_ERASEBKGND:
return 1;
@@ -459,9 +463,8 @@ void CustomizeButton(HANDLE ttbid, HWND hWnd, LPARAM lParam) MakeButtonSkinned(hWnd);
- TBBUTTONDATA* p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0);
+ TBBUTTONDATA *p = (TBBUTTONDATA*)GetWindowLongPtr(hWnd, 0);
p->szButtonID = "Toolbar.MissingID";
- p->ttbID = ttbid;
SendMessage(hWnd, MBM_UPDATETRANSPARENTFLAG, 0, 2);
}
diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 9024f08c5a..e766f8b095 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct
{
- int ctrlid;
- char *pszButtonID, *pszButtonDn, *pszButtonName;
+ int ctrlid;
+ char *pszButtonID, *pszButtonDn, *pszButtonName;
int isPush, isVis, isAction;
HANDLE hButton;
HWND hwndButton;
@@ -67,8 +67,7 @@ static int getButtonIndex(HANDLE hButton) static void InitDefaultButtons()
{
for (int i=0; i < SIZEOF(BTNS); i++ ) {
- TTBButton tbb = { 0 };
- tbb.cbSize = sizeof(tbb);
+ TTBButton tbb = { sizeof(tbb) };
g_index = i;
if (BTNS[i].pszButtonID) {
@@ -110,6 +109,15 @@ HWND ClcGetButtonWindow(int ctrlid) return NULL;
}
+int ClcGetButtonId(HWND hwnd)
+{
+ for (int i=0; i < SIZEOF(BTNS); i++)
+ if (BTNS[i].hwndButton == hwnd)
+ return BTNS[i].ctrlid;
+
+ return 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
struct MButtonExtension : public MButtonCtrl
@@ -118,8 +126,7 @@ struct MButtonExtension : public MButtonCtrl TCHAR szText[128];
SIZE sLabel;
HIMAGELIST hIml;
- int iIcon, iCtrlID;
- BOOL bSendOnDown;
+ int iIcon;
ButtonItem *buttonItem;
LONG lastGlyphMetrics[4];
};
@@ -362,7 +369,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- MButtonExtension *bct = (MButtonExtension*) GetWindowLongPtr(hwnd, 0);
+ MButtonExtension *bct = (MButtonExtension*)GetWindowLongPtr(hwnd, 0);
switch (msg) {
case WM_DESTROY:
@@ -371,22 +378,12 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_SETTEXT:
- lstrcpyn(bct->szText, (TCHAR *)lParam, 127);
- bct->szText[127] = 0;
- break;
-
- case WM_SYSKEYUP:
- if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int) wParam)) {
- if ( !bct->bSendOnDown)
- SendMessage(pcli->hwndContactList, WM_COMMAND, MAKELONG(bct->iCtrlID, BN_CLICKED), (LPARAM) hwnd);
- return 0;
- }
+ _tcsncpy_s(bct->szText, SIZEOF(bct->szText), (TCHAR*)lParam, _TRUNCATE);
break;
case BM_GETIMAGE:
if (wParam == IMAGE_ICON)
return (LRESULT)(bct->hIconPrivate ? bct->hIconPrivate : bct->hIcon);
-
break;
case BM_SETIMAGE:
@@ -414,7 +411,8 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR ImageList_RemoveAll(hImageList);
ImageList_Destroy(hImageList);
bct->hIcon = 0;
- } else {
+ }
+ else {
bct->hIcon = (HICON) lParam;
bct->hIconPrivate = 0;
}
@@ -452,37 +450,6 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->buttonItem = (ButtonItem *)lParam;
break;
- case BUTTONSETASMENUACTION:
- bct->bSendOnDown = wParam ? TRUE : FALSE;
- break;
-
- case WM_LBUTTONDOWN:
- if (!bct->iCtrlID) break;
- if (bct->stateId != PBS_DISABLED && bct->stateId != PBS_PRESSED) {
- bct->stateId = PBS_PRESSED;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- if (bct->bSendOnDown) {
- SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(bct->iCtrlID, BN_CLICKED), (LPARAM) hwnd);
- bct->stateId = PBS_NORMAL;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- }
- return 1;
-
- case WM_LBUTTONUP:
- if (!bct->iCtrlID) break;
- if (bct->bIsPushBtn)
- bct->bIsPushed = !bct->bIsPushed;
-
- if (bct->stateId != PBS_DISABLED) {
- // don't change states if disabled
- bct->stateId = PBS_HOT;
- InvalidateRect(bct->hwnd, NULL, TRUE);
- }
- if ( !bct->bSendOnDown)
- SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(bct->iCtrlID, BN_CLICKED), (LPARAM) hwnd);
- return 1;
-
case WM_NCHITTEST:
switch( SendMessage(pcli->hwndContactList, WM_NCHITTEST, wParam, lParam)) {
case HTLEFT: case HTRIGHT: case HTBOTTOM: case HTTOP:
@@ -493,16 +460,14 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR return mir_callNextSubclass(hwnd, TSButtonWndProc, msg, wParam, lParam);
}
-static void SetButtonAsCustom(HWND hWnd)
-{
- SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(MButtonExtension), (LPARAM)PaintWorker);
- mir_subclassWindow(hWnd, TSButtonWndProc);
-}
-
static LRESULT CALLBACK ToolbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED)
- SendMessage(pcli->hwndContactList, msg, wParam, lParam);
+ // standard buttons are processed in the main window
+ if (msg == WM_COMMAND && HIWORD(wParam) == BN_CLICKED) {
+ int iCtrlId = ClcGetButtonId((HWND)lParam);
+ if (iCtrlId)
+ SendMessage(pcli->hwndContactList, msg, MAKELONG(iCtrlId, BN_CLICKED), lParam);
+ }
return mir_callNextSubclass(hwnd, ToolbarWndProc, msg, wParam, lParam);
}
@@ -516,27 +481,24 @@ static void CustomizeToolbar(HANDLE hButton, HWND hWnd, LPARAM) return;
}
- SetButtonAsCustom(hWnd);
+ SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(MButtonExtension), (LPARAM)PaintWorker);
+ mir_subclassWindow(hWnd, TSButtonWndProc);
MButtonExtension *bct = (MButtonExtension*) GetWindowLongPtr(hWnd, 0);
int idx = getButtonIndex(hButton);
if (idx != -1) { // adding built-in button
BTNS[idx].hwndButton = hWnd;
- bct->iCtrlID = BTNS[idx].ctrlid;
if (BTNS[idx].isAction)
- bct->bSendOnDown = TRUE;
+ bct->bSendOnDown = true;
if ( !BTNS[idx].isPush)
- bct->bIsPushBtn = TRUE;
+ bct->bIsPushBtn = true;
}
}
void CustomizeButton(HWND hWnd, bool bIsSkinned, bool bIsThemed, bool bIsFlat)
{
- SetButtonAsCustom(hWnd);
-
- MButtonExtension *bct = (MButtonExtension*) GetWindowLongPtr(hWnd, 0);
- if (bct)
- bct->iCtrlID = GetDlgCtrlID(hWnd);
+ SendMessage(hWnd, BUTTONSETCUSTOMPAINT, sizeof(MButtonExtension), (LPARAM)PaintWorker);
+ mir_subclassWindow(hWnd, TSButtonWndProc);
SendMessage(hWnd, BUTTONSETSKINNED, bIsSkinned, 0);
SendMessage(hWnd, BUTTONSETASTHEMEDBTN, bIsThemed, 0);
diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index e28143eeec..9fe24eb181 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -461,8 +461,7 @@ int Docking_IsDocked(WPARAM wParam, LPARAM lParam); #define BUTTONSETIMLICON (WM_USER+20)
#define BUTTONSETSKINNED (WM_USER+21)
-#define BUTTONSETASMENUACTION (WM_USER+22)
-#define BUTTONSETBTNITEM (WM_USER+23)
+#define BUTTONSETBTNITEM (WM_USER+22)
// Menus
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 1c6f4e2839..75166d6429 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -315,14 +315,14 @@ void CreateButtonBar(HWND hWnd) CustomizeButton(hTbMenu, false, false, false);
SetWindowText(hTbMenu, TranslateT("Menu"));
SendMessage(hTbMenu, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadSkinnedIcon(SKINICON_OTHER_MAINMENU));
- SendMessage(hTbMenu, BUTTONSETASMENUACTION, 1, 0);
+ SendMessage(hTbMenu, BUTTONSETSENDONDOWN, TRUE, 0);
SendMessage(hTbMenu, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Open main menu"), BATF_TCHAR);
hTbGlobalStatus = CreateWindowEx(0, MIRANDABUTTONCLASS, _T(""), BS_PUSHBUTTON | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20, hWnd, (HMENU) IDC_TBGLOBALSTATUS, g_hInst, NULL);
CustomizeButton(hTbGlobalStatus, false, false, false);
SetWindowText(hTbGlobalStatus, TranslateT("Offline"));
SendMessage(hTbGlobalStatus, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadSkinnedIcon(SKINICON_STATUS_OFFLINE));
- SendMessage(hTbGlobalStatus, BUTTONSETASMENUACTION, 1, 0);
+ SendMessage(hTbGlobalStatus, BUTTONSETSENDONDOWN, TRUE, 0);
SendMessage(hTbGlobalStatus, BUTTONADDTOOLTIP, (WPARAM) TranslateT("Set status modes"), BATF_TCHAR);
}
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 47ac3f043a..831407e081 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -861,7 +861,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM hwnd, (HMENU) IDC_SELECTMODE, g_hInst, NULL);
CustomizeButton(hwndSelector, false, false, false);
SendMessage(hwndSelector, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Select a view mode"), BATF_UNICODE);
- SendMessage(hwndSelector, BUTTONSETASMENUACTION, 1, 0);
+ SendMessage(hwndSelector, BUTTONSETSENDONDOWN, TRUE, 0);
HWND hwndButton = CreateWindowEx(0, MIRANDABUTTONCLASS, _T(""), BS_PUSHBUTTON | WS_VISIBLE | WS_CHILD | WS_TABSTOP, 0, 0, 20, 20,
hwnd, (HMENU) IDC_CONFIGUREMODES, g_hInst, NULL);
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index d1b06896ea..7bbbd9ef8a 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -341,14 +341,14 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_SYSKEYUP:
- if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) {
+ if (bct->stateId != PBS_DISABLED && !bct->bSendOnDown && bct->cHot && bct->cHot == tolower((int)wParam)) {
if (bct->bIsPushBtn) {
if (bct->bIsPushed) {
- bct->bIsPushed = 0;
+ bct->bIsPushed = false;
bct->stateId = PBS_NORMAL;
}
else {
- bct->bIsPushed = 1;
+ bct->bIsPushed = true;
bct->stateId = PBS_PRESSED;
}
InvalidateRect(bct->hwnd, NULL, TRUE);
@@ -513,6 +513,10 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->fnPainter = pfnPainterFunc(lParam);
break;
+ case BUTTONSETSENDONDOWN:
+ bct->bSendOnDown = (wParam != 0);
+ break;
+
case WM_SETFOCUS: // set keybord focus and redraw
bct->focus = 1;
InvalidateRect(bct->hwnd, NULL, TRUE);
@@ -528,7 +532,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR break;
case WM_ENABLE: // windows tells us to enable/disable
- bct->stateId = wParam?PBS_NORMAL:PBS_DISABLED;
+ bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED;
InvalidateRect(bct->hwnd, NULL, TRUE);
break;
@@ -543,6 +547,11 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
bct->stateId = PBS_PRESSED;
InvalidateRect(bct->hwnd, NULL, TRUE);
+ if (bct->bSendOnDown) {
+ SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
+ bct->stateId = PBS_NORMAL;
+ InvalidateRect(bct->hwnd, NULL, TRUE);
+ }
}
break;
@@ -558,8 +567,8 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR bct->stateId = (msg == WM_LBUTTONUP) ? PBS_HOT : PBS_NORMAL;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
- if (showClick) // Tell your daddy you got clicked.
- SendMessage(GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
+ if (showClick && !bct->bSendOnDown) // Tell your daddy you got clicked.
+ SendMessage( GetParent(hwnd), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwnd), BN_CLICKED), (LPARAM)hwnd);
}
break;
|