Changeset 5236 for trunk/src/user32/win32wbasenonclient.cpp
- Timestamp:
- Feb 21, 2001, 9:51:07 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbasenonclient.cpp
r5217 r5236 1 /* $Id: win32wbasenonclient.cpp,v 1.2 8 2001-02-20 17:22:06sandervl Exp $ */1 /* $Id: win32wbasenonclient.cpp,v 1.29 2001-02-21 20:51:07 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (non-client methods) … … 1013 1013 VOID Win32BaseWindow::DoNCPaint(HRGN clip,BOOL suppress_menupaint) 1014 1014 { 1015 BOOL active = flags & WIN_NCACTIVATED;1016 HDC hdc;1017 RECT rect,rectClip,rfuzz;1018 1019 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in1020 the call to GetDCEx implying that it is allowed not to use it either.1021 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN)1022 will cause clipRgn to be deleted after ReleaseDC().1023 Now, how is the "system" supposed to tell what happened?1024 */1025 1026 dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint));1027 DecreaseLogCount();1028 1029 rect.top = rect.left = 0;1030 rect.right = rectWindow.right - rectWindow.left;1031 rect.bottom = rectWindow.bottom - rectWindow.top;1032 1033 if (clip > 1)1034 {1035 //only redraw caption1036 GetRgnBox(clip,&rectClip);1015 BOOL active = flags & WIN_NCACTIVATED; 1016 HDC hdc; 1017 RECT rect,rectClip,rfuzz; 1018 1019 /* MSDN docs are pretty idiotic here, they say app CAN use clipRgn in 1020 the call to GetDCEx implying that it is allowed not to use it either. 1021 However, the suggested GetDCEx( , DCX_WINDOW | DCX_INTERSECTRGN) 1022 will cause clipRgn to be deleted after ReleaseDC(). 1023 Now, how is the "system" supposed to tell what happened? 1024 */ 1025 1026 dprintf(("DoNCPaint %x %x %d", getWindowHandle(), clip, suppress_menupaint)); 1027 DecreaseLogCount(); 1028 1029 rect.top = rect.left = 0; 1030 rect.right = rectWindow.right - rectWindow.left; 1031 rect.bottom = rectWindow.bottom - rectWindow.top; 1032 1033 if (clip > 1) 1034 { 1035 //only redraw caption 1036 GetRgnBox(clip,&rectClip); 1037 1037 #if 1 1038 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1039 // with a region that covers the entire window (RealPlayer 7 Update 1) 1040 // As we don't need to clip anything when that occurs, this workaround 1041 // solves the problem. 1042 if(rectClip.right == getWindowWidth() && rectClip.bottom == getWindowHeight()) 1038 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1039 // with a region that covers the entire window (RealPlayer 7 Update 1) 1040 // As we don't need to clip anything when that occurs, this workaround 1041 // solves the problem. 1042 if(rectClip.right == getWindowWidth() && rectClip.bottom == getWindowHeight()) 1043 { 1044 clip = 0; 1045 rectClip = rect; 1046 } 1047 #endif 1048 } 1049 else 1043 1050 { 1044 1051 clip = 0; 1045 1052 rectClip = rect; 1046 1053 } 1047 #endif 1048 } 1049 else 1050 { 1051 clip = 0; 1052 rectClip = rect; 1053 } 1054 1055 if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | 1056 ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return; 1057 1058 SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); 1059 1060 if (HAS_BIGFRAME( dwStyle, dwExStyle)) 1061 { 1062 DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); 1063 } 1064 if (HAS_THICKFRAME( dwStyle, dwExStyle )) 1065 DrawFrame(hdc, &rect, FALSE, active ); 1066 else if (HAS_DLGFRAME( dwStyle, dwExStyle )) 1067 DrawFrame( hdc, &rect, TRUE, active ); 1068 else if (HAS_THINFRAME( dwStyle )) 1069 { 1070 SelectObject( hdc, GetStockObject(NULL_BRUSH) ); 1071 Rectangle( hdc, 0, 0, rect.right, rect.bottom ); 1072 } 1073 1074 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1075 { 1076 RECT r = rect; 1077 if (dwExStyle & WS_EX_TOOLWINDOW) 1078 { 1079 r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION); 1080 rect.top += GetSystemMetrics(SM_CYSMCAPTION); 1081 } 1054 1055 if (!(hdc = GetDCEx( Win32Hwnd, (clip > 1) ? clip : 0, DCX_USESTYLE | DCX_WINDOW | 1056 ((clip > 1) ?(DCX_INTERSECTRGN /*| DCX_KEEPCLIPRGN*/) : 0) ))) return; 1057 1058 SelectObject( hdc, GetSysColorPen(COLOR_WINDOWFRAME) ); 1059 1060 if (HAS_BIGFRAME( dwStyle, dwExStyle)) 1061 { 1062 DrawEdge (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST); 1063 } 1064 if (HAS_THICKFRAME( dwStyle, dwExStyle )) 1065 DrawFrame(hdc, &rect, FALSE, active ); 1082 1066 else 1083 { 1084 r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION); 1085 rect.top += GetSystemMetrics(SM_CYCAPTION); 1086 } 1087 if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) ) 1088 DrawCaption(hdc,&r,active); 1089 } 1090 1091 if (HAS_MENU()) 1092 { 1093 RECT r = rect; 1094 r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); 1095 1096 rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1; 1097 } 1098 1099 if (dwExStyle & WS_EX_CLIENTEDGE) 1100 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); 1101 1102 if (dwExStyle & WS_EX_STATICEDGE) 1103 DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 1104 1105 /* Draw the scroll-bars */ 1106 if (dwStyle & WS_VSCROLL) 1107 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE); 1108 if (dwStyle & WS_HSCROLL) 1109 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE); 1110 1111 /* Draw the "size-box" */ 1112 if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) 1113 { 1114 RECT r = rect; 1115 r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; 1116 r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; 1117 FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); 1118 //CB: todo: child windows have sometimes a size grip (i.e. Notepad) 1119 // WS_SIZEBOX isn't set in these cases 1120 if (!(dwStyle & WS_CHILD)) 1121 { 1122 POINT p1,p2; 1123 HPEN penDark = GetSysColorPen(COLOR_3DSHADOW); 1124 HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT); 1125 HPEN oldPen = SelectObject(hdc,penDark); 1126 INT x; 1127 1128 p1.x = r.right-1; 1129 p1.y = r.bottom; 1130 p2.x = r.right; 1131 p2.y = r.bottom-1; 1132 for (x = 0;x < 3;x++) 1133 { 1134 SelectObject(hdc,penDark); 1135 MoveToEx(hdc,p1.x,p1.y,NULL); 1136 LineTo(hdc,p2.x,p2.y); 1137 p1.x--; 1138 p2.y--; 1139 MoveToEx(hdc,p1.x,p1.y,NULL); 1140 LineTo(hdc,p2.x,p2.y); 1141 SelectObject(hdc,penWhite); 1142 p1.x--; 1143 p2.y--; 1144 MoveToEx(hdc,p1.x,p1.y,NULL); 1145 LineTo(hdc,p2.x,p2.y); 1146 p1.x -= 2; 1147 p2.y -= 2; 1148 } 1149 1150 SelectObject(hdc,oldPen); 1151 } 1152 } 1153 1154 ReleaseDC(getWindowHandle(),hdc); 1155 IncreaseLogCount(); 1156 dprintf(("**DoNCPaint %x DONE", getWindowHandle())); 1067 if (HAS_DLGFRAME( dwStyle, dwExStyle )) 1068 DrawFrame( hdc, &rect, TRUE, active ); 1069 else 1070 if (HAS_THINFRAME( dwStyle )) 1071 { 1072 SelectObject( hdc, GetStockObject(NULL_BRUSH) ); 1073 Rectangle( hdc, 0, 0, rect.right, rect.bottom ); 1074 } 1075 1076 if ((dwStyle & WS_CAPTION) == WS_CAPTION) 1077 { 1078 RECT r = rect; 1079 if (dwExStyle & WS_EX_TOOLWINDOW) 1080 { 1081 r.bottom = rect.top + GetSystemMetrics(SM_CYSMCAPTION); 1082 rect.top += GetSystemMetrics(SM_CYSMCAPTION); 1083 } 1084 else 1085 { 1086 r.bottom = rect.top + GetSystemMetrics(SM_CYCAPTION); 1087 rect.top += GetSystemMetrics(SM_CYCAPTION); 1088 } 1089 if( !clip || IntersectRect( &rfuzz, &r, &rectClip ) ) 1090 DrawCaption(hdc,&r,active); 1091 } 1092 1093 if (HAS_MENU()) 1094 { 1095 RECT r = rect; 1096 r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); 1097 1098 rect.top += MENU_DrawMenuBar(hdc,&r,Win32Hwnd,suppress_menupaint)+1; 1099 } 1100 1101 if (dwExStyle & WS_EX_CLIENTEDGE) 1102 DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST); 1103 1104 if (dwExStyle & WS_EX_STATICEDGE) 1105 DrawEdge (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST); 1106 1107 /* Draw the scroll-bars */ 1108 if (dwStyle & WS_VSCROLL) 1109 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_VERT,TRUE,TRUE); 1110 if (dwStyle & WS_HSCROLL) 1111 SCROLL_DrawScrollBar(Win32Hwnd,hdc,SB_HORZ,TRUE,TRUE); 1112 1113 /* Draw the "size-box" */ 1114 if ((dwStyle & WS_VSCROLL) && (dwStyle & WS_HSCROLL)) 1115 { 1116 RECT r = rect; 1117 r.left = r.right - GetSystemMetrics(SM_CXVSCROLL) + 1; 1118 r.top = r.bottom - GetSystemMetrics(SM_CYHSCROLL) + 1; 1119 FillRect( hdc, &r, GetSysColorBrush(COLOR_SCROLLBAR) ); 1120 //CB: todo: child windows have sometimes a size grip (i.e. Notepad) 1121 // WS_SIZEBOX isn't set in these cases 1122 if (!(dwStyle & WS_CHILD)) 1123 { 1124 POINT p1,p2; 1125 HPEN penDark = GetSysColorPen(COLOR_3DSHADOW); 1126 HPEN penWhite = GetSysColorPen(COLOR_3DHILIGHT); 1127 HPEN oldPen = SelectObject(hdc,penDark); 1128 INT x; 1129 1130 p1.x = r.right-1; 1131 p1.y = r.bottom; 1132 p2.x = r.right; 1133 p2.y = r.bottom-1; 1134 for (x = 0;x < 3;x++) 1135 { 1136 SelectObject(hdc,penDark); 1137 MoveToEx(hdc,p1.x,p1.y,NULL); 1138 LineTo(hdc,p2.x,p2.y); 1139 p1.x--; 1140 p2.y--; 1141 MoveToEx(hdc,p1.x,p1.y,NULL); 1142 LineTo(hdc,p2.x,p2.y); 1143 SelectObject(hdc,penWhite); 1144 p1.x--; 1145 p2.y--; 1146 MoveToEx(hdc,p1.x,p1.y,NULL); 1147 LineTo(hdc,p2.x,p2.y); 1148 p1.x -= 2; 1149 p2.y -= 2; 1150 } 1151 1152 SelectObject(hdc,oldPen); 1153 } 1154 } 1155 1156 ReleaseDC(getWindowHandle(),hdc); 1157 IncreaseLogCount(); 1158 dprintf(("**DoNCPaint %x DONE", getWindowHandle())); 1157 1159 } 1158 1160 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.