Changeset 1525 for trunk/src/user32/button.cpp
- Timestamp:
- Oct 30, 1999, 8:40:49 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/button.cpp
r1433 r1525 1 /* $Id: button.cpp,v 1.1 5 1999-10-24 22:56:00 sandervlExp $ */1 /* $Id: button.cpp,v 1.16 1999-10-30 18:40:43 cbratschi Exp $ */ 2 2 /* File: button.cpp -- Button type widgets 3 3 * … … 626 626 } 627 627 628 static INT BUTTON_GetTextFormat(DWORD dwStyle,INT defHorz,INT defVert) 629 { 630 INT format = 0; 631 632 if (dwStyle & BS_LEFT) format = DT_LEFT; 633 else if (dwStyle & BS_CENTER) format = DT_CENTER; 634 else if (dwStyle & BS_RIGHT) format = DT_RIGHT; 635 else format = defHorz; 636 637 if (dwStyle & BS_TOP) format |= DT_TOP; 638 else if (dwStyle & BS_VCENTER) format |= DT_VCENTER; 639 else if (dwStyle & BS_BOTTOM) format |= DT_BOTTOM; 640 else format |= defVert; 641 642 if (!(dwStyle & BS_MULTILINE)) format |= DT_SINGLELINE; 643 644 return format; 645 } 646 628 647 /********************************************************************** 629 648 * This method will actually do the drawing of the pushbutton … … 692 711 if (textLen > 0 && (!(dwStyle & (BS_ICON|BS_BITMAP)))) 693 712 { 713 INT format = BUTTON_GetTextFormat(dwStyle,DT_CENTER,DT_VCENTER); 714 694 715 textLen++; 695 716 text = (char*)malloc(textLen); 696 717 GetWindowTextA(hwnd,text,textLen); 697 718 698 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); else719 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,format); else 699 720 { 700 SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) ); 701 DrawTextA( hDC, text, -1, &rc, 702 DT_SINGLELINE | DT_CENTER | DT_VCENTER ); 721 SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT)); 722 DrawTextA(hDC,text,-1,&rc,format); 703 723 /* do we have the focus? 704 724 * Win9x draws focus last with a size prop. to the button … … 903 923 if( text && action != ODA_SELECT ) 904 924 { 905 906 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rtext,DT_SINGLELINE | DT_VCENTER); 907 else DrawTextA(hDC,text,-1,&rtext,DT_SINGLELINE | DT_VCENTER); 925 INT format = BUTTON_GetTextFormat(dwStyle,DT_TOP,DT_VCENTER); 926 927 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rtext,format); 928 else DrawTextA(hDC,text,-1,&rtext,format); 908 929 } 909 930 } … … 916 937 SetRectEmpty(&rbox); 917 938 if(textLen > 0) 918 DrawTextA( hDC, text, -1, &rbox, 919 DT_SINGLELINE | DT_CALCRECT ); 939 DrawTextA(hDC,text,-1,&rbox,DT_SINGLELINE | DT_CALCRECT); 920 940 textLen = rbox.bottom - rbox.top; 921 941 delta = ((rtext.bottom - rtext.top) - textLen)/2; … … 943 963 parent = GetParent(hwnd); 944 964 /* assure that starting control is not disabled or invisible */ 945 //start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE );965 start = sibling = GetNextDlgGroupItem( parent, hwnd, TRUE ); 946 966 //@YD: bugfix 947 start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE ); 967 //CB: doesn't work! 968 //start = sibling = GetNextDlgGroupItem( parent, hwnd, FALSE ); 948 969 do 949 970 { … … 987 1008 if (textLen > 0) 988 1009 { 989 textLen++; 990 text = (char*)malloc(textLen); 991 GetWindowTextA(hwnd,text,textLen); 992 if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); 993 rc.left += 10; 994 995 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,DT_SINGLELINE | DT_NOCLIP); else 996 { 997 SetTextColor( hDC, GetSysColor(COLOR_BTNTEXT) ); 998 DrawTextA( hDC, text, -1, &rc, 999 DT_SINGLELINE | DT_NOCLIP ); 1000 } 1001 1002 free(text); 1010 INT format = BUTTON_GetTextFormat(dwStyle,DT_LEFT,DT_TOP) | DT_NOCLIP | DT_SINGLELINE; 1011 1012 textLen++; 1013 text = (char*)malloc(textLen); 1014 GetWindowTextA(hwnd,text,textLen); 1015 if (infoPtr->hFont) SelectObject( hDC, infoPtr->hFont ); 1016 rc.left += 10; 1017 1018 if (dwStyle & WS_DISABLED) DrawDisabledText(hDC,text,&rc,format); else 1019 { 1020 SetTextColor(hDC,GetSysColor(COLOR_BTNTEXT)); 1021 DrawTextA(hDC,text,-1,&rc,format); 1022 } 1023 1024 free(text); 1003 1025 } 1004 1026 }
Note:
See TracChangeset
for help on using the changeset viewer.