Ignore:
Timestamp:
Jan 2, 2000, 8:30:47 PM (26 years ago)
Author:
cbratschi
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/new/win32wbasepos.cpp

    r2290 r2292  
    1 /* $Id: win32wbasepos.cpp,v 1.1 2000-01-01 14:57:31 cbratschi Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.2 2000-01-02 19:30:45 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    7272#define HAS_MENU()  (!(getStyle() & WS_CHILD) && (GetMenu() != 0))
    7373
    74 #if 0
    75 /***********************************************************************
    76  *           WINPOS_MinMaximize
    77  *
    78  * Fill in lpRect and return additional flags to be used with SetWindowPos().
    79  * This function assumes that 'cmd' is different from the current window
    80  * state.
    81  */
    82 UINT Win32BaseWindow::MinMaximize(UINT cmd, LPRECT lpRect )
    83 {
    84     UINT swpFlags = 0;
    85     POINT pt, size;
    86     LPINTERNALPOS lpPos;
    87 
    88     size.x = rectWindow.left; size.y = rectWindow.top;
    89     lpPos = WINPOS_InitInternalPos( wndPtr, size, &rectWindow );
    90 
    91     if (lpPos && !HOOK_CallHooks16(WH_CBT, HCBT_MINMAX, hwndSelf, cmd))
    92     {
    93     if( dwStyle & WS_MINIMIZE )
    94     {
    95         if( !SendInternalMessageA(WM_QUERYOPEN, 0, 0L ) )
    96         return (SWP_NOSIZE | SWP_NOMOVE);
    97         swpFlags |= SWP_NOCOPYBITS;
    98     }
    99     switch( cmd )
    100     {
    101         case SW_MINIMIZE:
    102          if( dwStyle & WS_MAXIMIZE)
    103          {
    104              flags |= WIN_RESTORE_MAX;
    105              dwStyle &= ~WS_MAXIMIZE;
    106                  }
    107                  else
    108              flags &= ~WIN_RESTORE_MAX;
    109              dwStyle |= WS_MINIMIZE;
    110 
    111 #if 0
    112          if( flags & WIN_NATIVE )
    113              if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, TRUE ) )
    114              swpFlags |= MINMAX_NOSWP;
    115 #endif
    116 
    117          lpPos->ptIconPos = WINPOS_FindIconPos( wndPtr, lpPos->ptIconPos );
    118 
    119          SetRect(lpRect, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
    120              GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON) );
    121          swpFlags |= SWP_NOCOPYBITS;
    122          break;
    123 
    124         case SW_MAXIMIZE:
    125                 WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL );
    126 
    127          if( dwStyle & WS_MINIMIZE )
    128          {
    129              if( flags & WIN_NATIVE )
    130              if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    131                  swpFlags |= MINMAX_NOSWP;
    132 
    133              WINPOS_ShowIconTitle( wndPtr, FALSE );
    134              dwStyle &= ~WS_MINIMIZE;
    135          }
    136                  dwStyle |= WS_MAXIMIZE;
    137 
    138          SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
    139                     size.x, size.y );
    140          break;
    141 
    142         case SW_RESTORE:
    143          if( dwStyle & WS_MINIMIZE )
    144          {
    145              if( flags & WIN_NATIVE )
    146              if( pDriver->pSetHostAttr( wndPtr, HAK_ICONICSTATE, FALSE ) )
    147                  swpFlags |= MINMAX_NOSWP;
    148 
    149              dwStyle &= ~WS_MINIMIZE;
    150              WINPOS_ShowIconTitle( wndPtr, FALSE );
    151 
    152              if( flags & WIN_RESTORE_MAX)
    153              {
    154              /* Restore to maximized position */
    155                          CONV_POINT16TO32( &lpPos->ptMaxPos, &pt );
    156                          WINPOS_GetMinMaxInfo( wndPtr, &size, &pt, NULL, NULL);
    157                          CONV_POINT32TO16( &pt, &lpPos->ptMaxPos );
    158              dwStyle |= WS_MAXIMIZE;
    159              SetRect16( lpRect, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y, size.x, size.y );
    160              break;
    161              }
    162          }
    163          else
    164              if( !(dwStyle & WS_MAXIMIZE) ) return (UINT16)(-1);
    165              else dwStyle &= ~WS_MAXIMIZE;
    166 
    167          /* Restore to normal position */
    168 
    169         *lpRect = lpPos->rectNormal;
    170          lpRect->right -= lpRect->left;
    171          lpRect->bottom -= lpRect->top;
    172 
    173          break;
    174     }
    175     } else swpFlags |= SWP_NOSIZE | SWP_NOMOVE;
    176     return swpFlags;
    177 }
    178 #endif
    17974/*******************************************************************
    18075 *           GetMinMaxInfo
     
    280175   return result;
    281176}
    282 //******************************************************************************
    283 //******************************************************************************
    284 LONG Win32BaseWindow::NCHandleCalcSize(WPARAM wParam, NCCALCSIZE_PARAMS *ncsize)
    285 {
    286   LONG    result = 0;
    287 
    288         if (getStyle() & CS_VREDRAW) result |= WVR_VREDRAW;
    289         if (getStyle() & CS_HREDRAW) result |= WVR_HREDRAW;
    290 
    291 //TODO: Wine calculates new size of client area even when window is iconic (client edges)
    292         if(!(getStyle() & (WS_MINIMIZE | WS_ICONIC)))
    293         {
    294             dprintf(("NCHandleCalcSize %x (%d,%d) (%d,%d)", getWindowHandle(), ncsize->rgrc[0].left, ncsize->rgrc[0].top, ncsize->rgrc[0].right, ncsize->rgrc[0].bottom));
    295             OSLibWinCalcFrameRect(getOS2FrameWindowHandle(), &ncsize->rgrc[0], TRUE); //frame -> client
    296             dprintf(("NCHandleCalcSize Adjusted client rect (%d,%d) (%d,%d)", ncsize->rgrc[0].left, ncsize->rgrc[0].top, ncsize->rgrc[0].right, ncsize->rgrc[0].bottom));
    297 
    298             OffsetRect(&ncsize->rgrc[0], -ncsize->rgrc[0].left, -ncsize->rgrc[0].top);
    299         }
    300 #if 0
    301 //TODO: Docs say app should return 0 when fCalcValidRects == 0; Wine doesn't do this
    302         if(wParam == 0) //fCalcValidRects
    303             return 0;
    304 #endif
    305         return result;
    306 }
    307 /***********************************************************************
    308  *           WIN_WindowNeedsWMBorder
    309  *
    310  * This method defines the rules for a window to have a WM border,
    311  * caption...  It is used for consitency purposes.
    312  */
    313 BOOL Win32BaseWindow::WindowNeedsWMBorder( DWORD style, DWORD exStyle )
    314 {
    315 //    if (!(style & WS_CHILD) && Options.managed  &&
    316     if (!(style & WS_CHILD)  &&
    317         (((style & WS_CAPTION) == WS_CAPTION) ||
    318          (style & WS_THICKFRAME)))
    319         return TRUE;
    320     return FALSE;
    321 }
    322 /******************************************************************************
    323  * NC_AdjustRectOuter95
    324  *
    325  * Computes the size of the "outside" parts of the window based on the
    326  * parameters of the client area.
    327  *
    328  + PARAMS
    329  *     LPRECT16  rect
    330  *     DWORD  style
    331  *     BOOL32  menu
    332  *     DWORD  exStyle
    333  *
    334  * NOTES
    335  *     "Outer" parts of a window means the whole window frame, caption and
    336  *     menu bar. It does not include "inner" parts of the frame like client
    337  *     edge, static edge or scroll bars.
    338  *
    339  * Revision history
    340  *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
    341  *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
    342  *
    343  *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
    344  *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
    345  *        NC_AdjustRectInner95 and added handling of Win95 styles.
    346  *
    347  *     28-Jul-1999 Ove Kåven (ovek@arcticnet.no)
    348  *        Streamlined window style checks.
    349  *
    350  *****************************************************************************/
    351 void Win32BaseWindow::NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
    352 {
    353     if(style & WS_ICONIC) return;
    354 
    355     /* Decide if the window will be managed (see CreateWindowEx) */
    356 //    if (!WindowNeedsWMBorder(style, exStyle))
    357 //    {
    358        if (HAS_THICKFRAME( style, exStyle ))
    359             InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
    360         else
    361         if (HAS_DLGFRAME( style, exStyle ))
    362             InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
    363         else
    364         if (HAS_THINFRAME( style ))
    365             InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
    366 
    367         if ((style & WS_CAPTION) == WS_CAPTION)
    368         {
    369             if (exStyle & WS_EX_TOOLWINDOW)
    370                 rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
    371             else
    372                 rect->top -= GetSystemMetrics(SM_CYCAPTION);
    373         }
    374 //    }
    375 
    376     if (menu)
    377         rect->top -= GetSystemMetrics(SM_CYMENU);
    378 }
    379 /******************************************************************************
    380  * NC_AdjustRectInner95
    381  *
    382  * Computes the size of the "inside" part of the window based on the
    383  * parameters of the client area.
    384  *
    385  + PARAMS
    386  *     LPRECT16 rect
    387  *     DWORD    style
    388  *     DWORD    exStyle
    389  *
    390  * NOTES
    391  *     "Inner" part of a window means the window frame inside of the flat
    392  *     window frame. It includes the client edge, the static edge and the
    393  *     scroll bars.
    394  *
    395  * Revision history
    396  *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
    397  *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
    398  *
    399  *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
    400  *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
    401  *        NC_AdjustRectInner95 and added handling of Win95 styles.
    402  *
    403  *****************************************************************************/
    404 void Win32BaseWindow::NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle)
    405 {
    406     if(style & WS_ICONIC) return;
    407 
    408     if (exStyle & WS_EX_CLIENTEDGE)
    409         InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
    410 
    411     if (exStyle & WS_EX_STATICEDGE)
    412         InflateRect(rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
    413 
    414     if (style & WS_VSCROLL) rect->right  += GetSystemMetrics(SM_CXVSCROLL);
    415     if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
    416 }
    417177/***********************************************************************
    418178 *           WINPOS_HandleWindowPosChanging16
Note: See TracChangeset for help on using the changeset viewer.