| 1 | /* $Id: pmframe.cpp,v 1.2 1999-10-08 16:19:34 cbratschi Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * Win32 Frame Managment Code for OS/2
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 1999 by Christoph Bratschi (cbratschi@datacomm.ch)
|
|---|
| 6 | *
|
|---|
| 7 | *
|
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 9 | *
|
|---|
| 10 | */
|
|---|
| 11 |
|
|---|
| 12 | #define INCL_WIN
|
|---|
| 13 | #define INCL_GPI
|
|---|
| 14 |
|
|---|
| 15 | #include <os2.h> /* PM header file */
|
|---|
| 16 | #include <os2wrap.h>
|
|---|
| 17 | #include <stdlib.h>
|
|---|
| 18 | #include "win32type.h"
|
|---|
| 19 | #include <misc.h>
|
|---|
| 20 | #include <win32wbase.h>
|
|---|
| 21 | #include "wprocess.h"
|
|---|
| 22 | #include "pmframe.h"
|
|---|
| 23 |
|
|---|
| 24 | //******************************************************************************
|
|---|
| 25 | //Win32 frame message handler
|
|---|
| 26 | //******************************************************************************
|
|---|
| 27 | MRESULT EXPENTRY Win32FrameProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
|
|---|
| 28 | {
|
|---|
| 29 | Win32BaseWindow *win32wnd;
|
|---|
| 30 | PFNWP OldFrameProc;
|
|---|
| 31 |
|
|---|
| 32 | SetWin32TIB();
|
|---|
| 33 |
|
|---|
| 34 | win32wnd = Win32BaseWindow::GetWindowFromFrameHandle(hwnd);
|
|---|
| 35 |
|
|---|
| 36 | if(win32wnd == NULL || !win32wnd->getOldFrameProc())
|
|---|
| 37 | {
|
|---|
| 38 | dprintf(("Invalid win32wnd pointer for frame %x!!", hwnd));
|
|---|
| 39 | goto RunDefWndProc;
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | OldFrameProc = (PFNWP)win32wnd->getOldFrameProc();
|
|---|
| 43 |
|
|---|
| 44 | switch(msg)
|
|---|
| 45 | {
|
|---|
| 46 | case WM_DESTROY:
|
|---|
| 47 | WinSubclassWindow(hwnd,OldFrameProc);
|
|---|
| 48 | win32wnd->setOldFrameProc(NULL);
|
|---|
| 49 | goto RunDefFrameProc;
|
|---|
| 50 |
|
|---|
| 51 | case WM_PAINT:
|
|---|
| 52 | //CB: todo
|
|---|
| 53 |
|
|---|
| 54 | default:
|
|---|
| 55 | RestoreOS2TIB();
|
|---|
| 56 | return OldFrameProc(hwnd,msg,mp1,mp2);
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | RestoreOS2TIB();
|
|---|
| 60 | return (MRESULT)FALSE;
|
|---|
| 61 |
|
|---|
| 62 | RunDefFrameProc:
|
|---|
| 63 | RestoreOS2TIB();
|
|---|
| 64 | return OldFrameProc(hwnd,msg,mp1,mp2);
|
|---|
| 65 |
|
|---|
| 66 | RunDefWndProc:
|
|---|
| 67 | RestoreOS2TIB();
|
|---|
| 68 | return WinDefWindowProc(hwnd,msg,mp1,mp2);
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | PVOID FrameSubclassFrameWindow(Win32BaseWindow *win32wnd)
|
|---|
| 72 | {
|
|---|
| 73 | return WinSubclassWindow(win32wnd->getOS2FrameWindowHandle(),PFNWP(Win32FrameProc));
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 | VOID FrameSetBorderSize(Win32BaseWindow *win32wnd)
|
|---|
| 77 | {
|
|---|
| 78 | WinSendMsg(win32wnd->getOS2FrameWindowHandle(),WM_SETBORDERSIZE,(MPARAM)win32wnd->getBorderWidth(),(MPARAM)win32wnd->getBorderHeight());
|
|---|
| 79 | }
|
|---|