Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

calcclrc.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

void xxxCalcClientRect (PWND pwnd, LPRECT lprc, BOOL fHungRedraw)
void xxxUpdateClientRect (PWND pwnd)


Function Documentation

void xxxCalcClientRect PWND  pwnd,
LPRECT  lprc,
BOOL  fHungRedraw
 

Definition at line 21 of file calcclrc.c.

References BOOL, BYTE, CheckLock, ClrWF, CopyRect, FALSE, FWINABLE, GetCaptionHeight(), GetWindowBorders(), InflateRect(), IsWinEventNotifyDeferredOK, LOBYTE, SetWF, tagWND::spmenu, TestWF, TestwndChild, ThreadLockAlways, ThreadUnlock, TRUE, WEF_USEPWNDTHREAD, WEFCLIENTEDGE, WEFLEFTSCROLL, WFBORDERMASK, WFCAPTION, WFCEPRESENT, WFCPRESENT, WFFRAMEPRESENTMASK, WFHPRESENT, WFHSCROLL, WFMINIMIZED, WFMPRESENT, WFVPRESENT, WFVSCROLL, WFWIN40COMPAT, xxxMenuBarCompute(), and xxxWindowEvent().

Referenced by xxxDefWindowProc(), xxxRedrawHungWindow(), and xxxUpdateClientRect().

