Mikołaj Zalewski : comctl32: toolbar: The top margin should be computed and saved in CalcToolbar.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Nov 2 05:46:50 CST 2006


Module: wine
Branch: master
Commit: 3bfcacc54c2c4705ec60813d4ed1f9d8f3e07aee
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3bfcacc54c2c4705ec60813d4ed1f9d8f3e07aee

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Wed Nov  1 23:02:45 2006 +0100

comctl32: toolbar: The top margin should be computed and saved in CalcToolbar.

---

 dlls/comctl32/toolbar.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index 99c329e..dd63e1c 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -141,6 +141,7 @@ typedef struct
     INT      nOldHit;
     INT      nHotItem;        /* index of the "hot" item */
     SIZE     szPadding;       /* padding values around button */
+    INT      iTopMargin;      /* the top margin */
     INT      iListGap;        /* default gap between text and image for toolbar with list style */
     HFONT    hDefaultFont;
     HFONT    hFont;           /* text font */
@@ -255,6 +256,10 @@ static void TOOLBAR_TooltipSetRect(TOOLB
 static LRESULT
 TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
 
+inline static int default_top_margin(TOOLBAR_INFO *infoPtr)
+{
+    return (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
+}
 
 static LPWSTR
 TOOLBAR_GetText(TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr)
@@ -1628,6 +1633,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
     sizeButton = TOOLBAR_MeasureButton(infoPtr, sizeString, TRUE, validImageList);
     infoPtr->nButtonWidth = sizeButton.cx;
     infoPtr->nButtonHeight = sizeButton.cy;
+    infoPtr->iTopMargin = default_top_margin(infoPtr);
 
     if ( infoPtr->cxMin >= 0 && infoPtr->nButtonWidth < infoPtr->cxMin )
         infoPtr->nButtonWidth = infoPtr->cxMin;
@@ -1652,7 +1658,7 @@ TOOLBAR_LayoutToolbar(HWND hwnd)
     TOOLBAR_WrapToolbar(hwnd, infoPtr->dwStyle);
 
     x  = infoPtr->nIndent;
-    y  = (infoPtr->dwStyle & TBSTYLE_FLAT ? 0 : TOP_BORDER);
+    y  = infoPtr->iTopMargin;
     cx = infoPtr->nButtonWidth;
     cy = infoPtr->nButtonHeight;
 
@@ -5393,6 +5399,7 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam
     infoPtr->szPadding.cx = DEFPAD_CX;
     infoPtr->szPadding.cy = DEFPAD_CY;
     infoPtr->iListGap = DEFLISTGAP;
+    infoPtr->iTopMargin = default_top_margin(infoPtr);
     infoPtr->dwStyle = dwStyle;
     infoPtr->tbim.iButton = -1;
     GetClientRect(hwnd, &infoPtr->client_rect);




More information about the wine-cvs mailing list