changeset 1723:d55227360864

Center toolbar-based bitmap buttons on Windows during layout since they don't automatically center in the packed area.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 14 May 2012 20:32:28 +0000
parents d9849833e535
children 48983a2f839f
files win/dw.c
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/win/dw.c	Mon May 14 19:24:27 2012 +0000
+++ b/win/dw.c	Mon May 14 20:32:28 2012 +0000
@@ -1499,6 +1499,21 @@
                MoveWindow(handle, currentx + pad, currenty + pad,
                         width, height + 400, FALSE);
             }
+#ifdef TOOLBAR
+            /* Bitmap Buttons */
+            else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0)
+            {
+               HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0);
+               int thiswidth = 16, thisheight = 16;
+               
+               if(imlist)
+                  ImageList_GetIconSize(imlist, &thiswidth, &thisheight);
+                  
+               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);
+            }
+#endif
             else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0)
             {
                /* Handle special case Spinbutton */