Ignore:
Timestamp:
Oct 17, 1999, 5:46:10 PM (26 years ago)
Author:
sandervl
Message:

Dialog fixes + ported Wine apis

File:
1 edited

Legend:

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

    r1322 r1336  
    1 /* $Id: win32wbasepos.cpp,v 1.2 1999-10-16 14:51:43 sandervl Exp $ */
     1/* $Id: win32wbasepos.cpp,v 1.3 1999-10-17 15:46:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (nonclient/position methods)
     
    1111 *
    1212 * TODO: Not thread/process safe
     13 *
     14 * Wine code based on build 990815
    1315 *
    1416 * Project Odin Software License can be found in LICENSE.TXT
     
    4143#include "win32wdesktop.h"
    4244
     45  /* Some useful macros */
    4346#define HAS_DLGFRAME(style,exStyle) \
    4447    (((exStyle) & WS_EX_DLGMODALFRAME) || \
    45      (((style) & WS_DLGFRAME) && !((style) & WS_BORDER)))
    46 
    47 #define HAS_THICKFRAME(style) \
     48     (((style) & WS_DLGFRAME) && !((style) & WS_THICKFRAME)))
     49
     50#define HAS_THICKFRAME(style,exStyle) \
    4851    (((style) & WS_THICKFRAME) && \
    49      !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
     52     !((exStyle) & WS_EX_DLGMODALFRAME))
     53
     54#define HAS_THINFRAME(style) \
     55    (((style) & WS_BORDER) || !((style) & (WS_CHILD | WS_POPUP)))
     56
     57#define HAS_BIGFRAME(style,exStyle) \
     58    (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \
     59     ((exStyle) & WS_EX_DLGMODALFRAME))
     60
     61#define HAS_ANYFRAME(style,exStyle) \
     62    (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \
     63     ((exStyle) & WS_EX_DLGMODALFRAME) || \
     64     !((style) & (WS_CHILD | WS_POPUP)))
    5065
    5166#define HAS_3DFRAME(exStyle) \
     
    194209    {
    195210        xinc = yinc = 0;
    196         if (HAS_THICKFRAME(dwStyle))
     211        if (HAS_THICKFRAME(dwStyle, dwExStyle))
    197212        {
    198213            xinc += GetSystemMetrics(SM_CXFRAME);
     
    284299            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));
    285300
    286 #if 0
    287             //relative to frame -> relative to itself
    288             ncsize->rgrc[0].right  -= ncsize->rgrc[0].left;
    289             ncsize->rgrc[0].left    = 0;
    290             ncsize->rgrc[0].bottom -= ncsize->rgrc[0].top;
    291             ncsize->rgrc[0].top     = 0;
    292 #endif
     301            OffsetRect(&ncsize->rgrc[0], -ncsize->rgrc[0].left, -ncsize->rgrc[0].top);
    293302        }
    294303#if 0
     
    299308        return result;
    300309}
     310/***********************************************************************
     311 *           WIN_WindowNeedsWMBorder
     312 *
     313 * This method defines the rules for a window to have a WM border,
     314 * caption...  It is used for consitency purposes.
     315 */
     316BOOL Win32BaseWindow::WindowNeedsWMBorder( DWORD style, DWORD exStyle )
     317{
     318//    if (!(style & WS_CHILD) && Options.managed  &&
     319    if (!(style & WS_CHILD)  &&
     320        (((style & WS_CAPTION) == WS_CAPTION) ||
     321         (style & WS_THICKFRAME)))
     322        return TRUE;
     323    return FALSE;
     324}
     325/******************************************************************************
     326 * NC_AdjustRectOuter95
     327 *
     328 * Computes the size of the "outside" parts of the window based on the
     329 * parameters of the client area.
     330 *
     331 + PARAMS
     332 *     LPRECT16  rect
     333 *     DWORD  style
     334 *     BOOL32  menu
     335 *     DWORD  exStyle
     336 *
     337 * NOTES
     338 *     "Outer" parts of a window means the whole window frame, caption and
     339 *     menu bar. It does not include "inner" parts of the frame like client
     340 *     edge, static edge or scroll bars.
     341 *
     342 * Revision history
     343 *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
     344 *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
     345 *
     346 *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
     347 *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
     348 *        NC_AdjustRectInner95 and added handling of Win95 styles.
     349 *
     350 *     28-Jul-1999 Ove Kåven (ovek@arcticnet.no)
     351 *        Streamlined window style checks.
     352 *
     353 *****************************************************************************/
     354void Win32BaseWindow::NC_AdjustRectOuter(LPRECT rect, DWORD style, BOOL menu, DWORD exStyle)
     355{
     356    if(style & WS_ICONIC) return;
     357
     358    /* Decide if the window will be managed (see CreateWindowEx) */
     359//    if (!WindowNeedsWMBorder(style, exStyle))
     360//    {
     361       if (HAS_THICKFRAME( style, exStyle ))
     362            InflateRect( rect, GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME) );
     363        else
     364        if (HAS_DLGFRAME( style, exStyle ))
     365            InflateRect(rect, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) );
     366        else
     367        if (HAS_THINFRAME( style ))
     368            InflateRect( rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
     369
     370        if ((style & WS_CAPTION) == WS_CAPTION)
     371        {
     372                if (exStyle & WS_EX_TOOLWINDOW)
     373                        rect->top -= GetSystemMetrics(SM_CYSMCAPTION);
     374                else
     375                        rect->top -= GetSystemMetrics(SM_CYCAPTION);
     376        }
     377//    }
     378
     379    if (menu)
     380            rect->top -= GetSystemMetrics(SM_CYMENU);
     381}
     382/******************************************************************************
     383 * NC_AdjustRectInner95
     384 *
     385 * Computes the size of the "inside" part of the window based on the
     386 * parameters of the client area.
     387 *
     388 + PARAMS
     389 *     LPRECT16 rect
     390 *     DWORD    style
     391 *     DWORD    exStyle
     392 *
     393 * NOTES
     394 *     "Inner" part of a window means the window frame inside of the flat
     395 *     window frame. It includes the client edge, the static edge and the
     396 *     scroll bars.
     397 *
     398 * Revision history
     399 *     05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
     400 *        Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
     401 *
     402 *     20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
     403 *        Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
     404 *        NC_AdjustRectInner95 and added handling of Win95 styles.
     405 *
     406 *****************************************************************************/
     407void Win32BaseWindow::NC_AdjustRectInner(LPRECT rect, DWORD style, DWORD exStyle)
     408{
     409    if(style & WS_ICONIC) return;
     410
     411    if (exStyle & WS_EX_CLIENTEDGE)
     412            InflateRect(rect, GetSystemMetrics(SM_CXEDGE), GetSystemMetrics(SM_CYEDGE));
     413
     414    if (exStyle & WS_EX_STATICEDGE)
     415            InflateRect(rect, GetSystemMetrics(SM_CXBORDER), GetSystemMetrics(SM_CYBORDER));
     416
     417    if (style & WS_VSCROLL) rect->right  += GetSystemMetrics(SM_CXVSCROLL);
     418    if (style & WS_HSCROLL) rect->bottom += GetSystemMetrics(SM_CYHSCROLL);
     419}
    301420//******************************************************************************
    302421//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.