1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: salobj.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
37 #include <tools/svwin.h>
39 #include <wincomp.hxx>
40 #include <saldata.hxx>
44 #include <tools/debug.hxx>
46 // =======================================================================
48 static BOOL
ImplIsSysWindowOrChild( HWND hWndParent
, HWND hWndChild
)
50 if ( hWndParent
== hWndChild
)
53 HWND hTempWnd
= ::GetParent( hWndChild
);
56 // Ab nicht Child-Fenstern hoeren wir auf zu suchen
57 if ( !(GetWindowStyle( hTempWnd
) & WS_CHILD
) )
59 if ( hTempWnd
== hWndParent
)
61 hTempWnd
= ::GetParent( hTempWnd
);
67 // -----------------------------------------------------------------------
69 WinSalObject
* ImplFindSalObject( HWND hWndChild
)
71 SalData
* pSalData
= GetSalData();
72 WinSalObject
* pObject
= pSalData
->mpFirstObject
;
75 if ( ImplIsSysWindowOrChild( pObject
->mhWndChild
, hWndChild
) )
78 pObject
= pObject
->mpNextObject
;
84 // -----------------------------------------------------------------------
86 WinSalFrame
* ImplFindSalObjectFrame( HWND hWnd
)
88 WinSalFrame
* pFrame
= NULL
;
89 WinSalObject
* pObject
= ImplFindSalObject( hWnd
);
92 // Dazugehoerenden Frame suchen
93 HWND hWnd
= ::GetParent( pObject
->mhWnd
);
94 pFrame
= GetSalData()->mpFirstFrame
;
97 if ( pFrame
->mhWnd
== hWnd
)
100 pFrame
= pFrame
->mpNextFrame
;
107 // -----------------------------------------------------------------------
109 LRESULT CALLBACK
SalSysMsgProc( int nCode
, WPARAM wParam
, LPARAM lParam
)
111 // Used for Unicode and none Unicode
112 SalData
* pSalData
= GetSalData();
114 if ( (nCode
>= 0) && lParam
)
116 CWPSTRUCT
* pData
= (CWPSTRUCT
*)lParam
;
117 if ( (pData
->message
!= WM_KEYDOWN
) &&
118 (pData
->message
!= WM_KEYUP
) )
119 pSalData
->mnSalObjWantKeyEvt
= 0;
121 // Testen, ob wir Daten fuer ein SalObject-Fenster behandeln
123 WinSalObject
* pObject
;
124 if ( pData
->message
== WM_SETFOCUS
)
126 pObject
= ImplFindSalObject( pData
->hwnd
);
129 pObject
->mhLastFocusWnd
= pData
->hwnd
;
130 if ( ImplSalYieldMutexTryToAcquire() )
132 pObject
->CallCallback( SALOBJ_EVENT_GETFOCUS
, 0 );
133 ImplSalYieldMutexRelease();
136 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
139 else if ( pData
->message
== WM_KILLFOCUS
)
141 pObject
= ImplFindSalObject( pData
->hwnd
);
142 if ( pObject
&& !ImplFindSalObject( (HWND
)pData
->wParam
) )
144 // LoseFocus nur rufen, wenn wirklich kein ChildFenster
146 if ( !pData
->wParam
|| !ImplFindSalObject( (HWND
)pData
->wParam
) )
148 if ( ImplSalYieldMutexTryToAcquire() )
150 pObject
->CallCallback( SALOBJ_EVENT_LOSEFOCUS
, 0 );
151 ImplSalYieldMutexRelease();
154 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
157 pObject
->mhLastFocusWnd
= (HWND
)pData
->wParam
;
162 return CallNextHookEx( pSalData
->mhSalObjMsgHook
, nCode
, wParam
, lParam
);
165 // -----------------------------------------------------------------------
167 BOOL
ImplSalPreDispatchMsg( MSG
* pMsg
)
169 // Used for Unicode and none Unicode
170 SalData
* pSalData
= GetSalData();
171 WinSalObject
* pObject
;
173 if ( (pMsg
->message
== WM_LBUTTONDOWN
) ||
174 (pMsg
->message
== WM_RBUTTONDOWN
) ||
175 (pMsg
->message
== WM_MBUTTONDOWN
) )
177 ImplSalYieldMutexAcquireWithWait();
178 pObject
= ImplFindSalObject( pMsg
->hwnd
);
179 if ( pObject
&& !pObject
->IsMouseTransparent() )
180 ImplPostMessage( pObject
->mhWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
181 ImplSalYieldMutexRelease();
184 if ( (pMsg
->message
== WM_KEYDOWN
) ||
185 (pMsg
->message
== WM_KEYUP
) )
187 // KeyEvents wollen wir nach Moeglichkeit auch abarbeiten,
188 // wenn das Control diese nicht selber auswertet
189 // SysKeys werden als WM_SYSCOMMAND verarbeitet
190 // Char-Events verarbeiten wir nicht, da wir nur
191 // Accelerator relevante Keys verarbeiten wollen
192 BOOL bWantedKeyCode
= FALSE
;
193 // A-Z, 0-9 nur in Verbindung mit Control-Taste
194 if ( ((pMsg
->wParam
>= 65) && (pMsg
->wParam
<= 90)) ||
195 ((pMsg
->wParam
>= 48) && (pMsg
->wParam
<= 57)) )
197 if ( GetKeyState( VK_CONTROL
) & 0x8000 )
198 bWantedKeyCode
= TRUE
;
200 else if ( ((pMsg
->wParam
>= VK_F1
) && (pMsg
->wParam
<= VK_F24
)) ||
201 ((pMsg
->wParam
>= VK_SPACE
) && (pMsg
->wParam
<= VK_HELP
)) ||
202 (pMsg
->wParam
== VK_BACK
) || (pMsg
->wParam
== VK_TAB
) ||
203 (pMsg
->wParam
== VK_CLEAR
) || (pMsg
->wParam
== VK_RETURN
) ||
204 (pMsg
->wParam
== VK_ESCAPE
) )
205 bWantedKeyCode
= TRUE
;
206 if ( bWantedKeyCode
)
208 ImplSalYieldMutexAcquireWithWait();
209 pObject
= ImplFindSalObject( pMsg
->hwnd
);
211 pSalData
->mnSalObjWantKeyEvt
= pMsg
->wParam
;
212 ImplSalYieldMutexRelease();
215 // Hier WM_SYSCHAR abfangen, um mit Alt+Taste evtl. Menu zu aktivieren
216 else if ( pMsg
->message
== WM_SYSCHAR
)
218 pSalData
->mnSalObjWantKeyEvt
= 0;
220 USHORT nKeyCode
= LOWORD( pMsg
->wParam
);
222 if ( ((nKeyCode
>= 48) && (nKeyCode
<= 57)) ||
223 ((nKeyCode
>= 65) && (nKeyCode
<= 90)) ||
224 ((nKeyCode
>= 97) && (nKeyCode
<= 122)) )
227 ImplSalYieldMutexAcquireWithWait();
228 pObject
= ImplFindSalObject( pMsg
->hwnd
);
231 if ( pMsg
->hwnd
== ::GetFocus() )
233 WinSalFrame
* pFrame
= ImplFindSalObjectFrame( pMsg
->hwnd
);
236 if ( ImplHandleSalObjSysCharMsg( pFrame
->mhWnd
, pMsg
->wParam
, pMsg
->lParam
) )
241 ImplSalYieldMutexRelease();
247 pSalData
->mnSalObjWantKeyEvt
= 0;
252 // -----------------------------------------------------------------------
254 void ImplSalPostDispatchMsg( MSG
* pMsg
, LRESULT
/* nDispatchResult */ )
256 // Used for Unicode and none Unicode
257 SalData
* pSalData
= GetSalData();
260 if ( (pMsg
->message
== WM_KEYDOWN
) || (pMsg
->message
== WM_KEYUP
) )
262 if ( pSalData
->mnSalObjWantKeyEvt
== pMsg
->wParam
)
264 pSalData
->mnSalObjWantKeyEvt
= 0;
265 if ( pMsg
->hwnd
== ::GetFocus() )
267 ImplSalYieldMutexAcquireWithWait();
268 pFrame
= ImplFindSalObjectFrame( pMsg
->hwnd
);
270 ImplHandleSalObjKeyMsg( pFrame
->mhWnd
, pMsg
->message
, pMsg
->wParam
, pMsg
->lParam
);
271 ImplSalYieldMutexRelease();
276 pSalData
->mnSalObjWantKeyEvt
= 0;
279 // =======================================================================
281 LRESULT CALLBACK
SalSysObjWndProc( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
, int& rDef
)
283 WinSalObject
* pSysObj
;
295 BeginPaint( hWnd
, &aPs
);
296 EndPaint( hWnd
, &aPs
);
301 case WM_PARENTNOTIFY
:
303 UINT nNotifyMsg
= LOWORD( wParam
);
304 if ( (nNotifyMsg
== WM_LBUTTONDOWN
) ||
305 (nNotifyMsg
== WM_RBUTTONDOWN
) ||
306 (nNotifyMsg
== WM_MBUTTONDOWN
) )
308 ImplSalYieldMutexAcquireWithWait();
309 pSysObj
= GetSalObjWindowPtr( hWnd
);
310 if ( pSysObj
&& !pSysObj
->IsMouseTransparent() )
311 pSysObj
->CallCallback( SALOBJ_EVENT_TOTOP
, 0 );
312 ImplSalYieldMutexRelease();
317 case WM_MOUSEACTIVATE
:
319 ImplSalYieldMutexAcquireWithWait();
320 pSysObj
= GetSalObjWindowPtr( hWnd
);
321 if ( pSysObj
&& !pSysObj
->IsMouseTransparent() )
322 ImplPostMessage( hWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
323 ImplSalYieldMutexRelease();
327 case SALOBJ_MSG_TOTOP
:
328 if ( ImplSalYieldMutexTryToAcquire() )
330 pSysObj
= GetSalObjWindowPtr( hWnd
);
331 pSysObj
->CallCallback( SALOBJ_EVENT_TOTOP
, 0 );
332 ImplSalYieldMutexRelease();
336 ImplPostMessage( hWnd
, SALOBJ_MSG_TOTOP
, 0, 0 );
339 case SALOBJ_MSG_POSTFOCUS
:
340 if ( ImplSalYieldMutexTryToAcquire() )
342 pSysObj
= GetSalObjWindowPtr( hWnd
);
343 HWND hFocusWnd
= ::GetFocus();
345 if ( hFocusWnd
&& ImplIsSysWindowOrChild( hWnd
, hFocusWnd
) )
346 nEvent
= SALOBJ_EVENT_GETFOCUS
;
348 nEvent
= SALOBJ_EVENT_LOSEFOCUS
;
349 pSysObj
->CallCallback( nEvent
, 0 );
350 ImplSalYieldMutexRelease();
353 ImplPostMessage( hWnd
, SALOBJ_MSG_POSTFOCUS
, 0, 0 );
359 HWND hWndChild
= GetWindow( hWnd
, GW_CHILD
);
362 SetWindowPos( hWndChild
,
363 0, 0, 0, (int)LOWORD( lParam
), (int)HIWORD( lParam
),
364 SWP_NOZORDER
| SWP_NOACTIVATE
);
372 // Window-Instanz am Windowhandle speichern
373 // Can also be used for the W-Version, because the struct
374 // to access lpCreateParams is the same structure
375 CREATESTRUCTA
* pStruct
= (CREATESTRUCTA
*)lParam
;
376 pSysObj
= (WinSalObject
*)pStruct
->lpCreateParams
;
377 SetSalObjWindowPtr( hWnd
, pSysObj
);
378 // HWND schon hier setzen, da schon auf den Instanzdaten
379 // gearbeitet werden kann, wenn Messages waehrend
380 // CreateWindow() gesendet werden
381 pSysObj
->mhWnd
= hWnd
;
390 LRESULT CALLBACK
SalSysObjWndProcA( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
393 LRESULT nRet
= SalSysObjWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
395 nRet
= DefWindowProcA( hWnd
, nMsg
, wParam
, lParam
);
399 LRESULT CALLBACK
SalSysObjWndProcW( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
402 LRESULT nRet
= SalSysObjWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
404 nRet
= DefWindowProcW( hWnd
, nMsg
, wParam
, lParam
);
408 // -----------------------------------------------------------------------
410 LRESULT CALLBACK
SalSysObjChildWndProc( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
, int& rDef
)
416 // Wegen PlugIn's loeschen wir erstmal den Hintergrund
419 WinSalObject
* pSysObj
= GetSalObjWindowPtr( ::GetParent( hWnd
) );
421 if( pSysObj
&& !pSysObj
->IsEraseBackgroundEnabled() )
423 // do not erase background
433 BeginPaint( hWnd
, &aPs
);
434 EndPaint( hWnd
, &aPs
);
447 WinSalObject
* pSysObj
;
448 pSysObj
= GetSalObjWindowPtr( ::GetParent( hWnd
) );
450 if( pSysObj
&& pSysObj
->IsMouseTransparent() )
452 // forward mouse events to parent frame
453 HWND hWndParent
= ::GetParent( pSysObj
->mhWnd
);
455 // transform coordinates
457 pt
.x
= (long) LOWORD( lParam
);
458 pt
.y
= (long) HIWORD( lParam
);
459 MapWindowPoints( hWnd
, hWndParent
, &pt
, 1 );
460 lParam
= MAKELPARAM( (WORD
) pt
.x
, (WORD
) pt
.y
);
462 nRet
= ImplSendMessage( hWndParent
, nMsg
, wParam
, lParam
);
472 LRESULT CALLBACK
SalSysObjChildWndProcA( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
475 LRESULT nRet
= SalSysObjChildWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
477 nRet
= DefWindowProcA( hWnd
, nMsg
, wParam
, lParam
);
481 LRESULT CALLBACK
SalSysObjChildWndProcW( HWND hWnd
, UINT nMsg
, WPARAM wParam
, LPARAM lParam
)
484 LRESULT nRet
= SalSysObjChildWndProc( hWnd
, nMsg
, wParam
, lParam
, bDef
);
486 nRet
= DefWindowProcW( hWnd
, nMsg
, wParam
, lParam
);
490 // =======================================================================
492 SalObject
* ImplSalCreateObject( WinSalInstance
* pInst
, WinSalFrame
* pParent
)
494 SalData
* pSalData
= GetSalData();
496 // Hook installieren, wenn es das erste SalObject ist
497 if ( !pSalData
->mpFirstObject
)
499 if ( aSalShlData
.mbWNT
)
501 pSalData
->mhSalObjMsgHook
= SetWindowsHookExW( WH_CALLWNDPROC
,
504 pSalData
->mnAppThreadId
);
508 pSalData
->mhSalObjMsgHook
= SetWindowsHookExA( WH_CALLWNDPROC
,
511 pSalData
->mnAppThreadId
);
515 if ( !pSalData
->mbObjClassInit
)
517 // #95301# shockwave plugin has bug; expects ASCII functions to be used
518 if ( false )//aSalShlData.mbWNT )
520 WNDCLASSEXW aWndClassEx
;
521 aWndClassEx
.cbSize
= sizeof( aWndClassEx
);
522 aWndClassEx
.style
= 0;
523 aWndClassEx
.lpfnWndProc
= SalSysObjWndProcW
;
524 aWndClassEx
.cbClsExtra
= 0;
525 aWndClassEx
.cbWndExtra
= SAL_OBJECT_WNDEXTRA
;
526 aWndClassEx
.hInstance
= pSalData
->mhInst
;
527 aWndClassEx
.hIcon
= 0;
528 aWndClassEx
.hIconSm
= 0;
529 aWndClassEx
.hCursor
= LoadCursor( 0, IDC_ARROW
);
530 aWndClassEx
.hbrBackground
= 0;
531 aWndClassEx
.lpszMenuName
= 0;
532 aWndClassEx
.lpszClassName
= SAL_OBJECT_CLASSNAMEW
;
533 if ( RegisterClassExW( &aWndClassEx
) )
535 // Wegen PlugIn's loeschen wir erstmal den Hintergrund
536 aWndClassEx
.cbWndExtra
= 0;
537 aWndClassEx
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
538 aWndClassEx
.lpfnWndProc
= SalSysObjChildWndProcW
;
539 aWndClassEx
.lpszClassName
= SAL_OBJECT_CHILDCLASSNAMEW
;
540 if ( RegisterClassExW( &aWndClassEx
) )
541 pSalData
->mbObjClassInit
= TRUE
;
546 WNDCLASSEXA aWndClassEx
;
547 aWndClassEx
.cbSize
= sizeof( aWndClassEx
);
548 aWndClassEx
.style
= 0;
549 aWndClassEx
.lpfnWndProc
= SalSysObjWndProcA
;
550 aWndClassEx
.cbClsExtra
= 0;
551 aWndClassEx
.cbWndExtra
= SAL_OBJECT_WNDEXTRA
;
552 aWndClassEx
.hInstance
= pSalData
->mhInst
;
553 aWndClassEx
.hIcon
= 0;
554 aWndClassEx
.hIconSm
= 0;
555 aWndClassEx
.hCursor
= LoadCursor( 0, IDC_ARROW
);
556 aWndClassEx
.hbrBackground
= 0;
557 aWndClassEx
.lpszMenuName
= 0;
558 aWndClassEx
.lpszClassName
= SAL_OBJECT_CLASSNAMEA
;
559 if ( RegisterClassExA( &aWndClassEx
) )
561 // Wegen PlugIn's loeschen wir erstmal den Hintergrund
562 aWndClassEx
.cbWndExtra
= 0;
563 aWndClassEx
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+1);
564 aWndClassEx
.lpfnWndProc
= SalSysObjChildWndProcA
;
565 aWndClassEx
.lpszClassName
= SAL_OBJECT_CHILDCLASSNAMEA
;
566 if ( RegisterClassExA( &aWndClassEx
) )
567 pSalData
->mbObjClassInit
= TRUE
;
572 if ( pSalData
->mbObjClassInit
)
574 WinSalObject
* pObject
= new WinSalObject
;
576 // #135235# Clip siblings of this
577 // SystemChildWindow. Otherwise, DXCanvas (using a hidden
578 // SystemChildWindow) clobbers applets/plugins during
580 HWND hWnd
= CreateWindowExA( 0, SAL_OBJECT_CLASSNAMEA
, "",
581 WS_CHILD
| WS_CLIPSIBLINGS
, 0, 0, 0, 0,
583 pInst
->mhInst
, (void*)pObject
);
588 // #135235# Explicitely stack SystemChildWindows in
589 // the order they're created - since there's no notion
591 SetWindowPos(hWnd
,HWND_TOP
,0,0,0,0,
592 SWP_NOACTIVATE
|SWP_NOMOVE
|SWP_NOREDRAW
|SWP_NOSIZE
);
593 hWndChild
= CreateWindowExA( 0, SAL_OBJECT_CHILDCLASSNAMEA
, "",
594 WS_CHILD
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
| WS_VISIBLE
,
597 pInst
->mhInst
, NULL
);
608 pObject
->mhWnd
= hWnd
;
609 pObject
->mhWndChild
= hWndChild
;
610 pObject
->maSysData
.hWnd
= hWndChild
;
618 // =======================================================================
620 WinSalObject::WinSalObject()
622 SalData
* pSalData
= GetSalData();
627 maSysData
.nSize
= sizeof( SystemEnvData
);
628 mpStdClipRgnData
= NULL
;
630 // Insert object in objectlist
631 mpNextObject
= pSalData
->mpFirstObject
;
632 pSalData
->mpFirstObject
= this;
635 // -----------------------------------------------------------------------
637 WinSalObject::~WinSalObject()
639 SalData
* pSalData
= GetSalData();
641 // remove frame from framelist
642 if ( this == pSalData
->mpFirstObject
)
644 pSalData
->mpFirstObject
= mpNextObject
;
646 // Wenn letztes SalObject, dann Hook wieder entfernen
647 if ( !pSalData
->mpFirstObject
)
648 UnhookWindowsHookEx( pSalData
->mhSalObjMsgHook
);
652 WinSalObject
* pTempObject
= pSalData
->mpFirstObject
;
653 while ( pTempObject
->mpNextObject
!= this )
654 pTempObject
= pTempObject
->mpNextObject
;
656 pTempObject
->mpNextObject
= mpNextObject
;
659 // Cache-Daten zerstoeren
660 if ( mpStdClipRgnData
)
661 delete mpStdClipRgnData
;
663 HWND hWndParent
= ::GetParent( mhWnd
);
666 DestroyWindow( mhWndChild
);
668 DestroyWindow( mhWnd
);
670 // Palette wieder zuruecksetzen, wenn kein externes Child-Fenster
671 // mehr vorhanden ist, da diese unsere Palette ueberschrieben haben
674 ::GetActiveWindow() == hWndParent
&&
675 !GetWindow( hWndParent
, GW_CHILD
) )
676 ImplSendMessage( hWndParent
, SAL_MSG_FORCEPALETTE
, 0, 0 );
679 // -----------------------------------------------------------------------
681 void WinSalObject::ResetClipRegion()
683 SetWindowRgn( mhWnd
, 0, TRUE
);
686 // -----------------------------------------------------------------------
688 USHORT
WinSalObject::GetClipRegionType()
690 return SAL_OBJECT_CLIP_INCLUDERECTS
;
693 // -----------------------------------------------------------------------
695 void WinSalObject::BeginSetClipRegion( ULONG nRectCount
)
697 ULONG nRectBufSize
= sizeof(RECT
)*nRectCount
;
698 if ( nRectCount
< SAL_CLIPRECT_COUNT
)
700 if ( !mpStdClipRgnData
)
701 mpStdClipRgnData
= (RGNDATA
*)new BYTE
[sizeof(RGNDATA
)-1+(SAL_CLIPRECT_COUNT
*sizeof(RECT
))];
702 mpClipRgnData
= mpStdClipRgnData
;
705 mpClipRgnData
= (RGNDATA
*)new BYTE
[sizeof(RGNDATA
)-1+nRectBufSize
];
706 mpClipRgnData
->rdh
.dwSize
= sizeof( RGNDATAHEADER
);
707 mpClipRgnData
->rdh
.iType
= RDH_RECTANGLES
;
708 mpClipRgnData
->rdh
.nCount
= nRectCount
;
709 mpClipRgnData
->rdh
.nRgnSize
= nRectBufSize
;
710 SetRectEmpty( &(mpClipRgnData
->rdh
.rcBound
) );
711 mpNextClipRect
= (RECT
*)(&(mpClipRgnData
->Buffer
));
712 mbFirstClipRect
= TRUE
;
715 // -----------------------------------------------------------------------
717 void WinSalObject::UnionClipRegion( long nX
, long nY
, long nWidth
, long nHeight
)
719 RECT
* pRect
= mpNextClipRect
;
720 RECT
* pBoundRect
= &(mpClipRgnData
->rdh
.rcBound
);
721 long nRight
= nX
+ nWidth
;
722 long nBottom
= nY
+ nHeight
;
724 if ( mbFirstClipRect
)
726 pBoundRect
->left
= nX
;
727 pBoundRect
->top
= nY
;
728 pBoundRect
->right
= nRight
;
729 pBoundRect
->bottom
= nBottom
;
730 mbFirstClipRect
= FALSE
;
734 if ( nX
< pBoundRect
->left
)
735 pBoundRect
->left
= (int)nX
;
737 if ( nY
< pBoundRect
->top
)
738 pBoundRect
->top
= (int)nY
;
740 if ( nRight
> pBoundRect
->right
)
741 pBoundRect
->right
= (int)nRight
;
743 if ( nBottom
> pBoundRect
->bottom
)
744 pBoundRect
->bottom
= (int)nBottom
;
747 pRect
->left
= (int)nX
;
748 pRect
->top
= (int)nY
;
749 pRect
->right
= (int)nRight
;
750 pRect
->bottom
= (int)nBottom
;
754 // -----------------------------------------------------------------------
756 void WinSalObject::EndSetClipRegion()
760 // Aus den Region-Daten muessen wir jetzt eine ClipRegion erzeugen
761 if ( mpClipRgnData
->rdh
.nCount
== 1 )
763 RECT
* pRect
= &(mpClipRgnData
->rdh
.rcBound
);
764 hRegion
= CreateRectRgn( pRect
->left
, pRect
->top
,
765 pRect
->right
, pRect
->bottom
);
769 ULONG nSize
= mpClipRgnData
->rdh
.nRgnSize
+sizeof(RGNDATAHEADER
);
770 hRegion
= ExtCreateRegion( NULL
, nSize
, mpClipRgnData
);
771 if ( mpClipRgnData
!= mpStdClipRgnData
)
772 delete [] (BYTE
*)mpClipRgnData
;
775 DBG_ASSERT( hRegion
, "SalObject::EndSetClipRegion() - Can't create ClipRegion" );
776 SetWindowRgn( mhWnd
, hRegion
, TRUE
);
779 // -----------------------------------------------------------------------
781 void WinSalObject::SetPosSize( long nX
, long nY
, long nWidth
, long nHeight
)
784 BOOL bVisible
= (GetWindowStyle( mhWnd
) & WS_VISIBLE
) != 0;
787 ShowWindow( mhWnd
, SW_HIDE
);
788 nStyle
|= SWP_SHOWWINDOW
;
790 SetWindowPos( mhWnd
, 0,
791 (int)nX
, (int)nY
, (int)nWidth
, (int)nHeight
,
792 SWP_NOZORDER
| SWP_NOACTIVATE
| nStyle
);
795 // -----------------------------------------------------------------------
797 void WinSalObject::Show( BOOL bVisible
)
800 ShowWindow( mhWnd
, SW_SHOWNORMAL
);
802 ShowWindow( mhWnd
, SW_HIDE
);
805 // -----------------------------------------------------------------------
807 void WinSalObject::Enable( BOOL bEnable
)
809 EnableWindow( mhWnd
, bEnable
);
812 // -----------------------------------------------------------------------
814 void WinSalObject::GrabFocus()
816 if ( mhLastFocusWnd
&&
817 IsWindow( mhLastFocusWnd
) &&
818 ImplIsSysWindowOrChild( mhWndChild
, mhLastFocusWnd
) )
819 ::SetFocus( mhLastFocusWnd
);
821 ::SetFocus( mhWndChild
);
824 // -----------------------------------------------------------------------
826 void WinSalObject::SetBackground()
830 // -----------------------------------------------------------------------
832 void WinSalObject::SetBackground( SalColor
)
836 // -----------------------------------------------------------------------
838 const SystemEnvData
* WinSalObject::GetSystemData() const