00025 { 00026 int cxFrame, yTopOld; 00027 RECT rcTemp; 00028 PMENU pMenu; 00029 TL tlpmenu; 00030 int cBorders; 00031 BOOL fEmptyClient; 00032 BYTE bFramePresent; 00033 00034 CheckLock(pwnd); 00035 UserAssert(IsWinEventNotifyDeferredOK()); 00036 00037 bFramePresent = TestWF(pwnd, WFFRAMEPRESENTMASK); 00038 00039 /* 00040 * Clear all the frame bits. NOTE: The HIBYTE of all these #defines 00041 * must stay the same for this line to work. 00042 */ 00043 ClrWF(pwnd, WFFRAMEPRESENTMASK); 00044 00045 // 00046 // We need to clear the client border bits also. Otherwise, when the 00047 // window gets really small, the client border will draw over the menu 00048 // and caption. 00049 // 00050 ClrWF(pwnd, WFCEPRESENT); 00051 00052 /* 00053 * If the window is iconic, the client area is empty. 00054 */ 00055 if (TestWF(pwnd, WFMINIMIZED)) { 00056 // SetRectEmpty(lprc); 00057 // We must make it an empty rectangle. 00058 // But, that empty rectangle should be at the top left corner of the 00059 // window rect. Else, ScreenToClient() will return bad values. 00060 lprc->right = lprc->left; 00061 lprc->bottom = lprc->top; 00062 goto CalcClientDone; 00063 } 00064 00065 // Save rect into rcTemp for easy local calculations. 00066 CopyRect(&rcTemp, lprc); 00067 00068 // Save the top so we'll know how tall the caption was 00069 yTopOld = rcTemp.top; 00070 00071 // Adjustment for the caption 00072 if (TestWF(pwnd, WFBORDERMASK) == LOBYTE(WFCAPTION)) 00073 { 00074 SetWF(pwnd, WFCPRESENT); 00075 00076 rcTemp.top += GetCaptionHeight(pwnd); 00077 } 00078 00079 // Subtract out window borders 00080 cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE); 00081 cxFrame = cBorders * SYSMETFROMPROCESS(CXBORDER); 00082 InflateRect(&rcTemp, -cxFrame, -cBorders * SYSMETFROMPROCESS(CYBORDER)); 00083 00084 if (!TestwndChild(pwnd) && (pMenu = pwnd->spmenu)) { 00085 SetWF(pwnd, WFMPRESENT); 00086 if (!fHungRedraw) { 00087 ThreadLockAlways(pMenu, &tlpmenu); 00088 rcTemp.top += xxxMenuBarCompute(pMenu, pwnd, rcTemp.top - yTopOld, 00089 cxFrame, rcTemp.right - rcTemp.left); 00090 ThreadUnlock(&tlpmenu); 00091 } 00092 } 00093 /* 00094 * We should have cleared WFMPRESENT in the else case here. Win9x doesn't do 00095 * it either. Any code checking this flag will do the wrong thing... 00096 * It seems that it's pretty unsual for apps to remove the menu.... 00097 * No code checking this flag can assume that pwnd->spmenu is not NULL -- we 00098 * would need to clear it way earlier (at unlock time) for such assumption to hold true. 00099 */ 00100 00101 // 00102 // Fix for B#1425 -- Sizing window really small used to move children's 00103 // rects because the client calculations were wrong. So we make the 00104 // bottom of the client match up with the top (the bottom of the menu 00105 // bar). 00106 // 00107 fEmptyClient = FALSE; 00108 00109 if (rcTemp.top >= rcTemp.bottom) { 00110 rcTemp.bottom = rcTemp.top; 00111 fEmptyClient = TRUE; 00112 } 00113 00114 // 00115 // BOGUS BOGUS BOGUS 00116 // Hack for Central Point PC Tools. 00117 // Possibly for M5 only. 00118 // B#8445 00119 // 00120 // They check for div-by-zero all over, but they jump to the wrong place 00121 // if a zero divisor is encountered, and end up faulting anyway. So this 00122 // code path was never tested basically. There's a period when starting 00123 // up where the window rect of their drives ribbon is empty. In Win3.x, 00124 // the client would be shrunk to account for the border it had, and it 00125 // would look like it wasn't empty because the width would be negative, 00126 // signed! So we version-switch this code, since other apps have 00127 // reported the non-emptiness as an annoying bug. 00128 // 00129 if (TestWF(pwnd, WFWIN40COMPAT) && (rcTemp.left >= rcTemp.right)) { 00130 rcTemp.right = rcTemp.left; 00131 fEmptyClient = TRUE; 00132 } 00133 00134 if (fEmptyClient) 00135 goto ClientCalcEnd; 00136 00137 // 00138 // Subtract client edge if we have space 00139 // 00140 if ( TestWF(pwnd, WEFCLIENTEDGE) && 00141 (rcTemp.right - rcTemp.left >= (2 * SYSMETFROMPROCESS(CXEDGE))) && 00142 (rcTemp.bottom - rcTemp.top >= (2 * SYSMETFROMPROCESS(CYEDGE))) ) { 00143 SetWF(pwnd, WFCEPRESENT); 00144 InflateRect(&rcTemp, -SYSMETFROMPROCESS(CXEDGE), -SYSMETFROMPROCESS(CYEDGE)); 00145 } 00146 00147 // 00148 // Subtract scrollbars 00149 // Note compatibility with 3.1: 00150 // * You don't get a horizontal scrollbar unless you have MORE 00151 // space (> ) in your client than you need for one. 00152 // * You get a vertical scrollbar if you have AT LEAST ENOUGH 00153 // space (>=) in your client for one. 00154 // 00155 if (TestWF(pwnd, WFHSCROLL) && (rcTemp.bottom - rcTemp.top > SYSMETFROMPROCESS(CYHSCROLL))) { 00156 SetWF(pwnd, WFHPRESENT); 00157 if (!fHungRedraw) { 00158 rcTemp.bottom -= SYSMETFROMPROCESS(CYHSCROLL); 00159 } 00160 } 00161 00162 if (TestWF(pwnd, WFVSCROLL) && (rcTemp.right - rcTemp.left >= SYSMETFROMPROCESS(CXVSCROLL))) { 00163 SetWF(pwnd, WFVPRESENT); 00164 if (!fHungRedraw) { 00165 #ifdef USE_MIRRORING 00166 if ((!!TestWF(pwnd, WEFLEFTSCROLL)) ^ (!!TestWF(pwnd, WEFLAYOUTRTL))) 00167 #else 00168 if (TestWF(pwnd, WEFLEFTSCROLL)) 00169 #endif 00170 rcTemp.left += SYSMETFROMPROCESS(CXVSCROLL); 00171 else 00172 rcTemp.right -= SYSMETFROMPROCESS(CXVSCROLL); 00173 } 00174 } 00175 00176 ClientCalcEnd: 00177 00178 CopyRect(lprc, &rcTemp); 00179 00180 CalcClientDone: 00181 if (FWINABLE() && (bFramePresent != TestWF(pwnd, WFFRAMEPRESENTMASK))) { 00182 xxxWindowEvent(EVENT_OBJECT_REORDER, pwnd, OBJID_WINDOW, 0, WEF_USEPWNDTHREAD); 00183 } 00184 }

void xxxUpdateClientRect PWND  pwnd  ) 
 

Definition at line 194 of file calcclrc.c.

References CopyRect, FALSE, tagWND::rcClient, tagWND::rcWindow, and xxxCalcClientRect().

00196 { 00197 RECT rc; 00198 00199 CopyRect(&rc, &pwnd->rcWindow); 00200 xxxCalcClientRect(pwnd, &rc, FALSE); 00201 CopyRect(&pwnd->rcClient, &rc); 00202 }


Generated on Sat May 15 19:42:59 2004 for test by doxygen 1.3.7