Ignore:
Timestamp:
Jan 9, 2000, 3:38:30 PM (26 years ago)
Author:
sandervl
Message:

Several updates/bug fixes

File:
1 edited

Legend:

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

    r2374 r2383  
    1 /* $Id: win32wbase.cpp,v 1.134 2000-01-08 14:41:27 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.135 2000-01-09 14:37:11 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    151151  fParentDC            = FALSE;
    152152  fDefWndProcCalled    = FALSE;
     153  fWindowRectChanged   = FALSE; //Set when parent window has been moved; cleared when window rect is updated
    153154
    154155  windowNameA      = NULL;
     
    193194  isIcon           = FALSE;
    194195  lastHitTestVal   = HTOS_NORMAL;
    195   fIgnoreHitTest   = FALSE;
    196196  owner            = NULL;
    197197  windowClass      = 0;
     
    645645  subclassScrollBars(dwStyle & WS_HSCROLL,dwStyle & WS_VSCROLL);
    646646
    647 //  FrameSubclassTitleBar(this);
     647  if(!fOS2Look)
     648    FrameSubclassTitleBar(this);
    648649
    649650  fakeWinBase.hwndThis     = OS2Hwnd;
     
    864865}
    865866//******************************************************************************
    866 //******************************************************************************
    867 ULONG Win32BaseWindow::MsgHitTest(MSG *msg)
    868 {
    869   lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)msg->pt.x, (USHORT)msg->pt.y));
    870   dprintf2(("MsgHitTest returned %x", lastHitTestVal));
    871 
    872   if (lastHitTestVal == HTERROR)
    873     return HTOS_ERROR;
    874 
    875 #if 0 //CB: problems with groupboxes, internal handling is better
    876   if (lastHitTestVal == HTTRANSPARENT)
    877     return HTOS_TRANSPARENT;
    878 #endif
    879 
    880   return HTOS_NORMAL;
     867// NOTE: WM_NCHITTEST messages are sent whenever the mouse cursor moves or a mouse button is clicked/released
     868//       (directly when receiving those messages)
     869//******************************************************************************
     870ULONG Win32BaseWindow::MsgHitTest(ULONG x, ULONG y)
     871{
     872  lastHitTestVal = SendInternalMessageA(WM_NCHITTEST, 0, MAKELONG((USHORT)x, (USHORT)y));
     873  dprintf(("MsgHitTest (%d,%d) (%d,%d) (%d,%d) returned %x", x, y, rectWindow.left, rectWindow.right, rectWindow.top, rectWindow.bottom, lastHitTestVal));
     874  return lastHitTestVal;
    881875}
    882876//******************************************************************************
     
    12391233}
    12401234/***********************************************************************
    1241  *           NC_HandleNCLButtonDown
    1242  *
    1243  * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
    1244  */
    1245 LONG Win32BaseWindow::HandleNCLButtonDown(WPARAM wParam,LPARAM lParam)
    1246 {
    1247   switch(wParam)  /* Hit test */
    1248   {
    1249     case HTCAPTION:
    1250       SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
    1251       break;
    1252 
    1253     case HTSYSMENU:
    1254       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
    1255       break;
    1256 
    1257     case HTMENU:
    1258       SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
    1259       break;
    1260 
    1261     case HTHSCROLL:
    1262       SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
    1263       break;
    1264 
    1265     case HTVSCROLL:
    1266       SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
    1267       break;
    1268 
    1269     case HTLEFT:
    1270     case HTRIGHT:
    1271     case HTTOP:
    1272     case HTTOPLEFT:
    1273     case HTTOPRIGHT:
    1274     case HTBOTTOM:
    1275     case HTBOTTOMLEFT:
    1276     case HTBOTTOMRIGHT:
    1277         /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
    1278         SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
    1279         break;
    1280     case HTBORDER:
    1281         break;
    1282   }
    1283 
    1284   return 0;
    1285 }
    1286 //******************************************************************************
    1287 //******************************************************************************
    1288 LONG Win32BaseWindow::HandleNCLButtonUp(WPARAM wParam,LPARAM lParam)
    1289 {
    1290   switch(wParam)  /* Hit test */
    1291   {
    1292     case HTMINBUTTON:
    1293       SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,lParam);
    1294       break;
    1295 
    1296     case HTMAXBUTTON:
    1297       SendInternalMessageA(WM_SYSCOMMAND,SC_MAXIMIZE,lParam);
    1298       break;
    1299 
    1300     case HTCLOSE:
    1301       SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
    1302       break;
    1303   }
    1304 
    1305   return 0;
    1306 }
    1307 /***********************************************************************
    1308  *           NC_HandleNCLButtonDblClk
    1309  *
    1310  * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
    1311  */
    1312 LONG Win32BaseWindow::HandleNCLButtonDblClk(WPARAM wParam,LPARAM lParam)
    1313 {
    1314   /*
    1315    * if this is an icon, send a restore since we are handling
    1316    * a double click
    1317    */
    1318   if (dwStyle & WS_MINIMIZE)
    1319   {
    1320     SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
    1321     return 0;
    1322   }
    1323 
    1324   switch(wParam)  /* Hit test */
    1325   {
    1326     case HTCAPTION:
    1327       /* stop processing if WS_MAXIMIZEBOX is missing */
    1328       if (dwStyle & WS_MAXIMIZEBOX)
    1329         SendInternalMessageA(WM_SYSCOMMAND,
    1330                       (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
    1331                       lParam);
    1332       break;
    1333 
    1334     case HTSYSMENU:
    1335       if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
    1336         SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
    1337       break;
    1338 
    1339     case HTHSCROLL:
    1340       SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
    1341       break;
    1342 
    1343     case HTVSCROLL:
    1344       SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
    1345       break;
    1346   }
    1347 
    1348   return 0;
    1349 }
    1350 /***********************************************************************
    13511235 *           NC_HandleSysCommand
    13521236 *
     
    16051489        setStyle(getStyle() | WS_VISIBLE);
    16061490        OSLibWinEnableWindowUpdate(OS2HwndFrame,TRUE);
    1607       } else
     1491      }
     1492      else
    16081493      {
    16091494        if (getStyle() & WS_VISIBLE)
     
    16151500      return 0;
    16161501    }
    1617 
    1618     case WM_NCPAINT:
    1619         return 0;
    1620 
    1621     case WM_NCACTIVATE:
    1622         return TRUE;
    1623 
    1624     case WM_NCCREATE:
    1625         return(TRUE);
    1626 
    1627     case WM_NCDESTROY:
    1628         return 0;
    1629 
    1630     case WM_NCCALCSIZE:
    1631         return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam);
    16321502
    16331503    case WM_CTLCOLORMSGBOX:
     
    17781648          if( (getStyle() & WS_MINIMIZE) && getWindowClass()->getIcon())
    17791649          {
    1780             int x = (rectWindow.right - rectWindow.left - GetSystemMetrics(SM_CXICON))/2;
    1781             int y = (rectWindow.bottom - rectWindow.top - GetSystemMetrics(SM_CYICON))/2;
     1650            int x = (getWindowRect()->right - getWindowRect()->left - GetSystemMetrics(SM_CXICON))/2;
     1651            int y = (getWindowRect()->bottom - getWindowRect()->top - GetSystemMetrics(SM_CYICON))/2;
    17821652            dprintf(("Painting class icon: vis rect=(%i,%i - %i,%i)\n", ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom ));
    17831653            DrawIcon(hdc, x, y, getWindowClass()->getIcon() );
     
    17911661        return 0;
    17921662
     1663    case WM_NCPAINT:
     1664        if(!fOS2Look) {
     1665            HandleNCPaint(wParam, FALSE);
     1666        }
     1667        return 0;
     1668
     1669    case WM_NCACTIVATE:
     1670        if(!fOS2Look) {
     1671            return HandleNCActivate(wParam);
     1672        }
     1673        return TRUE;
     1674
     1675    case WM_NCCREATE:
     1676        return(TRUE);
     1677
     1678    case WM_NCDESTROY:
     1679        return 0;
     1680
     1681    case WM_NCCALCSIZE:
     1682        return NCHandleCalcSize(wParam, (NCCALCSIZE_PARAMS *)lParam);
     1683
    17931684    case WM_NCLBUTTONDOWN:
    1794         return HandleNCLButtonDown(wParam,lParam);
     1685        if(!fOS2Look) {
     1686            return HandleNCLButtonDown(wParam,lParam);
     1687        }
     1688        return 0;
    17951689
    17961690    case WM_NCLBUTTONUP:
    1797         return HandleNCLButtonUp(wParam,lParam);
     1691        if(!fOS2Look) {
     1692            return HandleNCLButtonUp(wParam,lParam);
     1693        }
     1694        return 0;
    17981695
    17991696    case WM_NCLBUTTONDBLCLK:
    1800         return HandleNCLButtonDblClk(wParam,lParam);
     1697        if(!fOS2Look) {
     1698            return HandleNCLButtonDblClk(wParam,lParam);
     1699        }
     1700        return 0;
    18011701
    18021702    case WM_NCRBUTTONDOWN:
     
    18181718      point.y = (SHORT)HIWORD(lParam);
    18191719
    1820       return FrameHitTest(this,point.x,point.y);
     1720      if(fOS2Look) {
     1721                return FrameHitTest(this, point.x, point.y);
     1722      }
     1723      else      return HandleNCHitTest(point);
    18211724    }
    18221725
     
    23162219}
    23172220//******************************************************************************
     2221//When our parent window is moved, we aren't notified of the change (rectWindow is in
     2222//screen coordinates, so it needs to be updated)
     2223//Set the fWindowRectChanged flag and do the same for all the children
     2224//Whenever getWindowRect is called and this flag is set, it refreshes the rectWindow structure
     2225//******************************************************************************
     2226void Win32BaseWindow::setWindowRectChanged()
     2227{
     2228 Win32BaseWindow *child;
     2229
     2230    fWindowRectChanged = TRUE;
     2231
     2232    child = (Win32BaseWindow *)getFirstChild();
     2233    while(child)
     2234    {
     2235        child->setWindowRectChanged();
     2236        child = (Win32BaseWindow *)child->getNextChild();
     2237    }
     2238}
     2239//******************************************************************************
     2240//******************************************************************************
     2241PRECT Win32BaseWindow::getWindowRect()
     2242{
     2243    if(fWindowRectChanged) {
     2244        OSLibWinQueryWindowRect(getOS2FrameWindowHandle(), &rectWindow, RELATIVE_TO_SCREEN);
     2245        fWindowRectChanged = FALSE;
     2246    }
     2247    return &rectWindow;
     2248}
     2249//******************************************************************************
     2250//******************************************************************************
     2251void Win32BaseWindow::setWindowRect(LONG left, LONG top, LONG right, LONG bottom)
     2252{
     2253    fWindowRectChanged = FALSE;
     2254
     2255    rectWindow.left   = left;
     2256    rectWindow.top    = top;
     2257    rectWindow.right  = right;
     2258    rectWindow.bottom = bottom;
     2259}
     2260//******************************************************************************
     2261//******************************************************************************
     2262void Win32BaseWindow::setWindowRect(PRECT rect)
     2263{
     2264    fWindowRectChanged = FALSE;
     2265
     2266    rectWindow = *rect;
     2267}
     2268//******************************************************************************
    23182269//******************************************************************************
    23192270BOOL Win32BaseWindow::SetWindowPos(HWND hwndInsertAfter, int x, int y, int cx, int cy, UINT fuFlags)
     
    28822833    return OSLibWinIsWindowVisible(OS2HwndFrame);
    28832834#endif
    2884 }
    2885 //******************************************************************************
    2886 //******************************************************************************
    2887 BOOL Win32BaseWindow::GetWindowRect(PRECT pRect)
    2888 {
    2889     return OSLibWinQueryWindowRect(OS2HwndFrame, pRect, RELATIVE_TO_SCREEN);
    28902835}
    28912836//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.