changeset 1728:aa2bd0d8bf27

Set the minimum button size to 24x24 instead of 20x20 when toolbar buttons are not set to flat (DW_BS_NOBORDER).
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 May 2012 06:37:39 +0000
parents 38a0e75bc59c
children 570a03dabdc2
files win/dw.c
diffstat 1 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Tue May 15 06:13:35 2012 +0000
+++ b/win/dw.c	Tue May 15 06:37:39 2012 +0000
@@ -1509,15 +1509,19 @@
             else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
             {
                HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0);
-               int thiswidth = 20, thisheight = 20;
-               
+               int thiswidth = 20, thisheight = 20, minsize = 24;
+
+               /* If we are flat the size can be smaller */
+               if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT)
+                  minsize = 20;
+                  
                if(imlist)
                   ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
                   
-               if(thiswidth < 20)
-                  thiswidth = 20;
-               if(thisheight < 20)
-                  thisheight = 20;
+               if(thiswidth < minsize)
+                  thiswidth = minsize;
+               if(thisheight < minsize)
+                  thisheight = minsize;
                   
                MoveWindow(handle, thiswidth < width ? currentx + pad + ((width-thiswidth)/2) : currentx + pad, 
                           thisheight < height ? currenty + pad + ((height-thisheight)/2) : currenty + pad, 
@@ -4656,14 +4660,19 @@
    else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
    {
       HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0);
+      int minsize = 24;
       
+      /* If we are flat the size can be smaller */
+      if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT)
+         minsize = 20;
+         
       if(imlist)
          ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
 
-      if(thiswidth < 20)
-         thiswidth = 20;
-      if(thisheight < 20)
-         thisheight = 20;
+      if(thiswidth < minsize)
+         thiswidth = minsize;
+      if(thisheight < minsize)
+         thisheight = minsize;
    }
 #endif   
    /* Listbox */