Changeset 1189 for trunk/src


Ignore:
Timestamp:
Oct 8, 1999, 6:13:09 PM (26 years ago)
Author:
cbratschi
Message:

subclassed frame, WM_STYLECHANGING fix

Location:
trunk/src/user32
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/Makefile

    r1077 r1189  
    1 # $Id: Makefile,v 1.25 1999-09-28 08:00:57 dengert Exp $
     1# $Id: Makefile,v 1.26 1999-10-08 16:13:07 cbratschi Exp $
    22
    33#
     
    2727        defwndproc.obj syscolor.obj char.obj initterm.obj \
    2828        uitools.obj unknown.obj spy.obj wndmsg.obj \
    29         pmwindow.obj win32class.obj win32wnd.obj win32dlg.obj \
     29        pmwindow.obj pmframe.obj win32class.obj win32wnd.obj win32dlg.obj \
    3030        msgbox.obj window.obj windowmsg.obj windowclass.obj win32wbase.obj \
    3131        windowword.obj gen_object.obj oslibwin.obj win32wndchild.obj \
     
    103103
    104104pmwindow.obj:   pmwindow.cpp win32class.h win32wbase.h win32dlg.h pmwindow.h win32wndchild.h $(PDWIN32_INCLUDE)\wprocess.h oslibgdi.h oslibwin.h dc.h
     105pmframe.obj: pmframe.cpp win32class.h win32wbase.h pmframe.h win32wndchild.h
    105106win32class.obj: win32class.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h
    106 win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h
     107win32wbase.obj:   win32wbase.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h dc.h pmframe.h
    107108win32wnd.obj:   win32wnd.cpp win32class.h win32wbase.h win32wnd.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h  $(PDWIN32_INCLUDE)\winres.h oslibres.h win32wndhandle.h oslibdos.h oslibmenu.h
    108109win32dlg.obj:   win32dlg.cpp win32class.h win32wbase.h win32dlg.h gen_object.h heapshared.h oslibwin.h win32wndchild.h oslibmsg.h
  • trunk/src/user32/oslibwin.cpp

    r1186 r1189  
    1 /* $Id: oslibwin.cpp,v 1.16 1999-10-08 14:57:17 sandervl Exp $ */
     1/* $Id: oslibwin.cpp,v 1.17 1999-10-08 16:13:07 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    9090//******************************************************************************
    9191//******************************************************************************
    92 BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
     92BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
    9393{
    9494  *OSWinStyle   = 0;
    9595  *OSFrameStyle = 0;
     96  *borderWidth  = 0;
     97  *borderHeight = 0;
    9698
    9799  /* Window styles */
     
    126128        dwExStyle & WS_EX_STATICEDGE_W ||
    127129        dwExStyle & WS_EX_WINDOWEDGE_W)
    128           *OSFrameStyle |= FCF_DLGBORDER;
     130          {
     131            *OSFrameStyle |= FCF_DLGBORDER;
     132            *borderHeight = *borderWidth = 2; //CB: right?
     133          }
    129134
    130135    if(dwStyle & WS_VSCROLL_W)
     
    834839void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle)
    835840{
    836   ULONG OSWinStyle, OSFrameStyle;
    837 
    838   OSLibWinConvertStyle(dwStyle, 0, &OSWinStyle, &OSFrameStyle);
     841  ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight;
     842
     843  OSLibWinConvertStyle(dwStyle, 0, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
    839844
    840845  WinSetWindowULong(hwnd, QWL_STYLE,
  • trunk/src/user32/oslibwin.h

    r1186 r1189  
    1 /* $Id: oslibwin.h,v 1.11 1999-10-08 14:57:17 sandervl Exp $ */
     1/* $Id: oslibwin.h,v 1.12 1999-10-08 16:13:08 cbratschi Exp $ */
    22/*
    33 * Window API wrappers for OS/2
     
    3939                           char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame);
    4040
    41 BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle);
     41BOOL  OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight);
    4242void  OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle);
    4343
     
    5757ULONG OSLibDosBeep(ULONG freg,ULONG dur);
    5858HWND OSLibWinQueryFocus(HWND hwndDeskTop);
     59
     60#define OSLIB_FID_SYSMENU                0x8002
     61#define OSLIB_FID_TITLEBAR               0x8003
     62#define OSLIB_FID_MINMAX                 0x8004
     63#define OSLIB_FID_MENU                   0x8005
     64#define OSLIB_FID_VERTSCROLL             0x8006
     65#define OSLIB_FID_HORZSCROLL             0x8007
     66#define OSLIB_FID_CLIENT                 0x8008
     67
    5968HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id);
    6069BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate);
     
    248257HWND  OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID);
    249258
    250 #define OSLIB_HSCROLL   0
    251 #define OSLIB_VSCROLL   1
     259#define OSLIB_HSCROLL   0
     260#define OSLIB_VSCROLL   1
    252261BOOL  OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable);
    253262BOOL  OSLibWinShowScrollBar(HWND hwndParent, HWND hwndScroll, int scrollBar, BOOL fShow);
     
    255264ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll);
    256265ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw);
    257 BOOL  OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos, 
     266BOOL  OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
    258267                             int maxpos, int fRedraw);
    259 BOOL  OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize, 
     268BOOL  OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
    260269                                int totalsize, int fRedraw);
    261270
  • trunk/src/user32/win32wbase.cpp

    r1186 r1189  
    1 /* $Id: win32wbase.cpp,v 1.29 1999-10-08 14:57:18 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.30 1999-10-08 16:13:08 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    3838#include "heapshared.h"
    3939#include "dc.h"
     40#include "pmframe.h"
    4041
    4142#define HAS_DLGFRAME(style,exStyle) \
     
    109110  windowId         = 0xFFFFFFFF;        //default = -1
    110111  userData         = 0;
     112
     113  pOldFrameProc = NULL;
     114  borderWidth   = 0;
     115  borderHeight  = 0;
    111116
    112117  hwndLinkAfter    = HWND_BOTTOM;
     
    424429  DWORD dwOSWinStyle, dwOSFrameStyle;
    425430
    426   OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle);
     431  OSLibWinConvertStyle(cs->style, cs->dwExStyle, &dwOSWinStyle, &dwOSFrameStyle, &borderWidth, &borderHeight);
    427432
    428433//CB: dwOSFrameStyle handled by OSLibWinConvertStyle
    429 //    todo: subclass frame WM_PAINT -> call DrawEdge() if HAS_3DFRAME (code below)
    430 //          OSLibWinCreateWindow: perhaps problems
     434//    OSLibWinCreateWindow: perhaps problems
    431435//    shouldn't we always use a frame? -> no problems with scrollbars
    432436
     
    527531  }
    528532  //Subclass frame
    529   if (dwStyle & WS_CHILD && HAS_3DFRAME(dwExStyle))
     533
     534  if (isFrameWindow())
    530535  {
    531     //CB: use a win32 window procedure and call DrawEdge() or
    532     //    emulate DrawEdge() in a OS/2 procedure
     536    pOldFrameProc = FrameSubclassFrameWindow(this);
     537    if (dwStyle & WS_CHILD && HAS_3DFRAME(dwExStyle)) FrameSetBorderSize(this);
    533538  }
    534539
     
    23972402                ss.styleNew = value;
    23982403                SendMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
    2399                 oldval = dwExStyle;
    2400                 setExStyle(value);
     2404                setExStyle(ss.styleNew);
    24012405                SendMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
    2402                 return oldval;
     2406                return ss.styleOld;
    24032407        }
    24042408        case GWL_STYLE:
     
    24092413                ss.styleNew = value;
    24102414                SendMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    2411                 oldval = dwStyle;
    2412                 setStyle(value);
     2415                setStyle(ss.styleNew);
    24132416                OSLibSetWindowStyle(OS2HwndFrame, dwStyle);
    24142417                SendMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
    2415                 return oldval;
     2418                return ss.styleOld;
    24162419        }
    24172420        case GWL_WNDPROC:
     
    25362539//******************************************************************************
    25372540//******************************************************************************
     2541Win32BaseWindow *Win32BaseWindow::GetWindowFromFrameHandle(HWND hwnd)
     2542{
     2543 Win32BaseWindow *win32wnd;
     2544 DWORD        magic;
     2545
     2546  return GetWindowFromOS2Handle(OSLibWinWindowFromID(hwnd,OSLIB_FID_CLIENT));
     2547
     2548  //CB: doesn't work with frame window words
     2549/*
     2550  win32wnd = (Win32BaseWindow *)OSLibWinGetWindowULong(hwnd, OFFSET_WIN32WNDPTR);
     2551  magic    = OSLibWinGetWindowULong(hwnd, OFFSET_WIN32PM_MAGIC);
     2552
     2553  if(win32wnd && CheckMagicDword(magic)) {
     2554        return win32wnd;
     2555  }
     2556  return 0;
     2557*/
     2558}
     2559//******************************************************************************
     2560//******************************************************************************
    25382561HWND Win32BaseWindow::Win32ToOS2Handle(HWND hwnd)
    25392562{
  • trunk/src/user32/win32wbase.h

    r1159 r1189  
    1 /* $Id: win32wbase.h,v 1.14 1999-10-07 09:28:02 sandervl Exp $ */
     1/* $Id: win32wbase.h,v 1.15 1999-10-08 16:13:09 cbratschi Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    7676         ULONG  MsgKillFocus(HWND hwnd);
    7777         ULONG  MsgTimer(ULONG TimerID);
    78         ULONG  MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos);
     78        ULONG  MsgScroll(ULONG msg, ULONG scrollCode, ULONG scrollPos);
    7979         ULONG  MsgCommand(ULONG cmd, ULONG Id, HWND hwnd);
    8080         ULONG  MsgSysCommand(ULONG win32sc, ULONG x, ULONG y);
     
    199199static Win32BaseWindow *GetWindowFromHandle(HWND hwnd);
    200200static Win32BaseWindow *GetWindowFromOS2Handle(HWND hwnd);
     201static Win32BaseWindow *GetWindowFromFrameHandle(HWND hwnd);
     202
     203       PVOID getOldFrameProc() { return pOldFrameProc; };
     204       VOID  setOldFrameProc(PVOID aOldFrameProc) { pOldFrameProc = aOldFrameProc; };
     205       ULONG   getBorderWidth() { return borderWidth; };
     206       ULONG   getBorderHeight() { return borderHeight; };
    201207
    202208protected:
     
    235241        BOOL    fFirstShow;
    236242        BOOL    fIsDialog;
    237         BOOL    fInternalMsg;           //Used to distinguish between messages 
     243        BOOL    fInternalMsg;           //Used to distinguish between messages
    238244                                        //sent by PM and those sent by apps
     245
     246        PVOID   pOldFrameProc;
     247        ULONG   borderWidth;
     248        ULONG   borderHeight;
     249
    239250   Win32BaseWindow *owner;
    240251
Note: See TracChangeset for help on using the changeset viewer.