changeset 1731:f7a41d057a50

A much better solution that centering the button in the space on Windows... During layout send the message to set the button size to the space we need.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 May 2012 19:43:49 +0000
parents 3828f3faec8c
children 03a76c4185a8
files win/dw.c
diffstat 1 files changed, 3 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Tue May 15 07:09:29 2012 +0000
+++ b/win/dw.c	Tue May 15 19:43:49 2012 +0000
@@ -1510,29 +1510,9 @@
             /* Bitmap Buttons */
             else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
             {
-               HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0);
-               int thiswidth = 20, thisheight = 20, minsize = 24;
-
-               if(imlist)
-                  ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
-                  
-               /* If we are flat the size can be smaller */
-               if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT)
-                  minsize = 20;
-               else
-               {
-                  thiswidth += 4;
-                  thisheight += 4;
-               }
-                  
-               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, 
-                          thiswidth < width ? thiswidth : width, thisheight < height ? thisheight : height, FALSE);
+               SendMessage(handle, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height));
+
+               MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE);
             }
 #endif
             else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0)