# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1337111029 0 # Node ID f7a41d057a50793ffcbd2f7ee9179d92c32873fd # Parent 3828f3faec8c41de4963755b260af678a4641c90 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. diff -r 3828f3faec8c -r f7a41d057a50 win/dw.c --- 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)