Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_INC_WINDOW_H
21 : #define INCLUDED_VCL_INC_WINDOW_H
22 :
23 : #include <com/sun/star/uno/Reference.hxx>
24 : #include <cppuhelper/weakref.hxx>
25 : #include <list>
26 : #include <tools/wintypes.hxx>
27 : #include <vcl/inputctx.hxx>
28 : #include <vcl/outdev.hxx>
29 : #include <vcl/pointr.hxx>
30 : #include <vcl/salnativewidgets.hxx>
31 : #include <vcl/timer.hxx>
32 : #include <vcl/vclevent.hxx>
33 : #include <vector>
34 :
35 : struct SalPaintEvent;
36 : struct ImplDelData;
37 : struct ImplAccessibleInfos;
38 :
39 : class FixedText;
40 : class Window;
41 : class VclSizeGroup;
42 : class VirtualDevice;
43 : class Cursor;
44 : class PhysicalFontCollection;
45 : class ImplFontCache;
46 : class VCLXWindow;
47 : class SalFrame;
48 : class SalObject;
49 :
50 : namespace com {
51 : namespace sun {
52 : namespace star {
53 : namespace accessibility {
54 : class XAccessible;
55 : }}}}
56 :
57 : namespace com {
58 : namespace sun {
59 : namespace star {
60 : namespace rendering {
61 : class XCanvas;
62 : }}}}
63 :
64 : namespace com {
65 : namespace sun {
66 : namespace star {
67 : namespace awt {
68 : class XWindowPeer;
69 : class XWindow;
70 : }
71 : namespace uno {
72 : class Any;
73 : class XInterface;
74 : }
75 : namespace datatransfer {
76 : namespace clipboard {
77 : class XClipboard;
78 : }
79 :
80 : namespace dnd {
81 : class XDropTargetListener;
82 : class XDragGestureRecognizer;
83 : class XDragSource;
84 : class XDropTarget;
85 : } } } } }
86 :
87 : namespace vcl {
88 : struct ControlLayoutData;
89 : }
90 :
91 : bool ImplWindowFrameProc( Window* pInst, SalFrame* pFrame, sal_uInt16 nEvent, const void* pEvent );
92 :
93 : #define WINDOW_HITTEST_INSIDE ((sal_uInt16)0x0001)
94 : #define WINDOW_HITTEST_TRANSPARENT ((sal_uInt16)0x0002)
95 :
96 0 : struct ImplWinData
97 : {
98 : OUString* mpExtOldText;
99 : sal_uInt16* mpExtOldAttrAry;
100 : Rectangle* mpCursorRect;
101 : long mnCursorExtWidth;
102 : bool mbVertical;
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< Window* >
112 : maTopWindowChildren;
113 : };
114 :
115 : struct ImplOverlapData
116 : {
117 : VirtualDevice* mpSaveBackDev; // saved background bitmap
118 : Region* mpSaveBackRgn; // saved region, which must be invalidated
119 : Window* mpNextBackWin; // next window with saved background
120 : sal_uIntPtr mnSaveBackSize; // bitmap size of saved background
121 : bool mbSaveBack; // sal_True: save background
122 : sal_uInt8 mnTopLevel; // Level for Overlap-Window
123 : };
124 :
125 0 : struct ImplFrameData
126 : {
127 : Timer maPaintTimer; // paint timer
128 : Timer maResizeTimer; // resize timer
129 : InputContext maOldInputContext; // last set Input Context
130 : Window* mpNextFrame; // next frame window
131 : Window* mpFirstOverlap; // first overlap window
132 : Window* mpFocusWin; // focus window (is also set, when frame doesn't have the focous)
133 : Window* mpMouseMoveWin; // last window, where MouseMove() called
134 : Window* mpMouseDownWin; // last window, where MouseButtonDown() called
135 : Window* mpFirstBackWin; // first overlap-window with saved background
136 : ::std::vector<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 : sal_uIntPtr mnFocusId; // FocusId for PostUserLink
144 : sal_uIntPtr 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_uIntPtr 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 : sal_uInt16 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
170 :
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;
176 :
177 : bool mbInternalDragGestureRecognizer;
178 : };
179 :
180 : struct ImplAccessibleInfos
181 : {
182 : sal_uInt16 nAccessibleRole;
183 : OUString* pAccessibleName;
184 : OUString* pAccessibleDescription;
185 : Window* pLabeledByWindow;
186 : Window* pLabelForWindow;
187 : Window* pMemberOfWindow;
188 :
189 : ImplAccessibleInfos();
190 : ~ImplAccessibleInfos();
191 : };
192 :
193 : enum AlwaysInputMode { AlwaysInputNone = 0, AlwaysInputEnabled = 1, AlwaysInputDisabled =2 };
194 :
195 : class WindowImpl
196 : {
197 : public:
198 : WindowImpl( WindowType );
199 : ~WindowImpl();
200 :
201 : ImplWinData* mpWinData;
202 : ImplOverlapData* mpOverlapData;
203 : ImplFrameData* mpFrameData;
204 : SalFrame* mpFrame;
205 : SalObject* mpSysObj;
206 : Window* mpFrameWindow;
207 : Window* mpOverlapWindow;
208 : Window* mpBorderWindow;
209 : Window* mpClientWindow;
210 : Window* mpParent;
211 : Window* mpRealParent;
212 : Window* mpFirstChild;
213 : Window* mpLastChild;
214 : Window* mpFirstOverlap;
215 : Window* mpLastOverlap;
216 : Window* mpPrev;
217 : Window* mpNext;
218 : Window* mpNextOverlap;
219 : Window* mpLastFocusWindow;
220 : Window* mpDlgCtrlDownWindow;
221 : VclEventListeners maEventListeners;
222 : VclEventListeners maChildEventListeners;
223 :
224 : // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
225 : ::com::sun::star::uno::WeakReference< ::com::sun::star::rendering::XCanvas > mxCanvas;
226 :
227 : ImplDelData* mpFirstDel;
228 : void* mpUserData;
229 : Cursor* mpCursor;
230 : Pointer maPointer;
231 : Fraction maZoom;
232 : OUString maText;
233 : 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 : long mnX;
243 : long mnY;
244 : long mnAbsScreenX;
245 : Point maPos;
246 : OString maHelpId;
247 : OString maUniqId;
248 : OUString maHelpText;
249 : OUString maQuickHelpText;
250 : InputContext maInputContext;
251 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxWindowPeer;
252 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
253 : ::boost::shared_ptr< VclSizeGroup > m_xSizeGroup;
254 : ::std::vector< FixedText* > m_aMnemonicLabels;
255 : ImplAccessibleInfos* mpAccessibleInfos;
256 : VCLXWindow* mpVCLXWindow;
257 : Region maWinRegion; // region to 'shape' the VCL window (frame coordinates)
258 : Region maWinClipRegion; // the (clipping) region that finally corresponds to the VCL window (frame coordinates)
259 : Region maInvalidateRegion; // region that has to be redrawn (frame coordinates)
260 : Region* mpChildClipRegion; // child clip region if CLIPCHILDREN is set (frame coordinates)
261 : Region* mpPaintRegion; // only set during Paint() method call (window coordinates)
262 : WinBits mnStyle;
263 : WinBits mnPrevStyle;
264 : WinBits mnExtendedStyle;
265 : WinBits mnPrevExtendedStyle;
266 : WindowType mnType;
267 : ControlPart mnNativeBackground;
268 : sal_uInt16 mnWaitCount;
269 : sal_uInt16 mnPaintFlags;
270 : sal_uInt16 mnGetFocusFlags;
271 : sal_uInt16 mnParentClipMode;
272 : sal_uInt16 mnActivateMode;
273 : sal_uInt16 mnDlgCtrlFlags;
274 : sal_uInt16 mnLockCount;
275 : AlwaysInputMode meAlwaysInputMode;
276 : VclAlign meHalign;
277 : VclAlign meValign;
278 : VclPackType mePackType;
279 : sal_Int32 mnPadding;
280 : sal_Int32 mnGridHeight;
281 : sal_Int32 mnGridLeftAttach;
282 : sal_Int32 mnGridTopAttach;
283 : sal_Int32 mnGridWidth;
284 : sal_Int32 mnBorderWidth;
285 : sal_Int32 mnMarginLeft;
286 : sal_Int32 mnMarginRight;
287 : sal_Int32 mnMarginTop;
288 : sal_Int32 mnMarginBottom;
289 : bool mbFrame:1,
290 : mbBorderWin:1,
291 : mbOverlapWin:1,
292 : mbSysWin:1,
293 : mbDialog:1,
294 : mbDockWin:1,
295 : mbFloatWin:1,
296 : mbPushButton:1,
297 : mbVisible:1,
298 : mbDisabled:1,
299 : mbInputDisabled:1,
300 : mbDropDisabled:1,
301 : mbNoUpdate:1,
302 : mbNoParentUpdate:1,
303 : mbActive:1,
304 : mbParentActive:1,
305 : mbReallyVisible:1,
306 : mbReallyShown:1,
307 : mbInInitShow:1,
308 : mbChildNotify:1,
309 : mbChildPtrOverwrite:1,
310 : mbNoPtrVisible:1,
311 : mbPaintFrame:1,
312 : mbInPaint:1,
313 : mbMouseMove:1,
314 : mbMouseButtonDown:1,
315 : mbMouseButtonUp:1,
316 : mbKeyInput:1,
317 : mbKeyUp:1,
318 : mbCommand:1,
319 : mbDefPos:1,
320 : mbDefSize:1,
321 : mbCallMove:1,
322 : mbCallResize:1,
323 : mbWaitSystemResize:1,
324 : mbInitWinClipRegion:1,
325 : mbInitChildRegion:1,
326 : mbWinRegion:1,
327 : mbClipChildren:1,
328 : mbClipSiblings:1,
329 : mbChildTransparent:1,
330 : mbPaintTransparent:1,
331 : mbMouseTransparent:1,
332 : mbDlgCtrlStart:1,
333 : mbFocusVisible:1,
334 : mbTrackVisible:1,
335 : mbUseNativeFocus:1,
336 : mbNativeFocusVisible:1,
337 : mbInShowFocus:1,
338 : mbInHideFocus:1,
339 : mbControlForeground:1,
340 : mbControlBackground:1,
341 : mbAlwaysOnTop:1,
342 : mbCompoundControl:1,
343 : mbCompoundControlHasFocus:1,
344 : mbPaintDisabled:1,
345 : mbAllResize:1,
346 : mbInDtor:1,
347 : mbExtTextInput:1,
348 : mbInFocusHdl:1,
349 : mbOverlapVisible:1,
350 : mbCreatedWithToolkit:1,
351 : mbToolBox:1,
352 : mbSplitter:1,
353 : mbSuppressAccessibilityEvents:1,
354 : mbMenuFloatingWindow:1,
355 : mbDrawSelectionBackground:1,
356 : mbIsInTaskPaneList:1,
357 : mbToolbarFloatingWindow:1,
358 : mbCallHandlersDuringInputDisabled:1,
359 : mbHelpTextDynamic:1,
360 : mbFakeFocusSet:1,
361 : mbHexpand:1,
362 : mbVexpand:1,
363 : mbExpand:1,
364 : mbFill:1,
365 : mbSecondary:1,
366 : mbNonHomogeneous:1;
367 :
368 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxDNDListenerContainer;
369 : };
370 :
371 : // helper methods
372 :
373 : bool ImplHandleMouseEvent( Window* pWindow, sal_uInt16 nSVEvent, bool bMouseLeave,
374 : long nX, long nY, sal_uIntPtr nMsgTime,
375 : sal_uInt16 nCode, sal_uInt16 nMode );
376 : void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight );
377 :
378 : #endif // INCLUDED_VCL_INC_WINDOW_H
379 :
380 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|