Changeset 992 for trunk/src/user32
- Timestamp:
- Sep 20, 1999, 9:17:58 PM (26 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/button.cpp
r990 r992 1 /* $Id: button.cpp,v 1. 2 1999-09-20 16:19:54 cbratschiExp $ */1 /* $Id: button.cpp,v 1.3 1999-09-20 19:17:57 sandervl Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 612 612 */ 613 613 BUTTON_DrawPushButton(hwnd, 614 615 616 614 hDC, 615 action, 616 bHighLighted); 617 617 } 618 618 … … 649 649 { 650 650 Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); 651 651 InflateRect( &rc, -1, -1 ); 652 652 } 653 653 … … 693 693 /* don't write gray text on gray background */ 694 694 PaintGrayOnGray( hDC,infoPtr->hFont,&rc,text, 695 695 DT_CENTER | DT_VCENTER ); 696 696 else 697 697 { … … 702 702 DT_SINGLELINE | DT_CENTER | DT_VCENTER ); 703 703 /* do we have the focus? 704 705 704 * Win9x draws focus last with a size prop. to the button 705 */ 706 706 } 707 707 free(text); 708 708 } 709 709 if ( ((dwStyle & BS_ICON) || (dwStyle & BS_BITMAP) ) && 710 711 { 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 710 (infoPtr->hImage != NULL) ) 711 { 712 int yOffset, xOffset; 713 int imageWidth, imageHeight; 714 715 /* 716 * We extract the size of the image from the handle. 717 */ 718 if (dwStyle & BS_ICON) 719 { 720 ICONINFO iconInfo; 721 BITMAP bm; 722 723 GetIconInfo((HICON)infoPtr->hImage, &iconInfo); 724 GetObjectA (iconInfo.hbmColor, sizeof(BITMAP), &bm); 725 726 imageWidth = bm.bmWidth; 727 imageHeight = bm.bmHeight; 728 728 729 729 DeleteObject(iconInfo.hbmColor); 730 730 DeleteObject(iconInfo.hbmMask); 731 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 732 } 733 else 734 { 735 BITMAP bm; 736 737 GetObjectA (infoPtr->hImage, sizeof(BITMAP), &bm); 738 739 imageWidth = bm.bmWidth; 740 imageHeight = bm.bmHeight; 741 } 742 743 /* Center the bitmap */ 744 xOffset = (((rc.right - rc.left) - 2*xBorderOffset) - imageWidth ) / 2; 745 yOffset = (((rc.bottom - rc.top) - 2*yBorderOffset) - imageHeight) / 2; 746 747 /* If the image is too big for the button then create a region*/ 748 748 if(xOffset < 0 || yOffset < 0) 749 749 { 750 750 HRGN hBitmapRgn = NULL; 751 751 hBitmapRgn = CreateRectRgn( … … 754 754 SelectClipRgn(hDC, hBitmapRgn); 755 755 DeleteObject(hBitmapRgn); 756 } 757 758 /* Let minimum 1 space from border */ 759 xOffset++, yOffset++; 760 761 /* 762 * Draw the image now. 763 */ 764 if (dwStyle & BS_ICON) 756 } 757 758 /* Let minimum 1 space from border */ 759 xOffset++, yOffset++; 760 761 /* 762 * Draw the image now. 763 */ 764 if (dwStyle & BS_ICON) 765 { 766 DrawIcon(hDC, 767 rc.left + xOffset, rc.top + yOffset, 768 (HICON)infoPtr->hImage); 769 } 770 else 765 771 { 766 DrawIcon(hDC, 767 rc.left + xOffset, rc.top + yOffset, 768 (HICON)infoPtr->hImage); 769 } 770 else 771 { 772 HDC hdcMem; 773 774 hdcMem = CreateCompatibleDC (hDC); 775 SelectObject (hdcMem, (HBITMAP)infoPtr->hImage); 776 BitBlt(hDC, 777 rc.left + xOffset, 778 rc.top + yOffset, 779 imageWidth, imageHeight, 780 hdcMem, 0, 0, SRCCOPY); 781 782 DeleteDC (hdcMem); 783 } 772 HDC hdcMem; 773 774 hdcMem = CreateCompatibleDC (hDC); 775 SelectObject (hdcMem, (HBITMAP)infoPtr->hImage); 776 BitBlt(hDC, 777 rc.left + xOffset, 778 rc.top + yOffset, 779 imageWidth, imageHeight, 780 hdcMem, 0, 0, SRCCOPY); 781 782 DeleteDC (hdcMem); 783 } 784 784 785 785 if(xOffset < 0 || yOffset < 0) … … 830 830 831 831 rect=*rc; 832 SetBkMode(hDC,TRANSPARENT);833 832 DrawTextA( hDC, text, -1, &rect, DT_SINGLELINE | DT_CALCRECT); 834 833 /* now text width and height are in rect.right and rect.bottom */ … … 876 875 { 877 876 BOOL bHighLighted = ((infoPtr->state & BUTTON_HIGHLIGHTED) || 878 877 (infoPtr->state & BUTTON_CHECKED)); 879 878 880 879 BUTTON_DrawPushButton(hwnd, 881 882 883 884 880 hDC, 881 action, 882 bHighLighted); 883 return; 885 884 } 886 885 … … 896 895 * particular case and the background is not painted at all. 897 896 */ 897 //SvL: 20/09/99: This works well for us. Now the background of 898 // the dialog button strings in Solitaire is gray 899 SendMessageA(GetParent(hwnd),WM_CTLCOLORBTN,hDC,hwnd); 898 900 899 901 hBrush = GetSysColorBrush(COLOR_BTNFACE); … … 951 953 if (dwStyle & WS_DISABLED) 952 954 SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) ); 953 SetBkMode(hDC,TRANSPARENT);954 955 DrawTextA( hDC, text, -1, &rtext, 955 956 DT_SINGLELINE | DT_VCENTER ); … … 1042 1043 SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) ); 1043 1044 rc.left += 10; 1044 SetBkMode(hDC,TRANSPARENT);1045 1045 DrawTextA( hDC, text, -1, &rc, DT_SINGLELINE | DT_NOCLIP ); 1046 1046 free(text); -
trunk/src/user32/static.cpp
r989 r992 1 /* $Id: static.cpp,v 1. 2 1999-09-20 16:04:44 cbratschiExp $ */1 /* $Id: static.cpp,v 1.3 1999-09-20 19:17:58 sandervl Exp $ */ 2 2 /* 3 3 * Static control … … 92 92 93 93 if (hBitmap && GetObjectType(hBitmap) != OBJ_BITMAP) { 94 95 94 //ERR("huh? hBitmap!=0, but not bitmap\n"); 95 return 0; 96 96 } 97 97 hOldBitmap = infoPtr->hIcon; … … 102 102 GetObjectA(hBitmap, sizeof(bm), &bm); 103 103 SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight, 104 104 SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); 105 105 /* CB: alternative code, if necessary 106 106 HDC hdc = GetDC(hwnd); … … 113 113 } 114 114 ReleaseDC(hwnd,hdc); 115 */ 116 115 */ 116 117 117 } 118 118 return hOldBitmap; … … 471 471 text = (char*)malloc(textLen); 472 472 GetWindowTextA(hwnd,text,textLen); 473 SetBkMode(hdc,TRANSPARENT);474 473 DrawTextA( hdc, text, -1, &rc, wFormat ); 475 474 free(text); … … 546 545 if (infoPtr->hIcon) { 547 546 BITMAP bm; 548 547 SIZE sz; 549 548 550 549 if(GetObjectType(infoPtr->hIcon) != OBJ_BITMAP) 551 550 return; 552 551 if (!(hMemDC = CreateCompatibleDC( hdc ))) return; 553 554 555 556 557 558 559 552 GetObjectA(infoPtr->hIcon, sizeof(bm), &bm); 553 GetBitmapDimensionEx(infoPtr->hIcon, &sz); 554 oldbitmap = SelectObject(hMemDC, infoPtr->hIcon); 555 BitBlt(hdc, sz.cx, sz.cy, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, 556 SRCCOPY); 557 SelectObject(hMemDC, oldbitmap); 558 DeleteDC(hMemDC); 560 559 } 561 560 } -
trunk/src/user32/win32wbase.cpp
r985 r992 1 /* $Id: win32wbase.cpp,v 1. 3 1999-09-19 18:33:32sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.4 1999-09-20 19:17:58 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 1084 1084 return(TRUE); 1085 1085 1086 //SvL: Set background color to default button color (not window (white)) 1087 case WM_CTLCOLORBTN: 1088 SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE)); 1089 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 1090 return GetSysColorBrush(COLOR_BTNFACE); 1091 1092 //SvL: Set background color to default dialog color if window is dialog 1093 case WM_CTLCOLORDLG: 1094 case WM_CTLCOLORSTATIC: 1095 if(IsDialog()) { 1096 SetBkColor((HDC)wParam, GetSysColor(COLOR_BTNFACE)); 1097 SetTextColor((HDC)wParam, GetSysColor(COLOR_WINDOWTEXT)); 1098 return GetSysColorBrush(COLOR_BTNFACE); 1099 } 1100 //no break 1101 1086 1102 case WM_CTLCOLORMSGBOX: 1087 1103 case WM_CTLCOLOREDIT: 1088 1104 case WM_CTLCOLORLISTBOX: 1089 case WM_CTLCOLORBTN:1090 case WM_CTLCOLORDLG:1091 case WM_CTLCOLORSTATIC:1092 1105 case WM_CTLCOLORSCROLLBAR: 1093 1106 SetBkColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
Note:
See TracChangeset
for help on using the changeset viewer.