Changeset 3662 for trunk/src/user32/win32wbasepos.cpp
- Timestamp:
- Jun 7, 2000, 4:51:33 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/win32wbasepos.cpp
r3625 r3662 1 /* $Id: win32wbasepos.cpp,v 1.1 4 2000-05-28 16:43:47sandervl Exp $ */1 /* $Id: win32wbasepos.cpp,v 1.15 2000-06-07 14:51:32 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 (nonclient/position methods) … … 37 37 #include "pmframe.h" 38 38 #include "win32wdesktop.h" 39 #include <win\hook.h> 39 40 40 41 #define DBG_LOCALLOG DBG_win32wbasepos … … 130 131 LONG result; 131 132 132 params.rgrc[0] = *newWindowRect; 133 if (calcValidRect) 134 { 135 winposCopy = *winpos; 136 params.rgrc[1] = *oldWindowRect; 137 if(getParent()) {//in parent coordinates 138 MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), (POINT *)oldClientRect, 2); 139 } 140 else {//in screen coordinates (just add window rectangle origin (already in screen coordinates)) 141 OffsetRect(oldClientRect, rectWindow.left, rectWindow.top); 142 } 143 params.rgrc[2] = *oldClientRect; 144 params.lppos = &winposCopy; 145 } 146 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 147 148 /* If the application send back garbage, ignore it */ 149 if (params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 150 { 151 *newClientRect = params.rgrc[0]; 152 //client rectangle now in screen coordinates; convert to 'frame' coordinates 153 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 154 } 155 133 /* Send WM_NCCALCSIZE message to get new client area */ 134 // if((winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE ) 135 // { 136 params.rgrc[0] = *newWindowRect; 137 if(calcValidRect) 138 { 139 winposCopy = *winpos; 140 params.rgrc[1] = *oldWindowRect; 141 //client rectangel must be in parent coordinates 142 OffsetRect(oldClientRect, rectWindow.left, rectWindow.top); 143 144 params.rgrc[2] = *oldClientRect; 145 params.lppos = &winposCopy; 146 } 147 result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)¶ms ); 148 149 /* If the application send back garbage, ignore it */ 150 if(params.rgrc[0].left <= params.rgrc[0].right && params.rgrc[0].top <= params.rgrc[0].bottom) 151 { 152 *newClientRect = params.rgrc[0]; 153 //client rectangle now in parent coordinates; convert to 'frame' coordinates 154 OffsetRect(newClientRect, -rectWindow.left, -rectWindow.top); 155 } 156 157 /* FIXME: WVR_ALIGNxxx */ 158 if(newClientRect->left != rectClient.left || newClientRect->top != rectClient.top) 159 winpos->flags &= ~SWP_NOCLIENTMOVE; 160 161 if((newClientRect->right - newClientRect->left != rectClient.right - rectClient.left) || 162 (newClientRect->bottom - newClientRect->top != rectClient.bottom - rectClient.top)) 163 winpos->flags &= ~SWP_NOCLIENTSIZE; 164 165 // } 166 // else 167 // if(!(winpos->flags & SWP_NOMOVE) && 168 // (newClientRect->left != rectClient.left || newClientRect->top != rectClient.top)) { 169 // winpos->flags &= ~SWP_NOCLIENTMOVE; 170 // } 156 171 return result; 157 172 } … … 175 190 return 0; 176 191 } 192 /****************************************************************************** 193 * WINPOS_MinMaximize 194 * 195 * Fill in lpRect and return additional flags to be used with SetWindowPos(). 196 * This function assumes that 'cmd' is different from the current window 197 * state. 198 */ 199 UINT Win32BaseWindow::MinMaximize(UINT cmd, LPRECT lpRect) 200 { 201 UINT swpFlags = 0; 202 POINT size; 203 204 size.x = rectWindow.left; 205 size.y = rectWindow.top; 206 207 if(IsRectEmpty(&windowpos.rcNormalPosition)) { 208 CopyRect(&windowpos.rcNormalPosition, &rectWindow); 209 } 210 if(!HOOK_CallHooksA(WH_CBT, HCBT_MINMAX, getWindowHandle(), cmd)) 211 { 212 if(getStyle() & WS_MINIMIZE ) 213 { 214 if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L)) 215 return (SWP_NOSIZE | SWP_NOMOVE); 216 } 217 switch( cmd ) 218 { 219 case SW_MINIMIZE: 220 if( getStyle() & WS_MAXIMIZE) 221 { 222 setFlags(getFlags() | WIN_RESTORE_MAX); 223 setStyle(getStyle() & ~WS_MAXIMIZE); 224 } 225 else setFlags(getFlags() & ~WIN_RESTORE_MAX); 226 227 setStyle(getStyle() | WS_MINIMIZE); 228 229 SetRect(lpRect, windowpos.ptMinPosition.x, windowpos.ptMinPosition.y, 230 GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) ); 231 break; 232 233 case SW_MAXIMIZE: 234 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL ); 235 236 if(getStyle() & WS_MINIMIZE ) 237 { 238 setStyle(getStyle() & ~WS_MINIMIZE); 239 } 240 setStyle(getStyle() | WS_MAXIMIZE); 241 242 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, 243 size.x, size.y ); 244 break; 245 246 case SW_RESTORE: 247 if(getStyle() & WS_MINIMIZE) 248 { 249 setStyle(getStyle() & ~WS_MINIMIZE); 250 251 if( getFlags() & WIN_RESTORE_MAX) 252 { 253 /* Restore to maximized position */ 254 GetMinMaxInfo(&size, &windowpos.ptMaxPosition, NULL, NULL); 255 setStyle(getStyle() | WS_MAXIMIZE); 256 SetRect(lpRect, windowpos.ptMaxPosition.x, windowpos.ptMaxPosition.y, size.x, size.y); 257 break; 258 } 259 } 260 else 261 if( !(getStyle() & WS_MAXIMIZE) ) 262 return 0; 263 else setStyle(getStyle() & ~WS_MAXIMIZE); 264 265 /* Restore to normal position */ 266 267 *lpRect = windowpos.rcNormalPosition; 268 lpRect->right -= lpRect->left; 269 lpRect->bottom -= lpRect->top; 270 break; 271 } 272 } 273 else swpFlags |= SWP_NOSIZE | SWP_NOMOVE; 274 275 return swpFlags; 276 } 177 277 //****************************************************************************** 178 278 //****************************************************************************** 179
Note:
See TracChangeset
for help on using the changeset viewer.