Mercurial > dwindows
comparison os2/dw.c @ 1433:feb0429278e2
Improvements on OS/2 to how buttons and text/status field sizes are calculated.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 05 Dec 2011 05:22:06 +0000 |
parents | fbaec6e5df63 |
children | 2cca36ec3da6 |
comparison
equal
deleted
inserted
replaced
1432:6aa94c8a91de | 1433:feb0429278e2 |
---|---|
4738 { | 4738 { |
4739 thiswidth = bmp.cx; | 4739 thiswidth = bmp.cx; |
4740 thisheight = bmp.cy; | 4740 thisheight = bmp.cy; |
4741 } | 4741 } |
4742 } | 4742 } |
4743 else if(dw_window_get_data(handle, "_dw_status")) | |
4744 { | |
4745 extrawidth = 4; | |
4746 extraheight = 4; | |
4747 } | |
4743 } | 4748 } |
4744 /* Ranged: Slider/Percent/Scrollbar */ | 4749 /* Ranged: Slider/Percent/Scrollbar */ |
4745 else if(strncmp(tmpbuf, "#38", 4)== 0 || | 4750 else if(strncmp(tmpbuf, "#38", 4)== 0 || |
4746 strncmp(tmpbuf, "#8", 3)== 0) | 4751 strncmp(tmpbuf, "#8", 3)== 0) |
4747 { | 4752 { |
4774 /* Button */ | 4779 /* Button */ |
4775 else if(strncmp(tmpbuf, "#3", 3)==0) | 4780 else if(strncmp(tmpbuf, "#3", 3)==0) |
4776 { | 4781 { |
4777 ULONG style = WinQueryWindowULong(handle, QWL_STYLE); | 4782 ULONG style = WinQueryWindowULong(handle, QWL_STYLE); |
4778 | 4783 |
4779 /* Handle bitmap buttons */ | 4784 if(style & BS_AUTOCHECKBOX || style & BS_AUTORADIOBUTTON) |
4780 if(dw_window_get_data(handle, "_dw_bitmapbutton")) | |
4781 { | |
4782 WNDPARAMS wp; | |
4783 BTNCDATA bcd; | |
4784 | |
4785 wp.fsStatus = WPM_CTLDATA; | |
4786 wp.cbCtlData = sizeof(BTNCDATA); | |
4787 wp.pCtlData = &bcd; | |
4788 | |
4789 /* Query the button's bitmap */ | |
4790 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage) | |
4791 { | |
4792 BITMAPINFOHEADER2 bmp; | |
4793 bmp.cbFix = sizeof(BITMAPINFOHEADER2); | |
4794 /* Get the parameters of the bitmap */ | |
4795 if(GpiQueryBitmapInfoHeader(bcd.hImage, &bmp)) | |
4796 { | |
4797 thiswidth = bmp.cx; | |
4798 thisheight = bmp.cy; | |
4799 } | |
4800 } | |
4801 } | |
4802 else if(style & BS_AUTOCHECKBOX || style & BS_AUTORADIOBUTTON) | |
4803 { | 4785 { |
4804 extrawidth = 24; | 4786 extrawidth = 24; |
4805 extraheight = 4; | 4787 extraheight = 4; |
4806 } | 4788 } |
4807 else | 4789 else |
4808 { | 4790 { |
4809 extrawidth = 8; | 4791 /* Handle bitmap buttons */ |
4810 extraheight = 8; | 4792 if(dw_window_get_data(handle, "_dw_bitmapbutton")) |
4793 { | |
4794 WNDPARAMS wp; | |
4795 BTNCDATA bcd; | |
4796 | |
4797 wp.fsStatus = WPM_CTLDATA; | |
4798 wp.cbCtlData = sizeof(BTNCDATA); | |
4799 wp.pCtlData = &bcd; | |
4800 | |
4801 /* Query the button's bitmap */ | |
4802 if(WinSendMsg(handle, WM_QUERYWINDOWPARAMS, (MPARAM)&wp, MPVOID) && bcd.hImage) | |
4803 { | |
4804 BITMAPINFOHEADER2 bmp; | |
4805 bmp.cbFix = sizeof(BITMAPINFOHEADER2); | |
4806 /* Get the parameters of the bitmap */ | |
4807 if(GpiQueryBitmapInfoHeader(bcd.hImage, &bmp)) | |
4808 { | |
4809 thiswidth = bmp.cx; | |
4810 thisheight = bmp.cy; | |
4811 } | |
4812 } | |
4813 } | |
4814 else | |
4815 { | |
4816 extrawidth = 4; | |
4817 extraheight = 4; | |
4818 } | |
4819 if(!(style & BS_NOBORDER)) | |
4820 { | |
4821 extrawidth += 4; | |
4822 extraheight += 4; | |
4823 } | |
4811 } | 4824 } |
4812 } | 4825 } |
4813 | 4826 |
4814 /* Set the requested sizes */ | 4827 /* Set the requested sizes */ |
4815 if(width) | 4828 if(width) |
5743 NULL); | 5756 NULL); |
5744 blah->oldproc = WinSubclassWindow(tmp, _statusproc); | 5757 blah->oldproc = WinSubclassWindow(tmp, _statusproc); |
5745 WinSetWindowPtr(tmp, QWP_USER, blah); | 5758 WinSetWindowPtr(tmp, QWP_USER, blah); |
5746 dw_window_set_font(tmp, DefaultFont); | 5759 dw_window_set_font(tmp, DefaultFont); |
5747 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 5760 dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
5761 dw_window_set_data(tmp, "_dw_status", DW_INT_TO_POINTER(1)); | |
5748 return tmp; | 5762 return tmp; |
5749 } | 5763 } |
5750 | 5764 |
5751 #ifndef MLS_LIMITVSCROLL | 5765 #ifndef MLS_LIMITVSCROLL |
5752 #define MLS_LIMITVSCROLL 0x00000080L | 5766 #define MLS_LIMITVSCROLL 0x00000080L |