handle resizing of the control
Modified: trunk/reactos/lib/aclui/checklist.c

Modified: trunk/reactos/lib/aclui/checklist.c
--- trunk/reactos/lib/aclui/checklist.c	2005-07-04 09:46:50 UTC (rev 16405)
+++ trunk/reactos/lib/aclui/checklist.c	2005-07-04 11:05:04 UTC (rev 16406)
@@ -63,8 +63,8 @@
 #endif
 } CHECKLISTWND, *PCHECKLISTWND;
 
-#define CI_TEXT_MARGIN_WIDTH    (6)
-#define CI_TEXT_MARGIN_HEIGHT   (2)
+#define CI_TEXT_MARGIN_WIDTH    (8)
+#define CI_TEXT_MARGIN_HEIGHT   (3)
 
 static PCHECKITEM
 FindCheckItemByIndex(IN PCHECKLISTWND infoPtr,
@@ -153,10 +153,9 @@
     {
         /* return the Deny checkbox in case both check boxes are enabled! */
         *CheckBox = ((!(LastEnabledItem->State & CIS_DENYDISABLED)) ? CLB_DENY : CLB_ALLOW);
-        return LastEnabledItem;
     }
 
-    return NULL;
+    return LastEnabledItem;
 }
 
 static PCHECKITEM
@@ -631,7 +630,7 @@
         }
         else
         {
-            height = 0;
+            height = 2;
         }
 
         SelectObject(hdc,
@@ -655,7 +654,7 @@
     
     if (hOldFont != hFont)
     {
-        infoPtr->ItemHeight = 4 + GetIdealItemHeight(infoPtr);
+        infoPtr->ItemHeight = (2 * CI_TEXT_MARGIN_HEIGHT) + GetIdealItemHeight(infoPtr);
     }
 
     UpdateControl(infoPtr,
@@ -762,7 +761,7 @@
              Item != NULL && CurrentIndex <= LastTouchedIndex;
              Item = Item->Next, CurrentIndex++)
         {
-            TextRect.bottom = TextRect.top + infoPtr->ItemHeight;
+            TextRect.bottom = TextRect.top + infoPtr->ItemHeight - (2 * CI_TEXT_MARGIN_HEIGHT);
             ItemRect.bottom = ItemRect.top + infoPtr->ItemHeight;
             
             SetBrushOrgEx(hDC,
@@ -789,15 +788,16 @@
                      &TextRect,
                      DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
 
+            CheckBox.top = TextRect.top;
+            CheckBox.bottom = TextRect.bottom;
+
             /* draw the Allow checkbox */
             IsPushed = (Enabled && Item == infoPtr->FocusedCheckItem && infoPtr->HasFocus &&
                         !(Item->State & CIS_ALLOWDISABLED) && infoPtr->FocusedCheckItemBox != CLB_DENY &&
                         infoPtr->FocusedPushed);
 
             CheckBox.left = infoPtr->CheckBoxLeft[CLB_ALLOW] - ((TextRect.bottom - TextRect.top) / 2);
-            CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT);
-            CheckBox.top = TextRect.top;
-            CheckBox.bottom = CheckBox.top + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT);
+            CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top);
 #if SUPPORT_UXTHEME
             if (infoPtr->ThemeHandle != NULL)
             {
@@ -853,7 +853,7 @@
                         infoPtr->FocusedPushed);
 
             CheckBox.left = infoPtr->CheckBoxLeft[CLB_DENY] - ((TextRect.bottom - TextRect.top) / 2);
-            CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT);
+            CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top);
 #if SUPPORT_UXTHEME
             if (infoPtr->ThemeHandle != NULL)
             {
@@ -1111,7 +1111,7 @@
             
 #if SUPPORT_UXTHEME
             /* handle hovering checkboxes */
-            if (hWndCapture == NULL)
+            if (hWndCapture == NULL && infoPtr->ThemeHandle != NULL)
             {
                 TRACKMOUSEEVENT tme;
                 PCHECKITEM HotTrackItem;
@@ -1547,6 +1547,8 @@
             infoPtr->HasFocus = FALSE;
             if (infoPtr->FocusedCheckItem != NULL)
             {
+                infoPtr->FocusedPushed = FALSE;
+                
                 UpdateCheckItem(infoPtr,
                                 infoPtr->FocusedCheckItem);
             }
@@ -1836,6 +1838,13 @@
 #endif
             break;
         }
+        
+        case WM_SIZE:
+        {
+            UpdateControl(infoPtr,
+                          TRUE);
+            break;
+        }
 
         case WM_CREATE:
         {