comparison win/dw.c @ 1570:d6988022c5cf

Implemented listbox sizing on OS/2 and Windows. Mac already works and GTK3 looks like it should from the code but have not tested. Will need to check into GTK2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 22 Jan 2012 10:05:16 +0000
parents 035bc006afbe
children a80ec948c3eb
comparison
equal deleted inserted replaced
1569:866d7d05d425 1570:d6988022c5cf
4504 { 4504 {
4505 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); 4505 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight);
4506 thiswidth = 50; 4506 thiswidth = 50;
4507 extraheight = 6; 4507 extraheight = 6;
4508 } 4508 }
4509 /* Listbox */
4510 else if(strnicmp(tmpbuf, LISTBOXCLASSNAME, strlen(LISTBOXCLASSNAME)+1) == 0)
4511 {
4512 char buf[1025] = {0};
4513 int x, count = dw_listbox_count(handle);
4514 int basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8;
4515
4516 thisheight = 8;
4517
4518 for(x=0;x<count;x++)
4519 {
4520 int height, width = 0;
4521
4522 dw_listbox_get_text(handle, x, buf, 1024);
4523
4524 if(strlen(buf))
4525 dw_font_text_extents_get(handle, NULL, buf, &width, &height);
4526 else
4527 dw_font_text_extents_get(handle, NULL, testtext, NULL, &height);
4528
4529 width += basicwidth;
4530
4531 if(width > thiswidth)
4532 thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width;
4533 thisheight += height;
4534 }
4535
4536 if(thiswidth < _DW_SCROLLED_MIN_WIDTH)
4537 thiswidth = _DW_SCROLLED_MIN_WIDTH;
4538 if(thisheight < _DW_SCROLLED_MIN_HEIGHT)
4539 thisheight = _DW_SCROLLED_MIN_HEIGHT;
4540 if(thisheight > _DW_SCROLLED_MAX_HEIGHT)
4541 thisheight = _DW_SCROLLED_MAX_HEIGHT;
4542 }
4509 /* Entryfields and MLE */ 4543 /* Entryfields and MLE */
4510 else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 || 4544 else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0 ||
4511 strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0) 4545 strnicmp(tmpbuf, RICHEDIT_CLASS, strlen(RICHEDIT_CLASS)+1) == 0)
4512 { 4546 {
4513 LONG style = GetWindowLong(handle, GWL_STYLE); 4547 LONG style = GetWindowLong(handle, GWL_STYLE);