[2/4] comctl32/tab: Implemented TCM_DESELECTALL

Nikolay Sivov bunglehead at gmail.com
Sat Mar 28 09:38:01 CDT 2009


Changelog:
   - Implemented TCM_DESELECTALL

>From 63959e6390039d450a7790417b8cb46629fc74b4 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sat, 28 Mar 2009 09:57:09 -0400
Subject: Implemented TCM_DESELECTALL

---
 dlls/comctl32/tab.c |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 2e5dced..1354054 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -51,9 +51,6 @@
  *   TCN_GETOBJECT
  *   TCN_KEYDOWN
  *
- *  Messages:
- *   TCM_DESELECTALL
- *
  *  Macros:
  *   TabCtrl_AdjustRect
  *
@@ -3164,6 +3161,39 @@ TAB_GetExtendedStyle (TAB_INFO *infoPtr)
   return infoPtr->exStyle;
 }
 
+static LRESULT
+TAB_DeselectAll (TAB_INFO *infoPtr, BOOL excludesel)
+{
+  LONG style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE);
+  BOOL paint = FALSE;
+  INT i, selected = infoPtr->iSelected;
+
+  if (!(style & TCS_BUTTONS))
+    return 0;
+
+  for (i = 0; i < infoPtr->uNumItem; i++)
+  {
+    if ((TAB_GetItem(infoPtr, i)->dwState & TCIS_BUTTONPRESSED) &&
+        (selected != i))
+    {
+      TAB_GetItem(infoPtr, i)->dwState &= ~TCIS_BUTTONPRESSED;
+      paint = TRUE;
+    }
+  }
+
+  if (!excludesel && (selected != -1))
+  {
+    TAB_GetItem(infoPtr, selected)->dwState &= ~TCIS_BUTTONPRESSED;
+    infoPtr->iSelected = -1;
+    paint = TRUE;
+  }
+
+  if (paint)
+    TAB_InvalidateTabArea (infoPtr);
+
+  return 0;
+}
+
 static LRESULT WINAPI
 TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
@@ -3257,8 +3287,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
       return TAB_SetMinTabWidth(infoPtr, (INT)lParam);
 
     case TCM_DESELECTALL:
-      FIXME("Unimplemented msg TCM_DESELECTALL\n");
-      return 0;
+      return TAB_DeselectAll (infoPtr, (BOOL)wParam);
 
     case TCM_GETEXTENDEDSTYLE:
       return TAB_GetExtendedStyle (infoPtr);
-- 
1.5.6.5







More information about the wine-patches mailing list