changeset 1724:48983a2f839f

Toolbar bitmap buttons don't seem to draw properly smaller than 20x20 on Windows... So clamp the minimum size for them at 20 pixels.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 14 May 2012 21:36:28 +0000
parents d55227360864
children 2e0f87ec24fe
files win/dw.c
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon May 14 20:32:28 2012 +0000
+++ b/win/dw.c	Mon May 14 21:36:28 2012 +0000
@@ -1504,11 +1504,16 @@
             else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
             {
                HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0);
-               int thiswidth = 16, thisheight = 16;
+               int thiswidth = 20, thisheight = 20;
                
                if(imlist)
                   ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
                   
+               if(thiswidth < 20)
+                  thiswidth = 20;
+               if(thisheight < 20)
+                  thisheight = 20;
+                  
                MoveWindow(handle, thiswidth < width ? currentx + pad + ((width-thiswidth)/2) : currentx + pad, 
                           thisheight < height ? currenty + pad + ((height-thisheight)/2) : currenty + pad, 
                           thiswidth < width ? thiswidth : width, thisheight < height ? thisheight : height, FALSE);
@@ -4648,6 +4653,11 @@
       
       if(imlist)
          ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
+
+      if(thiswidth < 20)
+         thiswidth = 20;
+      if(thisheight < 20)
+         thisheight = 20;
    }
 #endif   
    /* Listbox */
@@ -6191,6 +6201,7 @@
                          
    /* Insert the single bitmap and button into the toolbar */
    SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
+   SendMessage(tmp, TB_SETBUTTONSIZE, 0, MAKELPARAM(bmi.bmWidth, bmi.bmHeight));
    SendMessage(tmp, TB_SETPADDING, 0, 0);
    SendMessage(tmp, TB_SETIMAGELIST, 0, (LPARAM)imlist);
    SendMessage(tmp, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)imlist);