Changeset 5246 for trunk/src/user32/win32wbasepos.cpp
- Timestamp:
- Feb 22, 2001, 7:18:59 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbasepos.cpp
r5236 r5246 1 /* $Id: win32wbasepos.cpp,v 1.2 0 2001-02-21 20:51:07sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.21 2001-02-22 18:18:59 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 155 155 if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE ) 156 156 { 157 params.rgrc[0] = *newWindowRect;158 if(calcValidRect)159 {157 params.rgrc[0] = *newWindowRect; 158 if(calcValidRect) 159 { 160 160 winposCopy = *winpos; 161 161 params.rgrc[1] = *oldWindowRect; … … 165 165 166 166 params.lppos = &winposCopy; 167 }168 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms );169 170 /* If the application send back garbage, ignore it */171 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom)172 {167 } 168 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 169 170 /* If the application send back garbage, ignore it */ 171 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 172 { 173 173 *newClientRect = params.rgrc[0]; 174 174 //client rectangle now in parent coordinates; convert to 'frame' coordinates 175 175 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 176 }176 } 177 177 178 178 /* FIXME: WVR_ALIGNxxx */ … … 211 211 return 0; 212 212 } 213 /*********************************************************************** 214 * WINPOS_FindIconPos 215 * 216 * Find a suitable place for an iconic window. 217 */ 218 static void WINPOS_FindIconPos( HWND hwnd, POINT &pt ) 219 { 220 RECT rectParent; 221 int x, y, xspacing, yspacing; 222 HWND hwndChild, hwndParent; 223 224 hwndParent = GetParent(hwnd); 225 if(hwndParent == 0) { 226 DebugInt3(); 227 return; 228 } 229 230 GetClientRect(hwndParent, &rectParent ); 231 if ((pt.x >= rectParent.left) && (pt.x + GetSystemMetrics(SM_CXICON) < rectParent.right) && 232 (pt.y >= rectParent.top) && (pt.y + GetSystemMetrics(SM_CYICON) < rectParent.bottom)) 233 return; /* The icon already has a suitable position */ 234 235 xspacing = GetSystemMetrics(SM_CXICONSPACING); 236 yspacing = GetSystemMetrics(SM_CYICONSPACING); 237 238 y = rectParent.bottom; 239 for (;;) 240 { 241 x = rectParent.left; 242 do 243 { 244 /* Check if another icon already occupies this spot */ 245 hwndChild = GetWindow(hwndParent, GW_CHILD); 246 247 while(hwndChild) 248 { 249 Win32BaseWindow *child = NULL; 250 RECT *pRectWindow; 251 252 child = Win32BaseWindow::GetWindowFromHandle(hwndChild); 253 if(!child) { 254 dprintf(("ERROR: WINPOS_FindIconPos, child %x not found", hwndChild)); 255 return; 256 } 257 if ((child->getStyle() & WS_MINIMIZE) && (child->getWindowHandle() != hwnd)) 258 { 259 pRectWindow = child->getWindowRect(); 260 if ((pRectWindow->left < x + xspacing) && 261 (pRectWindow->right >= x) && 262 (pRectWindow->top <= y) && 263 (pRectWindow->bottom > y - yspacing)) 264 break; /* There's a window in there */ 265 } 266 hwndChild = GetWindow(hwndChild, GW_HWNDNEXT); 267 } 268 269 if (!hwndChild) /* No window was found, so it's OK for us */ 270 { 271 pt.x = x + (xspacing - GetSystemMetrics(SM_CXICON)) / 2; 272 pt.y = y - (yspacing + GetSystemMetrics(SM_CYICON)) / 2; 273 return; 274 } 275 x += xspacing; 276 } while(x <= rectParent.right-xspacing); 277 278 y -= yspacing; 279 } 280 } 213 281 /****************************************************************************** 214 282 * WINPOS_MinMaximize … … 221 289 { 222 290 UINT swpFlags = 0; 223 POINT size ;291 POINT size, iconPos; 224 292 225 293 size.x = rectWindow.left; … … 248 316 setStyle(getStyle() | WS_MINIMIZE); 249 317 250 SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 251 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 318 iconPos.x = windowpos.ptMinPosition.x; 319 iconPos.y = windowpos.ptMinPosition.y; 320 WINPOS_FindIconPos(getWindowHandle(), iconPos); 321 SetRect(lpRect, iconPos.x, iconPos.y, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 252 322 break; 253 323
Note:
See TracChangeset
for help on using the changeset viewer.