00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <os2win.h>
00017 #include <win.h>
00018 #include <stdlib.h>
00019 #include <string.h>
00020 #include <stdarg.h>
00021 #include <assert.h>
00022 #include <misc.h>
00023 #include <win32wnd.h>
00024 #include <heapstring.h>
00025 #include <spy.h>
00026 #include "wndmsg.h"
00027 #include <oslibwin.h>
00028 #include <oslibutil.h>
00029 #include <oslibgdi.h>
00030 #include <oslibres.h>
00031 #include "oslibdos.h"
00032 #include "syscolor.h"
00033 #include "win32wndhandle.h"
00034 #include "mdi.h"
00035 #include "win32wmdiclient.h"
00036
00037 #define DBG_LOCALLOG DBG_win32wnd
00038 #include "dbglocal.h"
00039
00040
00041
00042 Win32Window::Win32Window(CREATESTRUCTA *lpCreateStructA, ATOM classAtom, BOOL isUnicode)
00043 : Win32BaseWindow(lpCreateStructA, classAtom, isUnicode)
00044 {
00045 }
00046
00047
00048 Win32Window::~Win32Window()
00049 {
00050 }
00051
00052
00053 LRESULT Win32Window::DefFrameProcA(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
00054 {
00055 Win32MDIClientWindow *window = NULL;
00056 HWND hwndChild;
00057
00058 if(hwndMDIClient)
00059 window = (Win32MDIClientWindow*)GetWindowFromHandle(hwndMDIClient);
00060
00061 if (window && window->isMDIClient())
00062 {
00063 switch(Msg)
00064 {
00065 case WM_NCACTIVATE:
00066 window->SendMessageA(Msg, wParam, lParam);
00067 break;
00068
00069 #if 0
00070 case WM_SETTEXT:
00071
00072 window->updateFrameText(MDI_REPAINTFRAME,(LPCSTR)lParam);
00073 return 0;
00074 #endif
00075
00076 case WM_COMMAND:
00077
00078 if(wParam < window->getFirstChildId() || wParam >= window->getFirstChildId()+window->getNrOfChildren())
00079 {
00080 if( (wParam - 0xF000) & 0xF00F ) break;
00081 switch( wParam )
00082 {
00083 case SC_SIZE:
00084 case SC_MOVE:
00085 case SC_MINIMIZE:
00086 case SC_MAXIMIZE:
00087 case SC_NEXTWINDOW:
00088 case SC_PREVWINDOW:
00089 case SC_CLOSE:
00090 case SC_RESTORE:
00091 hwndChild = window->getMaximizedChild();
00092 RELEASE_WNDOBJ(window);
00093 if (hwndChild)
00094 return ::SendMessageA(hwndChild, WM_SYSCOMMAND, wParam, lParam);
00095 }
00096 }
00097 else
00098 {
00099 hwndChild = window->getChildByID(wParam);
00100 if (hwndChild)
00101 ::SendMessageA(window->getWindowHandle(),WM_MDIACTIVATE,(WPARAM)hwndChild,0L);
00102 }
00103 break;
00104
00105 case WM_SETFOCUS:
00106 SetFocus(hwndMDIClient);
00107 break;
00108
00109 case WM_SIZE:
00110 MoveWindow(hwndMDIClient, 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE);
00111 break;
00112
00113 #if 0
00114 case WM_NEXTMENU:
00115 ci = (MDICLIENTINFO*)wndPtr->wExtra;
00116
00117 if( !(wndPtr->parent->dwStyle & WS_MINIMIZE)
00118 && ci->hwndActiveChild && !ci->hwndChildMaximized )
00119 {
00120
00121
00122
00123 if( (wParam == VK_LEFT &&
00124 wndPtr->parent->wIDmenu == LOWORD(lParam)) ||
00125 (wParam == VK_RIGHT &&
00126 GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) )
00127 {
00128 LRESULT retvalue;
00129 wndPtr = WIN_FindWndPtr(ci->hwndActiveChild);
00130 retvalue = MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0),
00131 ci->hwndActiveChild);
00132 return retvalue;
00133 }
00134 }
00135 break;
00136 #endif
00137 }
00138 }
00139 if(window) RELEASE_WNDOBJ(window);
00140 return DefWindowProcA(Msg, wParam, lParam);
00141 }
00142
00143
00144 LRESULT Win32Window::DefFrameProcW(HWND hwndMDIClient, UINT Msg, WPARAM wParam, LPARAM lParam)
00145 {
00146 switch(Msg)
00147 {
00148 case WM_NCACTIVATE:
00149 ::SendMessageW(hwndMDIClient, Msg, wParam, lParam);
00150 break;
00151
00152 case WM_SETTEXT:
00153 {
00154 LPSTR txt = HEAP_strdupWtoA(GetProcessHeap(),0,(LPWSTR)lParam);
00155 LRESULT ret = DefFrameProcA(hwndMDIClient, Msg, wParam, (DWORD)txt );
00156 HeapFree(GetProcessHeap(),0,txt);
00157 return ret;
00158 }
00159 case WM_NEXTMENU:
00160 case WM_SETFOCUS:
00161 case WM_SIZE:
00162 return DefFrameProcA(hwndMDIClient, Msg, wParam, lParam );
00163 }
00164 return DefWindowProcW(Msg, wParam, lParam);
00165 }
00166
00167