1*9f62ea84SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9f62ea84SAndrew Rist * distributed with this work for additional information 6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance 9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at 10*9f62ea84SAndrew Rist * 11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9f62ea84SAndrew Rist * 13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an 15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the 17*9f62ea84SAndrew Rist * specific language governing permissions and limitations 18*9f62ea84SAndrew Rist * under the License. 19*9f62ea84SAndrew Rist * 20*9f62ea84SAndrew Rist *************************************************************/ 21*9f62ea84SAndrew Rist 22*9f62ea84SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <svpm.h> 25cdf0e10cSrcweir 26cdf0e10cSrcweir #define _SV_SALOBJ_CXX 27cdf0e10cSrcweir #include <saldata.hxx> 28cdf0e10cSrcweir #include <salinst.h> 29cdf0e10cSrcweir #include <salframe.h> 30cdf0e10cSrcweir #include <salobj.h> 31cdf0e10cSrcweir 32cdf0e10cSrcweir // ======================================================================= 33cdf0e10cSrcweir 34cdf0e10cSrcweir static BOOL ImplIsSysWindowOrChild( HWND hWndParent, HWND hWndChild ) 35cdf0e10cSrcweir { 36cdf0e10cSrcweir if ( hWndParent == hWndChild ) 37cdf0e10cSrcweir return TRUE; 38cdf0e10cSrcweir 39cdf0e10cSrcweir HWND hTempWnd = WinQueryWindow( hWndChild, QW_PARENT ); 40cdf0e10cSrcweir while ( hTempWnd ) 41cdf0e10cSrcweir { 42cdf0e10cSrcweir if ( hTempWnd == hWndParent ) 43cdf0e10cSrcweir return TRUE; 44cdf0e10cSrcweir hTempWnd = WinQueryWindow( hTempWnd, QW_PARENT ); 45cdf0e10cSrcweir } 46cdf0e10cSrcweir 47cdf0e10cSrcweir return FALSE; 48cdf0e10cSrcweir } 49cdf0e10cSrcweir 50cdf0e10cSrcweir // ----------------------------------------------------------------------- 51cdf0e10cSrcweir 52cdf0e10cSrcweir static Os2SalObject* ImplFindOs2SalObject( HWND hWndChild ) 53cdf0e10cSrcweir { 54cdf0e10cSrcweir SalData* pSalData = GetSalData(); 55cdf0e10cSrcweir Os2SalObject* pObject = pSalData->mpFirstObject; 56cdf0e10cSrcweir while ( pObject ) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir if ( ImplIsSysWindowOrChild( pObject->mhWndChild, hWndChild ) ) 59cdf0e10cSrcweir return pObject; 60cdf0e10cSrcweir 61cdf0e10cSrcweir pObject = pObject->mpNextObject; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir return NULL; 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir // ======================================================================= 68cdf0e10cSrcweir 69cdf0e10cSrcweir BOOL EXPENTRY SalSysMsgProc( HAB /* hAB */, QMSG* pMsg, ULONG /* fs */ ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir if ( (pMsg->msg == WM_BUTTON1DOWN) || 72cdf0e10cSrcweir (pMsg->msg == WM_BUTTON2DOWN) || 73cdf0e10cSrcweir (pMsg->msg == WM_BUTTON3DOWN) ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir SalData* pSalData = GetSalData(); 76cdf0e10cSrcweir Os2SalObject* pObject = ImplFindOs2SalObject( pMsg->hwnd ); 77cdf0e10cSrcweir if ( pObject ) 78cdf0e10cSrcweir WinPostMsg( pObject->mhWnd, SALOBJ_MSG_TOTOP, 0, 0 ); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir // Focus fangen wir hier nicht ab, da wir erstmal davon ausgehen, 82cdf0e10cSrcweir // das unser Os2SalObject-Fenster immer eine WM_FOCUSCHANGE-Message 83cdf0e10cSrcweir // bekommt. 84cdf0e10cSrcweir 85cdf0e10cSrcweir return FALSE; 86cdf0e10cSrcweir } 87cdf0e10cSrcweir 88cdf0e10cSrcweir // ----------------------------------------------------------------------- 89cdf0e10cSrcweir 90cdf0e10cSrcweir MRESULT EXPENTRY SalSysObjWndProc( HWND hWnd, ULONG nMsg, 91cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir Os2SalObject* pSysObj; 94cdf0e10cSrcweir MRESULT nRet = 0; 95cdf0e10cSrcweir int bDef = TRUE; 96cdf0e10cSrcweir 97cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 98cdf0e10cSrcweir debug_printf( "SalSysObjWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); 99cdf0e10cSrcweir #endif 100cdf0e10cSrcweir 101cdf0e10cSrcweir switch( nMsg ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir case WM_ERASEBACKGROUND: 104cdf0e10cSrcweir nRet = (MRESULT)FALSE; 105cdf0e10cSrcweir bDef = FALSE; 106cdf0e10cSrcweir break; 107cdf0e10cSrcweir case WM_PAINT: 108cdf0e10cSrcweir { 109cdf0e10cSrcweir HPS hPS; 110cdf0e10cSrcweir RECTL aRect; 111cdf0e10cSrcweir hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); 112cdf0e10cSrcweir WinEndPaint( hPS ); 113cdf0e10cSrcweir bDef = FALSE; 114cdf0e10cSrcweir } 115cdf0e10cSrcweir bDef = FALSE; 116cdf0e10cSrcweir break; 117cdf0e10cSrcweir 118cdf0e10cSrcweir case WM_BUTTON1DOWN: 119cdf0e10cSrcweir case WM_BUTTON2DOWN: 120cdf0e10cSrcweir case WM_BUTTON3DOWN: 121cdf0e10cSrcweir case SALOBJ_MSG_TOTOP: 122cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir pSysObj = GetSalObjWindowPtr( hWnd ); 125cdf0e10cSrcweir pSysObj->mpProc( pSysObj->mpInst, pSysObj, 126cdf0e10cSrcweir SALOBJ_EVENT_TOTOP, 0 ); 127cdf0e10cSrcweir ImplSalYieldMutexRelease(); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir else 130cdf0e10cSrcweir WinPostMsg( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); 131cdf0e10cSrcweir break; 132cdf0e10cSrcweir 133cdf0e10cSrcweir case WM_FOCUSCHANGE: 134cdf0e10cSrcweir case SALOBJ_MSG_POSTFOCUS: 135cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir pSysObj = GetSalObjWindowPtr( hWnd ); 138cdf0e10cSrcweir if ( SHORT1FROMMP( nMP2 ) ) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir pSysObj->mhLastFocusWnd = WinQueryFocus( HWND_DESKTOP ); 141cdf0e10cSrcweir pSysObj->mpProc( pSysObj->mpInst, pSysObj, 142cdf0e10cSrcweir SALOBJ_EVENT_GETFOCUS, 0 ); 143cdf0e10cSrcweir } 144cdf0e10cSrcweir else 145cdf0e10cSrcweir { 146cdf0e10cSrcweir HWND hWndFocus = HWNDFROMMP( nMP1 ); 147cdf0e10cSrcweir if ( !hWndFocus || !ImplIsSysWindowOrChild( hWnd, hWndFocus ) ) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir pSysObj->mpProc( pSysObj->mpInst, pSysObj, 150cdf0e10cSrcweir SALOBJ_EVENT_LOSEFOCUS, 0 ); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir } 153cdf0e10cSrcweir ImplSalYieldMutexRelease(); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir else 156cdf0e10cSrcweir WinPostMsg( hWnd, SALOBJ_MSG_POSTFOCUS, nMP1, nMP2 ); 157cdf0e10cSrcweir break; 158cdf0e10cSrcweir 159cdf0e10cSrcweir case WM_SIZE: 160cdf0e10cSrcweir { 161cdf0e10cSrcweir pSysObj = GetSalObjWindowPtr( hWnd ); 162cdf0e10cSrcweir pSysObj->mnHeight = (short)SHORT2FROMMP( nMP2 ); 163cdf0e10cSrcweir WinSetWindowPos( pSysObj->mhWndChild, 0, 164cdf0e10cSrcweir 0, 0, 165cdf0e10cSrcweir (short)SHORT1FROMMP( nMP2 ), (short)SHORT2FROMMP( nMP2 ), 166cdf0e10cSrcweir SWP_SIZE | SWP_MOVE ); 167cdf0e10cSrcweir bDef = FALSE; 168cdf0e10cSrcweir } 169cdf0e10cSrcweir break; 170cdf0e10cSrcweir 171cdf0e10cSrcweir case WM_CREATE: 172cdf0e10cSrcweir { 173cdf0e10cSrcweir // Window-Instanz am Windowhandle speichern 174cdf0e10cSrcweir CREATESTRUCT* pStruct = (CREATESTRUCT*)nMP2; 175cdf0e10cSrcweir pSysObj = (Os2SalObject*)pStruct->pPresParams; 176cdf0e10cSrcweir SetSalObjWindowPtr( hWnd, pSysObj ); 177cdf0e10cSrcweir bDef = FALSE; 178cdf0e10cSrcweir } 179cdf0e10cSrcweir break; 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir if ( bDef ) 183cdf0e10cSrcweir nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); 184cdf0e10cSrcweir return nRet; 185cdf0e10cSrcweir } 186cdf0e10cSrcweir 187cdf0e10cSrcweir // ----------------------------------------------------------------------- 188cdf0e10cSrcweir 189cdf0e10cSrcweir MRESULT EXPENTRY SalSysObjChildWndProc( HWND hWnd, ULONG nMsg, 190cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 191cdf0e10cSrcweir { 192cdf0e10cSrcweir MRESULT nRet = 0; 193cdf0e10cSrcweir int bDef = TRUE; 194cdf0e10cSrcweir 195cdf0e10cSrcweir debug_printf( "SalSysObjChildWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); 196cdf0e10cSrcweir 197cdf0e10cSrcweir switch( nMsg ) 198cdf0e10cSrcweir { 199cdf0e10cSrcweir case WM_ERASEBACKGROUND: 200cdf0e10cSrcweir // Wegen PlugIn's loeschen wir erstmal den Hintergrund 201cdf0e10cSrcweir /* 202cdf0e10cSrcweir nRet = (MRESULT)FALSE; 203cdf0e10cSrcweir bDef = FALSE; 204cdf0e10cSrcweir */ 205cdf0e10cSrcweir break; 206cdf0e10cSrcweir case WM_PAINT: 207cdf0e10cSrcweir { 208cdf0e10cSrcweir HPS hPS; 209cdf0e10cSrcweir RECTL aRect; 210cdf0e10cSrcweir hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); 211cdf0e10cSrcweir WinEndPaint( hPS ); 212cdf0e10cSrcweir bDef = FALSE; 213cdf0e10cSrcweir } 214cdf0e10cSrcweir break; 215cdf0e10cSrcweir } 216cdf0e10cSrcweir 217cdf0e10cSrcweir if ( bDef ) 218cdf0e10cSrcweir nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); 219cdf0e10cSrcweir return nRet; 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir // ----------------------------------------------------------------------- 223cdf0e10cSrcweir 224cdf0e10cSrcweir MRESULT EXPENTRY SalSysObjClipWndProc( HWND hWnd, ULONG nMsg, 225cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir MRESULT nRet = 0; 228cdf0e10cSrcweir int bDef = TRUE; 229cdf0e10cSrcweir 230cdf0e10cSrcweir debug_printf( "SalSysObjClipWndProc hWnd 0x%x nMsg %d\n", hWnd, nMsg); 231cdf0e10cSrcweir 232cdf0e10cSrcweir switch( nMsg ) 233cdf0e10cSrcweir { 234cdf0e10cSrcweir case WM_MOUSEMOVE: 235cdf0e10cSrcweir case WM_BUTTON1DOWN: 236cdf0e10cSrcweir case WM_BUTTON2DOWN: 237cdf0e10cSrcweir case WM_BUTTON3DOWN: 238cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 239cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 240cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 241cdf0e10cSrcweir case WM_BUTTON1UP: 242cdf0e10cSrcweir case WM_BUTTON2UP: 243cdf0e10cSrcweir case WM_BUTTON3UP: 244cdf0e10cSrcweir { 245cdf0e10cSrcweir // Alle Events an den Frame weiterreichen, da diese Bereiche 246cdf0e10cSrcweir // dem Frame gehoeren. Dazu muessen die Mouse-Koordinaaten 247cdf0e10cSrcweir // entsprechend umgerechnet werden 248cdf0e10cSrcweir HWND hWndParent = WinQueryWindow( hWnd, QW_PARENT ); // ergibt SysChild-Fenster 249cdf0e10cSrcweir hWndParent = WinQueryWindow( hWndParent, QW_PARENT ); 250cdf0e10cSrcweir short nX = (short)SHORT1FROMMP( nMP1 ); 251cdf0e10cSrcweir short nY = (short)SHORT2FROMMP( nMP1 ); 252cdf0e10cSrcweir POINTL aPos; 253cdf0e10cSrcweir aPos.x = nX; 254cdf0e10cSrcweir aPos.y = nY; 255cdf0e10cSrcweir WinMapWindowPoints( hWnd, hWndParent, &aPos, 1 ); 256cdf0e10cSrcweir nMP1 = MPFROM2SHORT( (short)aPos.x, (short)aPos.y ); 257cdf0e10cSrcweir bDef = FALSE; 258cdf0e10cSrcweir nRet = WinSendMsg( hWndParent, nMsg, nMP1, nMP2 ); 259cdf0e10cSrcweir } 260cdf0e10cSrcweir break; 261cdf0e10cSrcweir 262cdf0e10cSrcweir case WM_HITTEST: 263cdf0e10cSrcweir // Damit im disablten Zustand die MouseKlicks immer noch 264cdf0e10cSrcweir // an den Frame geschickt werden 265cdf0e10cSrcweir // Dieser Code reicht leider nicht aus, deshalb wir unter 266cdf0e10cSrcweir // OS2 immer das Child-Fenster disablen, im Gegensatz 267cdf0e10cSrcweir // zu Windows, wo immer der Parent disablte wird, da 268cdf0e10cSrcweir // sich das Fenster evtl. anders Darstellen koennte, 269cdf0e10cSrcweir // wenn es disablte wird. Da dieser Fall uns bisher 270cdf0e10cSrcweir // nicht bekannt ist, ignorieren wir das. 271cdf0e10cSrcweir nRet = HT_NORMAL; 272cdf0e10cSrcweir bDef = FALSE; 273cdf0e10cSrcweir break; 274cdf0e10cSrcweir 275cdf0e10cSrcweir case WM_ERASEBACKGROUND: 276cdf0e10cSrcweir nRet = (MRESULT)FALSE; 277cdf0e10cSrcweir bDef = FALSE; 278cdf0e10cSrcweir break; 279cdf0e10cSrcweir case WM_PAINT: 280cdf0e10cSrcweir { 281cdf0e10cSrcweir HPS hPS; 282cdf0e10cSrcweir RECTL aRect; 283cdf0e10cSrcweir hPS = WinBeginPaint( hWnd, NULLHANDLE, &aRect ); 284cdf0e10cSrcweir WinEndPaint( hPS ); 285cdf0e10cSrcweir bDef = FALSE; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir break; 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir if ( bDef ) 291cdf0e10cSrcweir nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); 292cdf0e10cSrcweir return nRet; 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir // ======================================================================= 296cdf0e10cSrcweir 297cdf0e10cSrcweir void ImplDestroyAllClipWindows( HWND hWndLast ) 298cdf0e10cSrcweir { 299cdf0e10cSrcweir if ( hWndLast == HWND_TOP ) 300cdf0e10cSrcweir return; 301cdf0e10cSrcweir 302cdf0e10cSrcweir HWND hWndPrev; 303cdf0e10cSrcweir while ( hWndLast ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir hWndPrev = WinQueryWindow( hWndLast, QW_PREV ); 306cdf0e10cSrcweir WinDestroyWindow( hWndLast ); 307cdf0e10cSrcweir hWndLast = hWndPrev; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir // ======================================================================= 312cdf0e10cSrcweir 313cdf0e10cSrcweir SalObject* ImplSalCreateObject( Os2SalInstance* pInst, Os2SalFrame* pParent ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir SalData* pSalData = GetSalData(); 316cdf0e10cSrcweir 317cdf0e10cSrcweir if ( !pSalData->mbObjClassInit ) 318cdf0e10cSrcweir { 319cdf0e10cSrcweir if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLASSNAME, 320cdf0e10cSrcweir (PFNWP)SalSysObjWndProc, CS_MOVENOTIFY, 321cdf0e10cSrcweir SAL_OBJECT_WNDEXTRA ) ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CLIPCLASSNAME, 324cdf0e10cSrcweir (PFNWP)SalSysObjClipWndProc, CS_HITTEST | CS_MOVENOTIFY, 0 ) ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir if ( WinRegisterClass( pSalData->mhAB, (PSZ)SAL_OBJECT_CHILDCLASSNAME, 327cdf0e10cSrcweir (PFNWP)SalSysObjChildWndProc, CS_HITTEST | CS_MOVENOTIFY, 32 ) ) 328cdf0e10cSrcweir pSalData->mbObjClassInit = TRUE; 329cdf0e10cSrcweir } 330cdf0e10cSrcweir } 331cdf0e10cSrcweir } 332cdf0e10cSrcweir 333cdf0e10cSrcweir if ( pSalData->mbObjClassInit ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir Os2SalObject* pObject = new Os2SalObject; 336cdf0e10cSrcweir HWND hWnd = WinCreateWindow( pParent->mhWndClient, SAL_OBJECT_CLASSNAME, "", 337cdf0e10cSrcweir 0, 338cdf0e10cSrcweir 0, 0, 0, 0, 339cdf0e10cSrcweir pParent->mhWndClient, HWND_TOP, 340cdf0e10cSrcweir 0, NULL, (void*)pObject ); 341cdf0e10cSrcweir HWND hWndChild = WinCreateWindow( hWnd, SAL_OBJECT_CHILDCLASSNAME, "", 342cdf0e10cSrcweir WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE, 343cdf0e10cSrcweir 0, 0, 0, 0, 344cdf0e10cSrcweir hWnd, HWND_TOP, 345cdf0e10cSrcweir 0, NULL, NULL ); 346cdf0e10cSrcweir 347cdf0e10cSrcweir if ( !hWndChild ) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir if ( hWnd ) 350cdf0e10cSrcweir WinDestroyWindow( hWnd ); 351cdf0e10cSrcweir delete pObject; 352cdf0e10cSrcweir return NULL; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir if ( hWnd ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir debug_printf("ImplSalCreateObject hWndChild %x\n", hWndChild); 358cdf0e10cSrcweir debug_printf("ImplSalCreateObject hWnd %x\n", hWnd); 359cdf0e10cSrcweir pObject->mhWnd = hWnd; 360cdf0e10cSrcweir pObject->mhWndChild = hWndChild; 361cdf0e10cSrcweir pObject->maSysData.hWnd = hWndChild; 362cdf0e10cSrcweir return pObject; 363cdf0e10cSrcweir } 364cdf0e10cSrcweir } 365cdf0e10cSrcweir 366cdf0e10cSrcweir return NULL; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir // ======================================================================= 370cdf0e10cSrcweir 371cdf0e10cSrcweir long ImplSalObjCallbackDummy( void*, SalObject*, USHORT, const void* ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir return 0; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir // ======================================================================= 377cdf0e10cSrcweir 378cdf0e10cSrcweir Os2SalObject::Os2SalObject() 379cdf0e10cSrcweir { 380cdf0e10cSrcweir SalData* pSalData = GetSalData(); 381cdf0e10cSrcweir 382cdf0e10cSrcweir mhLastClipWnd = HWND_TOP; 383cdf0e10cSrcweir 384cdf0e10cSrcweir mhWnd = 0; 385cdf0e10cSrcweir mhWndChild = 0; 386cdf0e10cSrcweir mhLastFocusWnd = 0; 387cdf0e10cSrcweir maSysData.nSize = sizeof( SystemEnvData ); 388cdf0e10cSrcweir mnHeight = 0; 389cdf0e10cSrcweir mpInst = NULL; 390cdf0e10cSrcweir mpProc = ImplSalObjCallbackDummy; 391cdf0e10cSrcweir 392cdf0e10cSrcweir // Hook installieren, wenn es das erste Os2SalObject ist 393cdf0e10cSrcweir if ( !pSalData->mpFirstObject ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir WinSetHook( pSalData->mhAB, pSalData->mhMQ, 396cdf0e10cSrcweir HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir // Insert object in objectlist 400cdf0e10cSrcweir mpNextObject = pSalData->mpFirstObject; 401cdf0e10cSrcweir pSalData->mpFirstObject = this; 402cdf0e10cSrcweir } 403cdf0e10cSrcweir 404cdf0e10cSrcweir // ----------------------------------------------------------------------- 405cdf0e10cSrcweir 406cdf0e10cSrcweir Os2SalObject::~Os2SalObject() 407cdf0e10cSrcweir { 408cdf0e10cSrcweir SalData* pSalData = GetSalData(); 409cdf0e10cSrcweir 410cdf0e10cSrcweir // remove frame from framelist 411cdf0e10cSrcweir if ( this == pSalData->mpFirstObject ) 412cdf0e10cSrcweir { 413cdf0e10cSrcweir pSalData->mpFirstObject = mpNextObject; 414cdf0e10cSrcweir 415cdf0e10cSrcweir // Wenn letztes Os2SalObject, dann Hook wieder entfernen 416cdf0e10cSrcweir if ( !pSalData->mpFirstObject ) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir WinReleaseHook( pSalData->mhAB, pSalData->mhMQ, 419cdf0e10cSrcweir HK_INPUT, (PFN)SalSysMsgProc, (HMODULE)0 ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir } 422cdf0e10cSrcweir else 423cdf0e10cSrcweir { 424cdf0e10cSrcweir Os2SalObject* pTempObject = pSalData->mpFirstObject; 425cdf0e10cSrcweir while ( pTempObject->mpNextObject != this ) 426cdf0e10cSrcweir pTempObject = pTempObject->mpNextObject; 427cdf0e10cSrcweir 428cdf0e10cSrcweir pTempObject->mpNextObject = mpNextObject; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir // Cache-Daten zerstoeren 432cdf0e10cSrcweir ImplDestroyAllClipWindows( mhLastClipWnd ); 433cdf0e10cSrcweir 434cdf0e10cSrcweir if ( mhWndChild ) 435cdf0e10cSrcweir WinDestroyWindow( mhWndChild ); 436cdf0e10cSrcweir if ( mhWnd ) 437cdf0e10cSrcweir WinDestroyWindow( mhWnd ); 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir // ----------------------------------------------------------------------- 441cdf0e10cSrcweir 442cdf0e10cSrcweir void Os2SalObject::ResetClipRegion() 443cdf0e10cSrcweir { 444cdf0e10cSrcweir ImplDestroyAllClipWindows( mhLastClipWnd ); 445cdf0e10cSrcweir mhLastClipWnd = HWND_TOP; 446cdf0e10cSrcweir } 447cdf0e10cSrcweir 448cdf0e10cSrcweir // ----------------------------------------------------------------------- 449cdf0e10cSrcweir 450cdf0e10cSrcweir USHORT Os2SalObject::GetClipRegionType() 451cdf0e10cSrcweir { 452cdf0e10cSrcweir return SAL_OBJECT_CLIP_EXCLUDERECTS; 453cdf0e10cSrcweir } 454cdf0e10cSrcweir 455cdf0e10cSrcweir // ----------------------------------------------------------------------- 456cdf0e10cSrcweir 457cdf0e10cSrcweir void Os2SalObject::BeginSetClipRegion( ULONG nRectCount ) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir mhOldLastClipWnd = mhLastClipWnd; 460cdf0e10cSrcweir } 461cdf0e10cSrcweir 462cdf0e10cSrcweir // ----------------------------------------------------------------------- 463cdf0e10cSrcweir 464cdf0e10cSrcweir void Os2SalObject::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir HWND hClipWnd = WinCreateWindow( mhWnd, SAL_OBJECT_CLIPCLASSNAME, "", 467cdf0e10cSrcweir WS_VISIBLE, 468cdf0e10cSrcweir nX, mnHeight-(nY+nHeight), nWidth, nHeight, 469cdf0e10cSrcweir mhWnd, mhLastClipWnd, 470cdf0e10cSrcweir 0, NULL, NULL ); 471cdf0e10cSrcweir debug_printf("Os2SalObject::UnionClipRegion hClipWnd %x\n", hClipWnd); 472cdf0e10cSrcweir mhLastClipWnd = hClipWnd; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir 475cdf0e10cSrcweir // ----------------------------------------------------------------------- 476cdf0e10cSrcweir 477cdf0e10cSrcweir void Os2SalObject::EndSetClipRegion() 478cdf0e10cSrcweir { 479cdf0e10cSrcweir ImplDestroyAllClipWindows( mhOldLastClipWnd ); 480cdf0e10cSrcweir } 481cdf0e10cSrcweir 482cdf0e10cSrcweir // ----------------------------------------------------------------------- 483cdf0e10cSrcweir 484cdf0e10cSrcweir void Os2SalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight ) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir ULONG nStyle = 0; 487cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( mhWnd ); 488cdf0e10cSrcweir if ( bVisible ) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir WinShowWindow( mhWnd, FALSE ); 491cdf0e10cSrcweir nStyle |= SWP_SHOW; 492cdf0e10cSrcweir } 493cdf0e10cSrcweir SWP aParentSWP; 494cdf0e10cSrcweir WinQueryWindowPos( WinQueryWindow( mhWnd, QW_PARENT ), &aParentSWP ); 495cdf0e10cSrcweir WinSetWindowPos( mhWnd, 0, nX, aParentSWP.cy-(nY+nHeight), nWidth, nHeight, 496cdf0e10cSrcweir SWP_MOVE | SWP_SIZE | nStyle ); 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir // ----------------------------------------------------------------------- 500cdf0e10cSrcweir 501cdf0e10cSrcweir void Os2SalObject::Show( BOOL bVisible ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir WinShowWindow( mhWnd, bVisible ); 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir // ----------------------------------------------------------------------- 507cdf0e10cSrcweir 508cdf0e10cSrcweir void Os2SalObject::Enable( BOOL bEnable ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir // Im Gegensatz zu Windows disablen wir das Childfenster, 511cdf0e10cSrcweir // da ansonsten unser Clippen nicht mehr funktioniert, da 512cdf0e10cSrcweir // wir keine Events mehr bekommen. Dadurch kann sich evtl. 513cdf0e10cSrcweir // das Fenster anders darstellen, was wir eigentlich nicht 514cdf0e10cSrcweir // wollen. Aber da uns bisher kein Fall bekannt ist, 515cdf0e10cSrcweir // ignorieren wir dies. Ansonsten muss ein Fenster dazwischen 516cdf0e10cSrcweir // gezogen werden oder getestet werden, wie wir die 517cdf0e10cSrcweir // Maustransparenz erreichen, wenn mhWnd 518cdf0e10cSrcweir // disablte wird. 519cdf0e10cSrcweir WinEnableWindow( mhWndChild, bEnable ); 520cdf0e10cSrcweir } 521cdf0e10cSrcweir 522cdf0e10cSrcweir // ----------------------------------------------------------------------- 523cdf0e10cSrcweir 524cdf0e10cSrcweir void Os2SalObject::GrabFocus() 525cdf0e10cSrcweir { 526cdf0e10cSrcweir if ( mhLastFocusWnd && 527cdf0e10cSrcweir WinIsWindow( GetSalData()->mhAB, mhLastFocusWnd ) && 528cdf0e10cSrcweir ImplIsSysWindowOrChild( mhWndChild, mhLastFocusWnd ) ) 529cdf0e10cSrcweir WinSetFocus( HWND_DESKTOP, mhLastFocusWnd ); 530cdf0e10cSrcweir else 531cdf0e10cSrcweir WinSetFocus( HWND_DESKTOP, mhWndChild ); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir 534cdf0e10cSrcweir // ----------------------------------------------------------------------- 535cdf0e10cSrcweir 536cdf0e10cSrcweir void Os2SalObject::SetBackground() 537cdf0e10cSrcweir { 538cdf0e10cSrcweir } 539cdf0e10cSrcweir 540cdf0e10cSrcweir // ----------------------------------------------------------------------- 541cdf0e10cSrcweir 542cdf0e10cSrcweir void Os2SalObject::SetBackground( SalColor nSalColor ) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir } 545cdf0e10cSrcweir 546cdf0e10cSrcweir // ----------------------------------------------------------------------- 547cdf0e10cSrcweir 548cdf0e10cSrcweir const SystemChildData* Os2SalObject::GetSystemData() const 549cdf0e10cSrcweir { 550cdf0e10cSrcweir return &maSysData; 551cdf0e10cSrcweir } 552cdf0e10cSrcweir 553cdf0e10cSrcweir // ----------------------------------------------------------------------- 554cdf0e10cSrcweir #if 0 555cdf0e10cSrcweir void Os2SalObject::SetCallback( void* pInst, SALOBJECTPROC pProc ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir mpInst = pInst; 558cdf0e10cSrcweir if ( pProc ) 559cdf0e10cSrcweir mpProc = pProc; 560cdf0e10cSrcweir else 561cdf0e10cSrcweir mpProc = ImplSalObjCallbackDummy; 562cdf0e10cSrcweir } 563cdf0e10cSrcweir #endif 564cdf0e10cSrcweir 565cdf0e10cSrcweir // ----------------------------------------------------------------------- 566cdf0e10cSrcweir 567cdf0e10cSrcweir void Os2SalObject::InterceptChildWindowKeyDown( sal_Bool /*bIntercept*/ ) 568cdf0e10cSrcweir { 569cdf0e10cSrcweir } 570cdf0e10cSrcweir 571