Changeset 9345 for trunk/src/user32


Ignore:
Timestamp:
Oct 15, 2002, 11:18:12 AM (23 years ago)
Author:
sandervl
Message:

PF: Disable close button & close item in system menu for windows with SC_NOCLOSE class style

Location:
trunk/src/user32
Files:
5 edited

Legend:

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

    r8872 r9345  
    1 /* $Id: menu.cpp,v 1.49 2002-07-15 10:16:28 sandervl Exp $*/
     1/* $Id: menu.cpp,v 1.50 2002-10-15 09:18:09 sandervl Exp $*/
    22/*
    33 * Menu functions
     
    28892889#ifdef __WIN32OS2__
    28902890                        //double click on system menu -> close application
    2891                         PostMessageA(hwnd, WM_SYSCOMMAND,SC_CLOSE, msg.lParam);
     2891                        if (!(GetClassLongA(hwnd, GCL_STYLE) & CS_NOCLOSE))
     2892                          PostMessageA(hwnd, WM_SYSCOMMAND, SC_CLOSE, msg.lParam);
    28922893#endif
    28932894                        fEndMenu = TRUE;
  • trunk/src/user32/oslibwin.cpp

    r9256 r9345  
    1 /* $Id: oslibwin.cpp,v 1.128 2002-09-17 10:24:02 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.129 2002-10-15 09:18:10 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    103103    if(fOS2Look && *hwndFrame) {
    104104        FCData.flCreateFlags = dwOSFrameStyle;
    105 //        FCData.flCreateFlags = FCF_TITLEBAR|FCF_SYSMENU|FCF_MINMAX;
    106105        WinCreateFrameControls(*hwndFrame, &FCData, NULL);
    107106    }
     
    156155//******************************************************************************
    157156BOOL OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect, DWORD dwStyle,
    158                                    DWORD dwExStyle, HICON hSysMenuIcon)
     157                                   DWORD dwExStyle, HICON hSysMenuIcon, BOOL drawCloseButton)
    159158{
    160159  SWP  swp[3];
     
    186185          i++;
    187186      }
     187
    188188  }
    189189  else
     
    209209              swp[i].cx -= minmaxwidth/2;
    210210          }
    211           //there is no close button in warp 3
    212           if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3) {
     211          //there is no close button in warp 3 and sometimes we do not
     212          //have close button as well
     213          if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3 && drawCloseButton) {
    213214              swp[i].cx -= minmaxwidth/2;
    214215          }
     
    238239              swp[i].cx += minmaxwidth/2;
    239240          }
    240           //there is no close button in warp 3
    241           if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3) {
     241          //there is no close button in warp 3 and sometimes we do not have
     242          //close button as well
     243          if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3 && drawCloseButton) {
    242244              swp[i].cx += minmaxwidth/2;
    243245          }
     
    975977  // the first entry returned is always the window list itself
    976978  if (WinQuerySwitchList(0, &swblk, sizeof(SWBLOCK)) > 0)
    977     WinSetActiveWindow(HWND_DESKTOP, swblk.aswentry[0].swctl.hwnd);
     979     WinSetActiveWindow(HWND_DESKTOP, swblk.aswentry[0].swctl.hwnd);
     980//      WinShowWindow(swblk.aswentry[0].swctl.hwnd, TRUE);
    978981}
    979982//******************************************************************************
     
    10821085            if (WinQueryActiveWindow(HWND_DESKTOP) == hwndFrame)
    10831086              WinSendMsg(WinWindowFromID(hwndFrame, FID_TITLEBAR), TBM_SETHILITE, (MPARAM)1, 0);
     1087
    10841088       }
    10851089   } // os2look
     1090}
     1091
     1092//******************************************************************************
     1093//******************************************************************************
     1094BOOL OSLibChangeCloseButtonState(HWND hwndFrame, BOOL State)
     1095{
     1096    return WinEnableMenuItem(WinWindowFromID(hwndFrame, FID_SYSMENU), SC_CLOSE, State);
    10861097}
    10871098//******************************************************************************
  • trunk/src/user32/oslibwin.h

    r9230 r9345  
    1 /* $Id: oslibwin.h,v 1.68 2002-09-12 09:30:06 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.69 2002-10-15 09:18:10 sandervl Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    4848DWORD OSLibQueryWindowStyle(HWND hwnd);
    4949
    50 BOOL  OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect, DWORD dwStyle, DWORD dwExStyle, HICON hSysMenuIcon);
     50BOOL  OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect, DWORD dwStyle, DWORD dwExStyle, HICON hSysMenuIcon, BOOL drawCloseButton);
     51BOOL  OSLibChangeCloseButtonState(HWND hwndFrame, BOOL State);
    5152
    5253#define OSLIB_QWL_USER -4
  • trunk/src/user32/win32wbase.cpp

    r9342 r9345  
    1 /* $Id: win32wbase.cpp,v 1.341 2002-10-11 14:58:36 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.342 2002-10-15 09:18:10 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    13601360  {
    13611361      RECT rect = {0};
     1362      BOOL fCloseButton;
     1363
     1364      fCloseButton = !(windowClass && (windowClass->getClassLongA(GCL_STYLE) & CS_NOCLOSE));
     1365
    13621366      int  height  = getWindowHeight();
    13631367      RECTLOS2 rectOS2;
     
    13731377      rectOS2.yBottom = height - rect.top;
    13741378      rectOS2.yTop    = height - rect.bottom;
    1375       OSLibWinPositionFrameControls(getOS2FrameWindowHandle(), &rectOS2, dwStyle, dwExStyle, IconForWindow(ICON_SMALL));
     1379
     1380      //@@PF Disable close button as well when needed by application
     1381      OSLibChangeCloseButtonState(getOS2FrameWindowHandle(), fCloseButton);
     1382      OSLibWinPositionFrameControls(getOS2FrameWindowHandle(), &rectOS2,
     1383                                    dwStyle, dwExStyle, IconForWindow(ICON_SMALL),
     1384                                    fCloseButton);
    13761385  }
    13771386  return rc;
  • trunk/src/user32/win32wbasenonclient.cpp

    r9008 r9345  
    1 /* $Id: win32wbasenonclient.cpp,v 1.43 2002-08-15 15:45:46 sandervl Exp $ */
     1/* $Id: win32wbasenonclient.cpp,v 1.44 2002-10-15 09:18:12 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2 (non-client methods)
     
    12401240
    12411241    case HTSYSMENU:
    1242       if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
     1242      if (!(GetClassLongA(getWindowHandle(),GCL_STYLE) & CS_NOCLOSE))
    12431243        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_CLOSE,lParam);
    12441244      break;
Note: See TracChangeset for help on using the changeset viewer.