Mercurial > dwindows
comparison win/dw.c @ 1724:48983a2f839f
Toolbar bitmap buttons don't seem to draw properly smaller than 20x20 on Windows...
So clamp the minimum size for them at 20 pixels.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 14 May 2012 21:36:28 +0000 |
parents | d55227360864 |
children | 2e0f87ec24fe |
comparison
equal
deleted
inserted
replaced
1723:d55227360864 | 1724:48983a2f839f |
---|---|
1502 #ifdef TOOLBAR | 1502 #ifdef TOOLBAR |
1503 /* Bitmap Buttons */ | 1503 /* Bitmap Buttons */ |
1504 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) | 1504 else if(_tcsnicmp(tmpbuf, TOOLBARCLASSNAME, _tcslen(TOOLBARCLASSNAME)+1) == 0) |
1505 { | 1505 { |
1506 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); | 1506 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); |
1507 int thiswidth = 16, thisheight = 16; | 1507 int thiswidth = 20, thisheight = 20; |
1508 | 1508 |
1509 if(imlist) | 1509 if(imlist) |
1510 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | 1510 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); |
1511 | |
1512 if(thiswidth < 20) | |
1513 thiswidth = 20; | |
1514 if(thisheight < 20) | |
1515 thisheight = 20; | |
1511 | 1516 |
1512 MoveWindow(handle, thiswidth < width ? currentx + pad + ((width-thiswidth)/2) : currentx + pad, | 1517 MoveWindow(handle, thiswidth < width ? currentx + pad + ((width-thiswidth)/2) : currentx + pad, |
1513 thisheight < height ? currenty + pad + ((height-thisheight)/2) : currenty + pad, | 1518 thisheight < height ? currenty + pad + ((height-thisheight)/2) : currenty + pad, |
1514 thiswidth < width ? thiswidth : width, thisheight < height ? thisheight : height, FALSE); | 1519 thiswidth < width ? thiswidth : width, thisheight < height ? thisheight : height, FALSE); |
1515 } | 1520 } |
4646 { | 4651 { |
4647 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); | 4652 HIMAGELIST imlist = (HIMAGELIST)SendMessage(handle, TB_GETIMAGELIST, 0, 0); |
4648 | 4653 |
4649 if(imlist) | 4654 if(imlist) |
4650 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); | 4655 ImageList_GetIconSize(imlist, &thiswidth, &thisheight); |
4656 | |
4657 if(thiswidth < 20) | |
4658 thiswidth = 20; | |
4659 if(thisheight < 20) | |
4660 thisheight = 20; | |
4651 } | 4661 } |
4652 #endif | 4662 #endif |
4653 /* Listbox */ | 4663 /* Listbox */ |
4654 else if(_tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1) == 0) | 4664 else if(_tcsnicmp(tmpbuf, LISTBOXCLASSNAME, _tcslen(LISTBOXCLASSNAME)+1) == 0) |
4655 { | 4665 { |
6189 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | | 6199 tmp = CreateWindowEx(0L, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_AUTOSIZE | CCS_NORESIZE | |
6190 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); | 6200 CCS_NOPARENTALIGN | CCS_NODIVIDER, 0, 0, 100, 30, DW_HWND_OBJECT, (HMENU)id, DWInstance, NULL); |
6191 | 6201 |
6192 /* Insert the single bitmap and button into the toolbar */ | 6202 /* Insert the single bitmap and button into the toolbar */ |
6193 SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); | 6203 SendMessage(tmp, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); |
6204 SendMessage(tmp, TB_SETBUTTONSIZE, 0, MAKELPARAM(bmi.bmWidth, bmi.bmHeight)); | |
6194 SendMessage(tmp, TB_SETPADDING, 0, 0); | 6205 SendMessage(tmp, TB_SETPADDING, 0, 0); |
6195 SendMessage(tmp, TB_SETIMAGELIST, 0, (LPARAM)imlist); | 6206 SendMessage(tmp, TB_SETIMAGELIST, 0, (LPARAM)imlist); |
6196 SendMessage(tmp, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)imlist); | 6207 SendMessage(tmp, TB_SETDISABLEDIMAGELIST, 0, (LPARAM)imlist); |
6197 SendMessage(tmp, TB_ADDBUTTONS, 1, (LONG) &tbButtons); | 6208 SendMessage(tmp, TB_ADDBUTTONS, 1, (LONG) &tbButtons); |
6198 | 6209 |