1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_WINDOW_H
21 #define INCLUDED_VCL_INC_WINDOW_H
23 #include <sal/config.h>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <cppuhelper/weakref.hxx>
28 #include <tools/wintypes.hxx>
29 #include <tools/fract.hxx>
30 #include <vcl/cursor.hxx>
31 #include <vcl/inputctx.hxx>
32 #include <vcl/outdev.hxx>
33 #include <vcl/pointr.hxx>
34 #include <vcl/salnativewidgets.hxx>
35 #include <vcl/timer.hxx>
36 #include <vcl/idle.hxx>
37 #include <vcl/vclevent.hxx>
38 #include <vcl/vclptr.hxx>
39 #include <vcl/rendersettings.hxx>
44 struct ImplAccessibleInfos
;
48 struct ControlLayoutData
;
54 class PhysicalFontCollection
;
59 enum class MouseEventModifiers
;
60 enum class MouseNotifyEvent
;
62 namespace com
{ namespace sun
{ namespace star
{
64 namespace accessibility
{
80 namespace datatransfer
{ namespace clipboard
{
85 class XDropTargetListener
;
86 class XDragGestureRecognizer
;
91 bool ImplWindowFrameProc( vcl::Window
* pInst
, SalFrame
* pFrame
, sal_uInt16 nEvent
, const void* pEvent
);
93 #define WINDOW_HITTEST_INSIDE ((sal_uInt16)0x0001)
94 #define WINDOW_HITTEST_TRANSPARENT ((sal_uInt16)0x0002)
98 OUString
* mpExtOldText
;
99 sal_uInt16
* mpExtOldAttrAry
;
100 Rectangle
* mpCursorRect
;
101 long mnCursorExtWidth
;
103 Rectangle
* mpCompositionCharRects
;
104 long mnCompositionCharRects
;
105 Rectangle
* mpFocusRect
;
106 Rectangle
* mpTrackRect
;
107 sal_uInt16 mnTrackFlags
;
108 sal_uInt16 mnIsTopWindow
;
109 bool mbMouseOver
; //< tracks mouse over for native widget paint effect
110 bool mbEnableNativeWidget
; //< toggle native widget rendering
111 ::std::list
< VclPtr
<vcl::Window
> >
115 struct ImplOverlapData
117 VclPtr
<VirtualDevice
> mpSaveBackDev
; //< saved background bitmap
118 vcl::Region
* mpSaveBackRgn
; //< saved region, which must be invalidated
119 VclPtr
<vcl::Window
> mpNextBackWin
; //< next window with saved background
120 sal_uIntPtr mnSaveBackSize
; //< bitmap size of saved background
121 bool mbSaveBack
; //< true: save background
122 sal_uInt8 mnTopLevel
; //< Level for Overlap-Window
127 Idle maPaintIdle
; //< paint idle handler
128 Idle maResizeIdle
; //< resize timer
129 InputContext maOldInputContext
; //< last set Input Context
130 VclPtr
<vcl::Window
> mpNextFrame
; //< next frame window
131 VclPtr
<vcl::Window
> mpFirstOverlap
; //< first overlap vcl::Window
132 VclPtr
<vcl::Window
> mpFocusWin
; //< focus window (is also set, when frame doesn't have the focous)
133 VclPtr
<vcl::Window
> mpMouseMoveWin
; //< last window, where MouseMove() called
134 VclPtr
<vcl::Window
> mpMouseDownWin
; //< last window, where MouseButtonDown() called
135 VclPtr
<vcl::Window
> mpFirstBackWin
; //< first overlap-window with saved background
136 ::std::vector
<VclPtr
<vcl::Window
> > maOwnerDrawList
; //< List of system windows with owner draw decoration
137 PhysicalFontCollection
* mpFontCollection
; //< Font-List for this frame
138 ImplFontCache
* mpFontCache
; //< Font-Cache for this frame
139 sal_Int32 mnDPIX
; //< Original Screen Resolution
140 sal_Int32 mnDPIY
; //< Original Screen Resolution
141 ImplMapRes maMapUnitRes
; //< for LogicUnitToPixel
142 sal_uIntPtr mnAllSaveBackSize
; //< size of all bitmaps of saved backgrounds
143 ImplSVEvent
* mnFocusId
; //< FocusId for PostUserLink
144 ImplSVEvent
* mnMouseMoveId
; //< MoveId for PostUserLink
145 long mnLastMouseX
; //< last x mouse position
146 long mnLastMouseY
; //< last y mouse position
147 long mnBeforeLastMouseX
; //< last but one x mouse position
148 long mnBeforeLastMouseY
; //< last but one y mouse position
149 long mnFirstMouseX
; //< first x mouse position by mousebuttondown
150 long mnFirstMouseY
; //< first y mouse position by mousebuttondown
151 long mnLastMouseWinX
; //< last x mouse position, rel. to pMouseMoveWin
152 long mnLastMouseWinY
; //< last y mouse position, rel. to pMouseMoveWin
153 sal_uInt16 mnModalMode
; //< frame based modal count (app based makes no sense anymore)
154 sal_uInt64 mnMouseDownTime
; //< mouse button down time for double click
155 sal_uInt16 mnClickCount
; //< mouse click count
156 sal_uInt16 mnFirstMouseCode
; //< mouse code by mousebuttondown
157 sal_uInt16 mnMouseCode
; //< mouse code
158 MouseEventModifiers mnMouseMode
; //< mouse mode
159 MapUnit meMapUnit
; //< last MapUnit for LogicUnitToPixel
160 bool mbHasFocus
; //< focus
161 bool mbInMouseMove
; //< is MouseMove on stack
162 bool mbMouseIn
; //> is Mouse inside the frame
163 bool mbStartDragCalled
; //< is command startdrag called
164 bool mbNeedSysWindow
; //< set, when FrameSize <= IMPL_MIN_NEEDSYSWIN
165 bool mbMinimized
; //< set, when FrameSize <= 0
166 bool mbStartFocusState
; //< FocusState, when sending the event
167 bool mbInSysObjFocusHdl
; //< within a SysChildren's GetFocus handler
168 bool mbInSysObjToTopHdl
; //< within a SysChildren's ToTop handler
169 bool mbSysObjFocus
; //< does a SysChild have focus
171 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragSource
> mxDragSource
;
172 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTarget
> mxDropTarget
;
173 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetListener
> mxDropTargetListener
;
174 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> mxClipboard
;
175 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboard
> mxSelection
;
177 bool mbInternalDragGestureRecognizer
;
178 VclPtr
<VirtualDevice
> mpBuffer
; ///< Buffer for the double-buffering
179 bool mbInBufferedPaint
; ///< PaintHelper is in the process of painting into this buffer.
180 Rectangle maBufferedRect
; ///< Rectangle in the buffer that has to be painted to the screen.
183 struct ImplAccessibleInfos
185 sal_uInt16 nAccessibleRole
;
186 OUString
* pAccessibleName
;
187 OUString
* pAccessibleDescription
;
188 VclPtr
<vcl::Window
> pLabeledByWindow
;
189 VclPtr
<vcl::Window
> pLabelForWindow
;
190 VclPtr
<vcl::Window
> pMemberOfWindow
;
192 ImplAccessibleInfos();
193 ~ImplAccessibleInfos();
196 enum AlwaysInputMode
{ AlwaysInputNone
= 0, AlwaysInputEnabled
= 1, AlwaysInputDisabled
=2 };
201 WindowImpl(const WindowImpl
&) SAL_DELETED_FUNCTION
;
202 WindowImpl
& operator=(const WindowImpl
&) SAL_DELETED_FUNCTION
;
204 WindowImpl( WindowType
);
207 ImplWinData
* mpWinData
;
208 ImplOverlapData
* mpOverlapData
;
209 ImplFrameData
* mpFrameData
;
212 VclPtr
<vcl::Window
> mpFrameWindow
;
213 VclPtr
<vcl::Window
> mpOverlapWindow
;
214 VclPtr
<vcl::Window
> mpBorderWindow
;
215 VclPtr
<vcl::Window
> mpClientWindow
;
216 VclPtr
<vcl::Window
> mpParent
;
217 VclPtr
<vcl::Window
> mpRealParent
;
218 VclPtr
<vcl::Window
> mpFirstChild
;
219 VclPtr
<vcl::Window
> mpLastChild
;
220 VclPtr
<vcl::Window
> mpFirstOverlap
;
221 VclPtr
<vcl::Window
> mpLastOverlap
;
222 VclPtr
<vcl::Window
> mpPrev
;
223 VclPtr
<vcl::Window
> mpNext
;
224 VclPtr
<vcl::Window
> mpNextOverlap
;
225 VclPtr
<vcl::Window
> mpLastFocusWindow
;
226 VclPtr
<vcl::Window
> mpDlgCtrlDownWindow
;
227 VclEventListeners maEventListeners
;
228 VclEventListeners maChildEventListeners
;
230 // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
231 ::com::sun::star::uno::WeakReference
< ::com::sun::star::rendering::XCanvas
> mxCanvas
;
233 ImplDelData
* mpFirstDel
;
235 vcl::Cursor
* mpCursor
;
239 vcl::Font
* mpControlFont
;
240 Color maControlForeground
;
241 Color maControlBackground
;
242 sal_Int32 mnLeftBorder
;
243 sal_Int32 mnTopBorder
;
244 sal_Int32 mnRightBorder
;
245 sal_Int32 mnBottomBorder
;
246 sal_Int32 mnWidthRequest
;
247 sal_Int32 mnHeightRequest
;
248 sal_Int32 mnOptimalWidthCache
;
249 sal_Int32 mnOptimalHeightCache
;
257 OUString maQuickHelpText
;
258 InputContext maInputContext
;
259 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
> mxWindowPeer
;
260 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> mxAccessible
;
261 std::shared_ptr
< VclSizeGroup
> m_xSizeGroup
;
262 std::vector
< VclPtr
<FixedText
> > m_aMnemonicLabels
;
263 ImplAccessibleInfos
* mpAccessibleInfos
;
264 VCLXWindow
* mpVCLXWindow
;
265 vcl::Region maWinRegion
; //< region to 'shape' the VCL window (frame coordinates)
266 vcl::Region maWinClipRegion
; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates)
267 vcl::Region maInvalidateRegion
; //< region that has to be redrawn (frame coordinates)
268 vcl::Region
* mpChildClipRegion
; //< child clip region if CLIPCHILDREN is set (frame coordinates)
269 vcl::Region
* mpPaintRegion
; //< only set during Paint() method call (window coordinates)
272 WinBits mnExtendedStyle
;
273 WinBits mnPrevExtendedStyle
;
275 ControlPart mnNativeBackground
;
276 sal_uInt16 mnWaitCount
;
277 sal_uInt16 mnPaintFlags
;
278 sal_uInt16 mnGetFocusFlags
;
279 sal_uInt16 mnParentClipMode
;
280 sal_uInt16 mnActivateMode
;
281 sal_uInt16 mnDlgCtrlFlags
;
282 sal_uInt16 mnLockCount
;
283 AlwaysInputMode meAlwaysInputMode
;
286 VclPackType mePackType
;
288 sal_Int32 mnGridHeight
;
289 sal_Int32 mnGridLeftAttach
;
290 sal_Int32 mnGridTopAttach
;
291 sal_Int32 mnGridWidth
;
292 sal_Int32 mnBorderWidth
;
293 sal_Int32 mnMarginLeft
;
294 sal_Int32 mnMarginRight
;
295 sal_Int32 mnMarginTop
;
296 sal_Int32 mnMarginBottom
;
317 mbChildPtrOverwrite
:1,
331 mbWaitSystemResize
:1,
332 mbInitWinClipRegion
:1,
337 mbChildTransparent
:1,
338 mbPaintTransparent
:1,
339 mbMouseTransparent
:1,
344 mbNativeFocusVisible
:1,
347 mbControlForeground
:1,
348 mbControlBackground
:1,
351 mbCompoundControlHasFocus
:1,
358 mbCreatedWithToolkit
:1,
361 mbSuppressAccessibilityEvents
:1,
362 mbMenuFloatingWindow
:1,
363 mbDrawSelectionBackground
:1,
364 mbIsInTaskPaneList
:1,
365 mbToolbarFloatingWindow
:1,
366 mbCallHandlersDuringInputDisabled
:1,
377 vcl::RenderSettings maRenderSettings
;
379 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> mxDNDListenerContainer
;
382 /// Sets up the buffer to have settings matching the window, and restores the original state in the dtor.
383 class PaintBufferGuard
385 ImplFrameData
* mpFrameData
;
386 VclPtr
<vcl::Window
> m_pWindow
;
388 Wallpaper maBackground
;
389 AllSettings maSettings
;
392 Rectangle m_aPaintRect
;
394 PaintBufferGuard(ImplFrameData
* pFrameData
, vcl::Window
* pWindow
);
396 /// If this is called, then the dtor will also copy rRectangle to the window from the buffer, before restoring the state.
397 void SetPaintRect(const Rectangle
& rRectangle
);
398 /// Returns either the frame's buffer or the window, in case of no buffering.
399 vcl::RenderContext
* GetRenderContext();
404 bool ImplHandleMouseEvent( vcl::Window
* pWindow
, MouseNotifyEvent nSVEvent
, bool bMouseLeave
,
405 long nX
, long nY
, sal_uInt64 nMsgTime
,
406 sal_uInt16 nCode
, MouseEventModifiers nMode
);
407 void ImplHandleResize( vcl::Window
* pWindow
, long nNewWidth
, long nNewHeight
);
409 #endif // INCLUDED_VCL_INC_WINDOW_H
411 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */