Mercurial > dwindows
comparison win/dw.c @ 1541:1c6593b0ce45
Initial scrolled minimum and maximum code on Windows... MLE implemented, container to go.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 13 Jan 2012 02:02:28 +0000 |
parents | a4ecef1980db |
children | edbc7405ed4d |
comparison
equal
deleted
inserted
replaced
1540:282727422698 | 1541:1c6593b0ce45 |
---|---|
4475 extraheight = 6; | 4475 extraheight = 6; |
4476 } | 4476 } |
4477 /* Entryfields and MLE */ | 4477 /* Entryfields and MLE */ |
4478 else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0) | 4478 else if(strnicmp(tmpbuf, EDITCLASSNAME, strlen(EDITCLASSNAME)+1) == 0) |
4479 { | 4479 { |
4480 if((GetWindowLong(handle, GWL_STYLE) & ES_MULTILINE)) | 4480 LONG style = GetWindowLong(handle, GWL_STYLE); |
4481 { | 4481 if((style & ES_MULTILINE)) |
4482 { | |
4483 unsigned long bytes; | |
4484 int height, width; | |
4485 char *buf, *ptr; | |
4486 int basicwidth; | |
4487 | |
4488 if(style & ES_AUTOHSCROLL) | |
4489 thisheight = GetSystemMetrics(SM_CYHSCROLL) + 8; | |
4490 else | |
4491 thisheight = 8; | |
4492 basicwidth = thiswidth = GetSystemMetrics(SM_CXVSCROLL) + 8; | |
4493 | |
4494 dw_mle_get_size(handle, &bytes, NULL); | |
4495 | |
4496 ptr = buf = _alloca(bytes + 2); | |
4497 dw_mle_export(handle, buf, 0, (int)bytes); | |
4498 strcat(buf, "\n"); | |
4499 | |
4482 /* MLE */ | 4500 /* MLE */ |
4483 thiswidth = 500; | 4501 while(ptr = strstr(buf, "\n")) |
4484 thisheight = 200; | 4502 { |
4503 ptr[0] = 0; | |
4504 width = 0; | |
4505 if(strlen(buf)) | |
4506 dw_font_text_extents_get(handle, NULL, buf, &width, &height); | |
4507 else | |
4508 dw_font_text_extents_get(handle, NULL, testtext, NULL, &height); | |
4509 | |
4510 width += basicwidth; | |
4511 | |
4512 if(!(style & ES_AUTOHSCROLL) && width > _DW_SCROLLED_MAX_WIDTH) | |
4513 { | |
4514 thiswidth = _DW_SCROLLED_MAX_WIDTH; | |
4515 thisheight += height * (width / _DW_SCROLLED_MAX_WIDTH); | |
4516 } | |
4517 else | |
4518 { | |
4519 if(width > thiswidth) | |
4520 thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width; | |
4521 } | |
4522 thisheight += height; | |
4523 buf = &ptr[1]; | |
4524 } | |
4525 | |
4526 if(thiswidth < _DW_SCROLLED_MIN_WIDTH) | |
4527 thiswidth = _DW_SCROLLED_MIN_WIDTH; | |
4528 if(thisheight < _DW_SCROLLED_MIN_HEIGHT) | |
4529 thisheight = _DW_SCROLLED_MIN_HEIGHT; | |
4530 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) | |
4531 thisheight = _DW_SCROLLED_MAX_HEIGHT; | |
4485 } | 4532 } |
4486 else | 4533 else |
4487 { | 4534 { |
4488 /* Entryfield */ | 4535 /* Entryfield */ |
4489 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); | 4536 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); |
4493 } | 4540 } |
4494 /* Container and Tree */ | 4541 /* Container and Tree */ |
4495 else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || | 4542 else if(strnicmp(tmpbuf, WC_LISTVIEW, strlen(WC_LISTVIEW)+1)== 0 || |
4496 strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) | 4543 strnicmp(tmpbuf, WC_TREEVIEW, strlen(WC_TREEVIEW)+1)== 0) |
4497 { | 4544 { |
4498 thiswidth = 500; | 4545 thiswidth = _DW_SCROLLED_MAX_WIDTH; |
4499 thisheight = 200; | 4546 thisheight = _DW_SCROLLED_MAX_HEIGHT; |
4500 } | 4547 } |
4501 /* Buttons */ | 4548 /* Buttons */ |
4502 else if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) | 4549 else if(strnicmp(tmpbuf, BUTTONCLASSNAME, strlen(BUTTONCLASSNAME)+1) == 0) |
4503 { | 4550 { |
4504 ULONG style = GetWindowLong(handle, GWL_STYLE); | 4551 ULONG style = GetWindowLong(handle, GWL_STYLE); |
7832 * handle: Handle to the MLE. | 7879 * handle: Handle to the MLE. |
7833 * state: TRUE if it wraps, FALSE if it doesn't. | 7880 * state: TRUE if it wraps, FALSE if it doesn't. |
7834 */ | 7881 */ |
7835 void API dw_mle_set_word_wrap(HWND handle, int state) | 7882 void API dw_mle_set_word_wrap(HWND handle, int state) |
7836 { | 7883 { |
7837 /* If ES_AUTOHSCROLL is not set and there is not | 7884 /* If ES_AUTOHSCROLL is not set and there is no |
7838 * horizontal scrollbar it word wraps. | 7885 * horizontal scrollbar it word wraps. |
7839 */ | 7886 */ |
7840 if(state) | 7887 if(state) |
7841 dw_window_set_style(handle, 0, ES_AUTOHSCROLL); | 7888 dw_window_set_style(handle, 0, ES_AUTOHSCROLL); |
7842 else | 7889 else |