Mercurial > dwindows
comparison os2/dw.c @ 1547:2fd9ff675d79
Added autosize code for the MLE on OS/2...
Using the max for container and tree on OS/2 right now...
Figuring out the space requirements for the container is very complicated.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 13 Jan 2012 17:03:24 +0000 |
parents | 1fd3a9635c4d |
children | ef7959aae8da |
comparison
equal
deleted
inserted
replaced
1546:189b27f24d64 | 1547:2fd9ff675d79 |
---|---|
4730 { | 4730 { |
4731 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); | 4731 dw_font_text_extents_get(handle, NULL, testtext, NULL, &thisheight); |
4732 thiswidth = 150; | 4732 thiswidth = 150; |
4733 extraheight = 6; | 4733 extraheight = 6; |
4734 } | 4734 } |
4735 /* MLE, Container and Tree */ | 4735 /* MLE */ |
4736 else if(strncmp(tmpbuf, "#10", 4)==0 || strncmp(tmpbuf, "#37", 4)==0) | 4736 else if(strncmp(tmpbuf, "#10", 4)==0) |
4737 { | 4737 { |
4738 thiswidth = 500; | 4738 unsigned long bytes; |
4739 thisheight = 200; | 4739 int height, width; |
4740 char *buf, *ptr; | |
4741 int basicwidth; | |
4742 int wrap = WinSendMsg(handle, MLM_QUERYWRAP, 0,0); | |
4743 | |
4744 thisheight = 8; | |
4745 basicwidth = thiswidth = WinQuerySysValue(HWND_DESKTOP, SV_CXVSCROLL) + 8; | |
4746 | |
4747 dw_mle_get_size(handle, &bytes, NULL); | |
4748 | |
4749 ptr = buf = _alloca(bytes + 2); | |
4750 dw_mle_export(handle, buf, 0, (int)bytes); | |
4751 buf[bytes] = 0; | |
4752 strcat(buf, "\n"); | |
4753 | |
4754 /* MLE */ | |
4755 while(ptr = strstr(buf, "\n")) | |
4756 { | |
4757 ptr[0] = 0; | |
4758 width = 0; | |
4759 if(strlen(buf)) | |
4760 dw_font_text_extents_get(handle, NULL, buf, &width, &height); | |
4761 else | |
4762 dw_font_text_extents_get(handle, NULL, testtext, NULL, &height); | |
4763 | |
4764 width += basicwidth; | |
4765 | |
4766 if(wrap && width > _DW_SCROLLED_MAX_WIDTH) | |
4767 { | |
4768 thiswidth = _DW_SCROLLED_MAX_WIDTH; | |
4769 thisheight += height * (width / _DW_SCROLLED_MAX_WIDTH); | |
4770 | |
4771 } | |
4772 else | |
4773 { | |
4774 if(width > thiswidth) | |
4775 thiswidth = width > _DW_SCROLLED_MAX_WIDTH ? _DW_SCROLLED_MAX_WIDTH : width; | |
4776 } | |
4777 thisheight += height; | |
4778 buf = &ptr[1]; | |
4779 } | |
4780 | |
4781 if(thiswidth < _DW_SCROLLED_MIN_WIDTH) | |
4782 thiswidth = _DW_SCROLLED_MIN_WIDTH; | |
4783 if(thisheight < _DW_SCROLLED_MIN_HEIGHT) | |
4784 thisheight = _DW_SCROLLED_MIN_HEIGHT; | |
4785 if(thisheight > _DW_SCROLLED_MAX_HEIGHT) | |
4786 thisheight = _DW_SCROLLED_MAX_HEIGHT; | |
4787 } | |
4788 /* Container and Tree */ | |
4789 else if(strncmp(tmpbuf, "#37", 4)==0) | |
4790 { | |
4791 thiswidth = _DW_SCROLLED_MAX_WIDTH; | |
4792 thisheight = _DW_SCROLLED_MAX_HEIGHT; | |
4740 } | 4793 } |
4741 /* Button */ | 4794 /* Button */ |
4742 else if(strncmp(tmpbuf, "#3", 3)==0) | 4795 else if(strncmp(tmpbuf, "#3", 3)==0) |
4743 { | 4796 { |
4744 ULONG style = WinQueryWindowULong(handle, QWL_STYLE); | 4797 ULONG style = WinQueryWindowULong(handle, QWL_STYLE); |
5618 WC_CONTAINER, | 5671 WC_CONTAINER, |
5619 NULL, | 5672 NULL, |
5620 WS_VISIBLE | CCS_READONLY | | 5673 WS_VISIBLE | CCS_READONLY | |
5621 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | | 5674 (multi ? CCS_EXTENDSEL : CCS_SINGLESEL) | |
5622 CCS_AUTOPOSITION, | 5675 CCS_AUTOPOSITION, |
5623 0,0,2000,1000, | 5676 0,0,0,0, |
5624 NULLHANDLE, | 5677 NULLHANDLE, |
5625 HWND_TOP, | 5678 HWND_TOP, |
5626 id ? id : _GlobalID(), | 5679 id ? id : _GlobalID(), |
5627 NULL, | 5680 NULL, |
5628 NULL); | 5681 NULL); |
7662 * state: TRUE if it wraps, FALSE if it doesn't. | 7715 * state: TRUE if it wraps, FALSE if it doesn't. |
7663 */ | 7716 */ |
7664 void API dw_mle_set_word_wrap(HWND handle, int state) | 7717 void API dw_mle_set_word_wrap(HWND handle, int state) |
7665 { | 7718 { |
7666 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); | 7719 WinSendMsg(handle, MLM_SETWRAP, MPFROMLONG(state), 0); |
7667 WinSetWindowBits(handle, QWL_STYLE, state ? MLS_HSCROLL : 0, MLS_HSCROLL); | |
7668 } | 7720 } |
7669 | 7721 |
7670 /* | 7722 /* |
7671 * Sets the current cursor position of an MLE box. | 7723 * Sets the current cursor position of an MLE box. |
7672 * Parameters: | 7724 * Parameters: |