Mercurial > dwindows
comparison win/dw.c @ 1729:570a03dabdc2
Slight improvement... check the flat flags and adjust the required
size and minimum sizes for the widget.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 15 May 2012 06:49:27 +0000 |
parents | aa2bd0d8bf27 |
children | 3828f3faec8c |
comparison
equal
deleted
inserted
replaced
1728:aa2bd0d8bf27 | 1729:570a03dabdc2 |
---|---|
1509 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) | 1509 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) |
1510 { | 1510 { |
1511 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); | 1511 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); |
1512 int thiswidth = 20, thisheight = 20, minsize = 24; | 1512 int thiswidth = 20, thisheight = 20, minsize = 24; |
1513 | 1513 |
1514 if(imlist) | |
1515 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | |
1516 | |
1514 /* If we are flat the size can be smaller */ | 1517 /* If we are flat the size can be smaller */ |
1515 if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT) | 1518 if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT) |
1516 minsize = 20; | 1519 minsize = 20; |
1517 | 1520 else |
1518 if(imlist) | 1521 { |
1519 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | 1522 thiswidth += 4; |
1523 thisheight += 4; | |
1524 } | |
1520 | 1525 |
1521 if(thiswidth < minsize) | 1526 if(thiswidth < minsize) |
1522 thiswidth = minsize; | 1527 thiswidth = minsize; |
1523 if(thisheight < minsize) | 1528 if(thisheight < minsize) |
1524 thisheight = minsize; | 1529 thisheight = minsize; |
4660 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) | 4665 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) |
4661 { | 4666 { |
4662 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); | 4667 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); |
4663 int minsize = 24; | 4668 int minsize = 24; |
4664 | 4669 |
4670 if(imlist) | |
4671 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | |
4672 | |
4665 /* If we are flat the size can be smaller */ | 4673 /* If we are flat the size can be smaller */ |
4666 if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT) | 4674 if(GetWindowLong(handle, GWL_STYLE) & TBSTYLE_FLAT) |
4667 minsize = 20; | 4675 minsize = 20; |
4676 else | |
4677 { | |
4678 thiswidth += 4; | |
4679 thisheight += 4; | |
4680 } | |
4668 | 4681 |
4669 if(imlist) | |
4670 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | |
4671 | |
4672 if(thiswidth < minsize) | 4682 if(thiswidth < minsize) |
4673 thiswidth = minsize; | 4683 thiswidth = minsize; |
4674 if(thisheight < minsize) | 4684 if(thisheight < minsize) |
4675 thisheight = minsize; | 4685 thisheight = minsize; |
4676 } | 4686 } |