Mercurial > dwindows
comparison win/dw.c @ 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 |
comparison
equal
deleted
inserted
replaced
1730:3828f3faec8c | 1731:f7a41d057a50 |
---|---|
1508 } | 1508 } |
1509 #ifdef TOOLBAR | 1509 #ifdef TOOLBAR |
1510 /* Bitmap Buttons */ | 1510 /* Bitmap Buttons */ |
1511 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) | 1511 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) |
1512 { | 1512 { |
1513 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); | 1513 SendMessage(handle, TB_SETBUTTONSIZE, 0, MAKELPARAM(width, height)); |
1514 int thiswidth = 20, thisheight = 20, minsize = 24; | 1514 |
1515 | 1515 MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); |
1516 if(imlist) | |
1517 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | |
1518 | |
1519 /* If we are flat the size can be smaller */ | |
1520 if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT) | |
1521 minsize = 20; | |
1522 else | |
1523 { | |
1524 thiswidth += 4; | |
1525 thisheight += 4; | |
1526 } | |
1527 | |
1528 if(thiswidth < minsize) | |
1529 thiswidth = minsize; | |
1530 if(thisheight < minsize) | |
1531 thisheight = minsize; | |
1532 | |
1533 MoveWindow(handle, thiswidth < width ? currentx + pad + ((width-thiswidth)/2) : currentx + pad, | |
1534 thisheight < height ? currenty + pad + ((height-thisheight)/2) : currenty + pad, | |
1535 thiswidth < width ? thiswidth : width, thisheight < height ? thisheight : height, FALSE); | |
1536 } | 1516 } |
1537 #endif | 1517 #endif |
1538 else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0) | 1518 else if(_tcsnicmp(tmpbuf, UPDOWN_CLASS, _tcslen(UPDOWN_CLASS)+1)==0) |
1539 { | 1519 { |
1540 /* Handle special case Spinbutton */ | 1520 /* Handle special case Spinbutton */ |