1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <string.h> 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir #define INCL_DOS 31*cdf0e10cSrcweir #define INCL_PM 32*cdf0e10cSrcweir #define INCL_WIN 33*cdf0e10cSrcweir #include <svpm.h> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir // ======================================================================= 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #define _SV_SALFRAME_CXX 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #ifndef DEBUG_HXX 40*cdf0e10cSrcweir #include <tools/debug.hxx> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #define private public 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #ifndef _SV_SALLANG_HXX 46*cdf0e10cSrcweir #include <sallang.hxx> 47*cdf0e10cSrcweir #endif 48*cdf0e10cSrcweir #ifndef _SV_SALIDS_HRC 49*cdf0e10cSrcweir #include <salids.hrc> 50*cdf0e10cSrcweir #endif 51*cdf0e10cSrcweir #include <saldata.hxx> 52*cdf0e10cSrcweir #include <salinst.h> 53*cdf0e10cSrcweir #include <salgdi.h> 54*cdf0e10cSrcweir #include <salframe.h> 55*cdf0e10cSrcweir #include <vcl/timer.hxx> 56*cdf0e10cSrcweir #include <vcl/settings.hxx> 57*cdf0e10cSrcweir #ifndef _SV_KEYCOES_HXX 58*cdf0e10cSrcweir #include <vcl/keycodes.hxx> 59*cdf0e10cSrcweir #endif 60*cdf0e10cSrcweir #include <saltimer.h> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 63*cdf0e10cSrcweir extern "C" int debug_printf(const char *f, ...); 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir static BOOL _bCapture; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir #else 68*cdf0e10cSrcweir #define debug_printf( ...) { 1; } 69*cdf0e10cSrcweir #endif 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir // ======================================================================= 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir HPOINTER ImplLoadPointer( ULONG nId ); 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); 76*cdf0e10cSrcweir static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ); 77*cdf0e10cSrcweir static void ImplSalCalcFrameSize( HWND hWnd, 78*cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); 79*cdf0e10cSrcweir static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, 80*cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ); 81*cdf0e10cSrcweir MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, 82*cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ); 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir // ======================================================================= 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir static LanguageType eImplKeyboardLanguage = LANGUAGE_DONTKNOW; 87*cdf0e10cSrcweir BOOL Os2SalFrame::mbInReparent = FALSE; 88*cdf0e10cSrcweir ULONG Os2SalFrame::mnInputLang = 0; 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // ======================================================================= 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir // define a new flag 93*cdf0e10cSrcweir #define SWP_CENTER (SWP_NOAUTOCLOSE<<4) 94*cdf0e10cSrcweir #define SWP_SHOWMAXIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MAXIMIZE) 95*cdf0e10cSrcweir #define SWP_SHOWMINIMIZED (SWP_ACTIVATE | SWP_SHOW | SWP_MINIMIZE) 96*cdf0e10cSrcweir #define SWP_SHOWNORMAL (SWP_ACTIVATE | SWP_SHOW | SWP_RESTORE) 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir static LONG nScreenHeight = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN); 99*cdf0e10cSrcweir static LONG nScreenWidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir BOOL APIENTRY _WinQueryWindowRect( HWND hwnd, PRECTL prclDest) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir BOOL rc = WinQueryWindowRect( hwnd, prclDest); 104*cdf0e10cSrcweir ULONG tmp = prclDest->yBottom; 105*cdf0e10cSrcweir prclDest->yBottom = prclDest->yTop; 106*cdf0e10cSrcweir prclDest->yTop = tmp; 107*cdf0e10cSrcweir return rc; 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir BOOL APIENTRY _WinQueryPointerPos (HWND hwndDesktop, PPOINTL pptl) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir BOOL rc = WinQueryPointerPos( hwndDesktop, pptl); 113*cdf0e10cSrcweir pptl->y = nScreenHeight - pptl->y; 114*cdf0e10cSrcweir return rc; 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir BOOL APIENTRY _WinQueryWindowPos( Os2SalFrame* pFrame, PSWP pswp) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir SWP swpOwner; 120*cdf0e10cSrcweir BOOL rc = WinQueryWindowPos( pFrame->mhWndFrame, pswp); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 123*cdf0e10cSrcweir debug_printf( "> WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", 124*cdf0e10cSrcweir pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); 125*cdf0e10cSrcweir #endif 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir Os2SalFrame* pParentFrame = pFrame->mpParentFrame; 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir //YD adjust to owner coordinates 130*cdf0e10cSrcweir if ( pParentFrame ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir POINTL ptlOwner = {0}; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // coords are relative to screen, map to parent frame client area 135*cdf0e10cSrcweir ptlOwner.x = pswp->x; 136*cdf0e10cSrcweir ptlOwner.y = pswp->y; 137*cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pParentFrame->mhWndClient, &ptlOwner, 1); 138*cdf0e10cSrcweir pswp->x = ptlOwner.x; 139*cdf0e10cSrcweir pswp->y = ptlOwner.y; 140*cdf0e10cSrcweir // get parent client area size 141*cdf0e10cSrcweir WinQueryWindowPos( pParentFrame->mhWndClient, &swpOwner); 142*cdf0e10cSrcweir } else 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // no owner info, use DESKTOP???? 145*cdf0e10cSrcweir swpOwner.cx = nScreenWidth; 146*cdf0e10cSrcweir swpOwner.cy = nScreenHeight; 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir // invert Y coordinate 150*cdf0e10cSrcweir pswp->y = swpOwner.cy - (pswp->y + pswp->cy); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 153*cdf0e10cSrcweir debug_printf( "< WinQueryWindowPos hwnd %x at %d,%d (%dx%d)\n", 154*cdf0e10cSrcweir pFrame->mhWndFrame, pswp->x, pswp->y, pswp->cx, pswp->cy); 155*cdf0e10cSrcweir #endif 156*cdf0e10cSrcweir return rc; 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir BOOL APIENTRY _WinSetWindowPos( Os2SalFrame* pFrame, HWND hwndInsertBehind, LONG x, LONG y, 160*cdf0e10cSrcweir LONG cx, LONG cy, ULONG fl) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir SWP swpOwner = {0}; 163*cdf0e10cSrcweir POINTL ptlOwner = {0}; 164*cdf0e10cSrcweir HWND hParent = NULL; 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>1 167*cdf0e10cSrcweir debug_printf( ">WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl 0x%08x\n", 168*cdf0e10cSrcweir pFrame->mhWndFrame, x, y, cx, cy, fl); 169*cdf0e10cSrcweir #endif 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // first resize window if requested 172*cdf0e10cSrcweir if ( (fl & SWP_SIZE) ) { 173*cdf0e10cSrcweir ULONG flag = SWP_SIZE; 174*cdf0e10cSrcweir LONG nX = 0, nY = 0; 175*cdf0e10cSrcweir LONG frameFrameX, frameFrameY, frameCaptionY; 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, frameFrameX, frameFrameY, frameCaptionY ); 178*cdf0e10cSrcweir // if we change y size, we need to move the window down 179*cdf0e10cSrcweir // because os2 window origin is lower left corner 180*cdf0e10cSrcweir if (pFrame->maGeometry.nHeight != cy) { 181*cdf0e10cSrcweir SWP aSWP; 182*cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndFrame, &aSWP); 183*cdf0e10cSrcweir nX = aSWP.x; 184*cdf0e10cSrcweir nY = aSWP.y - (cy + 2*frameFrameY + frameCaptionY - aSWP.cy); 185*cdf0e10cSrcweir flag |= SWP_MOVE; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, NULL, nX, nY, 188*cdf0e10cSrcweir cx+2*frameFrameX, cy+2*frameFrameY+frameCaptionY, flag); 189*cdf0e10cSrcweir fl = fl & ~SWP_SIZE; 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir else // otherwise get current size 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir SWP swp = {0}; 194*cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndClient, &swp); 195*cdf0e10cSrcweir cx = swp.cx; 196*cdf0e10cSrcweir cy = swp.cy; 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir // get parent window handle 200*cdf0e10cSrcweir Os2SalFrame* pParentFrame = pFrame->mpParentFrame; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir // use desktop if parent is not defined 203*cdf0e10cSrcweir hParent = pParentFrame ? pParentFrame->mhWndClient : HWND_DESKTOP; 204*cdf0e10cSrcweir // if parent is not visible, use desktop as reference 205*cdf0e10cSrcweir hParent = WinIsWindowVisible( hParent) ? hParent : HWND_DESKTOP; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir WinQueryWindowPos( hParent, &swpOwner); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir //YD adjust to owner coordinates only when moving and not centering 210*cdf0e10cSrcweir //if (!(fl & SWP_CENTER) && (fl & SWP_MOVE)) 211*cdf0e10cSrcweir if ((fl & SWP_MOVE)) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir // if SWP_CENTER is specified, change position to parent center 215*cdf0e10cSrcweir if (fl & SWP_CENTER) { 216*cdf0e10cSrcweir ptlOwner.x = (swpOwner.cx - cx) / 2; 217*cdf0e10cSrcweir ptlOwner.y = (swpOwner.cy - cy) / 2; 218*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 219*cdf0e10cSrcweir debug_printf( "_WinSetWindowPos SWP_CENTER\n"); 220*cdf0e10cSrcweir #endif 221*cdf0e10cSrcweir fl = fl & ~SWP_CENTER; 222*cdf0e10cSrcweir } else { 223*cdf0e10cSrcweir // coords are relative to parent frame client area, map to screen 224*cdf0e10cSrcweir // map Y to OS/2 system coordinates 225*cdf0e10cSrcweir ptlOwner.x = x; 226*cdf0e10cSrcweir ptlOwner.y = swpOwner.cy - (y + cy); 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 229*cdf0e10cSrcweir debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) OS2\n", 230*cdf0e10cSrcweir hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); 231*cdf0e10cSrcweir #endif 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir // map from client area to screen 234*cdf0e10cSrcweir WinMapWindowPoints( hParent, HWND_DESKTOP, &ptlOwner, 1); 235*cdf0e10cSrcweir x = ptlOwner.x; 236*cdf0e10cSrcweir y = ptlOwner.y; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 239*cdf0e10cSrcweir debug_printf( "_WinSetWindowPos owner 0x%x at %d,%d (%dx%d) MAPPED OS2\n", 240*cdf0e10cSrcweir hParent, ptlOwner.x, ptlOwner.y, swpOwner.cx, swpOwner.cy); 241*cdf0e10cSrcweir #endif 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 245*cdf0e10cSrcweir debug_printf( "<WinSetWindowPos hwnd %x at %d,%d (%dx%d) fl=%x\n", 246*cdf0e10cSrcweir pFrame->mhWndFrame, x, y, cx, cy, fl); 247*cdf0e10cSrcweir #endif 248*cdf0e10cSrcweir return WinSetWindowPos( pFrame->mhWndFrame, hwndInsertBehind, x, y, 0, 0, fl); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir // ======================================================================= 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 254*cdf0e10cSrcweir static void dumpWindowInfo( char* fnc, HWND hwnd) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir SWP aSWP; 257*cdf0e10cSrcweir HWND hwnd2; 258*cdf0e10cSrcweir char szTitle[256]; 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir #if 0 261*cdf0e10cSrcweir _WinQueryWindowPos( hwnd, &aSWP ); 262*cdf0e10cSrcweir strcpy(szTitle,""); 263*cdf0e10cSrcweir WinQueryWindowText(hwnd, sizeof(szTitle), szTitle); 264*cdf0e10cSrcweir debug_printf( "%s: window %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd, 265*cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 266*cdf0e10cSrcweir hwnd2 = WinQueryWindow(hwnd, QW_PARENT); 267*cdf0e10cSrcweir _WinQueryWindowPos( hwnd2, &aSWP ); 268*cdf0e10cSrcweir strcpy(szTitle,""); 269*cdf0e10cSrcweir WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); 270*cdf0e10cSrcweir debug_printf( "%s: parent %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, 271*cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 272*cdf0e10cSrcweir hwnd2 = WinQueryWindow(hwnd, QW_OWNER); 273*cdf0e10cSrcweir _WinQueryWindowPos( hwnd2, &aSWP ); 274*cdf0e10cSrcweir strcpy(szTitle,""); 275*cdf0e10cSrcweir WinQueryWindowText(hwnd2, sizeof(szTitle), szTitle); 276*cdf0e10cSrcweir debug_printf( "%s: owner %08x at %d,%d (size %dx%d) '%s'\n", fnc, hwnd2, 277*cdf0e10cSrcweir aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, szTitle); 278*cdf0e10cSrcweir #endif 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir #endif 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir // ======================================================================= 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir #ifdef ENABLE_IME 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir struct ImplSalIMEProc 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir ULONG nOrd; 289*cdf0e10cSrcweir PFN* pProc; 290*cdf0e10cSrcweir }; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir #define SAL_IME_PROC_COUNT 12 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // ----------------------------------------------------------------------- 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir static SalIMEData* GetSalIMEData() 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir if ( !pSalData->mbIMEInit ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir pSalData->mbIMEInit = TRUE; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir HMODULE hMod = 0; 305*cdf0e10cSrcweir if ( 0 == DosLoadModule( NULL, 0, "OS2IM", &hMod ) ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir SalIMEData* pIMEData = new SalIMEData; 308*cdf0e10cSrcweir BOOL bError = FALSE; 309*cdf0e10cSrcweir ImplSalIMEProc aProcAry[SAL_IME_PROC_COUNT] = 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir { 101, (PFN*)&(pIMEData->mpAssocIME) }, 312*cdf0e10cSrcweir { 104, (PFN*)&(pIMEData->mpGetIME) }, 313*cdf0e10cSrcweir { 106, (PFN*)&(pIMEData->mpReleaseIME) }, 314*cdf0e10cSrcweir { 117, (PFN*)&(pIMEData->mpSetConversionFont) }, 315*cdf0e10cSrcweir { 144, (PFN*)&(pIMEData->mpSetConversionFontSize) }, 316*cdf0e10cSrcweir { 118, (PFN*)&(pIMEData->mpGetConversionString) }, 317*cdf0e10cSrcweir { 122, (PFN*)&(pIMEData->mpGetResultString) }, 318*cdf0e10cSrcweir { 115, (PFN*)&(pIMEData->mpSetCandidateWin) }, 319*cdf0e10cSrcweir { 130, (PFN*)&(pIMEData->mpQueryIMEProperty) }, 320*cdf0e10cSrcweir { 131, (PFN*)&(pIMEData->mpRequestIME) }, 321*cdf0e10cSrcweir { 128, (PFN*)&(pIMEData->mpSetIMEMode) }, 322*cdf0e10cSrcweir { 127, (PFN*)&(pIMEData->mpQueryIMEMode) } 323*cdf0e10cSrcweir }; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir pIMEData->mhModIME = hMod; 326*cdf0e10cSrcweir for ( USHORT i = 0; i < SAL_IME_PROC_COUNT; i++ ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir if ( 0 != DosQueryProcAddr( pIMEData->mhModIME, aProcAry[i].nOrd, 0, aProcAry[i].pProc ) ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir bError = TRUE; 331*cdf0e10cSrcweir break; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir if ( bError ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir DosFreeModule( pIMEData->mhModIME ); 338*cdf0e10cSrcweir delete pIMEData; 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir else 341*cdf0e10cSrcweir pSalData->mpIMEData = pIMEData; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir return pSalData->mpIMEData; 346*cdf0e10cSrcweir } 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir // ----------------------------------------------------------------------- 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir void ImplReleaseSALIMEData() 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir if ( pSalData->mpIMEData ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir DosFreeModule( pSalData->mpIMEData->mhModIME ); 357*cdf0e10cSrcweir delete pSalData->mpIMEData; 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir #endif 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir // ======================================================================= 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir static void ImplSaveFrameState( Os2SalFrame* pFrame ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir // Position, Groesse und Status fuer GetWindowState() merken 368*cdf0e10cSrcweir if ( !pFrame->mbFullScreen ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir SWP aSWP; 371*cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( pFrame->mhWndFrame); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // Query actual state (maState uses screen coords) 374*cdf0e10cSrcweir WinQueryWindowPos( pFrame->mhWndFrame, &aSWP ); 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir if ( aSWP.fl & SWP_MINIMIZE ) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 379*cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MINIMIZED\n", 380*cdf0e10cSrcweir pFrame->mhWndFrame); 381*cdf0e10cSrcweir #endif 382*cdf0e10cSrcweir pFrame->maState.mnState |= SAL_FRAMESTATE_MINIMIZED; 383*cdf0e10cSrcweir if ( bVisible ) 384*cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWMAXIMIZED; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir else if ( aSWP.fl & SWP_MAXIMIZE ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 389*cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x SAL_FRAMESTATE_MAXIMIZED\n", 390*cdf0e10cSrcweir pFrame->mhWndFrame); 391*cdf0e10cSrcweir #endif 392*cdf0e10cSrcweir pFrame->maState.mnState &= ~SAL_FRAMESTATE_MINIMIZED; 393*cdf0e10cSrcweir pFrame->maState.mnState |= SAL_FRAMESTATE_MAXIMIZED; 394*cdf0e10cSrcweir if ( bVisible ) 395*cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWMINIMIZED; 396*cdf0e10cSrcweir pFrame->mbRestoreMaximize = TRUE; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir else 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 401*cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 402*cdf0e10cSrcweir // to be consistent with Unix, the frame state is without(!) decoration 403*cdf0e10cSrcweir long nTopDeco = nFrameY + nCaptionY; 404*cdf0e10cSrcweir long nLeftDeco = nFrameX; 405*cdf0e10cSrcweir long nBottomDeco = nFrameY; 406*cdf0e10cSrcweir long nRightDeco = nFrameX; 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir pFrame->maState.mnState &= ~(SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED); 409*cdf0e10cSrcweir // subtract decoration, store screen coords 410*cdf0e10cSrcweir pFrame->maState.mnX = aSWP.x+nLeftDeco; 411*cdf0e10cSrcweir pFrame->maState.mnY = nScreenHeight - (aSWP.y+aSWP.cy)+nTopDeco; 412*cdf0e10cSrcweir pFrame->maState.mnWidth = aSWP.cx-nLeftDeco-nRightDeco; 413*cdf0e10cSrcweir pFrame->maState.mnHeight = aSWP.cy-nTopDeco-nBottomDeco; 414*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 415*cdf0e10cSrcweir debug_printf("Os2SalFrame::GetWindowState %08x (%dx%d) at %d,%d VCL\n", 416*cdf0e10cSrcweir pFrame->mhWndFrame, 417*cdf0e10cSrcweir pFrame->maState.mnWidth,pFrame->maState.mnHeight,pFrame->maState.mnX,pFrame->maState.mnY); 418*cdf0e10cSrcweir #endif 419*cdf0e10cSrcweir if ( bVisible ) 420*cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWNORMAL; 421*cdf0e10cSrcweir pFrame->mbRestoreMaximize = FALSE; 422*cdf0e10cSrcweir //debug_printf( "ImplSaveFrameState: window %08x at %d,%d (size %dx%d)\n", 423*cdf0e10cSrcweir // pFrame->mhWndFrame, 424*cdf0e10cSrcweir // pFrame->maState.mnX, pFrame->maState.mnY, pFrame->maState.mnWidth, pFrame->maState.mnHeight); 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir // ----------------------------------------------------------------------- 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir long ImplSalCallbackDummy( void*, SalFrame*, USHORT, const void* ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir return 0; 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // ----------------------------------------------------------------------- 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir static void ImplSalCalcFrameSize( HWND hWnd, 439*cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 442*cdf0e10cSrcweir if ( !pFrame ) 443*cdf0e10cSrcweir return; 444*cdf0e10cSrcweir return ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir static void ImplSalCalcFrameSize( const Os2SalFrame* pFrame, 448*cdf0e10cSrcweir LONG& nFrameX, LONG& nFrameY, LONG& nCaptionY ) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir if ( pFrame->mbSizeBorder ) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXSIZEBORDER ); 453*cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER ); 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir else if ( pFrame->mbFixBorder ) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXDLGFRAME ); 458*cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYDLGFRAME ); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir else if ( pFrame->mbBorder ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir nFrameX = WinQuerySysValue( HWND_DESKTOP, SV_CXBORDER ); 463*cdf0e10cSrcweir nFrameY = WinQuerySysValue( HWND_DESKTOP, SV_CYBORDER ); 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir else 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir nFrameX = 0; 468*cdf0e10cSrcweir nFrameY = 0; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir if ( pFrame->mbCaption ) 471*cdf0e10cSrcweir nCaptionY = WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); 472*cdf0e10cSrcweir else 473*cdf0e10cSrcweir nCaptionY = 0; 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 476*cdf0e10cSrcweir //if (_bCapture) 477*cdf0e10cSrcweir debug_printf("ImplSalCalcFrameSize 0x%08x x=%d y=%d t=%d\n", pFrame->mhWndFrame, nFrameX, nFrameY, nCaptionY); 478*cdf0e10cSrcweir #endif 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir // ----------------------------------------------------------------------- 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir static void ImplSalCalcFullScreenSize( const Os2SalFrame* pFrame, 484*cdf0e10cSrcweir LONG& rX, LONG& rY, LONG& rDX, LONG& rDY ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir // set window to screen size 487*cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 488*cdf0e10cSrcweir LONG rScreenDX = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN ); 489*cdf0e10cSrcweir LONG rScreenDY = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN ); 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir // Framegroessen berechnen 492*cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY ); 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir rX = -nFrameX; 495*cdf0e10cSrcweir rY = -(nFrameY+nCaptionY); 496*cdf0e10cSrcweir rDX = rScreenDX+(nFrameX*2); 497*cdf0e10cSrcweir rDY = rScreenDY+(nFrameY*2)+nCaptionY; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir // ----------------------------------------------------------------------- 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir static void ImplSalFrameFullScreenPos( Os2SalFrame* pFrame, BOOL bAlways = FALSE ) 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir SWP aSWP; 505*cdf0e10cSrcweir _WinQueryWindowPos( pFrame, &aSWP ); 506*cdf0e10cSrcweir if ( bAlways || !(aSWP.fl & SWP_MINIMIZE) ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir // set window to screen size 509*cdf0e10cSrcweir LONG nX; 510*cdf0e10cSrcweir LONG nY; 511*cdf0e10cSrcweir LONG nWidth; 512*cdf0e10cSrcweir LONG nHeight; 513*cdf0e10cSrcweir ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight ); 514*cdf0e10cSrcweir _WinSetWindowPos( pFrame, 0, 515*cdf0e10cSrcweir nX, nY, nWidth, nHeight, 516*cdf0e10cSrcweir SWP_MOVE | SWP_SIZE ); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir // ----------------------------------------------------------------------- 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir // Uebersetzungstabelle von System-Keycodes in StarView-Keycodes 523*cdf0e10cSrcweir #define KEY_TAB_SIZE (VK_ENDDRAG+1) 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir static USHORT aImplTranslateKeyTab[KEY_TAB_SIZE] = 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir // StarView-Code System-Code Index 528*cdf0e10cSrcweir 0, // 0x00 529*cdf0e10cSrcweir 0, // VK_BUTTON1 0x01 530*cdf0e10cSrcweir 0, // VK_BUTTON2 0x02 531*cdf0e10cSrcweir 0, // VK_BUTTON3 0x03 532*cdf0e10cSrcweir 0, // VK_BREAK 0x04 533*cdf0e10cSrcweir KEY_BACKSPACE, // VK_BACKSPACE 0x05 534*cdf0e10cSrcweir KEY_TAB, // VK_TAB 0x06 535*cdf0e10cSrcweir KEY_TAB, // VK_BACKTAB 0x07 536*cdf0e10cSrcweir KEY_RETURN, // VK_NEWLINE 0x08 537*cdf0e10cSrcweir 0, // VK_SHIFT 0x09 538*cdf0e10cSrcweir 0, // VK_CTRL 0x0A 539*cdf0e10cSrcweir 0, // VK_ALT 0x0B 540*cdf0e10cSrcweir 0, // VK_ALTGRAF 0x0C 541*cdf0e10cSrcweir 0, // VK_PAUSE 0x0D 542*cdf0e10cSrcweir 0, // VK_CAPSLOCK 0x0E 543*cdf0e10cSrcweir KEY_ESCAPE, // VK_ESC 0x0F 544*cdf0e10cSrcweir KEY_SPACE, // VK_SPACE 0x10 545*cdf0e10cSrcweir KEY_PAGEUP, // VK_PAGEUP 0x11 546*cdf0e10cSrcweir KEY_PAGEDOWN, // VK_PAGEDOWN 0x12 547*cdf0e10cSrcweir KEY_END, // VK_END 0x13 548*cdf0e10cSrcweir KEY_HOME, // VK_HOME 0x14 549*cdf0e10cSrcweir KEY_LEFT, // VK_LEFT 0x15 550*cdf0e10cSrcweir KEY_UP, // VK_UP 0x16 551*cdf0e10cSrcweir KEY_RIGHT, // VK_RIGHT 0x17 552*cdf0e10cSrcweir KEY_DOWN, // VK_DOWN 0x18 553*cdf0e10cSrcweir 0, // VK_PRINTSCRN 0x19 554*cdf0e10cSrcweir KEY_INSERT, // VK_INSERT 0x1A 555*cdf0e10cSrcweir KEY_DELETE, // VK_DELETE 0x1B 556*cdf0e10cSrcweir 0, // VK_SCRLLOCK 0x1C 557*cdf0e10cSrcweir 0, // VK_NUMLOCK 0x1D 558*cdf0e10cSrcweir KEY_RETURN, // VK_ENTER 0x1E 559*cdf0e10cSrcweir 0, // VK_SYSRQ 0x1F 560*cdf0e10cSrcweir KEY_F1, // VK_F1 0x20 561*cdf0e10cSrcweir KEY_F2, // VK_F2 0x21 562*cdf0e10cSrcweir KEY_F3, // VK_F3 0x22 563*cdf0e10cSrcweir KEY_F4, // VK_F4 0x23 564*cdf0e10cSrcweir KEY_F5, // VK_F5 0x24 565*cdf0e10cSrcweir KEY_F6, // VK_F6 0x25 566*cdf0e10cSrcweir KEY_F7, // VK_F7 0x26 567*cdf0e10cSrcweir KEY_F8, // VK_F8 0x27 568*cdf0e10cSrcweir KEY_F9, // VK_F9 0x28 569*cdf0e10cSrcweir KEY_F10, // VK_F10 0x29 570*cdf0e10cSrcweir KEY_F11, // VK_F11 0x2A 571*cdf0e10cSrcweir KEY_F12, // VK_F12 0x2B 572*cdf0e10cSrcweir KEY_F13, // VK_F13 0x2C 573*cdf0e10cSrcweir KEY_F14, // VK_F14 0x2D 574*cdf0e10cSrcweir KEY_F15, // VK_F15 0x2E 575*cdf0e10cSrcweir KEY_F16, // VK_F16 0x2F 576*cdf0e10cSrcweir KEY_F17, // VK_F17 0x30 577*cdf0e10cSrcweir KEY_F18, // VK_F18 0x31 578*cdf0e10cSrcweir KEY_F19, // VK_F19 0x32 579*cdf0e10cSrcweir KEY_F20, // VK_F20 0x33 580*cdf0e10cSrcweir KEY_F21, // VK_F21 0x34 581*cdf0e10cSrcweir KEY_F22, // VK_F22 0x35 582*cdf0e10cSrcweir KEY_F23, // VK_F23 0x36 583*cdf0e10cSrcweir KEY_F24, // VK_F24 0x37 584*cdf0e10cSrcweir 0 // VK_ENDDRAG 0x38 585*cdf0e10cSrcweir }; 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir // ======================================================================= 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir SalFrame* ImplSalCreateFrame( Os2SalInstance* pInst, HWND hWndParent, ULONG nSalFrameStyle ) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 592*cdf0e10cSrcweir Os2SalFrame* pFrame = new Os2SalFrame; 593*cdf0e10cSrcweir HWND hWndFrame; 594*cdf0e10cSrcweir HWND hWndClient; 595*cdf0e10cSrcweir ULONG nFrameFlags = FCF_NOBYTEALIGN | FCF_SCREENALIGN; 596*cdf0e10cSrcweir ULONG nFrameStyle = 0; 597*cdf0e10cSrcweir ULONG nClientStyle = WS_CLIPSIBLINGS; 598*cdf0e10cSrcweir BOOL bSubFrame = FALSE; 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 601*cdf0e10cSrcweir debug_printf(">ImplSalCreateFrame hWndParent 0x%x, nSalFrameStyle 0x%x\n", hWndParent, nSalFrameStyle); 602*cdf0e10cSrcweir #endif 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir if ( hWndParent ) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir bSubFrame = TRUE; 607*cdf0e10cSrcweir pFrame->mbNoIcon = TRUE; 608*cdf0e10cSrcweir } 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir // determine creation data (bei Moveable nehmen wir DLG-Border, damit 611*cdf0e10cSrcweir // es besser aussieht) 612*cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE ) 613*cdf0e10cSrcweir nFrameFlags |= FCF_CLOSEBUTTON; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE ) { 616*cdf0e10cSrcweir pFrame->mbCaption = TRUE; 617*cdf0e10cSrcweir nFrameStyle = WS_ANIMATE; 618*cdf0e10cSrcweir nFrameFlags |= FCF_SYSMENU | FCF_TITLEBAR | FCF_DLGBORDER; 619*cdf0e10cSrcweir if ( !hWndParent ) 620*cdf0e10cSrcweir nFrameFlags |= FCF_MINBUTTON; 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE ) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir pFrame->mbSizeBorder = TRUE; 625*cdf0e10cSrcweir nFrameFlags |= FCF_SIZEBORDER; 626*cdf0e10cSrcweir if ( !hWndParent ) 627*cdf0e10cSrcweir nFrameFlags |= FCF_MAXBUTTON; 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir else 630*cdf0e10cSrcweir pFrame->mbFixBorder = TRUE; 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir // add task list style if not a tool window 633*cdf0e10cSrcweir if ( !(nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW) ) { 634*cdf0e10cSrcweir nFrameFlags |= FCF_TASKLIST; 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLWINDOW ) 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir pFrame->mbNoIcon = TRUE; 641*cdf0e10cSrcweir // YD gives small caption -> nExSysStyle |= WS_EX_TOOLWINDOW; 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir if ( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT ) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir //nExSysStyle |= WS_EX_TOOLWINDOW; 647*cdf0e10cSrcweir pFrame->mbFloatWin = TRUE; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir //if( nSalFrameStyle & SAL_FRAME_STYLE_TOOLTIP ) 650*cdf0e10cSrcweir // nExSysStyle |= WS_EX_TOPMOST; 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir // init frame data 653*cdf0e10cSrcweir pFrame->mnStyle = nSalFrameStyle; 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir // determine show style 656*cdf0e10cSrcweir pFrame->mnShowState = SWP_SHOWNORMAL; 657*cdf0e10cSrcweir 658*cdf0e10cSrcweir // create frame 659*cdf0e10cSrcweir //YD FIXME this is a potential bug with multiple threads and cuncurrent 660*cdf0e10cSrcweir //window creation, because this field is accessed in 661*cdf0e10cSrcweir //WM_CREATE to get window data, 662*cdf0e10cSrcweir pSalData->mpCreateFrame = pFrame; 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir //YD FIXME if SAL_FRAME_CHILD is specified, use hWndParent as parent handle... 665*cdf0e10cSrcweir hWndFrame = WinCreateStdWindow( HWND_DESKTOP, nFrameStyle, &nFrameFlags, 666*cdf0e10cSrcweir (PSZ)(bSubFrame ? SAL_SUBFRAME_CLASSNAME : SAL_FRAME_CLASSNAME), 667*cdf0e10cSrcweir NULL, 668*cdf0e10cSrcweir nClientStyle, 0, 0, &hWndClient ); 669*cdf0e10cSrcweir debug_printf("ImplSalCreateFrame hWndParent 0x%x, hWndFrame 0x%x, hWndClient 0x%x\n", hWndParent, hWndFrame, hWndClient); 670*cdf0e10cSrcweir if ( !hWndFrame ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir delete pFrame; 673*cdf0e10cSrcweir return NULL; 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir // Parent setzen (Owner) 677*cdf0e10cSrcweir if ( hWndParent != 0 && hWndParent != HWND_DESKTOP ) 678*cdf0e10cSrcweir WinSetOwner( hWndFrame, hWndParent ); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir Os2SalFrame* pParentFrame = GetWindowPtr( hWndParent ); 681*cdf0e10cSrcweir if ( pParentFrame ) 682*cdf0e10cSrcweir pFrame->mpParentFrame = pParentFrame; 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir // Icon setzen (YD win32 does it in the class registration) 685*cdf0e10cSrcweir if ( nFrameFlags & FCF_MINBUTTON ) 686*cdf0e10cSrcweir WinSendMsg( hWndFrame, WM_SETICON, (MPARAM)pInst->mhAppIcon, (MPARAM)0 ); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir // If we have an Window with an Caption Bar and without 689*cdf0e10cSrcweir // an MaximizeBox, we change the SystemMenu 690*cdf0e10cSrcweir if ( (nFrameFlags & (FCF_TITLEBAR | FCF_MAXBUTTON)) == (FCF_TITLEBAR) ) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); 693*cdf0e10cSrcweir if ( hSysMenu ) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir if ( !(nFrameFlags & (FCF_MINBUTTON | FCF_MAXBUTTON)) ) 696*cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_RESTORE, FALSE); 697*cdf0e10cSrcweir if ( !(nFrameFlags & FCF_MINBUTTON) ) 698*cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_MINIMIZE, FALSE); 699*cdf0e10cSrcweir if ( !(nFrameFlags & FCF_MAXBUTTON) ) 700*cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_MAXIMIZE, FALSE); 701*cdf0e10cSrcweir if ( !(nFrameFlags & FCF_SIZEBORDER) ) 702*cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_SIZE, FALSE); 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir if ( (nFrameFlags & FCF_SYSMENU) && !(nSalFrameStyle & SAL_FRAME_STYLE_CLOSEABLE) ) 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir HWND hSysMenu = WinWindowFromID( hWndFrame, FID_SYSMENU ); 708*cdf0e10cSrcweir if ( hSysMenu ) 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir WinEnableMenuItem(hSysMenu, SC_CLOSE, FALSE); 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir // ticket#124 subclass frame window: we need to intercept TRACK message 715*cdf0e10cSrcweir aSalShlData.mpFrameProc = WinSubclassWindow( hWndFrame, SalFrameSubClassWndProc); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir // init OS/2 frame data 718*cdf0e10cSrcweir pFrame->mhAB = pInst->mhAB; 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir // YD 18/08 under OS/2, invisible frames have size 0,0 at 0,0, so 721*cdf0e10cSrcweir // we need to set an initial size/position manually 722*cdf0e10cSrcweir SWP aSWP; 723*cdf0e10cSrcweir memset( &aSWP, 0, sizeof( aSWP ) ); 724*cdf0e10cSrcweir WinQueryTaskSizePos( pInst->mhAB, 0, &aSWP ); 725*cdf0e10cSrcweir WinSetWindowPos( hWndFrame, NULL, aSWP.x, aSWP.y, aSWP.cx, aSWP.cy, 726*cdf0e10cSrcweir SWP_MOVE | SWP_SIZE); 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir #ifdef ENABLE_IME 729*cdf0e10cSrcweir // Input-Context einstellen 730*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 731*cdf0e10cSrcweir if ( pIMEData ) 732*cdf0e10cSrcweir { 733*cdf0e10cSrcweir pFrame->mhIMEContext = 0; 734*cdf0e10cSrcweir if ( 0 != pIMEData->mpAssocIME( hWndClient, pFrame->mhIMEContext, &pFrame->mhDefIMEContext ) ) 735*cdf0e10cSrcweir pFrame->mhDefIMEContext = 0; 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir else 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir pFrame->mhIMEContext = 0; 740*cdf0e10cSrcweir pFrame->mhDefIMEContext = 0; 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir #endif 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir RECTL rectl; 745*cdf0e10cSrcweir _WinQueryWindowRect( hWndClient, &rectl ); 746*cdf0e10cSrcweir pFrame->mnWidth = rectl.xRight; 747*cdf0e10cSrcweir pFrame->mnHeight = rectl.yBottom; 748*cdf0e10cSrcweir debug_printf( "ImplSalCreateFrame %dx%d\n", pFrame->mnWidth, pFrame->mnHeight); 749*cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 750*cdf0e10cSrcweir pFrame->mbDefPos = TRUE; 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir UpdateFrameGeometry( hWndFrame, pFrame ); 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir if( pFrame->mnShowState == SWP_SHOWMAXIMIZED ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir // #96084 set a useful internal window size because 757*cdf0e10cSrcweir // the window will not be maximized (and the size updated) before show() 758*cdf0e10cSrcweir SetMaximizedFrameGeometry( hWndFrame, pFrame ); 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 762*cdf0e10cSrcweir dumpWindowInfo( "<ImplSalCreateFrame (exit)", hWndFrame); 763*cdf0e10cSrcweir #endif 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir return pFrame; 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir // ======================================================================= 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir Os2SalFrame::Os2SalFrame() 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 773*cdf0e10cSrcweir 774*cdf0e10cSrcweir mbGraphics = NULL; 775*cdf0e10cSrcweir mhPointer = WinQuerySysPointer( HWND_DESKTOP, SPTR_ARROW, FALSE ); 776*cdf0e10cSrcweir mpGraphics = NULL; 777*cdf0e10cSrcweir mpInst = NULL; 778*cdf0e10cSrcweir mbFullScreen = FALSE; 779*cdf0e10cSrcweir mbAllwayOnTop = FALSE; 780*cdf0e10cSrcweir mbVisible = FALSE; 781*cdf0e10cSrcweir mbMinHide = FALSE; 782*cdf0e10cSrcweir mbInShow = FALSE; 783*cdf0e10cSrcweir mbRestoreMaximize = FALSE; 784*cdf0e10cSrcweir mbInMoveMsg = FALSE; 785*cdf0e10cSrcweir mbInSizeMsg = FALSE; 786*cdf0e10cSrcweir mbDefPos = TRUE; 787*cdf0e10cSrcweir mbOverwriteState = TRUE; 788*cdf0e10cSrcweir mbHandleIME = FALSE; 789*cdf0e10cSrcweir mbConversionMode = FALSE; 790*cdf0e10cSrcweir mbCandidateMode = FALSE; 791*cdf0e10cSrcweir mbCaption = FALSE; 792*cdf0e10cSrcweir //mhDefIMEContext = 0; 793*cdf0e10cSrcweir mpGraphics = NULL; 794*cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 795*cdf0e10cSrcweir mnWidth = 0; 796*cdf0e10cSrcweir mnHeight = 0; 797*cdf0e10cSrcweir mnMinWidth = 0; 798*cdf0e10cSrcweir mnMinHeight = 0; 799*cdf0e10cSrcweir mnMaxWidth = SHRT_MAX; 800*cdf0e10cSrcweir mnMaxHeight = SHRT_MAX; 801*cdf0e10cSrcweir mnInputLang = 0; 802*cdf0e10cSrcweir mnKeyboardHandle = 0; 803*cdf0e10cSrcweir mbGraphics = FALSE; 804*cdf0e10cSrcweir mbCaption = FALSE; 805*cdf0e10cSrcweir mbBorder = FALSE; 806*cdf0e10cSrcweir mbFixBorder = FALSE; 807*cdf0e10cSrcweir mbSizeBorder = FALSE; 808*cdf0e10cSrcweir mbFullScreen = FALSE; 809*cdf0e10cSrcweir //mbPresentation = FALSE; 810*cdf0e10cSrcweir mbInShow = FALSE; 811*cdf0e10cSrcweir mbRestoreMaximize = FALSE; 812*cdf0e10cSrcweir mbInMoveMsg = FALSE; 813*cdf0e10cSrcweir mbInSizeMsg = FALSE; 814*cdf0e10cSrcweir //mbFullScreenToolWin = FALSE; 815*cdf0e10cSrcweir mbDefPos = TRUE; 816*cdf0e10cSrcweir mbOverwriteState = TRUE; 817*cdf0e10cSrcweir //mbIME = FALSE; 818*cdf0e10cSrcweir mbHandleIME = FALSE; 819*cdf0e10cSrcweir //mbSpezIME = FALSE; 820*cdf0e10cSrcweir //mbAtCursorIME = FALSE; 821*cdf0e10cSrcweir mbCandidateMode = FALSE; 822*cdf0e10cSrcweir mbFloatWin = FALSE; 823*cdf0e10cSrcweir mbNoIcon = FALSE; 824*cdf0e10cSrcweir //mSelectedhMenu = 0; 825*cdf0e10cSrcweir //mLastActivatedhMenu = 0; 826*cdf0e10cSrcweir mpParentFrame = NULL; 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir memset( &maState, 0, sizeof( SalFrameState ) ); 829*cdf0e10cSrcweir maSysData.nSize = sizeof( SystemEnvData ); 830*cdf0e10cSrcweir memset( &maGeometry, 0, sizeof( maGeometry ) ); 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir // insert frame in framelist 833*cdf0e10cSrcweir mpNextFrame = pSalData->mpFirstFrame; 834*cdf0e10cSrcweir pSalData->mpFirstFrame = this; 835*cdf0e10cSrcweir } 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir // ----------------------------------------------------------------------- 838*cdf0e10cSrcweir 839*cdf0e10cSrcweir Os2SalFrame::~Os2SalFrame() 840*cdf0e10cSrcweir { 841*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir // destroy DC 844*cdf0e10cSrcweir if ( mpGraphics ) 845*cdf0e10cSrcweir { 846*cdf0e10cSrcweir ImplSalDeInitGraphics( mpGraphics ); 847*cdf0e10cSrcweir WinReleasePS( mpGraphics->mhPS ); 848*cdf0e10cSrcweir delete mpGraphics; 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir // destroy system frame 852*cdf0e10cSrcweir WinDestroyWindow( mhWndFrame ); 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir // remove frame from framelist 855*cdf0e10cSrcweir if ( this == pSalData->mpFirstFrame ) 856*cdf0e10cSrcweir pSalData->mpFirstFrame = mpNextFrame; 857*cdf0e10cSrcweir else 858*cdf0e10cSrcweir { 859*cdf0e10cSrcweir Os2SalFrame* pTempFrame = pSalData->mpFirstFrame; 860*cdf0e10cSrcweir while ( pTempFrame->mpNextFrame != this ) 861*cdf0e10cSrcweir pTempFrame = pTempFrame->mpNextFrame; 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir pTempFrame->mpNextFrame = mpNextFrame; 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir // ----------------------------------------------------------------------- 868*cdf0e10cSrcweir 869*cdf0e10cSrcweir static HDC ImplWinGetDC( HWND hWnd ) 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir HDC hDC = WinQueryWindowDC( hWnd ); 872*cdf0e10cSrcweir if ( !hDC ) 873*cdf0e10cSrcweir hDC = WinOpenWindowDC( hWnd ); 874*cdf0e10cSrcweir return hDC; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir 877*cdf0e10cSrcweir // ----------------------------------------------------------------------- 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir SalGraphics* Os2SalFrame::GetGraphics() 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir if ( mbGraphics ) 882*cdf0e10cSrcweir return NULL; 883*cdf0e10cSrcweir 884*cdf0e10cSrcweir if ( !mpGraphics ) 885*cdf0e10cSrcweir { 886*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 887*cdf0e10cSrcweir mpGraphics = new Os2SalGraphics; 888*cdf0e10cSrcweir mpGraphics->mhPS = WinGetPS( mhWndClient ); 889*cdf0e10cSrcweir mpGraphics->mhDC = ImplWinGetDC( mhWndClient ); 890*cdf0e10cSrcweir mpGraphics->mhWnd = mhWndClient; 891*cdf0e10cSrcweir mpGraphics->mnHeight = mnHeight; 892*cdf0e10cSrcweir mpGraphics->mbPrinter = FALSE; 893*cdf0e10cSrcweir mpGraphics->mbVirDev = FALSE; 894*cdf0e10cSrcweir mpGraphics->mbWindow = TRUE; 895*cdf0e10cSrcweir mpGraphics->mbScreen = TRUE; 896*cdf0e10cSrcweir ImplSalInitGraphics( mpGraphics ); 897*cdf0e10cSrcweir mbGraphics = TRUE; 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir else 900*cdf0e10cSrcweir mbGraphics = TRUE; 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir return mpGraphics; 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir // ----------------------------------------------------------------------- 906*cdf0e10cSrcweir 907*cdf0e10cSrcweir void Os2SalFrame::ReleaseGraphics( SalGraphics* ) 908*cdf0e10cSrcweir { 909*cdf0e10cSrcweir mbGraphics = FALSE; 910*cdf0e10cSrcweir } 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir // ----------------------------------------------------------------------- 913*cdf0e10cSrcweir 914*cdf0e10cSrcweir BOOL Os2SalFrame::PostEvent( void* pData ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir return (BOOL)WinPostMsg( mhWndClient, SAL_MSG_USEREVENT, 0, (MPARAM)pData ); 917*cdf0e10cSrcweir } 918*cdf0e10cSrcweir 919*cdf0e10cSrcweir // ----------------------------------------------------------------------- 920*cdf0e10cSrcweir 921*cdf0e10cSrcweir void Os2SalFrame::SetTitle( const XubString& rTitle ) 922*cdf0e10cSrcweir { 923*cdf0e10cSrcweir // set window title 924*cdf0e10cSrcweir ByteString title( rTitle, gsl_getSystemTextEncoding() ); 925*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetTitle %x '%s'\n", mhWndFrame, title.GetBuffer() ); 926*cdf0e10cSrcweir WinSetWindowText( mhWndFrame, title.GetBuffer() ); 927*cdf0e10cSrcweir } 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir // ----------------------------------------------------------------------- 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir void Os2SalFrame::SetIcon( USHORT nIcon ) 932*cdf0e10cSrcweir { 933*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetIcon\n"); 934*cdf0e10cSrcweir 935*cdf0e10cSrcweir // If we have a window without an Icon (for example a dialog), ignore this call 936*cdf0e10cSrcweir if ( mbNoIcon ) 937*cdf0e10cSrcweir return; 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir // 0 means default (class) icon 940*cdf0e10cSrcweir HPOINTER hIcon = NULL; 941*cdf0e10cSrcweir if ( !nIcon ) 942*cdf0e10cSrcweir nIcon = 1; 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir ImplLoadSalIcon( nIcon, hIcon ); 945*cdf0e10cSrcweir 946*cdf0e10cSrcweir DBG_ASSERT( hIcon , "Os2SalFrame::SetIcon(): Could not load icon !" ); 947*cdf0e10cSrcweir 948*cdf0e10cSrcweir // Icon setzen 949*cdf0e10cSrcweir WinSendMsg( mhWndFrame, WM_SETICON, (MPARAM)hIcon, (MPARAM)0 ); 950*cdf0e10cSrcweir } 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir // ----------------------------------------------------------------------- 953*cdf0e10cSrcweir 954*cdf0e10cSrcweir SalFrame* Os2SalFrame::GetParent() const 955*cdf0e10cSrcweir { 956*cdf0e10cSrcweir //debug_printf("Os2SalFrame::GetParent\n"); 957*cdf0e10cSrcweir return GetWindowPtr( WinQueryWindow(mhWndFrame, QW_OWNER) ); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir // ----------------------------------------------------------------------- 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir static void ImplSalShow( HWND hWnd, ULONG bVisible, ULONG bNoActivate ) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 965*cdf0e10cSrcweir if ( !pFrame ) 966*cdf0e10cSrcweir return; 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir if ( bVisible ) 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 971*cdf0e10cSrcweir pFrame->mbOverwriteState = TRUE; 972*cdf0e10cSrcweir pFrame->mbInShow = TRUE; 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 975*cdf0e10cSrcweir debug_printf( "ImplSalShow hwnd %x visible flag %d, no activate: flag %d\n", hWnd, bVisible, bNoActivate); 976*cdf0e10cSrcweir #endif 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir if( bNoActivate ) 979*cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_SHOW); 980*cdf0e10cSrcweir else 981*cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, pFrame->mnShowState); 982*cdf0e10cSrcweir 983*cdf0e10cSrcweir pFrame->mbInShow = FALSE; 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir // Direct Paint only, if we get the SolarMutx 986*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir WinUpdateWindow( hWnd ); 989*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 990*cdf0e10cSrcweir } 991*cdf0e10cSrcweir } 992*cdf0e10cSrcweir else 993*cdf0e10cSrcweir { 994*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 995*cdf0e10cSrcweir debug_printf( "ImplSalShow hwnd %x HIDE\n"); 996*cdf0e10cSrcweir #endif 997*cdf0e10cSrcweir WinSetWindowPos(hWnd, NULL, 0, 0, 0, 0, SWP_HIDE); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir } 1000*cdf0e10cSrcweir 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir 1005*cdf0e10cSrcweir void Os2SalFrame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir } 1008*cdf0e10cSrcweir 1009*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1010*cdf0e10cSrcweir 1011*cdf0e10cSrcweir void Os2SalFrame::Show( BOOL bVisible, BOOL bNoActivate ) 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir // Post this Message to the window, because this only works 1014*cdf0e10cSrcweir // in the thread of the window, which has create this window. 1015*cdf0e10cSrcweir // We post this message to avoid deadlocks 1016*cdf0e10cSrcweir if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) 1017*cdf0e10cSrcweir WinPostMsg( mhWndFrame, SAL_MSG_SHOW, (MPARAM)bVisible, (MPARAM)bNoActivate ); 1018*cdf0e10cSrcweir else 1019*cdf0e10cSrcweir ImplSalShow( mhWndFrame, bVisible, bNoActivate ); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1023*cdf0e10cSrcweir 1024*cdf0e10cSrcweir void Os2SalFrame::Enable( BOOL bEnable ) 1025*cdf0e10cSrcweir { 1026*cdf0e10cSrcweir WinEnableWindow( mhWndFrame, bEnable ); 1027*cdf0e10cSrcweir } 1028*cdf0e10cSrcweir 1029*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir void Os2SalFrame::SetMinClientSize( long nWidth, long nHeight ) 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetMinClientSize\n"); 1034*cdf0e10cSrcweir mnMinWidth = nWidth; 1035*cdf0e10cSrcweir mnMinHeight = nHeight; 1036*cdf0e10cSrcweir } 1037*cdf0e10cSrcweir 1038*cdf0e10cSrcweir void Os2SalFrame::SetMaxClientSize( long nWidth, long nHeight ) 1039*cdf0e10cSrcweir { 1040*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetMaxClientSize\n"); 1041*cdf0e10cSrcweir mnMaxWidth = nWidth; 1042*cdf0e10cSrcweir mnMaxHeight = nHeight; 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir void Os2SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, 1048*cdf0e10cSrcweir USHORT nFlags ) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir // calculation frame size 1051*cdf0e10cSrcweir USHORT nEvent = 0; 1052*cdf0e10cSrcweir ULONG nPosFlags = 0; 1053*cdf0e10cSrcweir 1054*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1055*cdf0e10cSrcweir //dumpWindowInfo( "-Os2SalFrame::SetPosSize", mhWndFrame); 1056*cdf0e10cSrcweir debug_printf( ">Os2SalFrame::SetPosSize go to %d,%d (%dx%d) VCL\n",nX,nY,nWidth,nHeight); 1057*cdf0e10cSrcweir #endif 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir SWP aSWP; 1060*cdf0e10cSrcweir _WinQueryWindowPos( this, &aSWP ); 1061*cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( mhWndFrame ); 1062*cdf0e10cSrcweir if ( !bVisible ) 1063*cdf0e10cSrcweir { 1064*cdf0e10cSrcweir if ( mbFloatWin ) 1065*cdf0e10cSrcweir mnShowState = SWP_SHOW; 1066*cdf0e10cSrcweir else 1067*cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 1068*cdf0e10cSrcweir } 1069*cdf0e10cSrcweir else 1070*cdf0e10cSrcweir { 1071*cdf0e10cSrcweir if ( (aSWP.fl & SWP_MINIMIZE) || (aSWP.fl & SWP_MAXIMIZE) ) 1072*cdf0e10cSrcweir WinSetWindowPos(mhWndFrame, NULL, 0, 0, 0, 0, SWP_RESTORE ); 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir if ( (nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) ) { 1076*cdf0e10cSrcweir nPosFlags |= SWP_MOVE; 1077*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1078*cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize MOVE to %d,%d\n", nX, nY); 1079*cdf0e10cSrcweir #endif 1080*cdf0e10cSrcweir //DBG_ASSERT( nX && nY, " Windowposition of (0,0) requested!" ); 1081*cdf0e10cSrcweir nEvent = SALEVENT_MOVE; 1082*cdf0e10cSrcweir } 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir if ( (nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) ) { 1085*cdf0e10cSrcweir nPosFlags |= SWP_SIZE; 1086*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1087*cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize SIZE to %d,%d\n", nWidth,nHeight); 1088*cdf0e10cSrcweir #endif 1089*cdf0e10cSrcweir nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE; 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir // Default-Position, dann zentrieren, ansonsten Position beibehalten 1093*cdf0e10cSrcweir if ( mbDefPos && !(nPosFlags & SWP_MOVE)) 1094*cdf0e10cSrcweir { 1095*cdf0e10cSrcweir // calculate bottom left corner of frame 1096*cdf0e10cSrcweir mbDefPos = FALSE; 1097*cdf0e10cSrcweir nPosFlags |= SWP_MOVE | SWP_CENTER; 1098*cdf0e10cSrcweir nEvent = SALEVENT_MOVERESIZE; 1099*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 10 1100*cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize CENTER\n"); 1101*cdf0e10cSrcweir debug_printf( "-Os2SalFrame::SetPosSize default position to %d,%d\n", nX, nY); 1102*cdf0e10cSrcweir #endif 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir 1105*cdf0e10cSrcweir // Adjust Window in the screen 1106*cdf0e10cSrcweir BOOL bCheckOffScreen = TRUE; 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir // but don't do this for floaters or ownerdraw windows that are currently moved interactively 1109*cdf0e10cSrcweir if( (mnStyle & SAL_FRAME_STYLE_FLOAT) && !(mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) ) 1110*cdf0e10cSrcweir bCheckOffScreen = FALSE; 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir if( mnStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION ) 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir // may be the window is currently being moved (mouse is captured), then no check is required 1115*cdf0e10cSrcweir if( mhWndClient == WinQueryCapture( HWND_DESKTOP) ) 1116*cdf0e10cSrcweir bCheckOffScreen = FALSE; 1117*cdf0e10cSrcweir else 1118*cdf0e10cSrcweir bCheckOffScreen = TRUE; 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir if( bCheckOffScreen ) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir if ( nX+nWidth > nScreenWidth ) 1124*cdf0e10cSrcweir nX = nScreenWidth - nWidth; 1125*cdf0e10cSrcweir if ( nY+nHeight > nScreenHeight ) 1126*cdf0e10cSrcweir nY = nScreenHeight - nHeight; 1127*cdf0e10cSrcweir if ( nX < 0 ) 1128*cdf0e10cSrcweir nX = 0; 1129*cdf0e10cSrcweir if ( nY < 0 ) 1130*cdf0e10cSrcweir nY = 0; 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir // bring floating windows always to top 1134*cdf0e10cSrcweir // do not change zorder, otherwise tooltips will bring main window to top (ticket:14) 1135*cdf0e10cSrcweir //if( (mnStyle & SAL_FRAME_STYLE_FLOAT) ) 1136*cdf0e10cSrcweir // nPosFlags |= SWP_ZORDER; // do not change z-order 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir // set new position 1139*cdf0e10cSrcweir _WinSetWindowPos( this, HWND_TOP, nX, nY, nWidth, nHeight, nPosFlags); // | SWP_RESTORE 1140*cdf0e10cSrcweir 1141*cdf0e10cSrcweir UpdateFrameGeometry( mhWndFrame, this ); 1142*cdf0e10cSrcweir 1143*cdf0e10cSrcweir // Notification -- really ??? 1144*cdf0e10cSrcweir if( nEvent ) 1145*cdf0e10cSrcweir CallCallback( nEvent, NULL ); 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 1148*cdf0e10cSrcweir dumpWindowInfo( "<Os2SalFrame::SetPosSize (exit)", mhWndFrame); 1149*cdf0e10cSrcweir #endif 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir void Os2SalFrame::SetParent( SalFrame* pNewParent ) 1156*cdf0e10cSrcweir { 1157*cdf0e10cSrcweir APIRET rc; 1158*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1159*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetParent mhWndFrame 0x%08x to 0x%08x\n", 1160*cdf0e10cSrcweir static_cast<Os2SalFrame*>(this)->mhWndFrame, 1161*cdf0e10cSrcweir static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); 1162*cdf0e10cSrcweir #endif 1163*cdf0e10cSrcweir Os2SalFrame::mbInReparent = TRUE; 1164*cdf0e10cSrcweir //rc = WinSetParent(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1165*cdf0e10cSrcweir // static_cast<Os2SalFrame*>(pNewParent)->mhWndClient, TRUE); 1166*cdf0e10cSrcweir rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1167*cdf0e10cSrcweir static_cast<Os2SalFrame*>(pNewParent)->mhWndClient); 1168*cdf0e10cSrcweir mpParentFrame = static_cast<Os2SalFrame*>(pNewParent); 1169*cdf0e10cSrcweir Os2SalFrame::mbInReparent = FALSE; 1170*cdf0e10cSrcweir } 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir bool Os2SalFrame::SetPluginParent( SystemParentData* pNewParent ) 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir APIRET rc; 1175*cdf0e10cSrcweir if ( pNewParent->hWnd == 0 ) 1176*cdf0e10cSrcweir { 1177*cdf0e10cSrcweir pNewParent->hWnd = HWND_DESKTOP; 1178*cdf0e10cSrcweir } 1179*cdf0e10cSrcweir 1180*cdf0e10cSrcweir Os2SalFrame::mbInReparent = TRUE; 1181*cdf0e10cSrcweir rc = WinSetOwner(static_cast<Os2SalFrame*>(this)->mhWndFrame, 1182*cdf0e10cSrcweir pNewParent->hWnd); 1183*cdf0e10cSrcweir Os2SalFrame::mbInReparent = FALSE; 1184*cdf0e10cSrcweir return true; 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1189*cdf0e10cSrcweir 1190*cdf0e10cSrcweir void Os2SalFrame::GetWorkArea( RECTL &rRect ) 1191*cdf0e10cSrcweir { 1192*cdf0e10cSrcweir rRect.xLeft = rRect.yTop = 0; 1193*cdf0e10cSrcweir rRect.xRight = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN )-1; 1194*cdf0e10cSrcweir rRect.yBottom = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN )-1; 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir 1197*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir void Os2SalFrame::GetWorkArea( Rectangle &rRect ) 1200*cdf0e10cSrcweir { 1201*cdf0e10cSrcweir RECTL aRect; 1202*cdf0e10cSrcweir GetWorkArea( aRect); 1203*cdf0e10cSrcweir rRect.nLeft = aRect.xLeft; 1204*cdf0e10cSrcweir rRect.nRight = aRect.xRight; // win -1; 1205*cdf0e10cSrcweir rRect.nTop = aRect.yTop; 1206*cdf0e10cSrcweir rRect.nBottom = aRect.yBottom; // win -1; 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir void Os2SalFrame::GetClientSize( long& rWidth, long& rHeight ) 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir rWidth = maGeometry.nWidth; 1214*cdf0e10cSrcweir rHeight = maGeometry.nHeight; 1215*cdf0e10cSrcweir } 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir void Os2SalFrame::SetWindowState( const SalFrameState* pState ) 1220*cdf0e10cSrcweir { 1221*cdf0e10cSrcweir LONG nX; 1222*cdf0e10cSrcweir LONG nY; 1223*cdf0e10cSrcweir LONG nWidth; 1224*cdf0e10cSrcweir LONG nHeight; 1225*cdf0e10cSrcweir ULONG nPosSize = 0; 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1228*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState\n"); 1229*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState %08x (%dx%d) at %d,%d VCL\n", 1230*cdf0e10cSrcweir mhWndFrame, 1231*cdf0e10cSrcweir pState->mnWidth,pState->mnHeight,pState->mnX,pState->mnY); 1232*cdf0e10cSrcweir #endif 1233*cdf0e10cSrcweir 1234*cdf0e10cSrcweir BOOL bVisible = WinIsWindowVisible( mhWndFrame ); 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir // get screen coordinates 1237*cdf0e10cSrcweir SWP aSWP; 1238*cdf0e10cSrcweir WinQueryWindowPos( mhWndFrame, &aSWP ); 1239*cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 1240*cdf0e10cSrcweir ImplSalCalcFrameSize( this, nFrameX, nFrameY, nCaptionY ); 1241*cdf0e10cSrcweir 1242*cdf0e10cSrcweir long nTopDeco = nFrameY + nCaptionY; 1243*cdf0e10cSrcweir long nLeftDeco = nFrameX; 1244*cdf0e10cSrcweir long nBottomDeco = nFrameY; 1245*cdf0e10cSrcweir long nRightDeco = nFrameX; 1246*cdf0e10cSrcweir 1247*cdf0e10cSrcweir // Fenster-Position/Groesse in den Bildschirm einpassen 1248*cdf0e10cSrcweir if ((pState->mnMask & (SAL_FRAMESTATE_MASK_X | SAL_FRAMESTATE_MASK_Y)) ) 1249*cdf0e10cSrcweir nPosSize |= SWP_MOVE; 1250*cdf0e10cSrcweir if ((pState->mnMask & (SAL_FRAMESTATE_MASK_WIDTH | SAL_FRAMESTATE_MASK_HEIGHT)) ) 1251*cdf0e10cSrcweir nPosSize |= SWP_SIZE; 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_X ) 1254*cdf0e10cSrcweir nX = (int)pState->mnX - nLeftDeco; 1255*cdf0e10cSrcweir else 1256*cdf0e10cSrcweir nX = aSWP.x; 1257*cdf0e10cSrcweir 1258*cdf0e10cSrcweir // keep Y inverted since height is still unknown, will invert later 1259*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_Y ) 1260*cdf0e10cSrcweir nY = (int)pState->mnY - nTopDeco; 1261*cdf0e10cSrcweir else 1262*cdf0e10cSrcweir nY = nScreenHeight - (aSWP.y+aSWP.cy); 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_WIDTH ) 1265*cdf0e10cSrcweir nWidth = (int)pState->mnWidth + nLeftDeco + nRightDeco; 1266*cdf0e10cSrcweir else 1267*cdf0e10cSrcweir nWidth = aSWP.cx; 1268*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_HEIGHT ) 1269*cdf0e10cSrcweir nHeight = (int)pState->mnHeight + nTopDeco + nBottomDeco; 1270*cdf0e10cSrcweir else 1271*cdf0e10cSrcweir nHeight = aSWP.cy; 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1274*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState (%dx%d) at %d,%d\n", nWidth,nHeight,nX,nY); 1275*cdf0e10cSrcweir #endif 1276*cdf0e10cSrcweir 1277*cdf0e10cSrcweir // Adjust Window in the screen: 1278*cdf0e10cSrcweir // if it does not fit into the screen do nothing, ie default pos/size will be used 1279*cdf0e10cSrcweir // if there is an overlap with the screen border move the window while keeping its size 1280*cdf0e10cSrcweir 1281*cdf0e10cSrcweir //if( nWidth > nScreenWidth || nHeight > nScreenHeight ) 1282*cdf0e10cSrcweir // nPosSize |= (SWP_NOMOVE | SWP_NOSIZE); 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir if ( nX+nWidth > nScreenWidth ) 1285*cdf0e10cSrcweir nX = (nScreenWidth) - nWidth; 1286*cdf0e10cSrcweir if ( nY+nHeight > nScreenHeight ) 1287*cdf0e10cSrcweir nY = (nScreenHeight) - nHeight; 1288*cdf0e10cSrcweir if ( nX < 0 ) 1289*cdf0e10cSrcweir nX = 0; 1290*cdf0e10cSrcweir if ( nY < 0 ) 1291*cdf0e10cSrcweir nY = 0; 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir // Restore-Position setzen 1294*cdf0e10cSrcweir SWP aPlacement; 1295*cdf0e10cSrcweir WinQueryWindowPos( mhWndFrame, &aPlacement ); 1296*cdf0e10cSrcweir 1297*cdf0e10cSrcweir // Status setzen 1298*cdf0e10cSrcweir bVisible = WinIsWindowVisible( mhWndFrame); 1299*cdf0e10cSrcweir BOOL bUpdateHiddenFramePos = FALSE; 1300*cdf0e10cSrcweir if ( !bVisible ) 1301*cdf0e10cSrcweir { 1302*cdf0e10cSrcweir aPlacement.fl = SWP_HIDE; 1303*cdf0e10cSrcweir 1304*cdf0e10cSrcweir if ( mbOverwriteState ) 1305*cdf0e10cSrcweir { 1306*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) 1307*cdf0e10cSrcweir { 1308*cdf0e10cSrcweir if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) 1309*cdf0e10cSrcweir mnShowState = SWP_SHOWMINIMIZED; 1310*cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1311*cdf0e10cSrcweir { 1312*cdf0e10cSrcweir mnShowState = SWP_SHOWMAXIMIZED; 1313*cdf0e10cSrcweir bUpdateHiddenFramePos = TRUE; 1314*cdf0e10cSrcweir } 1315*cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) 1316*cdf0e10cSrcweir mnShowState = SWP_SHOWNORMAL; 1317*cdf0e10cSrcweir } 1318*cdf0e10cSrcweir } 1319*cdf0e10cSrcweir } 1320*cdf0e10cSrcweir else 1321*cdf0e10cSrcweir { 1322*cdf0e10cSrcweir if ( pState->mnMask & SAL_FRAMESTATE_MASK_STATE ) 1323*cdf0e10cSrcweir { 1324*cdf0e10cSrcweir if ( pState->mnState & SAL_FRAMESTATE_MINIMIZED ) 1325*cdf0e10cSrcweir { 1326*cdf0e10cSrcweir //if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1327*cdf0e10cSrcweir // aPlacement.flags |= WPF_RESTORETOMAXIMIZED; 1328*cdf0e10cSrcweir aPlacement.fl = SWP_SHOWMINIMIZED; 1329*cdf0e10cSrcweir } 1330*cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_MAXIMIZED ) 1331*cdf0e10cSrcweir aPlacement.fl = SWP_SHOWMAXIMIZED; 1332*cdf0e10cSrcweir else if ( pState->mnState & SAL_FRAMESTATE_NORMAL ) 1333*cdf0e10cSrcweir aPlacement.fl = SWP_RESTORE; 1334*cdf0e10cSrcweir } 1335*cdf0e10cSrcweir } 1336*cdf0e10cSrcweir 1337*cdf0e10cSrcweir // Wenn Fenster nicht minimiert/maximiert ist oder nicht optisch 1338*cdf0e10cSrcweir // umgesetzt werden muss, dann SetWindowPos() benutzen, da 1339*cdf0e10cSrcweir // SetWindowPlacement() die TaskBar mit einrechnet 1340*cdf0e10cSrcweir if ( !(aPlacement.fl & SWP_MINIMIZE) 1341*cdf0e10cSrcweir && !( aPlacement.fl & SWP_MAXIMIZE ) 1342*cdf0e10cSrcweir && (!bVisible || (aPlacement.fl == SWP_RESTORE)) ) 1343*cdf0e10cSrcweir { 1344*cdf0e10cSrcweir if( bUpdateHiddenFramePos ) 1345*cdf0e10cSrcweir { 1346*cdf0e10cSrcweir // #96084 set a useful internal window size because 1347*cdf0e10cSrcweir // the window will not be maximized (and the size updated) before show() 1348*cdf0e10cSrcweir SetMaximizedFrameGeometry( mhWndFrame, this ); 1349*cdf0e10cSrcweir } 1350*cdf0e10cSrcweir else 1351*cdf0e10cSrcweir WinSetWindowPos( mhWndFrame, 0, nX, 1352*cdf0e10cSrcweir nScreenHeight - (nY+nHeight), nWidth, nHeight, nPosSize); 1353*cdf0e10cSrcweir } 1354*cdf0e10cSrcweir else 1355*cdf0e10cSrcweir { 1356*cdf0e10cSrcweir if( (nPosSize & (SWP_MOVE|SWP_SIZE)) ) 1357*cdf0e10cSrcweir { 1358*cdf0e10cSrcweir aPlacement.x = nX; 1359*cdf0e10cSrcweir aPlacement.y = nScreenHeight-(nY+nHeight); 1360*cdf0e10cSrcweir aPlacement.cx = nWidth; 1361*cdf0e10cSrcweir aPlacement.cy = nHeight; 1362*cdf0e10cSrcweir } 1363*cdf0e10cSrcweir WinSetWindowPos( mhWndFrame, 0, aPlacement.x, aPlacement.y, 1364*cdf0e10cSrcweir aPlacement.cx, aPlacement.cy, aPlacement.fl ); 1365*cdf0e10cSrcweir } 1366*cdf0e10cSrcweir 1367*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1368*cdf0e10cSrcweir debug_printf("Os2SalFrame::SetWindowState DONE\n"); 1369*cdf0e10cSrcweir #endif 1370*cdf0e10cSrcweir } 1371*cdf0e10cSrcweir 1372*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1373*cdf0e10cSrcweir 1374*cdf0e10cSrcweir BOOL Os2SalFrame::GetWindowState( SalFrameState* pState ) 1375*cdf0e10cSrcweir { 1376*cdf0e10cSrcweir if ( maState.mnWidth && maState.mnHeight ) 1377*cdf0e10cSrcweir { 1378*cdf0e10cSrcweir *pState = maState; 1379*cdf0e10cSrcweir // #94144# allow Minimize again, should be masked out when read from configuration 1380*cdf0e10cSrcweir // 91625 - Don't save minimize 1381*cdf0e10cSrcweir //if ( !(pState->mnState & SAL_FRAMESTATE_MAXIMIZED) ) 1382*cdf0e10cSrcweir if ( !(pState->mnState & (SAL_FRAMESTATE_MINIMIZED | SAL_FRAMESTATE_MAXIMIZED)) ) 1383*cdf0e10cSrcweir pState->mnState |= SAL_FRAMESTATE_NORMAL; 1384*cdf0e10cSrcweir return TRUE; 1385*cdf0e10cSrcweir } 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir return FALSE; 1388*cdf0e10cSrcweir } 1389*cdf0e10cSrcweir 1390*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1391*cdf0e10cSrcweir 1392*cdf0e10cSrcweir void Os2SalFrame::SetScreenNumber( unsigned int nNewScreen ) 1393*cdf0e10cSrcweir { 1394*cdf0e10cSrcweir #if 0 1395*cdf0e10cSrcweir WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem()); 1396*cdf0e10cSrcweir if( pSys ) 1397*cdf0e10cSrcweir { 1398*cdf0e10cSrcweir const std::vector<WinSalSystem::DisplayMonitor>& rMonitors = 1399*cdf0e10cSrcweir pSys->getMonitors(); 1400*cdf0e10cSrcweir size_t nMon = rMonitors.size(); 1401*cdf0e10cSrcweir if( nNewScreen < nMon ) 1402*cdf0e10cSrcweir { 1403*cdf0e10cSrcweir Point aOldMonPos, aNewMonPos( rMonitors[nNewScreen].m_aArea.TopLeft() ); 1404*cdf0e10cSrcweir Point aCurPos( maGeometry.nX, maGeometry.nY ); 1405*cdf0e10cSrcweir for( size_t i = 0; i < nMon; i++ ) 1406*cdf0e10cSrcweir { 1407*cdf0e10cSrcweir if( rMonitors[i].m_aArea.IsInside( aCurPos ) ) 1408*cdf0e10cSrcweir { 1409*cdf0e10cSrcweir aOldMonPos = rMonitors[i].m_aArea.TopLeft(); 1410*cdf0e10cSrcweir break; 1411*cdf0e10cSrcweir } 1412*cdf0e10cSrcweir } 1413*cdf0e10cSrcweir mnDisplay = nNewScreen; 1414*cdf0e10cSrcweir maGeometry.nScreenNumber = nNewScreen; 1415*cdf0e10cSrcweir SetPosSize( aNewMonPos.X() + (maGeometry.nX - aOldMonPos.X()), 1416*cdf0e10cSrcweir aNewMonPos.Y() + (maGeometry.nY - aOldMonPos.Y()), 1417*cdf0e10cSrcweir 0, 0, 1418*cdf0e10cSrcweir SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ); 1419*cdf0e10cSrcweir } 1420*cdf0e10cSrcweir } 1421*cdf0e10cSrcweir #endif 1422*cdf0e10cSrcweir } 1423*cdf0e10cSrcweir 1424*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1425*cdf0e10cSrcweir 1426*cdf0e10cSrcweir // native menu implementation - currently empty 1427*cdf0e10cSrcweir void Os2SalFrame::DrawMenuBar() 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir } 1430*cdf0e10cSrcweir 1431*cdf0e10cSrcweir void Os2SalFrame::SetMenu( SalMenu* pSalMenu ) 1432*cdf0e10cSrcweir { 1433*cdf0e10cSrcweir } 1434*cdf0e10cSrcweir 1435*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1436*cdf0e10cSrcweir 1437*cdf0e10cSrcweir void Os2SalFrame::ShowFullScreen( BOOL bFullScreen, sal_Int32 nDisplay ) 1438*cdf0e10cSrcweir { 1439*cdf0e10cSrcweir if ( mbFullScreen == bFullScreen ) 1440*cdf0e10cSrcweir return; 1441*cdf0e10cSrcweir 1442*cdf0e10cSrcweir mbFullScreen = bFullScreen; 1443*cdf0e10cSrcweir if ( bFullScreen ) 1444*cdf0e10cSrcweir { 1445*cdf0e10cSrcweir // save old position 1446*cdf0e10cSrcweir memset( &maFullScreenRect, 0, sizeof( SWP ) ); 1447*cdf0e10cSrcweir _WinQueryWindowPos( this, &maFullScreenRect ); 1448*cdf0e10cSrcweir 1449*cdf0e10cSrcweir // set window to screen size 1450*cdf0e10cSrcweir ImplSalFrameFullScreenPos( this, TRUE ); 1451*cdf0e10cSrcweir } 1452*cdf0e10cSrcweir else 1453*cdf0e10cSrcweir { 1454*cdf0e10cSrcweir _WinSetWindowPos( this, 1455*cdf0e10cSrcweir 0, 1456*cdf0e10cSrcweir maFullScreenRect.x, maFullScreenRect.y, 1457*cdf0e10cSrcweir maFullScreenRect.cx, maFullScreenRect.cy, 1458*cdf0e10cSrcweir SWP_MOVE | SWP_SIZE ); 1459*cdf0e10cSrcweir } 1460*cdf0e10cSrcweir } 1461*cdf0e10cSrcweir 1462*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1463*cdf0e10cSrcweir 1464*cdf0e10cSrcweir void Os2SalFrame::StartPresentation( BOOL bStart ) 1465*cdf0e10cSrcweir { 1466*cdf0e10cSrcweir // SysSetObjectData("<WP_DESKTOP>","Autolockup=no"); oder OS2.INI: PM_Lockup 1467*cdf0e10cSrcweir } 1468*cdf0e10cSrcweir 1469*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1470*cdf0e10cSrcweir 1471*cdf0e10cSrcweir void Os2SalFrame::SetAlwaysOnTop( BOOL bOnTop ) 1472*cdf0e10cSrcweir { 1473*cdf0e10cSrcweir mbAllwayOnTop = bOnTop; 1474*cdf0e10cSrcweir #if 0 1475*cdf0e10cSrcweir HWND hWnd; 1476*cdf0e10cSrcweir if ( bOnTop ) 1477*cdf0e10cSrcweir hWnd = HWND_TOPMOST; 1478*cdf0e10cSrcweir else 1479*cdf0e10cSrcweir hWnd = HWND_NOTOPMOST; 1480*cdf0e10cSrcweir SetWindowPos( mhWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE ); 1481*cdf0e10cSrcweir #endif 1482*cdf0e10cSrcweir } 1483*cdf0e10cSrcweir 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1486*cdf0e10cSrcweir 1487*cdf0e10cSrcweir static void ImplSalToTop( HWND hWnd, ULONG nFlags ) 1488*cdf0e10cSrcweir { 1489*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 1490*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 1491*cdf0e10cSrcweir debug_printf("ImplSalToTop hWnd %08x, nFlags %x\n", hWnd, nFlags); 1492*cdf0e10cSrcweir #endif 1493*cdf0e10cSrcweir 1494*cdf0e10cSrcweir // if window is minimized, first restore it 1495*cdf0e10cSrcweir SWP aSWP; 1496*cdf0e10cSrcweir WinQueryWindowPos( hWnd, &aSWP ); 1497*cdf0e10cSrcweir if ( aSWP.fl & SWP_MINIMIZE ) 1498*cdf0e10cSrcweir WinSetWindowPos( hWnd, NULL, 0, 0, 0, 0, SWP_RESTORE ); 1499*cdf0e10cSrcweir 1500*cdf0e10cSrcweir if ( nFlags & SAL_FRAME_TOTOP_FOREGROUNDTASK ) 1501*cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER); 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir if ( nFlags & SAL_FRAME_TOTOP_RESTOREWHENMIN ) 1504*cdf0e10cSrcweir { 1505*cdf0e10cSrcweir ULONG nStyle; 1506*cdf0e10cSrcweir if ( pFrame->mbRestoreMaximize ) 1507*cdf0e10cSrcweir nStyle = SWP_MAXIMIZE; 1508*cdf0e10cSrcweir else 1509*cdf0e10cSrcweir nStyle = SWP_RESTORE; 1510*cdf0e10cSrcweir 1511*cdf0e10cSrcweir WinSetWindowPos( pFrame->mhWndFrame, NULL, 0, 0, 0, 0, nStyle ); 1512*cdf0e10cSrcweir } 1513*cdf0e10cSrcweir WinSetFocus( HWND_DESKTOP, pFrame->mhWndClient ); 1514*cdf0e10cSrcweir } 1515*cdf0e10cSrcweir 1516*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir void Os2SalFrame::ToTop( USHORT nFlags ) 1519*cdf0e10cSrcweir { 1520*cdf0e10cSrcweir nFlags &= ~SAL_FRAME_TOTOP_GRABFOCUS; // this flag is not needed on win32 1521*cdf0e10cSrcweir // Post this Message to the window, because this only works 1522*cdf0e10cSrcweir // in the thread of the window, which has create this window. 1523*cdf0e10cSrcweir // We post this message to avoid deadlocks 1524*cdf0e10cSrcweir if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) 1525*cdf0e10cSrcweir WinPostMsg( mhWndFrame, SAL_MSG_TOTOP, (MPARAM)nFlags, 0 ); 1526*cdf0e10cSrcweir else 1527*cdf0e10cSrcweir ImplSalToTop( mhWndFrame, nFlags ); 1528*cdf0e10cSrcweir } 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1531*cdf0e10cSrcweir 1532*cdf0e10cSrcweir void Os2SalFrame::SetPointer( PointerStyle ePointerStyle ) 1533*cdf0e10cSrcweir { 1534*cdf0e10cSrcweir struct ImplPtrData 1535*cdf0e10cSrcweir { 1536*cdf0e10cSrcweir HPOINTER mhPointer; 1537*cdf0e10cSrcweir ULONG mnSysId; 1538*cdf0e10cSrcweir ULONG mnOwnId; 1539*cdf0e10cSrcweir }; 1540*cdf0e10cSrcweir 1541*cdf0e10cSrcweir static ImplPtrData aImplPtrTab[POINTER_COUNT] = 1542*cdf0e10cSrcweir { 1543*cdf0e10cSrcweir { 0, SPTR_ARROW, 0 }, // POINTER_ARROW 1544*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL 1545*cdf0e10cSrcweir { 0, SPTR_WAIT, 0 }, // POINTER_WAIT 1546*cdf0e10cSrcweir { 0, SPTR_TEXT, 0 }, // POINTER_BEAM 1547*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HELP }, // POINTER_HELP 1548*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROSS }, // POINTER_CROSS 1549*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVE }, // POINTER_MOVE 1550*cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_NSIZE 1551*cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_SSIZE 1552*cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WSIZE 1553*cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_ESIZE 1554*cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_NWSIZE 1555*cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_NESIZE 1556*cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_SWSIZE 1557*cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_SESIZE 1558*cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_NSIZE 1559*cdf0e10cSrcweir { 0, SPTR_SIZENS, 0 }, // POINTER_WINDOW_SSIZE 1560*cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE 1561*cdf0e10cSrcweir { 0, SPTR_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE 1562*cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE 1563*cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE 1564*cdf0e10cSrcweir { 0, SPTR_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE 1565*cdf0e10cSrcweir { 0, SPTR_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE 1566*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSPLIT }, // POINTER_HSPLIT 1567*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSPLIT }, // POINTER_VSPLIT 1568*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSIZEBAR }, // POINTER_HSIZEBAR 1569*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSIZEBAR }, // POINTER_VSIZEBAR 1570*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HAND }, // POINTER_HAND 1571*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_REFHAND }, // POINTER_REFHAND 1572*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PEN }, // POINTER_PEN 1573*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY 1574*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL 1575*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE 1576*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR 1577*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR 1578*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR 1579*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK 1580*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP 1581*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT 1582*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT 1583*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA 1584*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA 1585*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA 1586*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK 1587*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK 1588*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE 1589*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE 1590*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE 1591*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK 1592*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK 1593*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES 1594*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES 1595*cdf0e10cSrcweir { 0, SPTR_ILLEGAL, 0 }, // POINTER_NOTALLOWED 1596*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE 1597*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT 1598*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON 1599*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER 1600*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC 1601*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE 1602*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT 1603*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE 1604*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND 1605*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT 1606*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT 1607*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION 1608*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART 1609*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE 1610*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL 1611*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW 1612*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD 1613*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN 1614*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED 1615*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE 1616*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE 1617*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N 1618*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S 1619*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W 1620*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E 1621*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW 1622*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE 1623*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW 1624*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE 1625*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS 1626*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE 1627*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE 1628*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH 1629*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL 1630*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir // --> FME 2004-07-30 #i32329# Enhanced table selection 1633*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S 1634*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E 1635*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE 1636*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W 1637*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW 1638*cdf0e10cSrcweir // <-- 1639*cdf0e10cSrcweir 1640*cdf0e10cSrcweir // --> FME 2004-08-16 #i20119# Paintbrush tool 1641*cdf0e10cSrcweir { 0, 0, SAL_RESID_POINTER_PAINTBRUSH } // POINTER_PAINTBRUSH 1642*cdf0e10cSrcweir // <-- 1643*cdf0e10cSrcweir }; 1644*cdf0e10cSrcweir 1645*cdf0e10cSrcweir #if POINTER_COUNT != 94 1646*cdf0e10cSrcweir #error New Pointer must be defined! 1647*cdf0e10cSrcweir #endif 1648*cdf0e10cSrcweir 1649*cdf0e10cSrcweir //debug_printf("Os2SalFrame::SetPointer\n"); 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir // Mousepointer loaded ? 1652*cdf0e10cSrcweir if ( !aImplPtrTab[ePointerStyle].mhPointer ) 1653*cdf0e10cSrcweir { 1654*cdf0e10cSrcweir if ( aImplPtrTab[ePointerStyle].mnOwnId ) 1655*cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = ImplLoadSalCursor( (ULONG)aImplPtrTab[ePointerStyle].mnOwnId ); 1656*cdf0e10cSrcweir else 1657*cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = WinQuerySysPointer( HWND_DESKTOP, aImplPtrTab[ePointerStyle].mnSysId, FALSE ); 1658*cdf0e10cSrcweir } 1659*cdf0e10cSrcweir if (aImplPtrTab[ePointerStyle].mhPointer == 0) { 1660*cdf0e10cSrcweir debug_printf( "SetPointer ePointerStyle %d unknown\n", ePointerStyle); 1661*cdf0e10cSrcweir aImplPtrTab[ePointerStyle].mhPointer = SPTR_ICONERROR; 1662*cdf0e10cSrcweir } 1663*cdf0e10cSrcweir 1664*cdf0e10cSrcweir // Unterscheidet sich der Mauspointer, dann den neuen setzen 1665*cdf0e10cSrcweir if ( mhPointer != aImplPtrTab[ePointerStyle].mhPointer ) 1666*cdf0e10cSrcweir { 1667*cdf0e10cSrcweir mhPointer = aImplPtrTab[ePointerStyle].mhPointer; 1668*cdf0e10cSrcweir WinSetPointer( HWND_DESKTOP, mhPointer ); 1669*cdf0e10cSrcweir } 1670*cdf0e10cSrcweir } 1671*cdf0e10cSrcweir 1672*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1673*cdf0e10cSrcweir 1674*cdf0e10cSrcweir void Os2SalFrame::CaptureMouse( BOOL bCapture ) 1675*cdf0e10cSrcweir { 1676*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 1677*cdf0e10cSrcweir _bCapture=bCapture; 1678*cdf0e10cSrcweir debug_printf("Os2SalFrame::CaptureMouse bCapture %d\n", bCapture); 1679*cdf0e10cSrcweir #endif 1680*cdf0e10cSrcweir if ( bCapture ) 1681*cdf0e10cSrcweir WinSetCapture( HWND_DESKTOP, mhWndClient ); 1682*cdf0e10cSrcweir else 1683*cdf0e10cSrcweir WinSetCapture( HWND_DESKTOP, 0 ); 1684*cdf0e10cSrcweir } 1685*cdf0e10cSrcweir 1686*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1687*cdf0e10cSrcweir 1688*cdf0e10cSrcweir void Os2SalFrame::SetPointerPos( long nX, long nY ) 1689*cdf0e10cSrcweir { 1690*cdf0e10cSrcweir POINTL aPt; 1691*cdf0e10cSrcweir aPt.x = nX; 1692*cdf0e10cSrcweir aPt.y = mnHeight - nY - 1; // convert sal coords to sys 1693*cdf0e10cSrcweir WinMapWindowPoints( mhWndClient, HWND_DESKTOP, &aPt, 1 ); 1694*cdf0e10cSrcweir WinSetPointerPos( HWND_DESKTOP, aPt.x, aPt.y ); 1695*cdf0e10cSrcweir } 1696*cdf0e10cSrcweir 1697*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1698*cdf0e10cSrcweir 1699*cdf0e10cSrcweir void Os2SalFrame::Flush() 1700*cdf0e10cSrcweir { 1701*cdf0e10cSrcweir } 1702*cdf0e10cSrcweir 1703*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1704*cdf0e10cSrcweir 1705*cdf0e10cSrcweir void Os2SalFrame::Sync() 1706*cdf0e10cSrcweir { 1707*cdf0e10cSrcweir } 1708*cdf0e10cSrcweir 1709*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1710*cdf0e10cSrcweir 1711*cdf0e10cSrcweir void Os2SalFrame::SetInputContext( SalInputContext* pContext ) 1712*cdf0e10cSrcweir { 1713*cdf0e10cSrcweir #ifdef ENABLE_IME 1714*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 1715*cdf0e10cSrcweir if ( pIMEData ) 1716*cdf0e10cSrcweir { 1717*cdf0e10cSrcweir HWND hWnd = mhWndClient; 1718*cdf0e10cSrcweir HIMI hIMI = 0; 1719*cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 1720*cdf0e10cSrcweir if ( hIMI ) 1721*cdf0e10cSrcweir { 1722*cdf0e10cSrcweir ULONG nInputMode; 1723*cdf0e10cSrcweir ULONG nConversionMode; 1724*cdf0e10cSrcweir if ( 0 == pIMEData->mpQueryIMEMode( hIMI, &nInputMode, &nConversionMode ) ) 1725*cdf0e10cSrcweir { 1726*cdf0e10cSrcweir if ( pContext->mnOptions & SAL_INPUTCONTEXT_TEXT ) 1727*cdf0e10cSrcweir { 1728*cdf0e10cSrcweir nInputMode &= ~IMI_IM_IME_DISABLE; 1729*cdf0e10cSrcweir if ( pContext->mnOptions & SAL_INPUTCONTEXT_EXTTEXTINPUT_OFF ) 1730*cdf0e10cSrcweir nInputMode &= ~IMI_IM_IME_ON; 1731*cdf0e10cSrcweir // !!! Da derzeit ueber das OS2-IME-UI der IME-Mode nicht einschaltbar ist !!! 1732*cdf0e10cSrcweir // if ( SAL_INPUTCONTEXT_EXTTEXTINPUT_ON ) 1733*cdf0e10cSrcweir nInputMode |= IMI_IM_IME_ON; 1734*cdf0e10cSrcweir } 1735*cdf0e10cSrcweir else 1736*cdf0e10cSrcweir nInputMode |= IMI_IM_IME_DISABLE; 1737*cdf0e10cSrcweir pIMEData->mpSetIMEMode( hIMI, nInputMode, nConversionMode ); 1738*cdf0e10cSrcweir } 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 1741*cdf0e10cSrcweir } 1742*cdf0e10cSrcweir } 1743*cdf0e10cSrcweir #endif 1744*cdf0e10cSrcweir } 1745*cdf0e10cSrcweir 1746*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1747*cdf0e10cSrcweir #if 0 1748*cdf0e10cSrcweir void Os2SalFrame::UpdateExtTextInputArea() 1749*cdf0e10cSrcweir { 1750*cdf0e10cSrcweir #ifdef ENABLE_IME 1751*cdf0e10cSrcweir #endif 1752*cdf0e10cSrcweir } 1753*cdf0e10cSrcweir #endif 1754*cdf0e10cSrcweir 1755*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1756*cdf0e10cSrcweir 1757*cdf0e10cSrcweir void Os2SalFrame::EndExtTextInput( USHORT nFlags ) 1758*cdf0e10cSrcweir { 1759*cdf0e10cSrcweir #ifdef ENABLE_IME 1760*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 1761*cdf0e10cSrcweir if ( pIMEData ) 1762*cdf0e10cSrcweir { 1763*cdf0e10cSrcweir HWND hWnd = mhWndClient; 1764*cdf0e10cSrcweir HIMI hIMI = 0; 1765*cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 1766*cdf0e10cSrcweir if ( hIMI ) 1767*cdf0e10cSrcweir { 1768*cdf0e10cSrcweir ULONG nIndex; 1769*cdf0e10cSrcweir if ( nFlags & SAL_FRAME_ENDEXTTEXTINPUT_COMPLETE ) 1770*cdf0e10cSrcweir nIndex = CNV_COMPLETE; 1771*cdf0e10cSrcweir else 1772*cdf0e10cSrcweir nIndex = CNV_CANCEL; 1773*cdf0e10cSrcweir 1774*cdf0e10cSrcweir pIMEData->mpRequestIME( hIMI, REQ_CONVERSIONSTRING, nIndex, 0 ); 1775*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 1776*cdf0e10cSrcweir } 1777*cdf0e10cSrcweir } 1778*cdf0e10cSrcweir #endif 1779*cdf0e10cSrcweir } 1780*cdf0e10cSrcweir 1781*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1782*cdf0e10cSrcweir 1783*cdf0e10cSrcweir XubString Os2SalFrame::GetKeyName( USHORT nCode ) 1784*cdf0e10cSrcweir { 1785*cdf0e10cSrcweir if ( eImplKeyboardLanguage == LANGUAGE_DONTKNOW ) 1786*cdf0e10cSrcweir eImplKeyboardLanguage = MsLangId::getSystemLanguage(); 1787*cdf0e10cSrcweir 1788*cdf0e10cSrcweir XubString aKeyCode; 1789*cdf0e10cSrcweir XubString aCode; 1790*cdf0e10cSrcweir const sal_Unicode** pLangTab = ImplGetLangTab( eImplKeyboardLanguage ); 1791*cdf0e10cSrcweir 1792*cdf0e10cSrcweir if ( nCode & KEY_SHIFT ) 1793*cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_SHIFT]; 1794*cdf0e10cSrcweir 1795*cdf0e10cSrcweir if ( nCode & KEY_MOD1 ) 1796*cdf0e10cSrcweir { 1797*cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1798*cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_CTRL]; 1799*cdf0e10cSrcweir else 1800*cdf0e10cSrcweir { 1801*cdf0e10cSrcweir aKeyCode += '+'; 1802*cdf0e10cSrcweir aKeyCode += pLangTab[LSTR_KEY_CTRL]; 1803*cdf0e10cSrcweir } 1804*cdf0e10cSrcweir } 1805*cdf0e10cSrcweir 1806*cdf0e10cSrcweir if ( nCode & KEY_MOD2 ) 1807*cdf0e10cSrcweir { 1808*cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1809*cdf0e10cSrcweir aKeyCode = pLangTab[LSTR_KEY_ALT]; 1810*cdf0e10cSrcweir else 1811*cdf0e10cSrcweir { 1812*cdf0e10cSrcweir aKeyCode += '+'; 1813*cdf0e10cSrcweir aKeyCode += pLangTab[LSTR_KEY_ALT]; 1814*cdf0e10cSrcweir } 1815*cdf0e10cSrcweir } 1816*cdf0e10cSrcweir 1817*cdf0e10cSrcweir USHORT nKeyCode = nCode & 0x0FFF; 1818*cdf0e10cSrcweir if ( (nKeyCode >= KEY_0) && (nKeyCode <= KEY_9) ) 1819*cdf0e10cSrcweir aCode = sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_0)); 1820*cdf0e10cSrcweir else if ( (nKeyCode >= KEY_A) && (nKeyCode <= KEY_Z) ) 1821*cdf0e10cSrcweir aCode = sal::static_int_cast<sal_Char>('A' + (nKeyCode - KEY_A)); 1822*cdf0e10cSrcweir else if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F26) ) 1823*cdf0e10cSrcweir { 1824*cdf0e10cSrcweir aCode += 'F'; 1825*cdf0e10cSrcweir if ( (nKeyCode >= KEY_F1) && (nKeyCode <= KEY_F9) ) 1826*cdf0e10cSrcweir { 1827*cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('1' + (nKeyCode - KEY_F1)); 1828*cdf0e10cSrcweir } 1829*cdf0e10cSrcweir else if ( (nKeyCode >= KEY_F10) && (nKeyCode <= KEY_F19) ) 1830*cdf0e10cSrcweir { 1831*cdf0e10cSrcweir aCode += '1'; 1832*cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F10)); 1833*cdf0e10cSrcweir } 1834*cdf0e10cSrcweir else 1835*cdf0e10cSrcweir { 1836*cdf0e10cSrcweir aCode += '2'; 1837*cdf0e10cSrcweir aCode += sal::static_int_cast<sal_Char>('0' + (nKeyCode - KEY_F20)); 1838*cdf0e10cSrcweir } 1839*cdf0e10cSrcweir } 1840*cdf0e10cSrcweir else 1841*cdf0e10cSrcweir { 1842*cdf0e10cSrcweir switch ( nKeyCode ) 1843*cdf0e10cSrcweir { 1844*cdf0e10cSrcweir case KEY_DOWN: 1845*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_DOWN]; 1846*cdf0e10cSrcweir break; 1847*cdf0e10cSrcweir case KEY_UP: 1848*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_UP]; 1849*cdf0e10cSrcweir break; 1850*cdf0e10cSrcweir case KEY_LEFT: 1851*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_LEFT]; 1852*cdf0e10cSrcweir break; 1853*cdf0e10cSrcweir case KEY_RIGHT: 1854*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_RIGHT]; 1855*cdf0e10cSrcweir break; 1856*cdf0e10cSrcweir case KEY_HOME: 1857*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_HOME]; 1858*cdf0e10cSrcweir break; 1859*cdf0e10cSrcweir case KEY_END: 1860*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_END]; 1861*cdf0e10cSrcweir break; 1862*cdf0e10cSrcweir case KEY_PAGEUP: 1863*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_PAGEUP]; 1864*cdf0e10cSrcweir break; 1865*cdf0e10cSrcweir case KEY_PAGEDOWN: 1866*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_PAGEDOWN]; 1867*cdf0e10cSrcweir break; 1868*cdf0e10cSrcweir case KEY_RETURN: 1869*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_RETURN]; 1870*cdf0e10cSrcweir break; 1871*cdf0e10cSrcweir case KEY_ESCAPE: 1872*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_ESC]; 1873*cdf0e10cSrcweir break; 1874*cdf0e10cSrcweir case KEY_TAB: 1875*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_TAB]; 1876*cdf0e10cSrcweir break; 1877*cdf0e10cSrcweir case KEY_BACKSPACE: 1878*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_BACKSPACE]; 1879*cdf0e10cSrcweir break; 1880*cdf0e10cSrcweir case KEY_SPACE: 1881*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_SPACE]; 1882*cdf0e10cSrcweir break; 1883*cdf0e10cSrcweir case KEY_INSERT: 1884*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_INSERT]; 1885*cdf0e10cSrcweir break; 1886*cdf0e10cSrcweir case KEY_DELETE: 1887*cdf0e10cSrcweir aCode = pLangTab[LSTR_KEY_DELETE]; 1888*cdf0e10cSrcweir break; 1889*cdf0e10cSrcweir 1890*cdf0e10cSrcweir case KEY_ADD: 1891*cdf0e10cSrcweir aCode += '+'; 1892*cdf0e10cSrcweir break; 1893*cdf0e10cSrcweir case KEY_SUBTRACT: 1894*cdf0e10cSrcweir aCode += '-'; 1895*cdf0e10cSrcweir break; 1896*cdf0e10cSrcweir case KEY_MULTIPLY: 1897*cdf0e10cSrcweir aCode += '*'; 1898*cdf0e10cSrcweir break; 1899*cdf0e10cSrcweir case KEY_DIVIDE: 1900*cdf0e10cSrcweir aCode += '/'; 1901*cdf0e10cSrcweir break; 1902*cdf0e10cSrcweir case KEY_POINT: 1903*cdf0e10cSrcweir aCode += '.'; 1904*cdf0e10cSrcweir break; 1905*cdf0e10cSrcweir case KEY_COMMA: 1906*cdf0e10cSrcweir aCode += ','; 1907*cdf0e10cSrcweir break; 1908*cdf0e10cSrcweir case KEY_LESS: 1909*cdf0e10cSrcweir aCode += '<'; 1910*cdf0e10cSrcweir break; 1911*cdf0e10cSrcweir case KEY_GREATER: 1912*cdf0e10cSrcweir aCode += '>'; 1913*cdf0e10cSrcweir break; 1914*cdf0e10cSrcweir case KEY_EQUAL: 1915*cdf0e10cSrcweir aCode += '='; 1916*cdf0e10cSrcweir break; 1917*cdf0e10cSrcweir } 1918*cdf0e10cSrcweir } 1919*cdf0e10cSrcweir 1920*cdf0e10cSrcweir if ( aCode.Len() ) 1921*cdf0e10cSrcweir { 1922*cdf0e10cSrcweir if ( aKeyCode.Len() == 0 ) 1923*cdf0e10cSrcweir aKeyCode = aCode; 1924*cdf0e10cSrcweir else 1925*cdf0e10cSrcweir { 1926*cdf0e10cSrcweir aKeyCode += '+'; 1927*cdf0e10cSrcweir aKeyCode += aCode; 1928*cdf0e10cSrcweir } 1929*cdf0e10cSrcweir } 1930*cdf0e10cSrcweir 1931*cdf0e10cSrcweir return aKeyCode; 1932*cdf0e10cSrcweir } 1933*cdf0e10cSrcweir 1934*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1935*cdf0e10cSrcweir 1936*cdf0e10cSrcweir XubString Os2SalFrame::GetSymbolKeyName( const XubString&, USHORT nKeyCode ) 1937*cdf0e10cSrcweir { 1938*cdf0e10cSrcweir return GetKeyName( nKeyCode ); 1939*cdf0e10cSrcweir } 1940*cdf0e10cSrcweir 1941*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1942*cdf0e10cSrcweir 1943*cdf0e10cSrcweir inline long ImplOS2ColorToSal( long nOS2Color ) 1944*cdf0e10cSrcweir { 1945*cdf0e10cSrcweir return MAKE_SALCOLOR( (BYTE)( nOS2Color>>16), (BYTE)(nOS2Color>>8), (BYTE)nOS2Color ); 1946*cdf0e10cSrcweir } 1947*cdf0e10cSrcweir 1948*cdf0e10cSrcweir // ----------------------------------------------------------------------- 1949*cdf0e10cSrcweir 1950*cdf0e10cSrcweir static USHORT ImplMouseSysValueToSAL( int iSysValue, USHORT& rCode, USHORT& rClicks, BOOL& rDown ) 1951*cdf0e10cSrcweir { 1952*cdf0e10cSrcweir LONG lValue = WinQuerySysValue( HWND_DESKTOP, iSysValue ); 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir rCode = 0; 1955*cdf0e10cSrcweir rClicks = 1; 1956*cdf0e10cSrcweir rDown = TRUE; 1957*cdf0e10cSrcweir 1958*cdf0e10cSrcweir switch ( lValue & 0xFFFF ) 1959*cdf0e10cSrcweir { 1960*cdf0e10cSrcweir case WM_BUTTON1UP: 1961*cdf0e10cSrcweir case WM_BUTTON1CLICK: 1962*cdf0e10cSrcweir rCode = MOUSE_LEFT; 1963*cdf0e10cSrcweir rDown = FALSE; 1964*cdf0e10cSrcweir break; 1965*cdf0e10cSrcweir case WM_BUTTON1DOWN: 1966*cdf0e10cSrcweir case WM_BUTTON1MOTIONSTART: 1967*cdf0e10cSrcweir rCode = MOUSE_LEFT; 1968*cdf0e10cSrcweir break; 1969*cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 1970*cdf0e10cSrcweir rCode = MOUSE_LEFT; 1971*cdf0e10cSrcweir rClicks = 2; 1972*cdf0e10cSrcweir break; 1973*cdf0e10cSrcweir 1974*cdf0e10cSrcweir case WM_BUTTON2UP: 1975*cdf0e10cSrcweir case WM_BUTTON2CLICK: 1976*cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1977*cdf0e10cSrcweir rDown = FALSE; 1978*cdf0e10cSrcweir break; 1979*cdf0e10cSrcweir case WM_BUTTON2DOWN: 1980*cdf0e10cSrcweir case WM_BUTTON2MOTIONSTART: 1981*cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1982*cdf0e10cSrcweir break; 1983*cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 1984*cdf0e10cSrcweir rCode = MOUSE_RIGHT; 1985*cdf0e10cSrcweir rClicks = 2; 1986*cdf0e10cSrcweir break; 1987*cdf0e10cSrcweir 1988*cdf0e10cSrcweir case WM_BUTTON3UP: 1989*cdf0e10cSrcweir case WM_BUTTON3CLICK: 1990*cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1991*cdf0e10cSrcweir rDown = FALSE; 1992*cdf0e10cSrcweir break; 1993*cdf0e10cSrcweir case WM_BUTTON3DOWN: 1994*cdf0e10cSrcweir case WM_BUTTON3MOTIONSTART: 1995*cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1996*cdf0e10cSrcweir break; 1997*cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 1998*cdf0e10cSrcweir rCode = MOUSE_MIDDLE; 1999*cdf0e10cSrcweir rClicks = 2; 2000*cdf0e10cSrcweir break; 2001*cdf0e10cSrcweir } 2002*cdf0e10cSrcweir 2003*cdf0e10cSrcweir if ( !rCode ) 2004*cdf0e10cSrcweir return FALSE; 2005*cdf0e10cSrcweir 2006*cdf0e10cSrcweir lValue = (lValue & 0xFFFF0000) >> 16; 2007*cdf0e10cSrcweir if ( lValue != 0xFFFF ) 2008*cdf0e10cSrcweir { 2009*cdf0e10cSrcweir if ( lValue & KC_SHIFT ) 2010*cdf0e10cSrcweir rCode |= KEY_SHIFT; 2011*cdf0e10cSrcweir if ( lValue & KC_CTRL ) 2012*cdf0e10cSrcweir rCode |= KEY_MOD1; 2013*cdf0e10cSrcweir if ( lValue & KC_ALT ) 2014*cdf0e10cSrcweir rCode |= KEY_MOD2; 2015*cdf0e10cSrcweir } 2016*cdf0e10cSrcweir 2017*cdf0e10cSrcweir return TRUE; 2018*cdf0e10cSrcweir } 2019*cdf0e10cSrcweir 2020*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2021*cdf0e10cSrcweir 2022*cdf0e10cSrcweir static BOOL ImplSalIsSameColor( const Color& rColor1, const Color& rColor2 ) 2023*cdf0e10cSrcweir { 2024*cdf0e10cSrcweir ULONG nWrong = 0; 2025*cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetRed()-(short)rColor2.GetRed() ); 2026*cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetGreen()-(short)rColor2.GetGreen() ); 2027*cdf0e10cSrcweir nWrong += Abs( (short)rColor1.GetBlue()-(short)rColor2.GetBlue() ); 2028*cdf0e10cSrcweir return (nWrong < 30); 2029*cdf0e10cSrcweir } 2030*cdf0e10cSrcweir 2031*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2032*cdf0e10cSrcweir 2033*cdf0e10cSrcweir static BOOL ImplOS2NameFontToVCLFont( const char* pFontName, Font& rFont ) 2034*cdf0e10cSrcweir { 2035*cdf0e10cSrcweir char aNumBuf[10]; 2036*cdf0e10cSrcweir int nNumBufLen = 0; 2037*cdf0e10cSrcweir 2038*cdf0e10cSrcweir while ( *pFontName && (*pFontName != '.') && 2039*cdf0e10cSrcweir (nNumBufLen < sizeof(aNumBuf)-1) ) 2040*cdf0e10cSrcweir { 2041*cdf0e10cSrcweir aNumBuf[nNumBufLen] = *pFontName; 2042*cdf0e10cSrcweir nNumBufLen++; 2043*cdf0e10cSrcweir pFontName++; 2044*cdf0e10cSrcweir } 2045*cdf0e10cSrcweir aNumBuf[nNumBufLen] = '\0'; 2046*cdf0e10cSrcweir 2047*cdf0e10cSrcweir pFontName++; 2048*cdf0e10cSrcweir while ( *pFontName == ' ' ) 2049*cdf0e10cSrcweir pFontName++; 2050*cdf0e10cSrcweir 2051*cdf0e10cSrcweir int nFontHeight = atoi( aNumBuf ); 2052*cdf0e10cSrcweir int nFontNameLen = strlen( pFontName ); 2053*cdf0e10cSrcweir if ( nFontHeight && nFontNameLen ) 2054*cdf0e10cSrcweir { 2055*cdf0e10cSrcweir rFont.SetFamily( FAMILY_DONTKNOW ); 2056*cdf0e10cSrcweir rFont.SetWeight( WEIGHT_NORMAL ); 2057*cdf0e10cSrcweir rFont.SetItalic( ITALIC_NONE ); 2058*cdf0e10cSrcweir // search for a style embedded in the name, e.g. 'WarpSans Bold' 2059*cdf0e10cSrcweir // because we need to split the style from the family name 2060*cdf0e10cSrcweir if (strstr( pFontName, " Bold") 2061*cdf0e10cSrcweir || strstr( pFontName, " Italic") 2062*cdf0e10cSrcweir || strstr( pFontName, "-Normal")) 2063*cdf0e10cSrcweir { 2064*cdf0e10cSrcweir char* fontName = strdup( pFontName); 2065*cdf0e10cSrcweir char* style = strstr( fontName, " Bold"); 2066*cdf0e10cSrcweir if (style) 2067*cdf0e10cSrcweir rFont.SetWeight( WEIGHT_BOLD ); 2068*cdf0e10cSrcweir 2069*cdf0e10cSrcweir if (!style) 2070*cdf0e10cSrcweir style = strstr( fontName, " Italic"); 2071*cdf0e10cSrcweir if (style) 2072*cdf0e10cSrcweir rFont.SetItalic( ITALIC_NORMAL ); 2073*cdf0e10cSrcweir 2074*cdf0e10cSrcweir if (!style) 2075*cdf0e10cSrcweir style = strstr( fontName, "-Normal"); 2076*cdf0e10cSrcweir // store style, skip whitespace char 2077*cdf0e10cSrcweir rFont.SetStyleName( ::rtl::OStringToOUString ( style+1, gsl_getSystemTextEncoding()) ); 2078*cdf0e10cSrcweir // truncate name 2079*cdf0e10cSrcweir *style = 0; 2080*cdf0e10cSrcweir // store family name 2081*cdf0e10cSrcweir rFont.SetName( ::rtl::OStringToOUString ( fontName, gsl_getSystemTextEncoding()) ); 2082*cdf0e10cSrcweir free( fontName); 2083*cdf0e10cSrcweir } 2084*cdf0e10cSrcweir else 2085*cdf0e10cSrcweir { 2086*cdf0e10cSrcweir rFont.SetName( ::rtl::OStringToOUString (pFontName, gsl_getSystemTextEncoding()) ); 2087*cdf0e10cSrcweir rFont.SetStyleName( ::rtl::OStringToOUString ("", gsl_getSystemTextEncoding()) ); 2088*cdf0e10cSrcweir } 2089*cdf0e10cSrcweir 2090*cdf0e10cSrcweir rFont.SetSize( Size( 0, nFontHeight ) ); 2091*cdf0e10cSrcweir return TRUE; 2092*cdf0e10cSrcweir } 2093*cdf0e10cSrcweir else 2094*cdf0e10cSrcweir return FALSE; 2095*cdf0e10cSrcweir } 2096*cdf0e10cSrcweir 2097*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2098*cdf0e10cSrcweir 2099*cdf0e10cSrcweir void Os2SalFrame::UpdateSettings( AllSettings& rSettings ) 2100*cdf0e10cSrcweir { 2101*cdf0e10cSrcweir static char aControlPanel[] = "PM_ControlPanel"; 2102*cdf0e10cSrcweir static char aSystemFonts[] = "PM_SystemFonts"; 2103*cdf0e10cSrcweir char aDummyStr[] = ""; 2104*cdf0e10cSrcweir 2105*cdf0e10cSrcweir // --- Mouse setting --- 2106*cdf0e10cSrcweir USHORT nCode; 2107*cdf0e10cSrcweir USHORT nClicks; 2108*cdf0e10cSrcweir BOOL bDown; 2109*cdf0e10cSrcweir MouseSettings aMouseSettings = rSettings.GetMouseSettings(); 2110*cdf0e10cSrcweir aMouseSettings.SetDoubleClickTime( WinQuerySysValue( HWND_DESKTOP, SV_DBLCLKTIME ) ); 2111*cdf0e10cSrcweir if ( ImplMouseSysValueToSAL( SV_BEGINDRAG, nCode, nClicks, bDown ) ) 2112*cdf0e10cSrcweir aMouseSettings.SetStartDragCode( nCode ); 2113*cdf0e10cSrcweir if ( ImplMouseSysValueToSAL( SV_CONTEXTMENU, nCode, nClicks, bDown ) ) 2114*cdf0e10cSrcweir { 2115*cdf0e10cSrcweir aMouseSettings.SetContextMenuCode( nCode ); 2116*cdf0e10cSrcweir aMouseSettings.SetContextMenuClicks( nClicks ); 2117*cdf0e10cSrcweir aMouseSettings.SetContextMenuDown( bDown ); 2118*cdf0e10cSrcweir } 2119*cdf0e10cSrcweir aMouseSettings.SetButtonStartRepeat( WinQuerySysValue( HWND_DESKTOP, SV_FIRSTSCROLLRATE ) ); 2120*cdf0e10cSrcweir aMouseSettings.SetButtonRepeat( WinQuerySysValue( HWND_DESKTOP, SV_SCROLLRATE ) ); 2121*cdf0e10cSrcweir rSettings.SetMouseSettings( aMouseSettings ); 2122*cdf0e10cSrcweir 2123*cdf0e10cSrcweir // --- Style settings --- 2124*cdf0e10cSrcweir StyleSettings aStyleSettings = rSettings.GetStyleSettings(); 2125*cdf0e10cSrcweir // General settings 2126*cdf0e10cSrcweir LONG nDisplayTime = PrfQueryProfileInt( HINI_PROFILE, (PSZ)aControlPanel, (PSZ)"LogoDisplayTime", -1 ); 2127*cdf0e10cSrcweir ULONG nSalDisplayTime; 2128*cdf0e10cSrcweir if ( nDisplayTime < 0 ) 2129*cdf0e10cSrcweir nSalDisplayTime = LOGO_DISPLAYTIME_STARTTIME; 2130*cdf0e10cSrcweir else if ( !nDisplayTime ) 2131*cdf0e10cSrcweir nSalDisplayTime = LOGO_DISPLAYTIME_NOLOGO; 2132*cdf0e10cSrcweir else 2133*cdf0e10cSrcweir nSalDisplayTime = (ULONG)nDisplayTime; 2134*cdf0e10cSrcweir aStyleSettings.SetLogoDisplayTime( nSalDisplayTime ); 2135*cdf0e10cSrcweir 2136*cdf0e10cSrcweir aStyleSettings.SetCursorBlinkTime( WinQuerySysValue( HWND_DESKTOP, SV_CURSORRATE ) ); 2137*cdf0e10cSrcweir ULONG nDragFullOptions = aStyleSettings.GetDragFullOptions(); 2138*cdf0e10cSrcweir if ( WinQuerySysValue( HWND_DESKTOP, SV_DYNAMICDRAG ) ) 2139*cdf0e10cSrcweir nDragFullOptions |= DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT; 2140*cdf0e10cSrcweir else 2141*cdf0e10cSrcweir nDragFullOptions &= ~(DRAGFULL_OPTION_WINDOWMOVE | DRAGFULL_OPTION_WINDOWSIZE | DRAGFULL_OPTION_DOCKING | DRAGFULL_OPTION_SPLIT); 2142*cdf0e10cSrcweir aStyleSettings.SetDragFullOptions( nDragFullOptions ); 2143*cdf0e10cSrcweir 2144*cdf0e10cSrcweir // Size settings 2145*cdf0e10cSrcweir aStyleSettings.SetScrollBarSize( WinQuerySysValue( HWND_DESKTOP, SV_CYHSCROLL ) ); 2146*cdf0e10cSrcweir aStyleSettings.SetTitleHeight( WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) ); 2147*cdf0e10cSrcweir 2148*cdf0e10cSrcweir // Color settings 2149*cdf0e10cSrcweir aStyleSettings.SetFaceColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); 2150*cdf0e10cSrcweir aStyleSettings.SetInactiveTabColor( aStyleSettings.GetFaceColor() ); 2151*cdf0e10cSrcweir aStyleSettings.SetLightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0 ) ) ); 2152*cdf0e10cSrcweir aStyleSettings.SetLightBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONMIDDLE, 0 ) ) ); 2153*cdf0e10cSrcweir aStyleSettings.SetShadowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0 ) ) ); 2154*cdf0e10cSrcweir aStyleSettings.SetDarkShadowColor( Color( COL_BLACK ) ); 2155*cdf0e10cSrcweir aStyleSettings.SetDialogColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0 ) ) ); 2156*cdf0e10cSrcweir aStyleSettings.SetButtonTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2157*cdf0e10cSrcweir aStyleSettings.SetActiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLE, 0 ) ) ); 2158*cdf0e10cSrcweir aStyleSettings.SetActiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVETITLETEXT, 0 ) ) ); 2159*cdf0e10cSrcweir aStyleSettings.SetActiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ACTIVEBORDER, 0 ) ) ); 2160*cdf0e10cSrcweir aStyleSettings.SetDeactiveColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLE, 0 ) ) ); 2161*cdf0e10cSrcweir aStyleSettings.SetDeactiveTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVETITLETEXT, 0 ) ) ); 2162*cdf0e10cSrcweir aStyleSettings.SetDeactiveBorderColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_INACTIVEBORDER, 0 ) ) ); 2163*cdf0e10cSrcweir aStyleSettings.SetMenuColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENU, 0 ) ) ); 2164*cdf0e10cSrcweir aStyleSettings.SetMenuTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2165*cdf0e10cSrcweir aStyleSettings.SetMenuBarTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUTEXT, 0 ) ) ); 2166*cdf0e10cSrcweir aStyleSettings.SetDialogTextColor( aStyleSettings.GetButtonTextColor() ); 2167*cdf0e10cSrcweir aStyleSettings.SetRadioCheckTextColor( aStyleSettings.GetButtonTextColor() ); 2168*cdf0e10cSrcweir aStyleSettings.SetGroupTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWSTATICTEXT, 0 ) ) ); 2169*cdf0e10cSrcweir aStyleSettings.SetLabelTextColor( aStyleSettings.GetGroupTextColor() ); 2170*cdf0e10cSrcweir aStyleSettings.SetInfoTextColor( aStyleSettings.GetGroupTextColor() ); 2171*cdf0e10cSrcweir aStyleSettings.SetWindowColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOW, 0 ) ) ); 2172*cdf0e10cSrcweir aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() ); 2173*cdf0e10cSrcweir aStyleSettings.SetWindowTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_WINDOWTEXT, 0 ) ) ); 2174*cdf0e10cSrcweir aStyleSettings.SetFieldColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_ENTRYFIELD, 0 ) ) ); 2175*cdf0e10cSrcweir aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() ); 2176*cdf0e10cSrcweir aStyleSettings.SetDisableColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUDISABLEDTEXT, 0 ) ) ); 2177*cdf0e10cSrcweir aStyleSettings.SetHighlightColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEBACKGROUND, 0 ) ) ); 2178*cdf0e10cSrcweir aStyleSettings.SetHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_HILITEFOREGROUND, 0 ) ) ); 2179*cdf0e10cSrcweir Color aMenuHighColor = ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITEBGND, 0 ) ); 2180*cdf0e10cSrcweir if ( ImplSalIsSameColor( aMenuHighColor, aStyleSettings.GetMenuColor() ) ) 2181*cdf0e10cSrcweir { 2182*cdf0e10cSrcweir aStyleSettings.SetMenuHighlightColor( Color( COL_BLUE ) ); 2183*cdf0e10cSrcweir aStyleSettings.SetMenuHighlightTextColor( Color( COL_WHITE ) ); 2184*cdf0e10cSrcweir } 2185*cdf0e10cSrcweir else 2186*cdf0e10cSrcweir { 2187*cdf0e10cSrcweir aStyleSettings.SetMenuHighlightColor( aMenuHighColor ); 2188*cdf0e10cSrcweir aStyleSettings.SetMenuHighlightTextColor( ImplOS2ColorToSal( WinQuerySysColor( HWND_DESKTOP, SYSCLR_MENUHILITE, 0 ) ) ); 2189*cdf0e10cSrcweir } 2190*cdf0e10cSrcweir // Checked-Color berechnen 2191*cdf0e10cSrcweir Color aColor1 = aStyleSettings.GetFaceColor(); 2192*cdf0e10cSrcweir Color aColor2 = aStyleSettings.GetLightColor(); 2193*cdf0e10cSrcweir BYTE nRed = (BYTE)(((USHORT)aColor1.GetRed() + (USHORT)aColor2.GetRed())/2); 2194*cdf0e10cSrcweir BYTE nGreen = (BYTE)(((USHORT)aColor1.GetGreen() + (USHORT)aColor2.GetGreen())/2); 2195*cdf0e10cSrcweir BYTE nBlue = (BYTE)(((USHORT)aColor1.GetBlue() + (USHORT)aColor2.GetBlue())/2); 2196*cdf0e10cSrcweir aStyleSettings.SetCheckedColor( Color( nRed, nGreen, nBlue ) ); 2197*cdf0e10cSrcweir 2198*cdf0e10cSrcweir // Fonts updaten 2199*cdf0e10cSrcweir Font aFont; 2200*cdf0e10cSrcweir char aFontNameBuf[255]; 2201*cdf0e10cSrcweir aFont = aStyleSettings.GetMenuFont(); 2202*cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"Menus", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2203*cdf0e10cSrcweir { 2204*cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) { 2205*cdf0e10cSrcweir #if 0 2206*cdf0e10cSrcweir // Add Workplace Sans if not already listed 2207*cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2208*cdf0e10cSrcweir { 2209*cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2210*cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2211*cdf0e10cSrcweir aFont.SetName( aFontName ); 2212*cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2213*cdf0e10cSrcweir } 2214*cdf0e10cSrcweir #endif 2215*cdf0e10cSrcweir aStyleSettings.SetMenuFont( aFont ); 2216*cdf0e10cSrcweir } 2217*cdf0e10cSrcweir } 2218*cdf0e10cSrcweir aFont = aStyleSettings.GetIconFont(); 2219*cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"IconText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2220*cdf0e10cSrcweir { 2221*cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2222*cdf0e10cSrcweir aStyleSettings.SetIconFont( aFont ); 2223*cdf0e10cSrcweir } 2224*cdf0e10cSrcweir aFont = aStyleSettings.GetTitleFont(); 2225*cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowTitles", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2226*cdf0e10cSrcweir { 2227*cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2228*cdf0e10cSrcweir { 2229*cdf0e10cSrcweir // Add Workplace Sans if not already listed 2230*cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2231*cdf0e10cSrcweir { 2232*cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2233*cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2234*cdf0e10cSrcweir aFont.SetName( aFontName ); 2235*cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2236*cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 2237*cdf0e10cSrcweir aFont.SetItalic( ITALIC_NONE ); 2238*cdf0e10cSrcweir } 2239*cdf0e10cSrcweir aStyleSettings.SetTitleFont( aFont ); 2240*cdf0e10cSrcweir aStyleSettings.SetFloatTitleFont( aFont ); 2241*cdf0e10cSrcweir } 2242*cdf0e10cSrcweir } 2243*cdf0e10cSrcweir aFont = aStyleSettings.GetAppFont(); 2244*cdf0e10cSrcweir if ( PrfQueryProfileString( HINI_PROFILE, (PSZ)aSystemFonts, (PSZ)"WindowText", aDummyStr, aFontNameBuf, sizeof( aFontNameBuf ) ) > 5 ) 2245*cdf0e10cSrcweir { 2246*cdf0e10cSrcweir if ( ImplOS2NameFontToVCLFont( aFontNameBuf, aFont ) ) 2247*cdf0e10cSrcweir { 2248*cdf0e10cSrcweir Font aHelpFont = aFont; 2249*cdf0e10cSrcweir aHelpFont.SetName( (sal_Unicode*)L"Helv;WarpSans" ); 2250*cdf0e10cSrcweir aHelpFont.SetSize( Size( 0, 8 ) ); 2251*cdf0e10cSrcweir aHelpFont.SetWeight( WEIGHT_NORMAL ); 2252*cdf0e10cSrcweir aHelpFont.SetItalic( ITALIC_NONE ); 2253*cdf0e10cSrcweir aStyleSettings.SetHelpFont( aHelpFont ); 2254*cdf0e10cSrcweir 2255*cdf0e10cSrcweir // Add Workplace Sans if not already listed 2256*cdf0e10cSrcweir if ( aFont.GetName().Search( (sal_Unicode*)L"WorkPlace Sans" ) == STRING_NOTFOUND ) 2257*cdf0e10cSrcweir { 2258*cdf0e10cSrcweir XubString aFontName = aFont.GetName(); 2259*cdf0e10cSrcweir aFontName.Insert( (sal_Unicode*)L"WorkPlace Sans;", 0 ); 2260*cdf0e10cSrcweir aFont.SetName( aFontName ); 2261*cdf0e10cSrcweir aFont.SetSize( Size( 0, 9 ) ); 2262*cdf0e10cSrcweir } 2263*cdf0e10cSrcweir aStyleSettings.SetAppFont( aFont ); 2264*cdf0e10cSrcweir aStyleSettings.SetToolFont( aFont ); 2265*cdf0e10cSrcweir aStyleSettings.SetLabelFont( aFont ); 2266*cdf0e10cSrcweir aStyleSettings.SetInfoFont( aFont ); 2267*cdf0e10cSrcweir aStyleSettings.SetRadioCheckFont( aFont ); 2268*cdf0e10cSrcweir aStyleSettings.SetPushButtonFont( aFont ); 2269*cdf0e10cSrcweir aStyleSettings.SetFieldFont( aFont ); 2270*cdf0e10cSrcweir aStyleSettings.SetGroupFont( aFont ); 2271*cdf0e10cSrcweir } 2272*cdf0e10cSrcweir } 2273*cdf0e10cSrcweir 2274*cdf0e10cSrcweir rSettings.SetStyleSettings( aStyleSettings ); 2275*cdf0e10cSrcweir } 2276*cdf0e10cSrcweir 2277*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2278*cdf0e10cSrcweir 2279*cdf0e10cSrcweir SalBitmap* Os2SalFrame::SnapShot() 2280*cdf0e10cSrcweir { 2281*cdf0e10cSrcweir debug_printf("Os2SalFrame::SnapShot\n"); 2282*cdf0e10cSrcweir return NULL; 2283*cdf0e10cSrcweir } 2284*cdf0e10cSrcweir 2285*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2286*cdf0e10cSrcweir 2287*cdf0e10cSrcweir const SystemEnvData* Os2SalFrame::GetSystemData() const 2288*cdf0e10cSrcweir { 2289*cdf0e10cSrcweir return &maSysData; 2290*cdf0e10cSrcweir } 2291*cdf0e10cSrcweir 2292*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2293*cdf0e10cSrcweir 2294*cdf0e10cSrcweir void Os2SalFrame::Beep( SoundType eSoundType ) 2295*cdf0e10cSrcweir { 2296*cdf0e10cSrcweir static ULONG aImplSoundTab[5] = 2297*cdf0e10cSrcweir { 2298*cdf0e10cSrcweir WA_NOTE, // SOUND_DEFAULT 2299*cdf0e10cSrcweir WA_NOTE, // SOUND_INFO 2300*cdf0e10cSrcweir WA_WARNING, // SOUND_WARNING 2301*cdf0e10cSrcweir WA_ERROR, // SOUND_ERROR 2302*cdf0e10cSrcweir WA_NOTE // SOUND_QUERY 2303*cdf0e10cSrcweir }; 2304*cdf0e10cSrcweir 2305*cdf0e10cSrcweir #if 0 2306*cdf0e10cSrcweir #if SOUND_COUNT != 5 2307*cdf0e10cSrcweir #error New Sound must be defined! 2308*cdf0e10cSrcweir #endif 2309*cdf0e10cSrcweir #endif 2310*cdf0e10cSrcweir 2311*cdf0e10cSrcweir debug_printf("Os2SalFrame::Beep %d\n", eSoundType); 2312*cdf0e10cSrcweir WinAlarm( HWND_DESKTOP, aImplSoundTab[eSoundType] ); 2313*cdf0e10cSrcweir } 2314*cdf0e10cSrcweir 2315*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2316*cdf0e10cSrcweir 2317*cdf0e10cSrcweir SalFrame::SalPointerState Os2SalFrame::GetPointerState() 2318*cdf0e10cSrcweir { 2319*cdf0e10cSrcweir SalPointerState aState; 2320*cdf0e10cSrcweir aState.mnState = 0; 2321*cdf0e10cSrcweir 2322*cdf0e10cSrcweir // MausModus feststellen und setzen 2323*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) 2324*cdf0e10cSrcweir aState.mnState |= MOUSE_LEFT; 2325*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) 2326*cdf0e10cSrcweir aState.mnState |= MOUSE_RIGHT; 2327*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) 2328*cdf0e10cSrcweir aState.mnState |= MOUSE_MIDDLE; 2329*cdf0e10cSrcweir // Modifier-Tasten setzen 2330*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2331*cdf0e10cSrcweir aState.mnState |= KEY_SHIFT; 2332*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2333*cdf0e10cSrcweir aState.mnState |= KEY_MOD1; 2334*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2335*cdf0e10cSrcweir aState.mnState |= KEY_MOD2; 2336*cdf0e10cSrcweir 2337*cdf0e10cSrcweir POINTL pt; 2338*cdf0e10cSrcweir _WinQueryPointerPos( HWND_DESKTOP, &pt ); 2339*cdf0e10cSrcweir 2340*cdf0e10cSrcweir aState.maPos = Point( pt.x - maGeometry.nX, pt.y - maGeometry.nY ); 2341*cdf0e10cSrcweir return aState; 2342*cdf0e10cSrcweir } 2343*cdf0e10cSrcweir 2344*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2345*cdf0e10cSrcweir 2346*cdf0e10cSrcweir void Os2SalFrame::SetBackgroundBitmap( SalBitmap* ) 2347*cdf0e10cSrcweir { 2348*cdf0e10cSrcweir } 2349*cdf0e10cSrcweir 2350*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2351*cdf0e10cSrcweir 2352*cdf0e10cSrcweir void SalTestMouseLeave() 2353*cdf0e10cSrcweir { 2354*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2355*cdf0e10cSrcweir 2356*cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg && !::WinQueryCapture( HWND_DESKTOP ) ) 2357*cdf0e10cSrcweir { 2358*cdf0e10cSrcweir POINTL aPt; 2359*cdf0e10cSrcweir WinQueryPointerPos( HWND_DESKTOP, &aPt ); 2360*cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg != WinWindowFromPoint( HWND_DESKTOP, &aPt, TRUE ) ) 2361*cdf0e10cSrcweir WinSendMsg( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MPFROM2SHORT( aPt.x, aPt.y ) ); 2362*cdf0e10cSrcweir } 2363*cdf0e10cSrcweir } 2364*cdf0e10cSrcweir 2365*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2366*cdf0e10cSrcweir 2367*cdf0e10cSrcweir static long ImplHandleMouseMsg( HWND hWnd, 2368*cdf0e10cSrcweir UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2369*cdf0e10cSrcweir { 2370*cdf0e10cSrcweir SalMouseEvent aMouseEvt; 2371*cdf0e10cSrcweir long nRet; 2372*cdf0e10cSrcweir USHORT nEvent; 2373*cdf0e10cSrcweir BOOL bCall = TRUE; 2374*cdf0e10cSrcweir USHORT nFlags = SHORT2FROMMP( nMP2 ); 2375*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2376*cdf0e10cSrcweir if ( !pFrame ) 2377*cdf0e10cSrcweir return 0; 2378*cdf0e10cSrcweir 2379*cdf0e10cSrcweir aMouseEvt.mnX = (short)SHORT1FROMMP( nMP1 ); 2380*cdf0e10cSrcweir aMouseEvt.mnY = pFrame->mnHeight - (short)SHORT2FROMMP( nMP1 ) - 1; 2381*cdf0e10cSrcweir aMouseEvt.mnCode = 0; 2382*cdf0e10cSrcweir aMouseEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2383*cdf0e10cSrcweir 2384*cdf0e10cSrcweir // MausModus feststellen und setzen 2385*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON1 ) & 0x8000 ) 2386*cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_LEFT; 2387*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON2 ) & 0x8000 ) 2388*cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_RIGHT; 2389*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_BUTTON3 ) & 0x8000 ) 2390*cdf0e10cSrcweir aMouseEvt.mnCode |= MOUSE_MIDDLE; 2391*cdf0e10cSrcweir // Modifier-Tasten setzen 2392*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2393*cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_SHIFT; 2394*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2395*cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_MOD1; 2396*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2397*cdf0e10cSrcweir aMouseEvt.mnCode |= KEY_MOD2; 2398*cdf0e10cSrcweir 2399*cdf0e10cSrcweir switch ( nMsg ) 2400*cdf0e10cSrcweir { 2401*cdf0e10cSrcweir case WM_MOUSEMOVE: 2402*cdf0e10cSrcweir { 2403*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2404*cdf0e10cSrcweir 2405*cdf0e10cSrcweir // Da bei Druecken von Modifier-Tasten die MouseEvents 2406*cdf0e10cSrcweir // nicht zusammengefast werden (da diese durch KeyEvents 2407*cdf0e10cSrcweir // unterbrochen werden), machen wir dieses hier selber 2408*cdf0e10cSrcweir if ( aMouseEvt.mnCode & (KEY_SHIFT | KEY_MOD1 | KEY_MOD2) ) 2409*cdf0e10cSrcweir { 2410*cdf0e10cSrcweir QMSG aTempMsg; 2411*cdf0e10cSrcweir if ( WinPeekMsg( pSalData->mhAB, &aTempMsg, 2412*cdf0e10cSrcweir pFrame->mhWndClient, 2413*cdf0e10cSrcweir WM_MOUSEFIRST, WM_MOUSELAST, PM_NOREMOVE ) ) 2414*cdf0e10cSrcweir { 2415*cdf0e10cSrcweir if ( (aTempMsg.msg == WM_MOUSEMOVE) && 2416*cdf0e10cSrcweir (aTempMsg.mp2 == nMP2) ) 2417*cdf0e10cSrcweir return 1; 2418*cdf0e10cSrcweir } 2419*cdf0e10cSrcweir } 2420*cdf0e10cSrcweir 2421*cdf0e10cSrcweir // Test for MouseLeave 2422*cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg && 2423*cdf0e10cSrcweir (pSalData->mhWantLeaveMsg != pFrame->mhWndClient) ) 2424*cdf0e10cSrcweir { 2425*cdf0e10cSrcweir POINTL aMousePoint; 2426*cdf0e10cSrcweir WinQueryMsgPos( pFrame->mhAB, &aMousePoint ); 2427*cdf0e10cSrcweir WinSendMsg( pSalData->mhWantLeaveMsg, 2428*cdf0e10cSrcweir SAL_MSG_MOUSELEAVE, 2429*cdf0e10cSrcweir 0, MPFROM2SHORT( aMousePoint.x, aMousePoint.y ) ); 2430*cdf0e10cSrcweir } 2431*cdf0e10cSrcweir pSalData->mhWantLeaveMsg = pFrame->mhWndClient; 2432*cdf0e10cSrcweir // Start MouseLeave-Timer 2433*cdf0e10cSrcweir if ( !pSalData->mpMouseLeaveTimer ) 2434*cdf0e10cSrcweir { 2435*cdf0e10cSrcweir pSalData->mpMouseLeaveTimer = new AutoTimer; 2436*cdf0e10cSrcweir pSalData->mpMouseLeaveTimer->SetTimeout( SAL_MOUSELEAVE_TIMEOUT ); 2437*cdf0e10cSrcweir pSalData->mpMouseLeaveTimer->Start(); 2438*cdf0e10cSrcweir // We dont need to set a timeout handler, because we test 2439*cdf0e10cSrcweir // for mouseleave in the timeout callback 2440*cdf0e10cSrcweir } 2441*cdf0e10cSrcweir aMouseEvt.mnButton = 0; 2442*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEMOVE; 2443*cdf0e10cSrcweir } 2444*cdf0e10cSrcweir break; 2445*cdf0e10cSrcweir 2446*cdf0e10cSrcweir case SAL_MSG_MOUSELEAVE: 2447*cdf0e10cSrcweir { 2448*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 2449*cdf0e10cSrcweir if ( pSalData->mhWantLeaveMsg == pFrame->mhWndClient ) 2450*cdf0e10cSrcweir { 2451*cdf0e10cSrcweir pSalData->mhWantLeaveMsg = 0; 2452*cdf0e10cSrcweir if ( pSalData->mpMouseLeaveTimer ) 2453*cdf0e10cSrcweir { 2454*cdf0e10cSrcweir delete pSalData->mpMouseLeaveTimer; 2455*cdf0e10cSrcweir pSalData->mpMouseLeaveTimer = NULL; 2456*cdf0e10cSrcweir } 2457*cdf0e10cSrcweir 2458*cdf0e10cSrcweir // Mouse-Coordinaates are relativ to the screen 2459*cdf0e10cSrcweir POINTL aPt; 2460*cdf0e10cSrcweir aPt.x = (short)SHORT1FROMMP( nMP2 ); 2461*cdf0e10cSrcweir aPt.y = (short)SHORT2FROMMP( nMP2 ); 2462*cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); 2463*cdf0e10cSrcweir aPt.y = pFrame->mnHeight - aPt.y - 1; 2464*cdf0e10cSrcweir aMouseEvt.mnX = aPt.x; 2465*cdf0e10cSrcweir aMouseEvt.mnY = aPt.y; 2466*cdf0e10cSrcweir aMouseEvt.mnButton = 0; 2467*cdf0e10cSrcweir nEvent = SALEVENT_MOUSELEAVE; 2468*cdf0e10cSrcweir } 2469*cdf0e10cSrcweir else 2470*cdf0e10cSrcweir bCall = FALSE; 2471*cdf0e10cSrcweir } 2472*cdf0e10cSrcweir break; 2473*cdf0e10cSrcweir 2474*cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 2475*cdf0e10cSrcweir case WM_BUTTON1DOWN: 2476*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_LEFT; 2477*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2478*cdf0e10cSrcweir break; 2479*cdf0e10cSrcweir 2480*cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 2481*cdf0e10cSrcweir case WM_BUTTON2DOWN: 2482*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_RIGHT; 2483*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2484*cdf0e10cSrcweir break; 2485*cdf0e10cSrcweir 2486*cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 2487*cdf0e10cSrcweir case WM_BUTTON3DOWN: 2488*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_MIDDLE; 2489*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONDOWN; 2490*cdf0e10cSrcweir break; 2491*cdf0e10cSrcweir 2492*cdf0e10cSrcweir case WM_BUTTON1UP: 2493*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_LEFT; 2494*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2495*cdf0e10cSrcweir break; 2496*cdf0e10cSrcweir 2497*cdf0e10cSrcweir case WM_BUTTON2UP: 2498*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_RIGHT; 2499*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2500*cdf0e10cSrcweir break; 2501*cdf0e10cSrcweir 2502*cdf0e10cSrcweir case WM_BUTTON3UP: 2503*cdf0e10cSrcweir aMouseEvt.mnButton = MOUSE_MIDDLE; 2504*cdf0e10cSrcweir nEvent = SALEVENT_MOUSEBUTTONUP; 2505*cdf0e10cSrcweir break; 2506*cdf0e10cSrcweir } 2507*cdf0e10cSrcweir 2508*cdf0e10cSrcweir // check if this window was destroyed - this might happen if we are the help window 2509*cdf0e10cSrcweir // and sent a mouse leave message to the application which killed the help window, ie ourself 2510*cdf0e10cSrcweir if( !WinIsWindow( pFrame->mhAB, hWnd ) ) 2511*cdf0e10cSrcweir return 0; 2512*cdf0e10cSrcweir 2513*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2514*cdf0e10cSrcweir //if (_bCapture) 2515*cdf0e10cSrcweir debug_printf("ImplHandleMouseMsg mouse %d,%d\n",aMouseEvt.mnX,aMouseEvt.mnY); 2516*cdf0e10cSrcweir #endif 2517*cdf0e10cSrcweir 2518*cdf0e10cSrcweir if ( bCall ) 2519*cdf0e10cSrcweir { 2520*cdf0e10cSrcweir if ( nEvent == SALEVENT_MOUSEBUTTONDOWN ) 2521*cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 2522*cdf0e10cSrcweir 2523*cdf0e10cSrcweir // --- RTL --- (mirror mouse pos) 2524*cdf0e10cSrcweir //if( Application::GetSettings().GetLayoutRTL() ) 2525*cdf0e10cSrcweir // aMouseEvt.mnX = pFrame->maGeometry.nWidth-1-aMouseEvt.mnX; 2526*cdf0e10cSrcweir 2527*cdf0e10cSrcweir nRet = pFrame->CallCallback( nEvent, &aMouseEvt ); 2528*cdf0e10cSrcweir if ( nMsg == WM_MOUSEMOVE ) 2529*cdf0e10cSrcweir { 2530*cdf0e10cSrcweir WinSetPointer( HWND_DESKTOP, pFrame->mhPointer ); 2531*cdf0e10cSrcweir nRet = TRUE; 2532*cdf0e10cSrcweir } 2533*cdf0e10cSrcweir } 2534*cdf0e10cSrcweir else 2535*cdf0e10cSrcweir nRet = 0; 2536*cdf0e10cSrcweir 2537*cdf0e10cSrcweir return nRet; 2538*cdf0e10cSrcweir } 2539*cdf0e10cSrcweir 2540*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2541*cdf0e10cSrcweir 2542*cdf0e10cSrcweir static long ImplHandleWheelMsg( HWND hWnd, UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2543*cdf0e10cSrcweir { 2544*cdf0e10cSrcweir 2545*cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 2546*cdf0e10cSrcweir 2547*cdf0e10cSrcweir long nRet = 0; 2548*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2549*cdf0e10cSrcweir if ( pFrame ) 2550*cdf0e10cSrcweir { 2551*cdf0e10cSrcweir 2552*cdf0e10cSrcweir // Mouse-Coordinaates are relativ to the screen 2553*cdf0e10cSrcweir POINTL aPt; 2554*cdf0e10cSrcweir WinQueryMsgPos( pFrame->mhAB, &aPt ); 2555*cdf0e10cSrcweir WinMapWindowPoints( HWND_DESKTOP, pFrame->mhWndClient, &aPt, 1 ); 2556*cdf0e10cSrcweir aPt.y = pFrame->mnHeight - aPt.y - 1; 2557*cdf0e10cSrcweir 2558*cdf0e10cSrcweir SalWheelMouseEvent aWheelEvt; 2559*cdf0e10cSrcweir aWheelEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2560*cdf0e10cSrcweir aWheelEvt.mnX = aPt.x; 2561*cdf0e10cSrcweir aWheelEvt.mnY = aPt.y; 2562*cdf0e10cSrcweir aWheelEvt.mnCode = 0; 2563*cdf0e10cSrcweir bool bNeg = (SHORT2FROMMP(nMP2) == SB_LINEDOWN || SHORT2FROMMP(nMP2) == SB_PAGEDOWN ); 2564*cdf0e10cSrcweir aWheelEvt.mnDelta = bNeg ? -120 : 120; 2565*cdf0e10cSrcweir aWheelEvt.mnNotchDelta = bNeg ? -1 : 1; 2566*cdf0e10cSrcweir if (SHORT2FROMMP(nMP2) == SB_PAGEUP || SHORT2FROMMP(nMP2) == SB_PAGEDOWN) 2567*cdf0e10cSrcweir aWheelEvt.mnScrollLines = SAL_WHEELMOUSE_EVENT_PAGESCROLL; 2568*cdf0e10cSrcweir else 2569*cdf0e10cSrcweir aWheelEvt.mnScrollLines = 1; 2570*cdf0e10cSrcweir 2571*cdf0e10cSrcweir if( nMsg == WM_HSCROLL ) 2572*cdf0e10cSrcweir aWheelEvt.mbHorz = TRUE; 2573*cdf0e10cSrcweir 2574*cdf0e10cSrcweir // Modifier-Tasten setzen 2575*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_SHIFT ) & 0x8000 ) 2576*cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_SHIFT; 2577*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_CTRL ) & 0x8000 ) 2578*cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_MOD1; 2579*cdf0e10cSrcweir if ( WinGetKeyState( HWND_DESKTOP, VK_ALT ) & 0x8000 ) 2580*cdf0e10cSrcweir aWheelEvt.mnCode |= KEY_MOD2; 2581*cdf0e10cSrcweir 2582*cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_WHEELMOUSE, &aWheelEvt ); 2583*cdf0e10cSrcweir } 2584*cdf0e10cSrcweir 2585*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2586*cdf0e10cSrcweir 2587*cdf0e10cSrcweir return nRet; 2588*cdf0e10cSrcweir } 2589*cdf0e10cSrcweir 2590*cdf0e10cSrcweir 2591*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2592*cdf0e10cSrcweir 2593*cdf0e10cSrcweir static USHORT ImplSalGetKeyCode( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) 2594*cdf0e10cSrcweir { 2595*cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); 2596*cdf0e10cSrcweir UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); 2597*cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); 2598*cdf0e10cSrcweir UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); 2599*cdf0e10cSrcweir USHORT rSVCode = 0; 2600*cdf0e10cSrcweir 2601*cdf0e10cSrcweir // Ist virtueller KeyCode gesetzt und befindet sich der KeyCode in der 2602*cdf0e10cSrcweir // Tabelle, dann mappen 2603*cdf0e10cSrcweir if ( (nKeyFlags & KC_VIRTUALKEY) && (nKeyCode < KEY_TAB_SIZE) ) 2604*cdf0e10cSrcweir rSVCode = aImplTranslateKeyTab[nKeyCode]; 2605*cdf0e10cSrcweir 2606*cdf0e10cSrcweir // Wenn kein KeyCode ermittelt werden konnte, versuchen wir aus dem 2607*cdf0e10cSrcweir // CharCode einen zu erzeugen 2608*cdf0e10cSrcweir if ( !rSVCode && nCharCode ) 2609*cdf0e10cSrcweir { 2610*cdf0e10cSrcweir // Bei 0-9, a-z und A-Z auch KeyCode setzen 2611*cdf0e10cSrcweir if ( (nCharCode >= '0') && (nCharCode <= '9') && (!rSVCode || !(nKeyFlags & KC_SHIFT)) ) 2612*cdf0e10cSrcweir rSVCode = KEYGROUP_NUM + (nCharCode-'0'); 2613*cdf0e10cSrcweir else if ( (nCharCode >= 'a') && (nCharCode <= 'z') ) 2614*cdf0e10cSrcweir rSVCode = KEYGROUP_ALPHA + (nCharCode-'a'); 2615*cdf0e10cSrcweir else if ( (nCharCode >= 'A') && (nCharCode <= 'Z') ) 2616*cdf0e10cSrcweir rSVCode = KEYGROUP_ALPHA + (nCharCode-'A'); 2617*cdf0e10cSrcweir else 2618*cdf0e10cSrcweir { 2619*cdf0e10cSrcweir switch ( nCharCode ) 2620*cdf0e10cSrcweir { 2621*cdf0e10cSrcweir case '+': 2622*cdf0e10cSrcweir rSVCode = KEY_ADD; 2623*cdf0e10cSrcweir break; 2624*cdf0e10cSrcweir case '-': 2625*cdf0e10cSrcweir rSVCode = KEY_SUBTRACT; 2626*cdf0e10cSrcweir break; 2627*cdf0e10cSrcweir case '*': 2628*cdf0e10cSrcweir rSVCode = KEY_MULTIPLY; 2629*cdf0e10cSrcweir break; 2630*cdf0e10cSrcweir case '/': 2631*cdf0e10cSrcweir rSVCode = KEY_DIVIDE; 2632*cdf0e10cSrcweir break; 2633*cdf0e10cSrcweir case '.': 2634*cdf0e10cSrcweir rSVCode = KEY_POINT; 2635*cdf0e10cSrcweir break; 2636*cdf0e10cSrcweir case ',': 2637*cdf0e10cSrcweir rSVCode = KEY_COMMA; 2638*cdf0e10cSrcweir break; 2639*cdf0e10cSrcweir case '<': 2640*cdf0e10cSrcweir rSVCode = KEY_LESS; 2641*cdf0e10cSrcweir break; 2642*cdf0e10cSrcweir case '>': 2643*cdf0e10cSrcweir rSVCode = KEY_GREATER; 2644*cdf0e10cSrcweir break; 2645*cdf0e10cSrcweir case '=': 2646*cdf0e10cSrcweir rSVCode = KEY_EQUAL; 2647*cdf0e10cSrcweir break; 2648*cdf0e10cSrcweir } 2649*cdf0e10cSrcweir } 2650*cdf0e10cSrcweir } 2651*cdf0e10cSrcweir 2652*cdf0e10cSrcweir // "Numlock-Hack": we want to get correct keycodes from the numpad 2653*cdf0e10cSrcweir if ( (nCharCode >= '0') && (nCharCode <= '9') && !(nKeyFlags & KC_SHIFT) ) 2654*cdf0e10cSrcweir rSVCode = KEYGROUP_NUM + (nCharCode-'0'); 2655*cdf0e10cSrcweir if ( nCharCode == ',' ) 2656*cdf0e10cSrcweir rSVCode = KEY_COMMA; 2657*cdf0e10cSrcweir if ( nCharCode == '.' ) 2658*cdf0e10cSrcweir rSVCode = KEY_POINT; 2659*cdf0e10cSrcweir 2660*cdf0e10cSrcweir return rSVCode; 2661*cdf0e10cSrcweir } 2662*cdf0e10cSrcweir 2663*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2664*cdf0e10cSrcweir 2665*cdf0e10cSrcweir static void ImplUpdateInputLang( Os2SalFrame* pFrame ) 2666*cdf0e10cSrcweir { 2667*cdf0e10cSrcweir BOOL bLanguageChange = FALSE; 2668*cdf0e10cSrcweir ULONG nLang = 0; 2669*cdf0e10cSrcweir APIRET rc; 2670*cdf0e10cSrcweir UconvObject uconv_object = NULL; 2671*cdf0e10cSrcweir LocaleObject locale_object = NULL; 2672*cdf0e10cSrcweir UniChar *pinfo_item; 2673*cdf0e10cSrcweir 2674*cdf0e10cSrcweir // we do not support change of input language while working, 2675*cdf0e10cSrcweir // so exit if already defined (mnInputLang is a static class field) 2676*cdf0e10cSrcweir if (pFrame->mnInputLang) 2677*cdf0e10cSrcweir return; 2678*cdf0e10cSrcweir 2679*cdf0e10cSrcweir // get current locale 2680*cdf0e10cSrcweir rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER, (UniChar *)L"", &locale_object); 2681*cdf0e10cSrcweir // get Win32 locale id and sublanguage (hex uni string) 2682*cdf0e10cSrcweir rc = UniQueryLocaleItem(locale_object, LOCI_xWinLocale, &pinfo_item); 2683*cdf0e10cSrcweir // convert uni string to integer 2684*cdf0e10cSrcweir rc = UniStrtoul(locale_object, pinfo_item, &pinfo_item, 16, &nLang); 2685*cdf0e10cSrcweir rc = UniFreeMem(pinfo_item); 2686*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2687*cdf0e10cSrcweir debug_printf("ImplUpdateInputLang nLang %04x\n", nLang); 2688*cdf0e10cSrcweir char char_buffer[256]; 2689*cdf0e10cSrcweir rc = UniCreateUconvObject((UniChar *)L"", &uconv_object); 2690*cdf0e10cSrcweir rc = UniQueryLocaleItem(locale_object, LOCI_sKeyboard, &pinfo_item); 2691*cdf0e10cSrcweir rc = UniStrFromUcs(uconv_object, char_buffer, pinfo_item, sizeof(char_buffer)); 2692*cdf0e10cSrcweir debug_printf("Keyboard name is: %s\n", char_buffer ); 2693*cdf0e10cSrcweir rc = UniFreeMem(pinfo_item); 2694*cdf0e10cSrcweir #endif 2695*cdf0e10cSrcweir rc = UniFreeLocaleObject(locale_object); 2696*cdf0e10cSrcweir 2697*cdf0e10cSrcweir // keep input lang up-to-date 2698*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2699*cdf0e10cSrcweir debug_printf("ImplUpdateInputLang pFrame %08x lang changed from %d to %d\n", 2700*cdf0e10cSrcweir pFrame, pFrame->mnInputLang, nLang); 2701*cdf0e10cSrcweir #endif 2702*cdf0e10cSrcweir pFrame->mnInputLang = nLang; 2703*cdf0e10cSrcweir } 2704*cdf0e10cSrcweir 2705*cdf0e10cSrcweir 2706*cdf0e10cSrcweir static sal_Unicode ImplGetCharCode( Os2SalFrame* pFrame, USHORT nKeyFlags, 2707*cdf0e10cSrcweir sal_Char nCharCode, UCHAR nScanCode ) 2708*cdf0e10cSrcweir { 2709*cdf0e10cSrcweir ImplUpdateInputLang( pFrame ); 2710*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2711*cdf0e10cSrcweir debug_printf("ImplGetCharCode nCharCode %c, %04x\n", nCharCode, nCharCode); 2712*cdf0e10cSrcweir #endif 2713*cdf0e10cSrcweir return OUString( &nCharCode, 1, gsl_getSystemTextEncoding()).toChar(); 2714*cdf0e10cSrcweir } 2715*cdf0e10cSrcweir 2716*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2717*cdf0e10cSrcweir 2718*cdf0e10cSrcweir LanguageType Os2SalFrame::GetInputLanguage() 2719*cdf0e10cSrcweir { 2720*cdf0e10cSrcweir if( !mnInputLang ) 2721*cdf0e10cSrcweir ImplUpdateInputLang( this ); 2722*cdf0e10cSrcweir 2723*cdf0e10cSrcweir if( !mnInputLang ) 2724*cdf0e10cSrcweir return LANGUAGE_DONTKNOW; 2725*cdf0e10cSrcweir else 2726*cdf0e10cSrcweir return (LanguageType) mnInputLang; 2727*cdf0e10cSrcweir } 2728*cdf0e10cSrcweir 2729*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2730*cdf0e10cSrcweir 2731*cdf0e10cSrcweir BOOL Os2SalFrame::MapUnicodeToKeyCode( sal_Unicode , LanguageType , KeyCode& ) 2732*cdf0e10cSrcweir { 2733*cdf0e10cSrcweir // not supported yet 2734*cdf0e10cSrcweir return FALSE; 2735*cdf0e10cSrcweir } 2736*cdf0e10cSrcweir 2737*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2738*cdf0e10cSrcweir 2739*cdf0e10cSrcweir static sal_Unicode ImplConvertKey( Os2SalFrame* pFrame, MPARAM aMP1, MPARAM aMP2 ) 2740*cdf0e10cSrcweir { 2741*cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( aMP1 ); 2742*cdf0e10cSrcweir UCHAR nCharCode = (UCHAR)SHORT1FROMMP( aMP2 ); 2743*cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( aMP2 ); 2744*cdf0e10cSrcweir UCHAR nScanCode = (UCHAR)CHAR4FROMMP( aMP1 ); 2745*cdf0e10cSrcweir sal_Unicode rSVCharCode = 0; 2746*cdf0e10cSrcweir 2747*cdf0e10cSrcweir // Ist Character-Code gesetzt 2748*cdf0e10cSrcweir // !!! Bei CTRL/ALT ist KC_CHAR nicht gesetzt, jedoch moechten wir 2749*cdf0e10cSrcweir // !!! dann auch einen CharCode und machen die Behandlung deshalb 2750*cdf0e10cSrcweir // !!! selber 2751*cdf0e10cSrcweir if ( (nKeyFlags & KC_CHAR) || (nKeyFlags & KC_CTRL) || (nKeyFlags & KC_ALT) ) 2752*cdf0e10cSrcweir rSVCharCode = ImplGetCharCode( pFrame, nKeyFlags, nCharCode, nScanCode); 2753*cdf0e10cSrcweir 2754*cdf0e10cSrcweir // ret unicode 2755*cdf0e10cSrcweir return rSVCharCode; 2756*cdf0e10cSrcweir } 2757*cdf0e10cSrcweir 2758*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2759*cdf0e10cSrcweir 2760*cdf0e10cSrcweir static long ImplHandleKeyMsg( HWND hWnd, 2761*cdf0e10cSrcweir UINT nMsg, MPARAM nMP1, MPARAM nMP2 ) 2762*cdf0e10cSrcweir { 2763*cdf0e10cSrcweir static USHORT nLastOS2KeyChar = 0; 2764*cdf0e10cSrcweir static sal_Unicode nLastChar = 0; 2765*cdf0e10cSrcweir USHORT nRepeat = CHAR3FROMMP( nMP1 ) - 1; 2766*cdf0e10cSrcweir SHORT nFlags = SHORT1FROMMP( nMP1 ); 2767*cdf0e10cSrcweir USHORT nModCode = 0; 2768*cdf0e10cSrcweir USHORT nSVCode = 0; 2769*cdf0e10cSrcweir USHORT nOS2KeyCode = (UCHAR)SHORT2FROMMP( nMP2 ); 2770*cdf0e10cSrcweir sal_Unicode nSVCharCode = 0; 2771*cdf0e10cSrcweir long nRet = 0; 2772*cdf0e10cSrcweir 2773*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2774*cdf0e10cSrcweir if ( !pFrame ) 2775*cdf0e10cSrcweir return 0; 2776*cdf0e10cSrcweir 2777*cdf0e10cSrcweir // determine modifiers 2778*cdf0e10cSrcweir if ( nFlags & KC_SHIFT ) 2779*cdf0e10cSrcweir nModCode |= KEY_SHIFT; 2780*cdf0e10cSrcweir if ( nFlags & KC_CTRL ) 2781*cdf0e10cSrcweir nModCode |= KEY_MOD1; 2782*cdf0e10cSrcweir if ( nFlags & KC_ALT ) 2783*cdf0e10cSrcweir nModCode |= KEY_MOD2; 2784*cdf0e10cSrcweir 2785*cdf0e10cSrcweir // Bei Shift, Control und Alt schicken wir einen KeyModChange-Event 2786*cdf0e10cSrcweir if ( (nOS2KeyCode == VK_SHIFT) || (nOS2KeyCode == VK_CTRL) || 2787*cdf0e10cSrcweir (nOS2KeyCode == VK_ALT) || (nOS2KeyCode == VK_ALTGRAF) ) 2788*cdf0e10cSrcweir { 2789*cdf0e10cSrcweir SalKeyModEvent aModEvt; 2790*cdf0e10cSrcweir aModEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2791*cdf0e10cSrcweir aModEvt.mnCode = nModCode; 2792*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2793*cdf0e10cSrcweir debug_printf("SALEVENT_KEYMODCHANGE\n"); 2794*cdf0e10cSrcweir #endif 2795*cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_KEYMODCHANGE, &aModEvt ); 2796*cdf0e10cSrcweir } 2797*cdf0e10cSrcweir else 2798*cdf0e10cSrcweir { 2799*cdf0e10cSrcweir nSVCode = ImplSalGetKeyCode( pFrame, nMP1, nMP2 ); 2800*cdf0e10cSrcweir nSVCharCode = ImplConvertKey( pFrame, nMP1, nMP2 ); 2801*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2802*cdf0e10cSrcweir debug_printf("nSVCode %04x nSVCharCode %04x\n",nSVCode,nSVCharCode ); 2803*cdf0e10cSrcweir #endif 2804*cdf0e10cSrcweir 2805*cdf0e10cSrcweir // Fuer Java muessen wir bei KeyUp einen CharCode liefern 2806*cdf0e10cSrcweir if ( nFlags & KC_KEYUP ) 2807*cdf0e10cSrcweir { 2808*cdf0e10cSrcweir if ( !nSVCharCode ) 2809*cdf0e10cSrcweir { 2810*cdf0e10cSrcweir if ( nLastOS2KeyChar == nOS2KeyCode ) 2811*cdf0e10cSrcweir { 2812*cdf0e10cSrcweir nSVCharCode = nLastChar; 2813*cdf0e10cSrcweir nLastOS2KeyChar = 0; 2814*cdf0e10cSrcweir nLastChar = 0; 2815*cdf0e10cSrcweir } 2816*cdf0e10cSrcweir } 2817*cdf0e10cSrcweir else 2818*cdf0e10cSrcweir { 2819*cdf0e10cSrcweir nLastOS2KeyChar = 0; 2820*cdf0e10cSrcweir nLastChar = 0; 2821*cdf0e10cSrcweir } 2822*cdf0e10cSrcweir } 2823*cdf0e10cSrcweir else 2824*cdf0e10cSrcweir { 2825*cdf0e10cSrcweir nLastOS2KeyChar = nOS2KeyCode; 2826*cdf0e10cSrcweir nLastChar = nSVCharCode; 2827*cdf0e10cSrcweir } 2828*cdf0e10cSrcweir 2829*cdf0e10cSrcweir if ( nSVCode || nSVCharCode ) 2830*cdf0e10cSrcweir { 2831*cdf0e10cSrcweir SalKeyEvent aKeyEvt; 2832*cdf0e10cSrcweir aKeyEvt.mnCode = nSVCode; 2833*cdf0e10cSrcweir aKeyEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 2834*cdf0e10cSrcweir aKeyEvt.mnCode |= nModCode; 2835*cdf0e10cSrcweir aKeyEvt.mnCharCode = nSVCharCode; 2836*cdf0e10cSrcweir aKeyEvt.mnRepeat = nRepeat; 2837*cdf0e10cSrcweir 2838*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 2839*cdf0e10cSrcweir debug_printf( (nFlags & KC_KEYUP) ? "SALEVENT_KEYUP\n" : "SALEVENT_KEYINPUT\n"); 2840*cdf0e10cSrcweir #endif 2841*cdf0e10cSrcweir nRet = pFrame->CallCallback( (nFlags & KC_KEYUP) ? SALEVENT_KEYUP : SALEVENT_KEYINPUT, 2842*cdf0e10cSrcweir &aKeyEvt ); 2843*cdf0e10cSrcweir } 2844*cdf0e10cSrcweir } 2845*cdf0e10cSrcweir 2846*cdf0e10cSrcweir return nRet; 2847*cdf0e10cSrcweir } 2848*cdf0e10cSrcweir 2849*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2850*cdf0e10cSrcweir 2851*cdf0e10cSrcweir static bool ImplHandlePaintMsg( HWND hWnd ) 2852*cdf0e10cSrcweir { 2853*cdf0e10cSrcweir BOOL bMutex = FALSE; 2854*cdf0e10cSrcweir 2855*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2856*cdf0e10cSrcweir bMutex = TRUE; 2857*cdf0e10cSrcweir 2858*cdf0e10cSrcweir // if we don't get the mutex, we can also change the clip region, 2859*cdf0e10cSrcweir // because other threads doesn't use the mutex from the main 2860*cdf0e10cSrcweir // thread --> see GetGraphics() 2861*cdf0e10cSrcweir 2862*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2863*cdf0e10cSrcweir if ( pFrame ) 2864*cdf0e10cSrcweir { 2865*cdf0e10cSrcweir // Laut Window-Doku soll man erst abfragen, ob ueberhaupt eine 2866*cdf0e10cSrcweir // Paint-Region anliegt 2867*cdf0e10cSrcweir if ( WinQueryUpdateRect( hWnd, NULL ) ) 2868*cdf0e10cSrcweir { 2869*cdf0e10cSrcweir // Call BeginPaint/EndPaint to query the rect and send 2870*cdf0e10cSrcweir // this Notofication to rect 2871*cdf0e10cSrcweir HPS hPS; 2872*cdf0e10cSrcweir RECTL aUpdateRect; 2873*cdf0e10cSrcweir hPS = WinBeginPaint( hWnd, NULLHANDLE, &aUpdateRect ); 2874*cdf0e10cSrcweir WinEndPaint( hPS ); 2875*cdf0e10cSrcweir 2876*cdf0e10cSrcweir // Paint 2877*cdf0e10cSrcweir if ( bMutex ) 2878*cdf0e10cSrcweir { 2879*cdf0e10cSrcweir SalPaintEvent aPEvt( aUpdateRect.xLeft, pFrame->mnHeight - aUpdateRect.yTop, aUpdateRect.xRight- aUpdateRect.xLeft, aUpdateRect.yTop - aUpdateRect.yBottom ); 2880*cdf0e10cSrcweir 2881*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); 2882*cdf0e10cSrcweir } 2883*cdf0e10cSrcweir else 2884*cdf0e10cSrcweir { 2885*cdf0e10cSrcweir RECTL* pRect = new RECTL; 2886*cdf0e10cSrcweir WinCopyRect( pFrame->mhAB, pRect, &aUpdateRect ); 2887*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); 2888*cdf0e10cSrcweir } 2889*cdf0e10cSrcweir } 2890*cdf0e10cSrcweir } 2891*cdf0e10cSrcweir 2892*cdf0e10cSrcweir if ( bMutex ) 2893*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2894*cdf0e10cSrcweir 2895*cdf0e10cSrcweir return bMutex ? true : false; 2896*cdf0e10cSrcweir } 2897*cdf0e10cSrcweir 2898*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2899*cdf0e10cSrcweir 2900*cdf0e10cSrcweir static void ImplHandlePaintMsg2( HWND hWnd, RECTL* pRect ) 2901*cdf0e10cSrcweir { 2902*cdf0e10cSrcweir // Paint 2903*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2904*cdf0e10cSrcweir { 2905*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2906*cdf0e10cSrcweir if ( pFrame ) 2907*cdf0e10cSrcweir { 2908*cdf0e10cSrcweir SalPaintEvent aPEvt( pRect->xLeft, pFrame->mnHeight - pRect->yTop, pRect->xRight - pRect->xLeft, pRect->yTop - pRect->yBottom ); 2909*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_PAINT, &aPEvt ); 2910*cdf0e10cSrcweir } 2911*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 2912*cdf0e10cSrcweir delete pRect; 2913*cdf0e10cSrcweir } 2914*cdf0e10cSrcweir else 2915*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTPAINT, (MPARAM)pRect, 0 ); 2916*cdf0e10cSrcweir } 2917*cdf0e10cSrcweir 2918*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2919*cdf0e10cSrcweir 2920*cdf0e10cSrcweir static void SetMaximizedFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) 2921*cdf0e10cSrcweir { 2922*cdf0e10cSrcweir // calculate and set frame geometry of a maximized window - useful if the window is still hidden 2923*cdf0e10cSrcweir 2924*cdf0e10cSrcweir RECTL aRect; 2925*cdf0e10cSrcweir pFrame->GetWorkArea( aRect); 2926*cdf0e10cSrcweir 2927*cdf0e10cSrcweir // a maximized window has no other borders than the caption 2928*cdf0e10cSrcweir pFrame->maGeometry.nLeftDecoration = pFrame->maGeometry.nRightDecoration = pFrame->maGeometry.nBottomDecoration = 0; 2929*cdf0e10cSrcweir pFrame->maGeometry.nTopDecoration = pFrame->mbCaption ? WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ) : 0; 2930*cdf0e10cSrcweir 2931*cdf0e10cSrcweir aRect.yTop += pFrame->maGeometry.nTopDecoration; 2932*cdf0e10cSrcweir pFrame->maGeometry.nX = aRect.xLeft; 2933*cdf0e10cSrcweir pFrame->maGeometry.nY = aRect.yBottom; 2934*cdf0e10cSrcweir pFrame->maGeometry.nWidth = aRect.xRight - aRect.xLeft + 1; 2935*cdf0e10cSrcweir pFrame->maGeometry.nHeight = aRect.yBottom - aRect.yTop + 1; 2936*cdf0e10cSrcweir } 2937*cdf0e10cSrcweir 2938*cdf0e10cSrcweir static void UpdateFrameGeometry( HWND hWnd, Os2SalFrame* pFrame ) 2939*cdf0e10cSrcweir { 2940*cdf0e10cSrcweir if( !pFrame ) 2941*cdf0e10cSrcweir return; 2942*cdf0e10cSrcweir 2943*cdf0e10cSrcweir //SalFrame has a 2944*cdf0e10cSrcweir //maGeometry member that holds absolute screen positions (and needs to be 2945*cdf0e10cSrcweir //updated if the window is moved by the way). 2946*cdf0e10cSrcweir 2947*cdf0e10cSrcweir // reset data 2948*cdf0e10cSrcweir memset(&pFrame->maGeometry, 0, sizeof(SalFrameGeometry) ); 2949*cdf0e10cSrcweir 2950*cdf0e10cSrcweir SWP swp; 2951*cdf0e10cSrcweir LONG nFrameX, nFrameY, nCaptionY; 2952*cdf0e10cSrcweir 2953*cdf0e10cSrcweir // get frame size 2954*cdf0e10cSrcweir WinQueryWindowPos(pFrame->mhWndFrame, &swp); 2955*cdf0e10cSrcweir if (swp.fl & SWP_MINIMIZE) 2956*cdf0e10cSrcweir return; 2957*cdf0e10cSrcweir 2958*cdf0e10cSrcweir // map from client area to screen 2959*cdf0e10cSrcweir ImplSalCalcFrameSize( pFrame, nFrameX, nFrameY, nCaptionY); 2960*cdf0e10cSrcweir pFrame->maGeometry.nTopDecoration = nFrameY + nCaptionY; 2961*cdf0e10cSrcweir pFrame->maGeometry.nLeftDecoration = nFrameX; 2962*cdf0e10cSrcweir pFrame->maGeometry.nRightDecoration = nFrameX; 2963*cdf0e10cSrcweir pFrame->maGeometry.nBottomDecoration = nFrameY; 2964*cdf0e10cSrcweir 2965*cdf0e10cSrcweir // position of client area, not of frame corner! 2966*cdf0e10cSrcweir pFrame->maGeometry.nX = swp.x + nFrameX; 2967*cdf0e10cSrcweir pFrame->maGeometry.nY = nScreenHeight - (swp.y + swp.cy) + nFrameY + nCaptionY; 2968*cdf0e10cSrcweir 2969*cdf0e10cSrcweir int nWidth = swp.cx - pFrame->maGeometry.nRightDecoration - pFrame->maGeometry.nLeftDecoration; 2970*cdf0e10cSrcweir int nHeight = swp.cy - pFrame->maGeometry.nBottomDecoration - pFrame->maGeometry.nTopDecoration; 2971*cdf0e10cSrcweir 2972*cdf0e10cSrcweir // clamp to zero 2973*cdf0e10cSrcweir pFrame->maGeometry.nHeight = nHeight < 0 ? 0 : nHeight; 2974*cdf0e10cSrcweir pFrame->maGeometry.nWidth = nWidth < 0 ? 0 : nWidth; 2975*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>0 2976*cdf0e10cSrcweir debug_printf( "UpdateFrameGeometry: hwnd %x, frame %x at %d,%d (%dx%d)\n", 2977*cdf0e10cSrcweir hWnd, pFrame->mhWndFrame, 2978*cdf0e10cSrcweir pFrame->maGeometry.nX, pFrame->maGeometry.nY, 2979*cdf0e10cSrcweir pFrame->maGeometry.nWidth,pFrame->maGeometry.nHeight); 2980*cdf0e10cSrcweir #endif 2981*cdf0e10cSrcweir } 2982*cdf0e10cSrcweir 2983*cdf0e10cSrcweir // ----------------------------------------------------------------------- 2984*cdf0e10cSrcweir 2985*cdf0e10cSrcweir static void ImplHandleMoveMsg( HWND hWnd) 2986*cdf0e10cSrcweir { 2987*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 2988*cdf0e10cSrcweir { 2989*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 2990*cdf0e10cSrcweir if ( pFrame ) 2991*cdf0e10cSrcweir { 2992*cdf0e10cSrcweir UpdateFrameGeometry( hWnd, pFrame ); 2993*cdf0e10cSrcweir 2994*cdf0e10cSrcweir if ( WinIsWindowVisible( hWnd )) 2995*cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 2996*cdf0e10cSrcweir 2997*cdf0e10cSrcweir // Gegen moegliche Rekursionen sichern 2998*cdf0e10cSrcweir if ( !pFrame->mbInMoveMsg ) 2999*cdf0e10cSrcweir { 3000*cdf0e10cSrcweir // Fenster im FullScreenModus wieder einpassen 3001*cdf0e10cSrcweir pFrame->mbInMoveMsg = TRUE; 3002*cdf0e10cSrcweir if ( pFrame->mbFullScreen ) 3003*cdf0e10cSrcweir ImplSalFrameFullScreenPos( pFrame ); 3004*cdf0e10cSrcweir pFrame->mbInMoveMsg = FALSE; 3005*cdf0e10cSrcweir } 3006*cdf0e10cSrcweir 3007*cdf0e10cSrcweir // Status merken 3008*cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 3009*cdf0e10cSrcweir 3010*cdf0e10cSrcweir // Call Hdl 3011*cdf0e10cSrcweir //#93851 if we call this handler, VCL floating windows are not updated correctly 3012*cdf0e10cSrcweir //ImplCallMoveHdl( hWnd ); 3013*cdf0e10cSrcweir 3014*cdf0e10cSrcweir } 3015*cdf0e10cSrcweir 3016*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3017*cdf0e10cSrcweir } 3018*cdf0e10cSrcweir else 3019*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); 3020*cdf0e10cSrcweir } 3021*cdf0e10cSrcweir 3022*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3023*cdf0e10cSrcweir 3024*cdf0e10cSrcweir static void ImplHandleSizeMsg( HWND hWnd, MPARAM nMP2 ) 3025*cdf0e10cSrcweir { 3026*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3027*cdf0e10cSrcweir if ( pFrame ) 3028*cdf0e10cSrcweir { 3029*cdf0e10cSrcweir UpdateFrameGeometry( hWnd, pFrame ); 3030*cdf0e10cSrcweir pFrame->mbDefPos = FALSE; 3031*cdf0e10cSrcweir pFrame->mnWidth = (short)SHORT1FROMMP( nMP2 ); 3032*cdf0e10cSrcweir pFrame->mnHeight = (short)SHORT2FROMMP( nMP2 ); 3033*cdf0e10cSrcweir if ( pFrame->mpGraphics ) 3034*cdf0e10cSrcweir pFrame->mpGraphics->mnHeight = (int)SHORT2FROMMP(nMP2); 3035*cdf0e10cSrcweir // Status merken 3036*cdf0e10cSrcweir ImplSaveFrameState( pFrame ); 3037*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_RESIZE, 0 ); 3038*cdf0e10cSrcweir if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) 3039*cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 3040*cdf0e10cSrcweir } 3041*cdf0e10cSrcweir } 3042*cdf0e10cSrcweir 3043*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3044*cdf0e10cSrcweir 3045*cdf0e10cSrcweir static long ImplHandleFocusMsg( Os2SalFrame* pFrame, MPARAM nMP2 ) 3046*cdf0e10cSrcweir { 3047*cdf0e10cSrcweir if ( pFrame && !Os2SalFrame::mbInReparent ) 3048*cdf0e10cSrcweir { 3049*cdf0e10cSrcweir if ( SHORT1FROMMP( nMP2 ) ) 3050*cdf0e10cSrcweir { 3051*cdf0e10cSrcweir if ( WinIsWindowVisible( pFrame->mhWndFrame ) && !pFrame->mbInShow ) 3052*cdf0e10cSrcweir WinUpdateWindow( pFrame->mhWndClient ); 3053*cdf0e10cSrcweir return pFrame->CallCallback( SALEVENT_GETFOCUS, 0 ); 3054*cdf0e10cSrcweir } 3055*cdf0e10cSrcweir else 3056*cdf0e10cSrcweir { 3057*cdf0e10cSrcweir return pFrame->CallCallback( SALEVENT_LOSEFOCUS, 0 ); 3058*cdf0e10cSrcweir } 3059*cdf0e10cSrcweir } 3060*cdf0e10cSrcweir } 3061*cdf0e10cSrcweir 3062*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3063*cdf0e10cSrcweir 3064*cdf0e10cSrcweir static void ImplHandleCloseMsg( HWND hWnd ) 3065*cdf0e10cSrcweir { 3066*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3067*cdf0e10cSrcweir { 3068*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3069*cdf0e10cSrcweir if ( pFrame ) 3070*cdf0e10cSrcweir { 3071*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_CLOSE, 0 ); 3072*cdf0e10cSrcweir } 3073*cdf0e10cSrcweir 3074*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3075*cdf0e10cSrcweir } 3076*cdf0e10cSrcweir else 3077*cdf0e10cSrcweir WinPostMsg( hWnd, WM_CLOSE, 0, 0 ); 3078*cdf0e10cSrcweir } 3079*cdf0e10cSrcweir 3080*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3081*cdf0e10cSrcweir 3082*cdf0e10cSrcweir inline void ImplHandleUserEvent( HWND hWnd, MPARAM nMP2 ) 3083*cdf0e10cSrcweir { 3084*cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3085*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3086*cdf0e10cSrcweir if ( pFrame ) 3087*cdf0e10cSrcweir { 3088*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_USEREVENT, (void*)nMP2 ); 3089*cdf0e10cSrcweir } 3090*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3091*cdf0e10cSrcweir } 3092*cdf0e10cSrcweir 3093*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3094*cdf0e10cSrcweir 3095*cdf0e10cSrcweir static int SalImplHandleProcessMenu( Os2SalFrame* pFrame, ULONG nMsg, MPARAM nMP1, MPARAM nMP2) 3096*cdf0e10cSrcweir { 3097*cdf0e10cSrcweir long nRet = 0; 3098*cdf0e10cSrcweir debug_printf("SalImplHandleProcessMenu\n"); 3099*cdf0e10cSrcweir #if 0 3100*cdf0e10cSrcweir DWORD err=0; 3101*cdf0e10cSrcweir if( !HIWORD(wParam) ) 3102*cdf0e10cSrcweir { 3103*cdf0e10cSrcweir // Menu command 3104*cdf0e10cSrcweir WORD nId = LOWORD(wParam); 3105*cdf0e10cSrcweir if( nId ) // zero for separators 3106*cdf0e10cSrcweir { 3107*cdf0e10cSrcweir SalMenuEvent aMenuEvt; 3108*cdf0e10cSrcweir aMenuEvt.mnId = nId; 3109*cdf0e10cSrcweir WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( pFrame->mSelectedhMenu, nId, FALSE ); 3110*cdf0e10cSrcweir if( pSalMenuItem ) 3111*cdf0e10cSrcweir aMenuEvt.mpMenu = pSalMenuItem->mpMenu; 3112*cdf0e10cSrcweir else 3113*cdf0e10cSrcweir aMenuEvt.mpMenu = NULL; 3114*cdf0e10cSrcweir 3115*cdf0e10cSrcweir nRet = pFrame->CallCallback( SALEVENT_MENUCOMMAND, &aMenuEvt ); 3116*cdf0e10cSrcweir } 3117*cdf0e10cSrcweir } 3118*cdf0e10cSrcweir #endif 3119*cdf0e10cSrcweir //return (nRet != 0); 3120*cdf0e10cSrcweir return (nRet == 0); 3121*cdf0e10cSrcweir } 3122*cdf0e10cSrcweir 3123*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3124*cdf0e10cSrcweir 3125*cdf0e10cSrcweir static void ImplHandleInputLangChange( HWND hWnd ) 3126*cdf0e10cSrcweir { 3127*cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3128*cdf0e10cSrcweir 3129*cdf0e10cSrcweir // Feststellen, ob wir IME unterstuetzen 3130*cdf0e10cSrcweir Os2SalFrame* pFrame = GetWindowPtr( hWnd ); 3131*cdf0e10cSrcweir #if 0 3132*cdf0e10cSrcweir if ( pFrame && pFrame->mbIME && pFrame->mhDefIMEContext ) 3133*cdf0e10cSrcweir { 3134*cdf0e10cSrcweir HWND hWnd = pFrame->mhWnd; 3135*cdf0e10cSrcweir HKL hKL = (HKL)lParam; 3136*cdf0e10cSrcweir UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY ); 3137*cdf0e10cSrcweir 3138*cdf0e10cSrcweir pFrame->mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0; 3139*cdf0e10cSrcweir pFrame->mbAtCursorIME = (nImeProps & IME_PROP_AT_CARET) != 0; 3140*cdf0e10cSrcweir pFrame->mbHandleIME = !pFrame->mbSpezIME; 3141*cdf0e10cSrcweir } 3142*cdf0e10cSrcweir #endif 3143*cdf0e10cSrcweir 3144*cdf0e10cSrcweir // trigger input language and codepage update 3145*cdf0e10cSrcweir UINT nLang = pFrame->mnInputLang; 3146*cdf0e10cSrcweir ImplUpdateInputLang( pFrame ); 3147*cdf0e10cSrcweir debug_printf("ImplHandleInputLangChange new language 0x%04x\n",pFrame->mnInputLang); 3148*cdf0e10cSrcweir 3149*cdf0e10cSrcweir // notify change 3150*cdf0e10cSrcweir if( nLang != pFrame->mnInputLang ) 3151*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_INPUTLANGUAGECHANGE, 0 ); 3152*cdf0e10cSrcweir 3153*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3154*cdf0e10cSrcweir } 3155*cdf0e10cSrcweir 3156*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3157*cdf0e10cSrcweir 3158*cdf0e10cSrcweir #ifdef ENABLE_IME 3159*cdf0e10cSrcweir 3160*cdf0e10cSrcweir static long ImplHandleIMEStartConversion( Os2SalFrame* pFrame ) 3161*cdf0e10cSrcweir { 3162*cdf0e10cSrcweir long nRet = FALSE; 3163*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3164*cdf0e10cSrcweir if ( pIMEData ) 3165*cdf0e10cSrcweir { 3166*cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3167*cdf0e10cSrcweir HIMI hIMI = 0; 3168*cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3169*cdf0e10cSrcweir if ( hIMI ) 3170*cdf0e10cSrcweir { 3171*cdf0e10cSrcweir ULONG nProp; 3172*cdf0e10cSrcweir if ( 0 != pIMEData->mpQueryIMEProperty( hIMI, QIP_PROPERTY, &nProp ) ) 3173*cdf0e10cSrcweir pFrame->mbHandleIME = FALSE; 3174*cdf0e10cSrcweir else 3175*cdf0e10cSrcweir { 3176*cdf0e10cSrcweir pFrame->mbHandleIME = !(nProp & PRP_SPECIALUI); 3177*cdf0e10cSrcweir 3178*cdf0e10cSrcweir } 3179*cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3180*cdf0e10cSrcweir { 3181*cdf0e10cSrcweir /* Windows-Code, der noch nicht angepasst wurde !!! 3182*cdf0e10cSrcweir // Cursor-Position ermitteln und aus der die Default-Position fuer 3183*cdf0e10cSrcweir // das Composition-Fenster berechnen 3184*cdf0e10cSrcweir SalCursorPosEvent aCursorPosEvt; 3185*cdf0e10cSrcweir pFrame->CallCallback( pFrame->mpInst, pFrame, 3186*cdf0e10cSrcweir SALEVENT_CURSORPOS, (void*)&aCursorPosEvt ); 3187*cdf0e10cSrcweir COMPOSITIONFORM aForm; 3188*cdf0e10cSrcweir memset( &aForm, 0, sizeof( aForm ) ); 3189*cdf0e10cSrcweir if ( !aCursorPosEvt.mnWidth || !aCursorPosEvt.mnHeight ) 3190*cdf0e10cSrcweir aForm.dwStyle |= CFS_DEFAULT; 3191*cdf0e10cSrcweir else 3192*cdf0e10cSrcweir { 3193*cdf0e10cSrcweir aForm.dwStyle |= CFS_POINT; 3194*cdf0e10cSrcweir aForm.ptCurrentPos.x = aCursorPosEvt.mnX; 3195*cdf0e10cSrcweir aForm.ptCurrentPos.y = aCursorPosEvt.mnY; 3196*cdf0e10cSrcweir } 3197*cdf0e10cSrcweir ImmSetCompositionWindow( hIMC, &aForm ); 3198*cdf0e10cSrcweir 3199*cdf0e10cSrcweir // Den InputContect-Font ermitteln und diesem dem Composition-Fenster 3200*cdf0e10cSrcweir // bekannt machen 3201*cdf0e10cSrcweir */ 3202*cdf0e10cSrcweir 3203*cdf0e10cSrcweir pFrame->mbConversionMode = TRUE; 3204*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_STARTEXTTEXTINPUT, (void*)NULL ); 3205*cdf0e10cSrcweir nRet = TRUE; 3206*cdf0e10cSrcweir } 3207*cdf0e10cSrcweir 3208*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3209*cdf0e10cSrcweir } 3210*cdf0e10cSrcweir } 3211*cdf0e10cSrcweir 3212*cdf0e10cSrcweir return nRet; 3213*cdf0e10cSrcweir } 3214*cdf0e10cSrcweir 3215*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3216*cdf0e10cSrcweir 3217*cdf0e10cSrcweir static long ImplHandleIMEConversion( Os2SalFrame* pFrame, MPARAM nMP2Param ) 3218*cdf0e10cSrcweir { 3219*cdf0e10cSrcweir long nRet = FALSE; 3220*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3221*cdf0e10cSrcweir if ( pIMEData ) 3222*cdf0e10cSrcweir { 3223*cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3224*cdf0e10cSrcweir HIMI hIMI = 0; 3225*cdf0e10cSrcweir ULONG nMP2 = (ULONG)nMP2Param; 3226*cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3227*cdf0e10cSrcweir if ( hIMI ) 3228*cdf0e10cSrcweir { 3229*cdf0e10cSrcweir if ( nMP2 & (IMR_RESULT_RESULTSTRING | 3230*cdf0e10cSrcweir IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | 3231*cdf0e10cSrcweir IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) 3232*cdf0e10cSrcweir { 3233*cdf0e10cSrcweir SalExtTextInputEvent aEvt; 3234*cdf0e10cSrcweir aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 3235*cdf0e10cSrcweir aEvt.mpTextAttr = NULL; 3236*cdf0e10cSrcweir aEvt.mnCursorPos = 0; 3237*cdf0e10cSrcweir aEvt.mnDeltaStart = 0; 3238*cdf0e10cSrcweir aEvt.mbOnlyCursor = FALSE; 3239*cdf0e10cSrcweir aEvt.mbCursorVisible = TRUE; 3240*cdf0e10cSrcweir 3241*cdf0e10cSrcweir ULONG nBufLen = 0; 3242*cdf0e10cSrcweir xub_Unicode* pBuf = NULL; 3243*cdf0e10cSrcweir ULONG nAttrBufLen = 0; 3244*cdf0e10cSrcweir PM_BYTE* pAttrBuf = NULL; 3245*cdf0e10cSrcweir BOOL bLastCursor = FALSE; 3246*cdf0e10cSrcweir if ( nMP2 & IMR_RESULT_RESULTSTRING ) 3247*cdf0e10cSrcweir { 3248*cdf0e10cSrcweir pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, 0, &nBufLen ); 3249*cdf0e10cSrcweir if ( nBufLen > 0 ) 3250*cdf0e10cSrcweir { 3251*cdf0e10cSrcweir pBuf = new xub_Unicode[nBufLen]; 3252*cdf0e10cSrcweir pIMEData->mpGetResultString( hIMI, IMR_RESULT_RESULTSTRING, pBuf, &nBufLen ); 3253*cdf0e10cSrcweir } 3254*cdf0e10cSrcweir 3255*cdf0e10cSrcweir bLastCursor = TRUE; 3256*cdf0e10cSrcweir aEvt.mbCursorVisible = TRUE; 3257*cdf0e10cSrcweir } 3258*cdf0e10cSrcweir else if ( nMP2 & (IMR_CONV_CONVERSIONSTRING | IMR_CONV_CONVERSIONATTR | 3259*cdf0e10cSrcweir IMR_CONV_CURSORPOS | IMR_CONV_CURSORATTR) ) 3260*cdf0e10cSrcweir { 3261*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); 3262*cdf0e10cSrcweir if ( nBufLen > 0 ) 3263*cdf0e10cSrcweir { 3264*cdf0e10cSrcweir pBuf = new xub_Unicode[nBufLen]; 3265*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, pBuf, &nBufLen ); 3266*cdf0e10cSrcweir } 3267*cdf0e10cSrcweir 3268*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, 0, &nAttrBufLen ); 3269*cdf0e10cSrcweir if ( nAttrBufLen > 0 ) 3270*cdf0e10cSrcweir { 3271*cdf0e10cSrcweir pAttrBuf = new PM_BYTE[nAttrBufLen]; 3272*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONATTR, pAttrBuf, &nAttrBufLen ); 3273*cdf0e10cSrcweir } 3274*cdf0e10cSrcweir 3275*cdf0e10cSrcweir /* !!! Wir bekommen derzeit nur falsche Daten, deshalb zeigen wir derzeit 3276*cdf0e10cSrcweir !!! auch keine Cursor an 3277*cdf0e10cSrcweir ULONG nTempBufLen; 3278*cdf0e10cSrcweir ULONG nCursorPos = 0; 3279*cdf0e10cSrcweir ULONG nCursorAttr = 0; 3280*cdf0e10cSrcweir ULONG nChangePos = 0; 3281*cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3282*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); 3283*cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3284*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORATTR, &nCursorAttr, &nTempBufLen ); 3285*cdf0e10cSrcweir nTempBufLen = sizeof( ULONG ); 3286*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CHANGESTART, &nChangePos, &nTempBufLen ); 3287*cdf0e10cSrcweir 3288*cdf0e10cSrcweir aEvt.mnCursorPos = nCursorPos; 3289*cdf0e10cSrcweir aEvt.mnDeltaStart = nChangePos; 3290*cdf0e10cSrcweir if ( nCursorAttr & CP_CURSORATTR_INVISIBLE ) 3291*cdf0e10cSrcweir aEvt.mbCursorVisible = FALSE; 3292*cdf0e10cSrcweir */ 3293*cdf0e10cSrcweir aEvt.mnCursorPos = 0; 3294*cdf0e10cSrcweir aEvt.mnDeltaStart = 0; 3295*cdf0e10cSrcweir aEvt.mbCursorVisible = FALSE; 3296*cdf0e10cSrcweir 3297*cdf0e10cSrcweir if ( (nMP2 == IMR_CONV_CURSORPOS) || 3298*cdf0e10cSrcweir (nMP2 == IMR_CONV_CURSORATTR) ) 3299*cdf0e10cSrcweir aEvt.mbOnlyCursor = TRUE; 3300*cdf0e10cSrcweir } 3301*cdf0e10cSrcweir 3302*cdf0e10cSrcweir USHORT* pSalAttrAry = NULL; 3303*cdf0e10cSrcweir if ( pBuf ) 3304*cdf0e10cSrcweir { 3305*cdf0e10cSrcweir aEvt.maText = XubString( pBuf, (USHORT)nBufLen ); 3306*cdf0e10cSrcweir delete [] pBuf; 3307*cdf0e10cSrcweir if ( pAttrBuf ) 3308*cdf0e10cSrcweir { 3309*cdf0e10cSrcweir USHORT nTextLen = aEvt.maText.Len(); 3310*cdf0e10cSrcweir if ( nTextLen ) 3311*cdf0e10cSrcweir { 3312*cdf0e10cSrcweir pSalAttrAry = new USHORT[nTextLen]; 3313*cdf0e10cSrcweir memset( pSalAttrAry, 0, nTextLen*sizeof( USHORT ) ); 3314*cdf0e10cSrcweir for ( USHORT i = 0; (i < nTextLen) && (i < nAttrBufLen); i++ ) 3315*cdf0e10cSrcweir { 3316*cdf0e10cSrcweir PM_BYTE nOS2Attr = pAttrBuf[i]; 3317*cdf0e10cSrcweir USHORT nSalAttr; 3318*cdf0e10cSrcweir if ( nOS2Attr == CP_ATTR_TARGET_CONVERTED ) 3319*cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETCONVERTED | SAL_EXTTEXTINPUT_ATTR_UNDERLINE | SAL_EXTTEXTINPUT_ATTR_HIGHLIGHT; 3320*cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_CONVERTED ) 3321*cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_CONVERTED | SAL_EXTTEXTINPUT_ATTR_DASHDOTUNDERLINE; 3322*cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_TARGET_NOTCONVERTED ) 3323*cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_TARGETNOTCONVERTED | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3324*cdf0e10cSrcweir else if ( nOS2Attr == CP_ATTR_INPUT_ERROR ) 3325*cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUTERROR | SAL_EXTTEXTINPUT_ATTR_REDTEXT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3326*cdf0e10cSrcweir else /* ( nOS2Attr == CP_ATTR_INPUT ) */ 3327*cdf0e10cSrcweir nSalAttr = SAL_EXTTEXTINPUT_ATTR_INPUT | SAL_EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE; 3328*cdf0e10cSrcweir pSalAttrAry[i] = nSalAttr; 3329*cdf0e10cSrcweir } 3330*cdf0e10cSrcweir aEvt.mpTextAttr = pSalAttrAry; 3331*cdf0e10cSrcweir } 3332*cdf0e10cSrcweir delete [] pAttrBuf; 3333*cdf0e10cSrcweir } 3334*cdf0e10cSrcweir if ( bLastCursor ) 3335*cdf0e10cSrcweir aEvt.mnCursorPos = aEvt.maText.Len(); 3336*cdf0e10cSrcweir } 3337*cdf0e10cSrcweir 3338*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3339*cdf0e10cSrcweir 3340*cdf0e10cSrcweir // Handler rufen und wenn wir ein Attribute-Array haben, danach 3341*cdf0e10cSrcweir // wieder zerstoeren 3342*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_EXTTEXTINPUT, (void*)&aEvt ); 3343*cdf0e10cSrcweir if ( pSalAttrAry ) 3344*cdf0e10cSrcweir delete [] pSalAttrAry; 3345*cdf0e10cSrcweir } 3346*cdf0e10cSrcweir else 3347*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3348*cdf0e10cSrcweir } 3349*cdf0e10cSrcweir 3350*cdf0e10cSrcweir nRet = TRUE; 3351*cdf0e10cSrcweir } 3352*cdf0e10cSrcweir 3353*cdf0e10cSrcweir return nRet; 3354*cdf0e10cSrcweir } 3355*cdf0e10cSrcweir 3356*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3357*cdf0e10cSrcweir 3358*cdf0e10cSrcweir inline long ImplHandleIMEEndConversion( Os2SalFrame* pFrame ) 3359*cdf0e10cSrcweir { 3360*cdf0e10cSrcweir pFrame->mbConversionMode = FALSE; 3361*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_ENDEXTTEXTINPUT, (void*)NULL ); 3362*cdf0e10cSrcweir return TRUE; 3363*cdf0e10cSrcweir } 3364*cdf0e10cSrcweir 3365*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3366*cdf0e10cSrcweir 3367*cdf0e10cSrcweir static void ImplHandleIMEOpenCandidate( Os2SalFrame* pFrame ) 3368*cdf0e10cSrcweir { 3369*cdf0e10cSrcweir pFrame->mbCandidateMode = TRUE; 3370*cdf0e10cSrcweir 3371*cdf0e10cSrcweir long nRet = FALSE; 3372*cdf0e10cSrcweir SalIMEData* pIMEData = GetSalIMEData(); 3373*cdf0e10cSrcweir if ( pIMEData ) 3374*cdf0e10cSrcweir { 3375*cdf0e10cSrcweir HWND hWnd = pFrame->mhWndClient; 3376*cdf0e10cSrcweir HIMI hIMI = 0; 3377*cdf0e10cSrcweir pIMEData->mpGetIME( hWnd, &hIMI ); 3378*cdf0e10cSrcweir if ( hIMI ) 3379*cdf0e10cSrcweir { 3380*cdf0e10cSrcweir ULONG nBufLen = 0; 3381*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CONVERSIONSTRING, 0, &nBufLen ); 3382*cdf0e10cSrcweir if ( nBufLen > 0 ) 3383*cdf0e10cSrcweir { 3384*cdf0e10cSrcweir /* !!! Wir bekommen derzeit nur falsche Daten steht der Cursor immer bei 0 3385*cdf0e10cSrcweir ULONG nTempBufLen = sizeof( ULONG ); 3386*cdf0e10cSrcweir ULONG nCursorPos = 0; 3387*cdf0e10cSrcweir pIMEData->mpGetConversionString( hIMI, IMR_CONV_CURSORPOS, &nCursorPos, &nTempBufLen ); 3388*cdf0e10cSrcweir */ 3389*cdf0e10cSrcweir ULONG nCursorPos = 0; 3390*cdf0e10cSrcweir 3391*cdf0e10cSrcweir SalExtTextInputPosEvent aEvt; 3392*cdf0e10cSrcweir aEvt.mnTime = WinQueryMsgTime( pFrame->mhAB ); 3393*cdf0e10cSrcweir aEvt.mnFirstPos = nCursorPos; 3394*cdf0e10cSrcweir aEvt.mnChars = nBufLen-nCursorPos; 3395*cdf0e10cSrcweir aEvt.mpPosAry = new SalExtCharPos[aEvt.mnChars]; 3396*cdf0e10cSrcweir memset( aEvt.mpPosAry, 0, aEvt.mnChars*sizeof(SalExtCharPos) ); 3397*cdf0e10cSrcweir 3398*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_EXTTEXTINPUTPOS, (void*)&aEvt ); 3399*cdf0e10cSrcweir 3400*cdf0e10cSrcweir long nMinLeft = aEvt.mpPosAry[0].mnX; 3401*cdf0e10cSrcweir long nMinTop = aEvt.mpPosAry[0].mnY; 3402*cdf0e10cSrcweir long nMaxBottom = aEvt.mpPosAry[0].mnY+aEvt.mpPosAry[0].mnHeight; 3403*cdf0e10cSrcweir long nMaxRight = nMinLeft; 3404*cdf0e10cSrcweir USHORT i = 0; 3405*cdf0e10cSrcweir while ( i < aEvt.mnChars ) 3406*cdf0e10cSrcweir { 3407*cdf0e10cSrcweir // Solange wir uns auf der gleichen Zeile bewegen, 3408*cdf0e10cSrcweir // ermitteln wir die Rechteck-Grenzen 3409*cdf0e10cSrcweir if ( !aEvt.mpPosAry[i].mnHeight || 3410*cdf0e10cSrcweir (aEvt.mpPosAry[i].mnY < nMaxBottom-1) ) 3411*cdf0e10cSrcweir { 3412*cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnX < nMinLeft ) 3413*cdf0e10cSrcweir nMinLeft = aEvt.mpPosAry[i].mnX; 3414*cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth > nMaxRight ) 3415*cdf0e10cSrcweir nMaxRight = aEvt.mpPosAry[i].mnX+aEvt.mpPosAry[0].mnWidth; 3416*cdf0e10cSrcweir if ( aEvt.mpPosAry[i].mnY < nMinTop ) 3417*cdf0e10cSrcweir nMinTop = aEvt.mpPosAry[i].mnY; 3418*cdf0e10cSrcweir i++; 3419*cdf0e10cSrcweir } 3420*cdf0e10cSrcweir else 3421*cdf0e10cSrcweir break; 3422*cdf0e10cSrcweir } 3423*cdf0e10cSrcweir 3424*cdf0e10cSrcweir CANDIDATEPOS aForm; 3425*cdf0e10cSrcweir aForm.ulIndex = 0; 3426*cdf0e10cSrcweir aForm.ulStyle = CPS_EXCLUDE; 3427*cdf0e10cSrcweir aForm.ptCurrentPos.x = aEvt.mpPosAry[0].mnX; 3428*cdf0e10cSrcweir aForm.ptCurrentPos.y = pFrame->mnHeight - (nMaxBottom+1) - 1; 3429*cdf0e10cSrcweir aForm.rcArea.xLeft = nMinLeft; 3430*cdf0e10cSrcweir aForm.rcArea.yBottom = pFrame->mnHeight - nMaxBottom - 1; 3431*cdf0e10cSrcweir aForm.rcArea.xRight = nMaxRight+1; 3432*cdf0e10cSrcweir aForm.rcArea.yTop = pFrame->mnHeight - nMinTop - 1; 3433*cdf0e10cSrcweir pIMEData->mpSetCandidateWin( hIMI, &aForm ); 3434*cdf0e10cSrcweir 3435*cdf0e10cSrcweir delete aEvt.mpPosAry; 3436*cdf0e10cSrcweir } 3437*cdf0e10cSrcweir 3438*cdf0e10cSrcweir pIMEData->mpReleaseIME( hWnd, hIMI ); 3439*cdf0e10cSrcweir } 3440*cdf0e10cSrcweir } 3441*cdf0e10cSrcweir } 3442*cdf0e10cSrcweir 3443*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3444*cdf0e10cSrcweir 3445*cdf0e10cSrcweir inline void ImplHandleIMECloseCandidate( Os2SalFrame* pFrame ) 3446*cdf0e10cSrcweir { 3447*cdf0e10cSrcweir pFrame->mbCandidateMode = FALSE; 3448*cdf0e10cSrcweir } 3449*cdf0e10cSrcweir 3450*cdf0e10cSrcweir #endif 3451*cdf0e10cSrcweir 3452*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3453*cdf0e10cSrcweir 3454*cdf0e10cSrcweir MRESULT EXPENTRY SalFrameWndProc( HWND hWnd, ULONG nMsg, 3455*cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 3456*cdf0e10cSrcweir { 3457*cdf0e10cSrcweir Os2SalFrame* pFrame = (Os2SalFrame*)GetWindowPtr( hWnd ); 3458*cdf0e10cSrcweir MRESULT nRet = (MRESULT)0; 3459*cdf0e10cSrcweir BOOL bDef = TRUE; 3460*cdf0e10cSrcweir bool bCheckTimers= false; 3461*cdf0e10cSrcweir 3462*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL>10 3463*cdf0e10cSrcweir if (nMsg!=WM_TIMER && nMsg!=WM_MOUSEMOVE) 3464*cdf0e10cSrcweir debug_printf( "SalFrameWndProc hWnd 0x%x nMsg 0x%x\n", hWnd, nMsg); 3465*cdf0e10cSrcweir #endif 3466*cdf0e10cSrcweir 3467*cdf0e10cSrcweir switch( nMsg ) 3468*cdf0e10cSrcweir { 3469*cdf0e10cSrcweir case WM_MOUSEMOVE: 3470*cdf0e10cSrcweir case WM_BUTTON1DOWN: 3471*cdf0e10cSrcweir case WM_BUTTON2DOWN: 3472*cdf0e10cSrcweir case WM_BUTTON3DOWN: 3473*cdf0e10cSrcweir case WM_BUTTON1DBLCLK: 3474*cdf0e10cSrcweir case WM_BUTTON2DBLCLK: 3475*cdf0e10cSrcweir case WM_BUTTON3DBLCLK: 3476*cdf0e10cSrcweir case WM_BUTTON1UP: 3477*cdf0e10cSrcweir case WM_BUTTON2UP: 3478*cdf0e10cSrcweir case WM_BUTTON3UP: 3479*cdf0e10cSrcweir case SAL_MSG_MOUSELEAVE: 3480*cdf0e10cSrcweir // ButtonUp/Down nie an die WinDefWindowProc weiterleiten, weil sonst 3481*cdf0e10cSrcweir // die Message an den Owner weitergeleitet wird 3482*cdf0e10cSrcweir ImplSalYieldMutexAcquireWithWait(); 3483*cdf0e10cSrcweir bDef = !ImplHandleMouseMsg( hWnd, nMsg, nMP1, nMP2 ); 3484*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3485*cdf0e10cSrcweir break; 3486*cdf0e10cSrcweir 3487*cdf0e10cSrcweir case WM_CHAR: 3488*cdf0e10cSrcweir if ( pFrame->mbConversionMode ) 3489*cdf0e10cSrcweir bDef = FALSE; 3490*cdf0e10cSrcweir else 3491*cdf0e10cSrcweir bDef = !ImplHandleKeyMsg( hWnd, nMsg, nMP1, nMP2 ); 3492*cdf0e10cSrcweir break; 3493*cdf0e10cSrcweir 3494*cdf0e10cSrcweir case WM_ERASEBACKGROUND: 3495*cdf0e10cSrcweir nRet = (MRESULT)FALSE; 3496*cdf0e10cSrcweir bDef = FALSE; 3497*cdf0e10cSrcweir break; 3498*cdf0e10cSrcweir 3499*cdf0e10cSrcweir case WM_PAINT: 3500*cdf0e10cSrcweir bCheckTimers = ImplHandlePaintMsg( hWnd ); 3501*cdf0e10cSrcweir bDef = FALSE; 3502*cdf0e10cSrcweir break; 3503*cdf0e10cSrcweir case SAL_MSG_POSTPAINT: 3504*cdf0e10cSrcweir ImplHandlePaintMsg2( hWnd, (RECTL*)nMP1 ); 3505*cdf0e10cSrcweir bCheckTimers = true; 3506*cdf0e10cSrcweir bDef = FALSE; 3507*cdf0e10cSrcweir break; 3508*cdf0e10cSrcweir 3509*cdf0e10cSrcweir case WM_MOVE: 3510*cdf0e10cSrcweir case SAL_MSG_POSTMOVE: 3511*cdf0e10cSrcweir ImplHandleMoveMsg( hWnd ); 3512*cdf0e10cSrcweir bDef = FALSE; 3513*cdf0e10cSrcweir break; 3514*cdf0e10cSrcweir 3515*cdf0e10cSrcweir case WM_SIZE: 3516*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3517*cdf0e10cSrcweir { 3518*cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, nMP2 ); 3519*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3520*cdf0e10cSrcweir } 3521*cdf0e10cSrcweir else 3522*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTSIZE, nMP1, nMP2 ); 3523*cdf0e10cSrcweir break; 3524*cdf0e10cSrcweir case SAL_MSG_POSTSIZE: 3525*cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, nMP2 ); 3526*cdf0e10cSrcweir break; 3527*cdf0e10cSrcweir case WM_MINMAXFRAME: 3528*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3529*cdf0e10cSrcweir { 3530*cdf0e10cSrcweir PSWP pswp = (PSWP) nMP1; 3531*cdf0e10cSrcweir ImplHandleSizeMsg( hWnd, MPFROM2SHORT( pswp->cx, pswp->cy) ); 3532*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3533*cdf0e10cSrcweir } 3534*cdf0e10cSrcweir else 3535*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTSIZE, 0, nMP2 ); 3536*cdf0e10cSrcweir break; 3537*cdf0e10cSrcweir 3538*cdf0e10cSrcweir case WM_CALCVALIDRECTS: 3539*cdf0e10cSrcweir return (MRESULT)(CVR_ALIGNLEFT | CVR_ALIGNTOP); 3540*cdf0e10cSrcweir 3541*cdf0e10cSrcweir case WM_SETFOCUS: 3542*cdf0e10cSrcweir if ( ImplSalYieldMutexTryToAcquire() ) 3543*cdf0e10cSrcweir { 3544*cdf0e10cSrcweir ImplHandleFocusMsg( pFrame, nMP2 ); 3545*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3546*cdf0e10cSrcweir } 3547*cdf0e10cSrcweir else 3548*cdf0e10cSrcweir WinPostMsg( hWnd, SAL_MSG_POSTFOCUS, 0, nMP2 ); 3549*cdf0e10cSrcweir break; 3550*cdf0e10cSrcweir case SAL_MSG_POSTFOCUS: 3551*cdf0e10cSrcweir ImplHandleFocusMsg( pFrame, nMP2 ); 3552*cdf0e10cSrcweir break; 3553*cdf0e10cSrcweir 3554*cdf0e10cSrcweir case WM_TRANSLATEACCEL: 3555*cdf0e10cSrcweir { 3556*cdf0e10cSrcweir // Da uns OS/2 zu viele Tasten abfaegnt, unternehmen wir etwas, 3557*cdf0e10cSrcweir // damit wir Shift+F1, Shift+F10 und Shift+Enter bekommen 3558*cdf0e10cSrcweir PQMSG pMsg = (PQMSG)nMP1; 3559*cdf0e10cSrcweir USHORT nKeyFlags = SHORT1FROMMP( pMsg->mp1 ); 3560*cdf0e10cSrcweir USHORT nKeyCode = (UCHAR)SHORT2FROMMP( pMsg->mp2 ); 3561*cdf0e10cSrcweir 3562*cdf0e10cSrcweir if ( !(nKeyFlags & KC_KEYUP) && (nKeyFlags & KC_VIRTUALKEY) && 3563*cdf0e10cSrcweir (nKeyFlags & KC_SHIFT) && (nKeyCode != VK_ESC) ) 3564*cdf0e10cSrcweir return (MRESULT)FALSE; 3565*cdf0e10cSrcweir 3566*cdf0e10cSrcweir if ( nKeyCode == VK_F1 ) 3567*cdf0e10cSrcweir return (MRESULT)FALSE; 3568*cdf0e10cSrcweir } 3569*cdf0e10cSrcweir break; 3570*cdf0e10cSrcweir 3571*cdf0e10cSrcweir case WM_CREATE: 3572*cdf0e10cSrcweir { 3573*cdf0e10cSrcweir HWND hWndFrame = WinQueryWindow(hWnd, QW_PARENT); 3574*cdf0e10cSrcweir if (hWndFrame == 0) 3575*cdf0e10cSrcweir debug_printf(" WARNING NULL FRAME!!\n"); 3576*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 3577*cdf0e10cSrcweir // Window-Instanz am Windowhandle speichern 3578*cdf0e10cSrcweir pFrame = pSalData->mpCreateFrame; 3579*cdf0e10cSrcweir pSalData->mpCreateFrame = NULL; 3580*cdf0e10cSrcweir SetWindowPtr( hWnd, pFrame ); 3581*cdf0e10cSrcweir SetWindowPtr( hWndFrame, pFrame); 3582*cdf0e10cSrcweir // HWND schon hier setzen, da schon auf den Instanzdaten 3583*cdf0e10cSrcweir // gearbeitet werden kann, wenn Messages waehrend 3584*cdf0e10cSrcweir // CreateWindow() gesendet werden 3585*cdf0e10cSrcweir pFrame->mhWndClient = hWnd; 3586*cdf0e10cSrcweir pFrame->mhWndFrame = hWndFrame; 3587*cdf0e10cSrcweir pFrame->maSysData.hWnd = hWnd; 3588*cdf0e10cSrcweir } 3589*cdf0e10cSrcweir break; 3590*cdf0e10cSrcweir 3591*cdf0e10cSrcweir case WM_CLOSE: 3592*cdf0e10cSrcweir ImplHandleCloseMsg( hWnd ); 3593*cdf0e10cSrcweir bDef = FALSE; 3594*cdf0e10cSrcweir break; 3595*cdf0e10cSrcweir 3596*cdf0e10cSrcweir case WM_SYSVALUECHANGED: 3597*cdf0e10cSrcweir if ( pFrame->mbFullScreen ) 3598*cdf0e10cSrcweir ImplSalFrameFullScreenPos( pFrame ); 3599*cdf0e10cSrcweir // kein break, da der Rest auch noch verarbeitet werden soll 3600*cdf0e10cSrcweir case PL_ALTERED: 3601*cdf0e10cSrcweir case WM_SYSCOLORCHANGE: 3602*cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3603*cdf0e10cSrcweir pFrame->CallCallback( SALEVENT_SETTINGSCHANGED, 0 ); 3604*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3605*cdf0e10cSrcweir break; 3606*cdf0e10cSrcweir 3607*cdf0e10cSrcweir case SAL_MSG_USEREVENT: 3608*cdf0e10cSrcweir ImplHandleUserEvent( hWnd, nMP2 ); 3609*cdf0e10cSrcweir bDef = FALSE; 3610*cdf0e10cSrcweir break; 3611*cdf0e10cSrcweir case SAL_MSG_TOTOP: 3612*cdf0e10cSrcweir ImplSalToTop( hWnd, (ULONG)nMP1 ); 3613*cdf0e10cSrcweir bDef = FALSE; 3614*cdf0e10cSrcweir break; 3615*cdf0e10cSrcweir case SAL_MSG_SHOW: 3616*cdf0e10cSrcweir ImplSalShow( hWnd, (ULONG)nMP1, (ULONG)nMP2 ); 3617*cdf0e10cSrcweir bDef = FALSE; 3618*cdf0e10cSrcweir break; 3619*cdf0e10cSrcweir 3620*cdf0e10cSrcweir case WM_KBDLAYERCHANGED: 3621*cdf0e10cSrcweir debug_printf("hWnd 0x%08x WM_KBDLAYERCHANGED\n", hWnd); 3622*cdf0e10cSrcweir ImplHandleInputLangChange( hWnd ); 3623*cdf0e10cSrcweir break; 3624*cdf0e10cSrcweir 3625*cdf0e10cSrcweir case WM_HSCROLL: 3626*cdf0e10cSrcweir case WM_VSCROLL: 3627*cdf0e10cSrcweir ImplHandleWheelMsg( hWnd, nMsg, nMP1, nMP2 ); 3628*cdf0e10cSrcweir bDef = FALSE; 3629*cdf0e10cSrcweir break; 3630*cdf0e10cSrcweir 3631*cdf0e10cSrcweir case WM_COMMAND: 3632*cdf0e10cSrcweir case SAL_MSG_SYSPROCESSMENU: 3633*cdf0e10cSrcweir if ( SalImplHandleProcessMenu( pFrame, nMsg, nMP1, nMP2 ) ) 3634*cdf0e10cSrcweir { 3635*cdf0e10cSrcweir bDef = FALSE; 3636*cdf0e10cSrcweir nRet = (MRESULT)1; 3637*cdf0e10cSrcweir } 3638*cdf0e10cSrcweir break; 3639*cdf0e10cSrcweir 3640*cdf0e10cSrcweir #ifdef ENABLE_IME 3641*cdf0e10cSrcweir case WM_IMEREQUEST: 3642*cdf0e10cSrcweir if ( (ULONG)nMP1 == IMR_CONVRESULT ) 3643*cdf0e10cSrcweir { 3644*cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3645*cdf0e10cSrcweir { 3646*cdf0e10cSrcweir // Nur im Conversionmodus akzeptieren wir den IME-Input 3647*cdf0e10cSrcweir if ( pFrame->mbConversionMode ) 3648*cdf0e10cSrcweir { 3649*cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3650*cdf0e10cSrcweir if ( ImplHandleIMEConversion( pFrame, nMP2 ) ) 3651*cdf0e10cSrcweir { 3652*cdf0e10cSrcweir bDef = FALSE; 3653*cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3654*cdf0e10cSrcweir } 3655*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3656*cdf0e10cSrcweir } 3657*cdf0e10cSrcweir } 3658*cdf0e10cSrcweir } 3659*cdf0e10cSrcweir else if ( (ULONG)nMP1 == IMR_CANDIDATE ) 3660*cdf0e10cSrcweir { 3661*cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3662*cdf0e10cSrcweir { 3663*cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3664*cdf0e10cSrcweir if ( (ULONG)nMP2 & IMR_CANDIDATE_SHOW ) 3665*cdf0e10cSrcweir ImplHandleIMEOpenCandidate( pFrame ); 3666*cdf0e10cSrcweir else if ( (ULONG)nMP2 & IMR_CANDIDATE_HIDE ) 3667*cdf0e10cSrcweir ImplHandleIMECloseCandidate( pFrame ); 3668*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3669*cdf0e10cSrcweir } 3670*cdf0e10cSrcweir } 3671*cdf0e10cSrcweir break; 3672*cdf0e10cSrcweir 3673*cdf0e10cSrcweir case WM_IMENOTIFY: 3674*cdf0e10cSrcweir if ( (ULONG)nMP1 == IMN_STARTCONVERSION ) 3675*cdf0e10cSrcweir { 3676*cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3677*cdf0e10cSrcweir if ( ImplHandleIMEStartConversion( pFrame ) ) 3678*cdf0e10cSrcweir { 3679*cdf0e10cSrcweir bDef = FALSE; 3680*cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3681*cdf0e10cSrcweir } 3682*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3683*cdf0e10cSrcweir } 3684*cdf0e10cSrcweir else if ( (ULONG)nMP1 == IMN_ENDCONVERSION ) 3685*cdf0e10cSrcweir { 3686*cdf0e10cSrcweir if ( pFrame->mbHandleIME ) 3687*cdf0e10cSrcweir { 3688*cdf0e10cSrcweir ImplSalYieldMutexAcquire(); 3689*cdf0e10cSrcweir if ( ImplHandleIMEEndConversion( pFrame ) ) 3690*cdf0e10cSrcweir { 3691*cdf0e10cSrcweir bDef = FALSE; 3692*cdf0e10cSrcweir nRet = (MRESULT)TRUE; 3693*cdf0e10cSrcweir } 3694*cdf0e10cSrcweir ImplSalYieldMutexRelease(); 3695*cdf0e10cSrcweir } 3696*cdf0e10cSrcweir } 3697*cdf0e10cSrcweir break; 3698*cdf0e10cSrcweir #endif 3699*cdf0e10cSrcweir } 3700*cdf0e10cSrcweir 3701*cdf0e10cSrcweir if( bCheckTimers ) 3702*cdf0e10cSrcweir { 3703*cdf0e10cSrcweir SalData* pSalData = GetSalData(); 3704*cdf0e10cSrcweir if( pSalData->mnNextTimerTime ) 3705*cdf0e10cSrcweir { 3706*cdf0e10cSrcweir ULONG nCurTime; 3707*cdf0e10cSrcweir DosQuerySysInfo( QSV_MS_COUNT, QSV_MS_COUNT, (PVOID)&nCurTime, sizeof(ULONG)); 3708*cdf0e10cSrcweir if( pSalData->mnNextTimerTime < nCurTime ) 3709*cdf0e10cSrcweir { 3710*cdf0e10cSrcweir QMSG aMsg; 3711*cdf0e10cSrcweir if (!WinPeekMsg( pFrame->mhAB, &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE ) ) 3712*cdf0e10cSrcweir WinPostMsg( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, (MPARAM)nCurTime ); 3713*cdf0e10cSrcweir } 3714*cdf0e10cSrcweir } 3715*cdf0e10cSrcweir } 3716*cdf0e10cSrcweir 3717*cdf0e10cSrcweir if ( bDef ) 3718*cdf0e10cSrcweir nRet = WinDefWindowProc( hWnd, nMsg, nMP1, nMP2 ); 3719*cdf0e10cSrcweir 3720*cdf0e10cSrcweir return nRet; 3721*cdf0e10cSrcweir } 3722*cdf0e10cSrcweir 3723*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3724*cdf0e10cSrcweir 3725*cdf0e10cSrcweir void Os2SalFrame::ResetClipRegion() 3726*cdf0e10cSrcweir { 3727*cdf0e10cSrcweir } 3728*cdf0e10cSrcweir 3729*cdf0e10cSrcweir void Os2SalFrame::BeginSetClipRegion( ULONG ) 3730*cdf0e10cSrcweir { 3731*cdf0e10cSrcweir } 3732*cdf0e10cSrcweir 3733*cdf0e10cSrcweir void Os2SalFrame::UnionClipRegion( long, long, long, long ) 3734*cdf0e10cSrcweir { 3735*cdf0e10cSrcweir } 3736*cdf0e10cSrcweir 3737*cdf0e10cSrcweir void Os2SalFrame::EndSetClipRegion() 3738*cdf0e10cSrcweir { 3739*cdf0e10cSrcweir } 3740*cdf0e10cSrcweir 3741*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3742*cdf0e10cSrcweir 3743*cdf0e10cSrcweir MRESULT EXPENTRY SalFrameSubClassWndProc( HWND hWnd, ULONG nMsg, 3744*cdf0e10cSrcweir MPARAM nMP1, MPARAM nMP2 ) 3745*cdf0e10cSrcweir { 3746*cdf0e10cSrcweir MRESULT mReturn = 0L; 3747*cdf0e10cSrcweir 3748*cdf0e10cSrcweir // ticket#124 min size of 132 px is too much 3749*cdf0e10cSrcweir if (nMsg == WM_QUERYTRACKINFO) { 3750*cdf0e10cSrcweir PTRACKINFO pti; 3751*cdf0e10cSrcweir // first, let PM initialize TRACKINFO 3752*cdf0e10cSrcweir mReturn = aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); 3753*cdf0e10cSrcweir // now change default min size 3754*cdf0e10cSrcweir pti = (PTRACKINFO) nMP2; 3755*cdf0e10cSrcweir pti->ptlMinTrackSize.x = 64L; 3756*cdf0e10cSrcweir // now return to PM 3757*cdf0e10cSrcweir return mReturn; 3758*cdf0e10cSrcweir } 3759*cdf0e10cSrcweir 3760*cdf0e10cSrcweir return aSalShlData.mpFrameProc( hWnd, nMsg, nMP1, nMP2 ); 3761*cdf0e10cSrcweir } 3762*cdf0e10cSrcweir 3763*cdf0e10cSrcweir // ----------------------------------------------------------------------- 3764