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 <tools/fract.hxx>
26 #include <vcl/idle.hxx>
27 #include <o3tl/typed_flags_set.hxx>
40 class PhysicalFontCollection
;
45 enum class MouseEventModifiers
;
46 enum class MouseNotifyEvent
;
47 enum class ActivateModeFlags
;
48 enum class DialogControlFlags
;
49 enum class GetFocusFlags
;
50 enum class ParentClipMode
;
53 namespace com
{ namespace sun
{ namespace star
{
55 namespace accessibility
{
71 namespace datatransfer
{ namespace clipboard
{
76 class XDropTargetListener
;
77 class XDragGestureRecognizer
;
82 bool ImplWindowFrameProc( vcl::Window
* pInst
, SalEvent nEvent
, const void* pEvent
);
86 OUString
* mpExtOldText
;
87 ExtTextInputAttr
* mpExtOldAttrAry
;
88 tools::Rectangle
* mpCursorRect
;
89 long mnCursorExtWidth
;
91 tools::Rectangle
* mpCompositionCharRects
;
92 long mnCompositionCharRects
;
93 tools::Rectangle
* mpFocusRect
;
94 tools::Rectangle
* mpTrackRect
;
95 ShowTrackFlags mnTrackFlags
;
96 sal_uInt16 mnIsTopWindow
;
97 bool mbMouseOver
; //< tracks mouse over for native widget paint effect
98 bool mbEnableNativeWidget
; //< toggle native widget rendering
99 ::std::list
< VclPtr
<vcl::Window
> >
108 Idle maPaintIdle
; //< paint idle handler
109 Idle maResizeIdle
; //< resize timer
110 InputContext maOldInputContext
; //< last set Input Context
111 VclPtr
<vcl::Window
> mpNextFrame
; //< next frame window
112 VclPtr
<vcl::Window
> mpFirstOverlap
; //< first overlap vcl::Window
113 VclPtr
<vcl::Window
> mpFocusWin
; //< focus window (is also set, when frame doesn't have the focus)
114 VclPtr
<vcl::Window
> mpMouseMoveWin
; //< last window, where MouseMove() called
115 VclPtr
<vcl::Window
> mpMouseDownWin
; //< last window, where MouseButtonDown() called
116 ::std::vector
<VclPtr
<vcl::Window
> > maOwnerDrawList
; //< List of system windows with owner draw decoration
117 PhysicalFontCollection
* mpFontCollection
; //< Font-List for this frame
118 ImplFontCache
* mpFontCache
; //< Font-Cache for this frame
119 sal_Int32 mnDPIX
; //< Original Screen Resolution
120 sal_Int32 mnDPIY
; //< Original Screen Resolution
121 ImplSVEvent
* mnFocusId
; //< FocusId for PostUserLink
122 ImplSVEvent
* mnMouseMoveId
; //< MoveId for PostUserLink
123 long mnLastMouseX
; //< last x mouse position
124 long mnLastMouseY
; //< last y mouse position
125 long mnBeforeLastMouseX
; //< last but one x mouse position
126 long mnBeforeLastMouseY
; //< last but one y mouse position
127 long mnFirstMouseX
; //< first x mouse position by mousebuttondown
128 long mnFirstMouseY
; //< first y mouse position by mousebuttondown
129 long mnLastMouseWinX
; //< last x mouse position, rel. to pMouseMoveWin
130 long mnLastMouseWinY
; //< last y mouse position, rel. to pMouseMoveWin
131 sal_uInt16 mnModalMode
; //< frame based modal count (app based makes no sense anymore)
132 sal_uInt64 mnMouseDownTime
; //< mouse button down time for double click
133 sal_uInt16 mnClickCount
; //< mouse click count
134 sal_uInt16 mnFirstMouseCode
; //< mouse code by mousebuttondown
135 sal_uInt16 mnMouseCode
; //< mouse code
136 MouseEventModifiers mnMouseMode
; //< mouse mode
137 bool mbHasFocus
; //< focus
138 bool mbInMouseMove
; //< is MouseMove on stack
139 bool mbMouseIn
; //> is Mouse inside the frame
140 bool mbStartDragCalled
; //< is command startdrag called
141 bool mbNeedSysWindow
; //< set, when FrameSize <= IMPL_MIN_NEEDSYSWIN
142 bool mbMinimized
; //< set, when FrameSize <= 0
143 bool mbStartFocusState
; //< FocusState, when sending the event
144 bool mbInSysObjFocusHdl
; //< within a SysChildren's GetFocus handler
145 bool mbInSysObjToTopHdl
; //< within a SysChildren's ToTop handler
146 bool mbSysObjFocus
; //< does a SysChild have focus
148 css::uno::Reference
< css::datatransfer::dnd::XDragSource
> mxDragSource
;
149 css::uno::Reference
< css::datatransfer::dnd::XDropTarget
> mxDropTarget
;
150 css::uno::Reference
< css::datatransfer::dnd::XDropTargetListener
> mxDropTargetListener
;
151 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> mxClipboard
;
152 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> mxSelection
;
154 bool mbInternalDragGestureRecognizer
;
155 VclPtr
<VirtualDevice
> mpBuffer
; ///< Buffer for the double-buffering
156 bool mbInBufferedPaint
; ///< PaintHelper is in the process of painting into this buffer.
157 tools::Rectangle maBufferedRect
; ///< Rectangle in the buffer that has to be painted to the screen.
159 ImplFrameData( vcl::Window
*pWindow
);
162 struct ImplAccessibleInfos
164 sal_uInt16 nAccessibleRole
;
165 OUString
* pAccessibleName
;
166 OUString
* pAccessibleDescription
;
167 VclPtr
<vcl::Window
> pLabeledByWindow
;
168 VclPtr
<vcl::Window
> pLabelForWindow
;
169 VclPtr
<vcl::Window
> pMemberOfWindow
;
171 ImplAccessibleInfos();
172 ~ImplAccessibleInfos();
175 enum AlwaysInputMode
{ AlwaysInputNone
= 0, AlwaysInputEnabled
= 1, AlwaysInputDisabled
=2 };
177 enum class ImplPaintFlags
{
181 PaintAllChildren
= 0x0004,
182 PaintChildren
= 0x0008,
187 template<> struct typed_flags
<ImplPaintFlags
> : is_typed_flags
<ImplPaintFlags
, 0x003f> {};
194 WindowImpl(const WindowImpl
&) = delete;
195 WindowImpl
& operator=(const WindowImpl
&) = delete;
197 WindowImpl( WindowType
);
200 ImplWinData
* mpWinData
;
201 ImplFrameData
* mpFrameData
;
204 VclPtr
<vcl::Window
> mpFrameWindow
;
205 VclPtr
<vcl::Window
> mpOverlapWindow
;
206 VclPtr
<vcl::Window
> mpBorderWindow
;
207 VclPtr
<vcl::Window
> mpClientWindow
;
208 VclPtr
<vcl::Window
> mpParent
;
209 VclPtr
<vcl::Window
> mpRealParent
;
210 VclPtr
<vcl::Window
> mpFirstChild
;
211 VclPtr
<vcl::Window
> mpLastChild
;
212 VclPtr
<vcl::Window
> mpFirstOverlap
;
213 VclPtr
<vcl::Window
> mpLastOverlap
;
214 VclPtr
<vcl::Window
> mpPrev
;
215 VclPtr
<vcl::Window
> mpNext
;
216 VclPtr
<vcl::Window
> mpNextOverlap
;
217 VclPtr
<vcl::Window
> mpLastFocusWindow
;
218 VclPtr
<vcl::Window
> mpDlgCtrlDownWindow
;
219 std::vector
<Link
<VclWindowEvent
&,void>> maEventListeners
;
220 int mnEventListenersIteratingCount
;
221 std::set
<Link
<VclWindowEvent
&,void>> maEventListenersDeleted
;
222 std::vector
<Link
<VclWindowEvent
&,void>> maChildEventListeners
;
223 int mnChildEventListenersIteratingCount
;
224 std::set
<Link
<VclWindowEvent
&,void>> maChildEventListenersDeleted
;
226 // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
227 css::uno::WeakReference
< css::rendering::XCanvas
> mxCanvas
;
229 vcl::Cursor
* mpCursor
;
233 vcl::Font
* mpControlFont
;
234 Color maControlForeground
;
235 Color maControlBackground
;
236 sal_Int32 mnLeftBorder
;
237 sal_Int32 mnTopBorder
;
238 sal_Int32 mnRightBorder
;
239 sal_Int32 mnBottomBorder
;
240 sal_Int32 mnWidthRequest
;
241 sal_Int32 mnHeightRequest
;
242 sal_Int32 mnOptimalWidthCache
;
243 sal_Int32 mnOptimalHeightCache
;
250 OUString maQuickHelpText
;
252 InputContext maInputContext
;
253 css::uno::Reference
< css::awt::XWindowPeer
> mxWindowPeer
;
254 css::uno::Reference
< css::accessibility::XAccessible
> mxAccessible
;
255 std::shared_ptr
< VclSizeGroup
> m_xSizeGroup
;
256 std::vector
< VclPtr
<FixedText
> > m_aMnemonicLabels
;
257 ImplAccessibleInfos
* mpAccessibleInfos
;
258 VCLXWindow
* mpVCLXWindow
;
259 vcl::Region maWinRegion
; //< region to 'shape' the VCL window (frame coordinates)
260 vcl::Region maWinClipRegion
; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates)
261 vcl::Region maInvalidateRegion
; //< region that has to be redrawn (frame coordinates)
262 vcl::Region
* mpChildClipRegion
; //< child clip region if CLIPCHILDREN is set (frame coordinates)
263 vcl::Region
* mpPaintRegion
; //< only set during Paint() method call (window coordinates)
266 WinBits mnExtendedStyle
;
267 WinBits mnPrevExtendedStyle
;
269 ControlPart mnNativeBackground
;
270 sal_uInt16 mnWaitCount
;
271 ImplPaintFlags mnPaintFlags
;
272 GetFocusFlags mnGetFocusFlags
;
273 ParentClipMode mnParentClipMode
;
274 ActivateModeFlags mnActivateMode
;
275 DialogControlFlags mnDlgCtrlFlags
;
276 sal_uInt16 mnLockCount
;
277 AlwaysInputMode meAlwaysInputMode
;
280 VclPackType mePackType
;
282 sal_Int32 mnGridHeight
;
283 sal_Int32 mnGridLeftAttach
;
284 sal_Int32 mnGridTopAttach
;
285 sal_Int32 mnGridWidth
;
286 sal_Int32 mnBorderWidth
;
287 sal_Int32 mnMarginLeft
;
288 sal_Int32 mnMarginRight
;
289 sal_Int32 mnMarginTop
;
290 sal_Int32 mnMarginBottom
;
308 mbChildPtrOverwrite
:1,
322 mbWaitSystemResize
:1,
323 mbInitWinClipRegion
:1,
328 mbChildTransparent
:1,
329 mbPaintTransparent
:1,
330 mbMouseTransparent
:1,
335 mbNativeFocusVisible
:1,
338 mbControlForeground
:1,
339 mbControlBackground
:1,
342 mbCompoundControlHasFocus
:1,
349 mbCreatedWithToolkit
:1,
352 mbSuppressAccessibilityEvents
:1,
353 mbMenuFloatingWindow
:1,
354 mbDrawSelectionBackground
:1,
355 mbIsInTaskPaneList
:1,
356 mbToolbarFloatingWindow
:1,
357 mbCallHandlersDuringInputDisabled
:1,
366 mbDoubleBufferingRequested
:1;
368 css::uno::Reference
< css::uno::XInterface
> mxDNDListenerContainer
;
371 /// Sets up the buffer to have settings matching the window, and restores the original state in the dtor.
372 class PaintBufferGuard
374 ImplFrameData
* mpFrameData
;
375 VclPtr
<vcl::Window
> m_pWindow
;
377 Wallpaper maBackground
;
378 AllSettings maSettings
;
381 tools::Rectangle m_aPaintRect
;
383 PaintBufferGuard(ImplFrameData
* pFrameData
, vcl::Window
* pWindow
);
385 /// If this is called, then the dtor will also copy rRectangle to the window from the buffer, before restoring the state.
386 void SetPaintRect(const tools::Rectangle
& rRectangle
);
387 /// Returns either the frame's buffer or the window, in case of no buffering.
388 vcl::RenderContext
* GetRenderContext();
393 bool ImplHandleMouseEvent( const VclPtr
<vcl::Window
>& xWindow
, MouseNotifyEvent nSVEvent
, bool bMouseLeave
,
394 long nX
, long nY
, sal_uInt64 nMsgTime
,
395 sal_uInt16 nCode
, MouseEventModifiers nMode
);
396 void ImplHandleResize( vcl::Window
* pWindow
, long nNewWidth
, long nNewHeight
);
398 #endif // INCLUDED_VCL_INC_WINDOW_H
400 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */