Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / window.hxx
blobae289400197459ce6db01ac069a4bcf979e00cdd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_WINDOW_HXX
21 #define INCLUDED_VCL_WINDOW_HXX
23 #include <config_features.h>
24 #include <tools/solar.h>
25 #include <vcl/dllapi.h>
26 #include <vcl/outdev.hxx>
27 #include <tools/resid.hxx>
28 #include <vcl/pointr.hxx>
29 #include <tools/wintypes.hxx>
30 #include <rsc/rsc-vcl-shared-types.hxx>
31 #include <vcl/apptypes.hxx>
32 #include <vcl/cursor.hxx>
33 #include <vcl/inputctx.hxx>
34 #include <vcl/keycodes.hxx>
35 #include <vcl/region.hxx>
36 #include <vcl/salnativewidgets.hxx>
37 #include <rtl/ustring.hxx>
38 #include <rtl/ref.hxx>
39 #include <cppuhelper/weakref.hxx>
40 #include <com/sun/star/uno/Reference.hxx>
41 #include <memory>
43 class VirtualDevice;
44 struct ImplDelData;
45 struct ImplSVEvent;
46 struct ImplWinData;
47 struct ImplFrameData;
48 struct ImplCalcToTopData;
49 struct SystemEnvData;
50 struct SystemParentData;
51 class ImplBorderWindow;
52 class Idle;
53 class Timer;
54 class DockingManager;
55 class ScrollBar;
56 class Bitmap;
57 class FixedText;
58 class Image;
59 class MouseEvent;
60 class KeyEvent;
61 class CommandEvent;
62 class TrackingEvent;
63 class HelpEvent;
64 class DataChangedEvent;
65 class VclSimpleEvent;
66 class NotifyEvent;
67 class SystemWindow;
68 class SalFrame;
69 class MenuFloatingWindow;
70 class VCLXWindow;
72 namespace com { namespace sun { namespace star {
73 namespace accessibility {
74 class XAccessible;
76 namespace beans {
77 struct PropertyValue;
79 namespace rendering {
80 class XCanvas;
81 class XSpriteCanvas;
83 namespace awt {
84 class XWindowPeer;
85 class XWindow;
87 namespace uno {
88 class Any;
89 class XInterface;
91 namespace datatransfer { namespace clipboard {
92 class XClipboard;
94 namespace dnd {
95 class XDragGestureRecognizer;
96 class XDragSource;
97 class XDropTarget;
98 }}}}}
100 namespace vcl {
101 struct ControlLayoutData;
102 class RenderSettings;
105 namespace svt { class PopupWindowControllerImpl; }
107 template<class T> class VclPtr;
109 enum class TrackingEventFlags
111 NONE = 0x0000,
112 Cancel = 0x0001,
113 Key = 0x0002,
114 Focus = 0x0004,
115 Repeat = 0x0100,
116 End = 0x1000,
117 DontCallHdl = 0x8000,
119 namespace o3tl
121 template<> struct typed_flags<TrackingEventFlags> : is_typed_flags<TrackingEventFlags, 0x9107> {};
125 // - WindowTypes -
128 // Type fuer GetWindow()
129 enum class GetWindowType
131 Parent = 0,
132 FirstChild = 1,
133 LastChild = 2,
134 Prev = 3,
135 Next = 4,
136 FirstOverlap = 5,
137 LastOverlap = 6,
138 Overlap = 7,
139 ParentOverlap = 8,
140 Client = 9,
141 RealParent = 10,
142 Frame = 11,
143 Border = 12,
144 FirstTopWindowChild = 13,
145 LastTopWindowChild = 14,
146 PrevTopWindowSibling = 15,
147 NextTopWindowSibling = 16,
150 // Flags for setPosSizePixel()
151 // These must match the definitions in css::awt::PosSize
152 enum class PosSizeFlags
154 NONE = 0x0000,
155 X = 0x0001,
156 Y = 0x0002,
157 Width = 0x0004,
158 Height = 0x0008,
159 Pos = X | Y,
160 Size = Width | Height,
161 PosSize = Pos | Size,
162 All = PosSize,
163 Dropdown = 0x0010,
165 namespace o3tl
167 template<> struct typed_flags<PosSizeFlags> : is_typed_flags<PosSizeFlags, 0x001f> {};
170 // Flags for Show()
171 #define SHOW_NOPARENTUPDATE ((sal_uInt16)0x0001)
172 #define SHOW_NOFOCUSCHANGE ((sal_uInt16)0x0002)
173 #define SHOW_NOACTIVATE ((sal_uInt16)0x0004)
174 #define SHOW_FOREGROUNDTASK ((sal_uInt16)0x0008)
176 // Flags for SetZOrder()
177 #define WINDOW_ZORDER_BEFOR ((sal_uInt16)0x0001)
178 #define WINDOW_ZORDER_BEHIND ((sal_uInt16)0x0002)
179 #define WINDOW_ZORDER_FIRST ((sal_uInt16)0x0004)
180 #define WINDOW_ZORDER_LAST ((sal_uInt16)0x0008)
182 // Activate-Flags
183 #define ACTIVATE_MODE_GRABFOCUS ((sal_uInt16)0x0001)
185 // ToTop-Flags
186 #define TOTOP_RESTOREWHENMIN ((sal_uInt16)0x0001)
187 #define TOTOP_FOREGROUNDTASK ((sal_uInt16)0x0002)
188 #define TOTOP_NOGRABFOCUS ((sal_uInt16)0x0004)
189 #define TOTOP_GRABFOCUSONLY ((sal_uInt16)0x0008)
191 // Flags for Invalidate
192 #define INVALIDATE_CHILDREN ((sal_uInt16)0x0001)
193 #define INVALIDATE_NOCHILDREN ((sal_uInt16)0x0002)
194 #define INVALIDATE_NOERASE ((sal_uInt16)0x0004)
195 #define INVALIDATE_UPDATE ((sal_uInt16)0x0008)
196 #define INVALIDATE_TRANSPARENT ((sal_uInt16)0x0010)
197 #define INVALIDATE_NOTRANSPARENT ((sal_uInt16)0x0020)
198 #define INVALIDATE_NOCLIPCHILDREN ((sal_uInt16)0x4000)
199 // Temporaer fuer Kompatibilitaet
200 #define INVALIDATE_BACKGROUND INVALIDATE_TRANSPARENT
202 // Flags for Validate
203 #define VALIDATE_CHILDREN ((sal_uInt16)0x0001)
204 #define VALIDATE_NOCHILDREN ((sal_uInt16)0x0002)
206 // Flags for Scroll
207 #define SCROLL_CLIP ((sal_uInt16)0x0001)
208 #define SCROLL_CHILDREN ((sal_uInt16)0x0002)
209 #define SCROLL_NOCHILDREN ((sal_uInt16)0x0004)
210 #define SCROLL_NOERASE ((sal_uInt16)0x0008)
211 #define SCROLL_NOINVALIDATE ((sal_uInt16)0x0010)
212 #define SCROLL_NOWINDOWINVALIDATE ((sal_uInt16)0x0020)
213 #define SCROLL_USECLIPREGION ((sal_uInt16)0x0040)
214 #define SCROLL_UPDATE ((sal_uInt16)0x0080)
216 // Flags for ParentClipMode
217 #define PARENTCLIPMODE_CLIP ((sal_uInt16)0x0001)
218 #define PARENTCLIPMODE_NOCLIP ((sal_uInt16)0x0002)
220 // Flags for ShowTracking()
221 #define SHOWTRACK_SMALL ((sal_uInt16)0x0001)
222 #define SHOWTRACK_BIG ((sal_uInt16)0x0002)
223 #define SHOWTRACK_SPLIT ((sal_uInt16)0x0003)
224 #define SHOWTRACK_OBJECT ((sal_uInt16)0x0004)
225 #define SHOWTRACK_WINDOW ((sal_uInt16)0x1000)
226 #define SHOWTRACK_CLIP ((sal_uInt16)0x2000)
227 #define SHOWTRACK_STYLE ((sal_uInt16)0x000F)
229 // Flags for StartTracking()
230 #define STARTTRACK_KEYINPUT ((sal_uInt16)0x0001)
231 #define STARTTRACK_KEYMOD ((sal_uInt16)0x0002)
232 #define STARTTRACK_NOKEYCANCEL ((sal_uInt16)0x0004)
233 #define STARTTRACK_SCROLLREPEAT ((sal_uInt16)0x0008)
234 #define STARTTRACK_BUTTONREPEAT ((sal_uInt16)0x0010)
235 #define STARTTRACK_MOUSEBUTTONDOWN ((sal_uInt16)0x0020)
236 #define STARTTRACK_FOCUSCANCEL ((sal_uInt16)0x0040)
238 // Flags for StartAutoScroll()
239 #define AUTOSCROLL_VERT ((sal_uInt16)0x0001)
240 #define AUTOSCROLL_HORZ ((sal_uInt16)0x0002)
242 // Flags for StateChanged()
243 enum class StateChangedType : sal_uInt16
245 InitShow = 1,
246 Visible = 2,
247 UpdateMode = 3,
248 Enable = 4,
249 Text = 5,
250 Image = 6,
251 Data = 7,
252 State = 8,
253 Style = 9,
254 Zoom = 10,
255 Border = 11,
256 Transparent = 12,
257 ControlFont = 13,
258 ControlForeground = 14,
259 ControlBackground = 15,
260 ReadOnly = 16,
261 ExtendedStyle = 17,
262 Mirroring = 18,
263 Layout = 19,
264 ControlFocus = 20,
265 User = 10000
268 // GetFocusFlags
269 #define GETFOCUS_TAB ((sal_uInt16)0x0001)
270 #define GETFOCUS_CURSOR ((sal_uInt16)0x0002)
271 #define GETFOCUS_MNEMONIC ((sal_uInt16)0x0004)
272 #define GETFOCUS_F6 ((sal_uInt16)0x0008)
273 #define GETFOCUS_FORWARD ((sal_uInt16)0x0010)
274 #define GETFOCUS_BACKWARD ((sal_uInt16)0x0020)
275 #define GETFOCUS_AROUND ((sal_uInt16)0x0040)
276 #define GETFOCUS_UNIQUEMNEMONIC ((sal_uInt16)0x0100)
277 #define GETFOCUS_INIT ((sal_uInt16)0x0200)
278 #define GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0400)
281 // Draw-Flags fuer Draw()
282 #define WINDOW_DRAW_MONO ((sal_uLong)0x00000001)
283 #define WINDOW_DRAW_NOBORDER ((sal_uLong)0x00000002)
284 #define WINDOW_DRAW_NOCONTROLS ((sal_uLong)0x00000004)
285 #define WINDOW_DRAW_NODISABLE ((sal_uLong)0x00000008)
286 #define WINDOW_DRAW_NOMNEMONIC ((sal_uLong)0x00000010)
287 #define WINDOW_DRAW_NOSELECTION ((sal_uLong)0x00000020)
288 #define WINDOW_DRAW_NOFOCUS ((sal_uLong)0x00000040)
289 #define WINDOW_DRAW_NOBACKGROUND ((sal_uLong)0x00000080)
290 #define WINDOW_DRAW_ROLLOVER ((sal_uLong)0x00000100)
292 // DialogControl-Flags
293 #define WINDOW_DLGCTRL_RETURN ((sal_uInt16)0x0001)
294 #define WINDOW_DLGCTRL_WANTFOCUS ((sal_uInt16)0x0002)
295 #define WINDOW_DLGCTRL_MOD1TAB ((sal_uInt16)0x0004)
296 #define WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0008)
298 // GetWindowClipRegionPixel-Flags
299 #define WINDOW_GETCLIPREGION_NULL ((sal_uInt16)0x0001)
300 #define WINDOW_GETCLIPREGION_NOCHILDREN ((sal_uInt16)0x0002)
302 // EndExtTextInput-Flags
303 #define EXTTEXTINPUT_END_COMPLETE ((sal_uInt16)0x0001)
304 #define EXTTEXTINPUT_END_CANCEL ((sal_uInt16)0x0002)
306 #define IMPL_MINSIZE_BUTTON_WIDTH 70
307 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
308 #define IMPL_EXTRA_BUTTON_WIDTH 18
309 #define IMPL_EXTRA_BUTTON_HEIGHT 10
310 #define IMPL_SEP_BUTTON_X 5
311 #define IMPL_SEP_BUTTON_Y 5
312 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
313 #define IMPL_DIALOG_OFFSET 5
314 #define IMPL_DIALOG_BAR_OFFSET 3
315 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
316 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
317 #define IMPL_SEP_MSGBOX_IMAGE 8
319 #define DLGWINDOW_PREV 0
320 #define DLGWINDOW_NEXT 1
321 #define DLGWINDOW_FIRST 2
324 // - Window -
327 #ifdef DBG_UTIL
328 const char* ImplDbgCheckWindow( const void* pObj );
329 #endif
331 inline bool ImplDoTiledRendering()
333 #if !HAVE_FEATURE_DESKTOP && !defined(ANDROID)
334 // We do tiled rendering only for iOS at the moment, actually, but
335 // let's see what happens if we assume it for Android, too.
336 // (That comment doesn't match what the code does, does it?)
337 return true;
338 #else
339 // We need some way to know globally if this process will use
340 // tiled rendering or not. Or should this be a per-window setting?
341 // Or what?
342 return false;
343 #endif
348 namespace vcl { class Window; }
349 vcl::Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos );
351 namespace vcl { class Cursor; }
352 class Dialog;
353 class WindowImpl;
354 class PaintHelper;
355 class VclBuilder;
356 class VclSizeGroup;
357 class OutputDevice;
358 class Application;
359 class SystemWindow;
360 class WorkWindow;
361 class Dialog;
362 class MessBox;
363 class DockingWindow;
364 class FloatingWindow;
365 class GroupBox;
366 class PushButton;
367 class RadioButton;
368 class SystemChildWindow;
369 class ImplBorderWindow;
370 class VclBuilder;
371 class ImplDockingWindowWrapper;
372 class ImplPopupFloatWin;
373 class MenuFloatingWindow;
374 class LifecycleTest;
376 namespace svt { class PopupWindowControllerImpl; }
378 struct WindowResHeader
380 sal_uLong nObjMask;
381 OString aHelpId;
382 sal_uLong nRSStyle;
385 namespace vcl {
387 class VCL_DLLPUBLIC RenderTools
389 public:
390 // transparent background for selected or checked items in toolboxes etc.
391 // + selection Color with a text color complementing the selection background
392 // + rounded edge
393 static void DrawSelectionBackground(vcl::RenderContext& rRenderContext, vcl::Window& rWindow,
394 const Rectangle& rRect, sal_uInt16 nHighlight,
395 bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly,
396 Color* pSelectionTextColor = nullptr, long nCornerRadius = 0,
397 Color* pPaintColor = nullptr);
400 class VCL_DLLPUBLIC Window : public ::OutputDevice, public Resource
402 friend class ::vcl::Cursor;
403 friend class ::OutputDevice;
404 friend class ::Application;
405 friend class ::SystemWindow;
406 friend class ::WorkWindow;
407 friend class ::Dialog;
408 friend class ::MessBox;
409 friend class ::DockingWindow;
410 friend class ::FloatingWindow;
411 friend class ::GroupBox;
412 friend class ::PushButton;
413 friend class ::RadioButton;
414 friend class ::SystemChildWindow;
415 friend class ::ImplBorderWindow;
416 friend class ::VclBuilder;
417 friend class ::PaintHelper;
418 friend class ::LifecycleTest;
420 // TODO: improve missing functionality
421 // only required because of SetFloatingMode()
422 friend class ::ImplDockingWindowWrapper;
423 friend class ::ImplPopupFloatWin;
424 friend class ::MenuFloatingWindow;
426 friend class ::svt::PopupWindowControllerImpl;
428 private:
429 // NOTE: to remove many dependencies of other modules
430 // to this central file, all members are now hidden
431 // in the WindowImpl class and all inline functions
432 // were removed.
433 // (WindowImpl is a pImpl pattern)
435 // Please do *not* add new members or inline functions to class Window,
436 // but use class WindowImpl instead
438 WindowImpl* mpWindowImpl;
440 #ifdef DBG_UTIL
441 friend const char* ::ImplDbgCheckWindow( const void* pObj );
442 #endif
443 friend vcl::Window* ::ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos );
445 public:
447 DECL_DLLPRIVATE_LINK_TYPED( ImplHandlePaintHdl, Idle*, void );
448 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl, void* );
449 DECL_DLLPRIVATE_LINK_TYPED( ImplTrackTimerHdl, Timer*, void );
450 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl, void* );
451 DECL_DLLPRIVATE_LINK_TYPED( ImplHandleResizeTimerHdl, Idle*, void );
452 DECL_DLLPRIVATE_LINK( ImplHideOwnerDrawWindowsHdl, void* );
455 SAL_DLLPRIVATE static void ImplInitAppFontData( vcl::Window* pWindow );
457 SAL_DLLPRIVATE vcl::Window* ImplGetFrameWindow() const;
458 SalFrame* ImplGetFrame() const;
459 SAL_DLLPRIVATE ImplFrameData* ImplGetFrameData();
461 SAL_DLLPRIVATE vcl::Window* ImplGetWindow();
462 SAL_DLLPRIVATE ImplWinData* ImplGetWinData() const;
463 SAL_DLLPRIVATE vcl::Window* ImplGetClientWindow() const;
464 SAL_DLLPRIVATE vcl::Window* ImplGetDlgWindow( sal_uInt16 n, sal_uInt16 nType, sal_uInt16 nStart = 0, sal_uInt16 nEnd = 0xFFFF, sal_uInt16* pIndex = NULL );
465 SAL_DLLPRIVATE vcl::Window* ImplGetParent() const;
466 SAL_DLLPRIVATE vcl::Window* ImplFindWindow( const Point& rFramePos );
468 SAL_DLLPRIVATE void ImplInvalidateFrameRegion( const vcl::Region* pRegion, sal_uInt16 nFlags );
469 SAL_DLLPRIVATE void ImplInvalidateOverlapFrameRegion( const vcl::Region& rRegion );
471 SAL_DLLPRIVATE bool ImplSetClipFlag( bool bSysObjOnlySmaller = false );
473 SAL_DLLPRIVATE bool ImplIsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
474 SAL_DLLPRIVATE bool ImplIsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
475 SAL_DLLPRIVATE bool ImplIsFloatingWindow() const;
476 SAL_DLLPRIVATE bool ImplIsPushButton() const;
477 SAL_DLLPRIVATE bool ImplIsSplitter() const;
478 SAL_DLLPRIVATE bool ImplIsOverlapWindow() const;
480 SAL_DLLPRIVATE void ImplIsInTaskPaneList( bool mbIsInTaskList );
482 SAL_DLLPRIVATE WindowImpl* ImplGetWindowImpl() const { return mpWindowImpl; }
484 SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos );
486 SAL_DLLPRIVATE void ImplGrabFocus( sal_uInt16 nFlags );
487 SAL_DLLPRIVATE void ImplGrabFocusToDocument( sal_uInt16 nFlags );
488 SAL_DLLPRIVATE void ImplInvertFocus( const Rectangle& rRect );
490 SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const;
491 SAL_DLLPRIVATE void ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged = false );
492 SAL_DLLPRIVATE void ImplGenerateMouseMove();
494 SAL_DLLPRIVATE void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt );
495 SAL_DLLPRIVATE void ImplNotifyIconifiedState( bool bIconified );
497 SAL_DLLPRIVATE void ImplUpdateAll( bool bOverlapWindows = true );
499 SAL_DLLPRIVATE void ImplDeleteOverlapBackground();
501 SAL_DLLPRIVATE void ImplControlFocus( sal_uInt16 nFlags = 0 );
503 SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const;
505 SAL_DLLPRIVATE void ImplPosSizeWindow( long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags );
507 SAL_DLLPRIVATE void ImplAddDel( ImplDelData* pDel );
508 SAL_DLLPRIVATE void ImplRemoveDel( ImplDelData* pDel );
510 SAL_DLLPRIVATE void ImplCallResize();
511 SAL_DLLPRIVATE void ImplCallMove();
513 SAL_DLLPRIVATE void ImplIncModalCount();
514 SAL_DLLPRIVATE void ImplDecModalCount();
516 SAL_DLLPRIVATE static void ImplCalcSymbolRect( Rectangle& rRect );
518 protected:
520 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
521 virtual void dispose() SAL_OVERRIDE;
523 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData );
525 SAL_DLLPRIVATE Point ImplOutputToFrame( const Point& rPos );
527 SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( vcl::Region& rRegion );
528 SAL_DLLPRIVATE void ImplValidateFrameRegion( const vcl::Region* rRegion, sal_uInt16 nFlags );
529 SAL_DLLPRIVATE void ImplValidate( const vcl::Region* rRegion, sal_uInt16 nFlags );
530 SAL_DLLPRIVATE void ImplMoveInvalidateRegion( const Rectangle& rRect, long nHorzScroll, long nVertScroll, bool bChildren );
531 SAL_DLLPRIVATE void ImplMoveAllInvalidateRegions( const Rectangle& rRect, long nHorzScroll, long nVertScroll, bool bChildren );
533 SAL_DLLPRIVATE vcl::Window* ImplGetBorderWindow() const;
535 SAL_DLLPRIVATE void ImplInvalidate( const vcl::Region* rRegion, sal_uInt16 nFlags );
537 SAL_DLLPRIVATE sal_uInt16 ImplHitTest( const Point& rFramePos );
539 SAL_DLLPRIVATE void ImplSetMouseTransparent( bool bTransparent );
541 SAL_DLLPRIVATE void ImplScroll( const Rectangle& rRect, long nHorzScroll, long nVertScroll, sal_uInt16 nFlags );
543 SAL_DLLPRIVATE void ImplSaveOverlapBackground();
544 SAL_DLLPRIVATE bool ImplRestoreOverlapBackground( vcl::Region& rInvRegion );
545 SAL_DLLPRIVATE void ImplInvalidateAllOverlapBackgrounds();
547 SAL_DLLPRIVATE bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller = false );
548 SAL_DLLPRIVATE bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller = false );
550 SAL_DLLPRIVATE WinBits ImplInitRes( const ResId& rResId );
551 SAL_DLLPRIVATE WindowResHeader ImplLoadResHeader( const ResId& rResId );
552 SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
554 SAL_DLLPRIVATE void PushPaintHelper(PaintHelper* pHelper, vcl::RenderContext& rRenderContext);
555 SAL_DLLPRIVATE void PopPaintHelper(PaintHelper* pHelper);
557 private:
559 SAL_DLLPRIVATE void ImplInitWindowData( WindowType nType );
561 SAL_DLLPRIVATE void getFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
562 OutputDevice& rOutDev );
565 SAL_DLLPRIVATE void drawFrameDev( const Point& rPt, const Point& rDevPt, const Size& rDevSize,
566 const OutputDevice& rOutDev, const vcl::Region& rRegion );
568 SAL_DLLPRIVATE void ImplSetFrameParent( const vcl::Window* pParent );
570 SAL_DLLPRIVATE void ImplInsertWindow( vcl::Window* pParent );
571 SAL_DLLPRIVATE void ImplRemoveWindow( bool bRemoveFrameData );
573 SAL_DLLPRIVATE SalGraphics* ImplGetFrameGraphics() const;
575 SAL_DLLPRIVATE void ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow, vcl::Window* pOldOverlapWindow );
576 SAL_DLLPRIVATE vcl::Window* ImplGetFirstOverlapWindow();
577 SAL_DLLPRIVATE const vcl::Window* ImplGetFirstOverlapWindow() const;
579 SAL_DLLPRIVATE bool ImplIsRealParentPath( const vcl::Window* pWindow ) const;
581 SAL_DLLPRIVATE bool ImplTestMousePointerSet();
583 SAL_DLLPRIVATE void ImplResetReallyVisible();
584 SAL_DLLPRIVATE void ImplSetReallyVisible();
586 SAL_DLLPRIVATE void ImplCallInitShow();
588 SAL_DLLPRIVATE void ImplInitResolutionSettings();
590 SAL_DLLPRIVATE void ImplPointToLogic(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const;
591 SAL_DLLPRIVATE void ImplLogicToPoint(vcl::RenderContext& rRenderContext, vcl::Font& rFont) const;
593 SAL_DLLPRIVATE bool ImplSysObjClip( const vcl::Region* pOldRegion );
594 SAL_DLLPRIVATE void ImplUpdateSysObjChildrenClip();
595 SAL_DLLPRIVATE void ImplUpdateSysObjOverlapsClip();
596 SAL_DLLPRIVATE void ImplUpdateSysObjClip();
598 SAL_DLLPRIVATE void ImplIntersectWindowClipRegion( vcl::Region& rRegion );
599 SAL_DLLPRIVATE void ImplIntersectWindowRegion( vcl::Region& rRegion );
600 SAL_DLLPRIVATE void ImplExcludeWindowRegion( vcl::Region& rRegion );
601 SAL_DLLPRIVATE void ImplExcludeOverlapWindows( vcl::Region& rRegion );
602 SAL_DLLPRIVATE void ImplExcludeOverlapWindows2( vcl::Region& rRegion );
604 SAL_DLLPRIVATE void ImplClipBoundaries( vcl::Region& rRegion, bool bThis, bool bOverlaps );
605 SAL_DLLPRIVATE bool ImplClipChildren( vcl::Region& rRegion );
606 SAL_DLLPRIVATE void ImplClipAllChildren( vcl::Region& rRegion );
607 SAL_DLLPRIVATE void ImplClipSiblings( vcl::Region& rRegion );
609 SAL_DLLPRIVATE void ImplInitWinClipRegion();
610 SAL_DLLPRIVATE void ImplInitWinChildClipRegion();
611 SAL_DLLPRIVATE vcl::Region* ImplGetWinChildClipRegion();
613 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows( const vcl::Region& rInterRegion, vcl::Region& rRegion );
614 SAL_DLLPRIVATE void ImplIntersectAndUnionOverlapWindows2( const vcl::Region& rInterRegion, vcl::Region& rRegion );
615 SAL_DLLPRIVATE void ImplCalcOverlapRegionOverlaps( const vcl::Region& rInterRegion, vcl::Region& rRegion );
616 SAL_DLLPRIVATE void ImplCalcOverlapRegion( const Rectangle& rSourceRect, vcl::Region& rRegion,
617 bool bChildren, bool bParent, bool bSiblings );
619 /** Invoke the actual painting.
621 This function is kind of recursive - it may be called from the
622 PaintHelper destructor; and on the other hand it creates PaintHelper
623 that (when destructed) calls other ImplCallPaint()'s.
625 SAL_DLLPRIVATE void ImplCallPaint(const vcl::Region* pRegion, sal_uInt16 nPaintFlags);
627 SAL_DLLPRIVATE void ImplCallOverlapPaint();
628 SAL_DLLPRIVATE void ImplPostPaint();
630 SAL_DLLPRIVATE void ImplUpdateWindowPtr( vcl::Window* pWindow );
631 SAL_DLLPRIVATE void ImplUpdateWindowPtr();
632 SAL_DLLPRIVATE void ImplUpdateOverlapWindowPtr( bool bNewFrame );
634 SAL_DLLPRIVATE bool ImplUpdatePos();
635 SAL_DLLPRIVATE void ImplUpdateSysObjPos();
637 SAL_DLLPRIVATE void ImplUpdateGlobalSettings( AllSettings& rSettings, bool bCallHdl = true );
639 SAL_DLLPRIVATE void ImplAlignChildren();
640 SAL_DLLPRIVATE void ImplToBottomChild();
642 SAL_DLLPRIVATE void ImplCalcToTop( ImplCalcToTopData* pPrevData );
643 SAL_DLLPRIVATE void ImplToTop( sal_uInt16 nFlags );
644 SAL_DLLPRIVATE void ImplStartToTop( sal_uInt16 nFlags );
645 SAL_DLLPRIVATE void ImplFocusToTop( sal_uInt16 nFlags, bool bReallyVisible );
647 SAL_DLLPRIVATE void ImplShowAllOverlaps();
648 SAL_DLLPRIVATE void ImplHideAllOverlaps();
650 SAL_DLLPRIVATE bool ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput );
651 SAL_DLLPRIVATE bool ImplHasDlgCtrl();
652 SAL_DLLPRIVATE void ImplDlgCtrlNextWindow();
653 SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged( vcl::Window* pWindow, bool bGetFocus );
654 SAL_DLLPRIVATE vcl::Window* ImplFindDlgCtrlWindow( vcl::Window* pWindow );
656 SAL_DLLPRIVATE long ImplLogicUnitToPixelX( long nX, MapUnit eUnit );
657 SAL_DLLPRIVATE long ImplLogicUnitToPixelY( long nY, MapUnit eUnit );
659 SAL_DLLPRIVATE bool ImplIsWindowInFront( const vcl::Window* pTestWindow ) const;
661 SAL_DLLPRIVATE static void ImplNewInputContext();
663 SAL_DLLPRIVATE void ImplCallActivateListeners(vcl::Window*);
664 SAL_DLLPRIVATE void ImplCallDeactivateListeners(vcl::Window*);
666 SAL_DLLPRIVATE void ImplHandleScroll( ScrollBar* pHScrl, long nX, ScrollBar* pVScrl, long nY );
668 SAL_DLLPRIVATE Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle& rRect ) const;
669 SAL_DLLPRIVATE long ImplGetUnmirroredOutOffX();
671 // retrieves the list of owner draw decorated windows for this window hiearchy
672 SAL_DLLPRIVATE ::std::vector<VclPtr<vcl::Window> >& ImplGetOwnerDrawList();
674 SAL_DLLPRIVATE vcl::Window* ImplGetTopmostFrameWindow();
676 SAL_DLLPRIVATE Rectangle ImplGetWindowExtentsRelative( vcl::Window *pRelativeWindow, bool bClientOnly ) const;
678 SAL_DLLPRIVATE bool ImplStopDnd();
679 SAL_DLLPRIVATE void ImplStartDnd();
681 SAL_DLLPRIVATE void ImplPaintToDevice( ::OutputDevice* pTargetOutDev, const Point& rPos );
683 SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >
684 ImplGetCanvas( const Size& rFullscreenSize, bool bFullscreen, bool bSpriteCanvas ) const;
686 public:
687 virtual vcl::Region GetActiveClipRegion() const SAL_OVERRIDE;
689 protected:
690 // Single argument ctors shall be explicit.
691 explicit Window( WindowType nType );
693 void SetCompoundControl( bool bCompound );
695 void CallEventListeners( sal_uLong nEvent, void* pData = NULL );
696 static void FireVclEvent( VclSimpleEvent* pEvent );
698 virtual bool AcquireGraphics() const SAL_OVERRIDE;
699 virtual void ReleaseGraphics( bool bRelease = true ) SAL_OVERRIDE;
701 virtual void InitClipRegion() SAL_OVERRIDE;
703 // FIXME: this is a hack to workaround missing layout functionality
704 SAL_DLLPRIVATE void ImplAdjustNWFSizes();
706 virtual void CopyDeviceArea( SalTwoRect& aPosAry, bool bWindowInvalidate = false) SAL_OVERRIDE;
707 virtual void ClipToPaintRegion( Rectangle& rDstRect ) SAL_OVERRIDE;
708 virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
710 virtual void DrawGradientWallpaper(long nX, long nY, long nWidth, long nHeight,
711 const Wallpaper& rWallpaper) SAL_OVERRIDE
713 OutputDevice::DrawGradientWallpaper(nX, nY, nWidth, nHeight, rWallpaper);
716 virtual void DrawGradientWallpaper(vcl::RenderContext& rRenderContext, long nX, long nY,
717 long nWidth, long nHeight, const Wallpaper& rWallpaper);
719 virtual void ApplySettings(vcl::RenderContext& rRenderContext);
720 public:
721 bool HasMirroredGraphics() const SAL_OVERRIDE;
723 public:
724 // Single argument ctors shall be explicit.
725 explicit Window( vcl::Window* pParent, WinBits nStyle = 0 );
727 Window( vcl::Window* pParent, const ResId& rResId );
728 virtual ~Window();
730 ::OutputDevice const* GetOutDev() const;
731 ::OutputDevice* GetOutDev();
733 virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE;
734 virtual void MouseMove( const MouseEvent& rMEvt );
735 virtual void MouseButtonDown( const MouseEvent& rMEvt );
736 virtual void MouseButtonUp( const MouseEvent& rMEvt );
737 virtual void KeyInput( const KeyEvent& rKEvt );
738 virtual void KeyUp( const KeyEvent& rKEvt );
739 virtual void PrePaint(vcl::RenderContext& rRenderContext);
740 virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
741 virtual void PostPaint(vcl::RenderContext& rRenderContext);
742 virtual void Erase(vcl::RenderContext& rRenderContext);
744 virtual void Erase() SAL_OVERRIDE
746 OutputDevice::Erase();
749 virtual void Erase(const Rectangle& rRect) SAL_OVERRIDE
751 OutputDevice::Erase(rRect);
754 virtual void Draw( ::OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
755 virtual void Move();
756 virtual void Resize();
757 virtual void Activate();
758 virtual void Deactivate();
759 virtual void GetFocus();
760 virtual void LoseFocus();
761 virtual void RequestHelp( const HelpEvent& rHEvt );
762 virtual void Command( const CommandEvent& rCEvt );
763 virtual void Tracking( const TrackingEvent& rTEvt );
764 virtual void StateChanged( StateChangedType nStateChange );
765 virtual void DataChanged( const DataChangedEvent& rDCEvt );
766 virtual bool PreNotify( NotifyEvent& rNEvt );
767 virtual bool Notify( NotifyEvent& rNEvt );
768 virtual vcl::Window* GetPreferredKeyInputWindow();
770 // These methods call the relevant virtual method when not in/post dispose
771 void CompatGetFocus();
772 void CompatLoseFocus();
773 void CompatStateChanged( StateChangedType nStateChange );
774 void CompatDataChanged( const DataChangedEvent& rDCEvt );
775 bool CompatPreNotify( NotifyEvent& rNEvt );
776 bool CompatNotify( NotifyEvent& rNEvt );
778 void AddEventListener( const Link<>& rEventListener );
779 void RemoveEventListener( const Link<>& rEventListener );
780 void AddChildEventListener( const Link<>& rEventListener );
781 void RemoveChildEventListener( const Link<>& rEventListener );
783 ImplSVEvent * PostUserEvent( const Link<>& rLink, void* pCaller = NULL, bool bReferenceLink = false );
784 void RemoveUserEvent( ImplSVEvent * nUserEvent );
786 void IncrementLockCount();
787 void DecrementLockCount();
788 bool IsLocked( bool bChildren = false ) const;
790 // returns the input language used for the last key stroke
791 // may be LANGUAGE_DONTKNOW if not supported by the OS
792 LanguageType GetInputLanguage() const;
794 void SetStyle( WinBits nStyle );
795 WinBits GetStyle() const;
796 WinBits GetPrevStyle() const;
797 void SetExtendedStyle( WinBits nExtendedStyle );
798 WinBits GetExtendedStyle() const;
799 void SetType( WindowType nType );
800 WindowType GetType() const;
801 bool IsSystemWindow() const;
802 bool IsDockingWindow() const;
803 bool IsDialog() const;
804 bool IsMenuFloatingWindow() const;
805 bool IsToolbarFloatingWindow() const;
806 bool IsTopWindow() const;
807 bool IsDisposed() const;
808 SystemWindow* GetSystemWindow() const;
810 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
811 bool SupportsDoubleBuffering() const;
812 /// Mark this window / widget derived from this window as working with double-buffering via RenderContext.
813 void SetDoubleBuffering(bool bDoubleBuffering = true);
815 void EnableAllResize( bool bEnable = true );
817 void SetBorderStyle( WindowBorderStyle nBorderStyle );
818 WindowBorderStyle GetBorderStyle() const;
819 void GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
820 sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
821 Size CalcWindowSize( const Size& rOutSz ) const;
822 Size CalcOutputSize( const Size& rWinSz ) const;
823 long CalcTitleWidth() const;
825 void EnableClipSiblings( bool bClipSiblings = true );
827 void EnableChildTransparentMode( bool bEnable = true );
828 bool IsChildTransparentModeEnabled() const;
830 void SetMouseTransparent( bool bTransparent );
831 bool IsMouseTransparent() const;
832 void SetPaintTransparent( bool bTransparent );
833 bool IsPaintTransparent() const;
834 void SetDialogControlStart( bool bStart );
835 bool IsDialogControlStart() const;
836 void SetDialogControlFlags( sal_uInt16 nFlags );
837 sal_uInt16 GetDialogControlFlags() const;
839 struct PointerState
841 sal_uLong mnState; // the button state
842 Point maPos; // mouse position in output coordinates
844 PointerState GetPointerState();
845 bool IsMouseOver();
847 sal_uLong GetCurrentModButtons();
849 void SetInputContext( const InputContext& rInputContext );
850 const InputContext& GetInputContext() const;
851 void EndExtTextInput( sal_uInt16 nFlags );
852 void SetCursorRect( const Rectangle* pRect = NULL, long nExtTextInputWidth = 0 );
853 const Rectangle* GetCursorRect() const;
854 long GetCursorExtTextInputWidth() const;
856 void SetCompositionCharRect( const Rectangle* pRect, long nCompositionLength, bool bVertical = false );
858 using ::OutputDevice::SetSettings;
859 virtual void SetSettings( const AllSettings& rSettings ) SAL_OVERRIDE;
860 void SetSettings( const AllSettings& rSettings, bool bChild );
861 void UpdateSettings( const AllSettings& rSettings, bool bChild = false );
862 void NotifyAllChildren( DataChangedEvent& rDCEvt );
864 void SetPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
865 vcl::Font GetPointFont(vcl::RenderContext& rRenderContext) const;
866 void SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::Font& rFont);
867 long GetDrawPixel( ::OutputDevice* pDev, long nPixels ) const;
868 vcl::Font GetDrawPixelFont( ::OutputDevice* pDev ) const;
870 void SetControlFont();
871 void SetControlFont( const vcl::Font& rFont );
872 vcl::Font GetControlFont() const;
873 bool IsControlFont() const;
874 void ApplyControlFont(vcl::RenderContext& rRenderContext, const vcl::Font& rDefaultFont);
876 void SetControlForeground();
877 void SetControlForeground(const Color& rColor);
878 Color GetControlForeground() const;
879 bool IsControlForeground() const;
880 void ApplyControlForeground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
882 void SetControlBackground();
883 void SetControlBackground( const Color& rColor );
884 Color GetControlBackground() const;
885 bool IsControlBackground() const;
886 void ApplyControlBackground(vcl::RenderContext& rRenderContext, const Color& rDefaultColor);
888 void SetParentClipMode( sal_uInt16 nMode = 0 );
889 sal_uInt16 GetParentClipMode() const;
891 void SetWindowRegionPixel();
892 void SetWindowRegionPixel( const vcl::Region& rRegion );
893 const vcl::Region& GetWindowRegionPixel() const;
894 bool IsWindowRegionPixel() const;
895 vcl::Region GetWindowClipRegionPixel( sal_uInt16 nFlags = 0 ) const;
896 vcl::Region GetPaintRegion() const;
897 bool IsInPaint() const;
898 // while IsInPaint returns true ExpandPaintClipRegion adds the
899 // submitted region to the paint clip region so you can
900 // paint additional parts of your window if necessary
901 void ExpandPaintClipRegion( const vcl::Region& rRegion );
903 void SetParent( vcl::Window* pNewParent );
904 vcl::Window* GetParent() const;
905 // return the dialog we are contained in or NULL if un-contained
906 Dialog* GetParentDialog() const;
908 void Show( bool bVisible = true, sal_uInt16 nFlags = 0 );
909 void Hide() { Show( false ); }
910 bool IsVisible() const;
911 bool IsReallyVisible() const;
912 bool IsReallyShown() const;
913 bool IsInInitShow() const;
915 void Enable( bool bEnable = true, bool bChild = true );
916 void Disable( bool bChild = true ) { Enable( false, bChild ); }
917 bool IsEnabled() const;
919 void EnableInput( bool bEnable = true, bool bChild = true );
920 void EnableInput( bool bEnable, bool bChild, bool bSysWin,
921 const vcl::Window* pExcludeWindow = NULL );
922 bool IsInputEnabled() const;
924 vcl::RenderSettings& GetRenderSettings();
926 /** Override <code>EnableInput</code>. This can be necessary due to other people
927 using EnableInput for whole window hierarchies.
930 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
931 mutually exclusive; the last setter wins.
932 @param bAlways
933 sets always enabled flag
935 @param bChild
936 if true children are recursively set to AlwaysEnableInput
938 void AlwaysEnableInput( bool bAlways, bool bChild = true );
939 /** returns the current AlwaysEnableInput state
940 @return
941 true if window is in AlwaysEnableInput state
943 bool IsAlwaysEnableInput() const;
944 /** Override <code>EnableInput</code>, counterpart to AlwaysEnableInput.
945 Windows with AlwaysDisableInput will not get key events even if enabled
946 and input enabled.This can be necessary due to other people using EnableInput
947 for whole window hierarchies.
949 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
950 mutually exclusive; the last setter wins.
952 @param bAlways
953 sets always disable flag
955 @param bChild
956 if true children are recursively set to AlwaysDisableInput
958 void AlwaysDisableInput( bool bAlways, bool bChild = true );
960 /** usually event handlers (see AddEventListener and AddChildEventListener)
961 are not called on disabled, modal or input disabled windows. There are however rare cases
962 in which one wants a Window or rather one of its Control subclasses to
963 not evaluate events but still react to those events externally. In these
964 rare cases call SetCallHandlersOnInputDisabled( true ) to have your handler
965 called anyway.
967 Currently only mouse events get this special treatment.
969 Use this sparingly, chances are if you want to use it you're working around
970 the real problem.
972 @param bCall
973 Enable/Disable calling event handlers for this disabled, modal or input disabled window.
974 This call is implicity done recursively for possible child windows.
976 void SetCallHandlersOnInputDisabled( bool bCall );
977 /** get state of SetCallHandlersOnInputDisabled
979 @returns whether handlers are called regardless of input enabled state
981 bool IsCallHandlersOnInputDisabled() const;
982 /** A window is in modal mode if one of its children or subchildren
983 is a running modal window (a modal dialog)
985 @returns sal_True if a child or subchild is a running modal window
987 bool IsInModalMode() const;
990 * Necessary for calc ref input handling from modal dialogs
992 bool IsInModalNonRefMode() const;
994 void SetActivateMode( sal_uInt16 nMode );
995 sal_uInt16 GetActivateMode() const;
997 void ToTop( sal_uInt16 nFlags = 0 );
998 void SetZOrder( vcl::Window* pRefWindow, sal_uInt16 nFlags );
999 void EnableAlwaysOnTop( bool bEnable = true );
1000 bool IsAlwaysOnTopEnabled() const;
1002 virtual void setPosSizePixel( long nX, long nY,
1003 long nWidth, long nHeight,
1004 PosSizeFlags nFlags = PosSizeFlags::All );
1005 virtual void SetPosPixel( const Point& rNewPos );
1006 virtual Point GetPosPixel() const;
1007 virtual void SetSizePixel( const Size& rNewSize );
1008 virtual Size GetSizePixel() const;
1009 virtual void SetPosSizePixel( const Point& rNewPos,
1010 const Size& rNewSize );
1011 virtual void SetOutputSizePixel( const Size& rNewSize );
1012 bool IsDefaultPos() const;
1013 bool IsDefaultSize() const;
1015 // those conversion routines might deliver different results during UI mirroring
1016 Point OutputToScreenPixel( const Point& rPos ) const;
1017 Point ScreenToOutputPixel( const Point& rPos ) const;
1018 // the normalized screen methods work independent from UI mirroring
1019 Point OutputToNormalizedScreenPixel( const Point& rPos ) const;
1020 Point NormalizedScreenToOutputPixel( const Point& rPos ) const;
1021 Point OutputToAbsoluteScreenPixel( const Point& rPos ) const;
1022 Point AbsoluteScreenToOutputPixel( const Point& rPos ) const;
1023 Rectangle GetDesktopRectPixel() const;
1024 // window extents including border and decoratrion
1025 Rectangle GetWindowExtentsRelative( vcl::Window *pRelativeWindow ) const;
1026 // window extents of the client window, coordinates to be used in SetPosPixel
1027 Rectangle GetClientWindowExtentsRelative( vcl::Window *pRelativeWindow ) const;
1029 bool IsScrollable() const;
1030 virtual void Scroll( long nHorzScroll, long nVertScroll,
1031 sal_uInt16 nFlags = 0 );
1032 void Scroll( long nHorzScroll, long nVertScroll,
1033 const Rectangle& rRect, sal_uInt16 nFlags = 0 );
1034 virtual void Invalidate( sal_uInt16 nFlags = 0 );
1035 virtual void Invalidate( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
1036 virtual void Invalidate( const vcl::Region& rRegion, sal_uInt16 nFlags = 0 );
1037 void Validate( sal_uInt16 nFlags = 0 );
1038 bool HasPaintEvent() const;
1039 void Update();
1040 void Flush();
1041 void Sync();
1043 // toggles new docking support, enabled via toolkit
1044 void EnableDocking( bool bEnable = true );
1045 // retrieves the single dockingmanager instance
1046 static DockingManager* GetDockingManager();
1048 void EnablePaint( bool bEnable );
1049 bool IsPaintEnabled() const;
1050 void SetUpdateMode( bool bUpdate );
1051 bool IsUpdateMode() const;
1052 void SetParentUpdateMode( bool bUpdate );
1054 void GrabFocus();
1055 bool HasFocus() const;
1056 bool HasChildPathFocus( bool bSystemWindow = false ) const;
1057 bool IsActive() const;
1058 bool HasActiveChildFrame();
1059 sal_uInt16 GetGetFocusFlags() const;
1060 void GrabFocusToDocument();
1063 * Set this when you need to act as if the window has focus even if it
1064 * doesn't. This is necessary for implementing tab stops inside floating
1065 * windows, but floating windows don't get focus from the system.
1067 void SetFakeFocus( bool bFocus );
1069 bool IsCompoundControl() const;
1071 static sal_uIntPtr SaveFocus();
1072 static bool EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore = true );
1074 void CaptureMouse();
1075 void ReleaseMouse();
1076 bool IsMouseCaptured() const;
1078 void SetPointer( const Pointer& rPointer );
1079 const Pointer& GetPointer() const;
1080 void EnableChildPointerOverwrite( bool bOverwrite );
1081 void SetPointerPosPixel( const Point& rPos );
1082 Point GetPointerPosPixel();
1083 Point GetLastPointerPosPixel();
1084 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1085 void SetLastMousePos(const Point& rPos);
1086 void ShowPointer( bool bVisible );
1087 void EnterWait();
1088 void LeaveWait();
1089 bool IsWait() const;
1091 void SetCursor( vcl::Cursor* pCursor );
1092 vcl::Cursor* GetCursor() const;
1094 void SetZoom( const Fraction& rZoom );
1095 const Fraction& GetZoom() const;
1096 bool IsZoom() const;
1097 long CalcZoom( long n ) const;
1099 virtual void SetText( const OUString& rStr );
1100 virtual OUString GetText() const;
1101 // return the actual text displayed
1102 // this may have e.g. accelerators removed or portions
1103 // replaced by ellipses
1104 virtual OUString GetDisplayText() const;
1105 // gets the visible background color. for transparent windows
1106 // this may be the parent's background color; for controls
1107 // this may be a child's background color (e.g. ListBox)
1108 virtual const Wallpaper& GetDisplayBackground() const;
1110 void SetHelpText( const OUString& rHelpText );
1111 const OUString& GetHelpText() const;
1113 void SetQuickHelpText( const OUString& rHelpText );
1114 const OUString& GetQuickHelpText() const;
1116 void SetHelpId( const OString& );
1117 const OString& GetHelpId() const;
1119 void SetUniqueId( const OString& );
1120 const OString& GetUniqueId() const;
1122 vcl::Window* FindWindow( const Point& rPos ) const;
1124 sal_uInt16 GetChildCount() const;
1125 vcl::Window* GetChild( sal_uInt16 nChild ) const;
1126 vcl::Window* GetWindow( GetWindowType nType ) const;
1127 bool IsChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1128 bool IsWindowOrChild( const vcl::Window* pWindow, bool bSystemWindow = false ) const;
1130 void SetData( void* pNewData );
1131 void* GetData() const;
1133 /// Add all children to @rAllChildren recursively.
1134 SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
1136 virtual void ShowFocus(const Rectangle& rRect);
1137 void HideFocus();
1139 // transparent background for selected or checked items in toolboxes etc.
1140 void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly );
1141 // the same, but fills a passed Color with a text color complementing the selection background
1142 void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, Color* pSelectionTextColor );
1143 // support rounded edges in the selection rect
1144 void DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, long nCornerRadius, Color* pSelectionTextColor, Color* pPaintColor );
1146 void ShowTracking( const Rectangle& rRect,
1147 sal_uInt16 nFlags = SHOWTRACK_SMALL );
1148 void HideTracking();
1149 void InvertTracking( const Rectangle& rRect,
1150 sal_uInt16 nFlags = SHOWTRACK_SMALL );
1151 void InvertTracking( const Polygon& rPoly, sal_uInt16 nFlags = 0 );
1153 void StartTracking( sal_uInt16 nFlags = 0 );
1154 void EndTracking( TrackingEventFlags nFlags = TrackingEventFlags::NONE );
1155 bool IsTracking() const;
1157 void StartAutoScroll( sal_uInt16 nFlags );
1158 void EndAutoScroll();
1160 bool HandleScrollCommand( const CommandEvent& rCmd,
1161 ScrollBar* pHScrl = NULL,
1162 ScrollBar* pVScrl = NULL );
1164 void SaveBackground( const Point& rPos, const Size& rSize,
1165 const Point& rDestOff, VirtualDevice& rSaveDevice );
1167 const SystemEnvData* GetSystemData() const;
1168 ::com::sun::star::uno::Any GetSystemDataAny() const;
1170 // API to set/query the component interfaces
1171 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
1172 GetComponentInterface( bool bCreate = true );
1174 void SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace );
1176 /** @name Accessibility
1178 ///@{
1179 public:
1181 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
1182 GetAccessible( bool bCreate = true );
1184 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
1185 CreateAccessible();
1187 void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > );
1189 vcl::Window* GetAccessibleParentWindow() const;
1190 sal_uInt16 GetAccessibleChildWindowCount();
1191 vcl::Window* GetAccessibleChildWindow( sal_uInt16 n );
1193 void SetAccessibleRole( sal_uInt16 nRole );
1194 sal_uInt16 GetAccessibleRole() const;
1196 void SetAccessibleName( const OUString& rName );
1197 OUString GetAccessibleName() const;
1199 void SetAccessibleDescription( const OUString& rDescr );
1200 OUString GetAccessibleDescription() const;
1202 void SetAccessibleRelationLabeledBy( vcl::Window* pLabeledBy );
1203 vcl::Window* GetAccessibleRelationLabeledBy() const;
1205 void SetAccessibleRelationLabelFor( vcl::Window* pLabelFor );
1206 vcl::Window* GetAccessibleRelationLabelFor() const;
1208 void SetAccessibleRelationMemberOf( vcl::Window* pMemberOf );
1209 vcl::Window* GetAccessibleRelationMemberOf() const;
1212 // to avoid sending accessibility events in cases like closing dialogs
1213 // by default checks complete parent path
1214 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath = true );
1215 void SetAccessibilityEventsSuppressed(bool bSuppressed);
1217 // Deprecated - can use SetAccessibleRelationLabelFor/By nowadys
1218 virtual vcl::Window* GetParentLabelFor( const vcl::Window* pLabel ) const;
1219 virtual vcl::Window* GetParentLabeledBy( const vcl::Window* pLabeled ) const;
1220 KeyEvent GetActivationKey() const;
1222 protected:
1224 // These eventually are supposed to go when everything is converted to .ui
1225 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1226 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1227 SAL_DLLPRIVATE vcl::Window* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1229 // Let Label override the code part of GetAccessibleRelationLabelFor
1230 virtual vcl::Window* getAccessibleRelationLabelFor() const;
1231 virtual sal_uInt16 getDefaultAccessibleRole() const;
1232 virtual OUString getDefaultAccessibleName() const;
1235 * Advisory Sizing - what is a good size for this widget
1237 * Retrieves the preferred size of a widget ignoring
1238 * "width-request" and "height-request" properties.
1240 * Implement this in sub-classes to tell layout
1241 * the preferred widget size.
1243 * Use get_preferred_size to retrieve this value
1244 * cached and mediated via height and width requests
1246 virtual Size GetOptimalSize() const;
1247 /// clear OptimalSize cache
1248 void InvalidateSizeCache();
1249 private:
1251 SAL_DLLPRIVATE bool ImplIsAccessibleCandidate() const;
1252 SAL_DLLPRIVATE bool ImplIsAccessibleNativeFrame() const;
1253 SAL_DLLPRIVATE sal_uInt16 ImplGetAccessibleCandidateChildWindowCount( GetWindowType nFirstWindowType ) const;
1254 SAL_DLLPRIVATE vcl::Window* ImplGetAccessibleCandidateChild( sal_uInt16 nChild, sal_uInt16& rChildCount, GetWindowType nFirstWindowType, bool bTopLevel = true ) const;
1255 SAL_DLLPRIVATE bool ImplRegisterAccessibleNativeFrame();
1256 SAL_DLLPRIVATE void ImplRevokeAccessibleNativeFrame();
1257 ///@}
1260 * Retrieves the preferred size of a widget taking
1261 * into account the "width-request" and "height-request" properties.
1263 * Overrides the result of GetOptimalSize to honor the
1264 * width-request and height-request properties.
1266 * So the same as get_ungrouped_preferred_size except
1267 * it ignores groups. A building block of get_preferred_size
1268 * that access the size cache
1270 * @see get_preferred_size
1272 Size get_ungrouped_preferred_size() const;
1273 public:
1274 /// request XCanvas render interface for this window
1275 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >
1276 GetCanvas() const;
1277 /// request XSpriteCanvas render interface for this window
1278 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas >
1279 GetSpriteCanvas() const;
1281 /* records all DrawText operations within the passed rectangle;
1282 * a synchronous paint is sent to achieve this
1284 void RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect );
1286 // set and retrieve for Toolkit
1287 VCLXWindow* GetWindowPeer() const;
1288 void SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow );
1290 // remember if it was generated by Toolkit
1291 bool IsCreatedWithToolkit() const;
1292 void SetCreatedWithToolkit( bool b );
1294 // Drag and Drop interfaces
1295 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > GetDropTarget();
1296 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > GetDragSource();
1297 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > GetDragGestureRecognizer();
1299 // Clipboard/Selection interfaces
1300 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetClipboard();
1301 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > GetPrimarySelection();
1304 * Widgets call this to inform their owner container that the widget wants
1305 * to renegotiate its size. Should be called when a widget has a new size
1306 * request. e.g. a FixedText Control gets a new label.
1308 * akin to gtk_widget_queue_resize
1310 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout);
1313 * Sets the "width-request" property
1315 * Override for width request of the widget, or -1 if natural request
1316 * should be used.
1318 * @see get_preferred_size, set_width_request
1320 void set_height_request(sal_Int32 nHeightRequest);
1321 sal_Int32 get_height_request() const;
1324 * Sets the "height-request" property
1326 * Override for height request of the widget, or -1 if natural request
1327 * should be used.
1329 * @see get_preferred_size, set_height_request
1331 void set_width_request(sal_Int32 nWidthRequest);
1332 sal_Int32 get_width_request() const;
1335 * Retrieves the preferred size of a widget taking
1336 * into account the "width-request" and "height-request" properties.
1338 * Overrides the result of GetOptimalSize to honor the
1339 * width-request and height-request properties.
1341 * @see GetOptimalSize
1343 * akin to gtk_widget_get_preferred_size
1345 Size get_preferred_size() const;
1348 * How to horizontally align this widget
1350 VclAlign get_halign() const;
1351 void set_halign(VclAlign eAlign);
1354 * How to vertically align this widget
1356 VclAlign get_valign() const;
1357 void set_valign(VclAlign eAlign);
1360 * Whether the widget would like to use any available extra horizontal
1361 * space.
1363 bool get_hexpand() const;
1364 void set_hexpand(bool bExpand);
1367 * Whether the widget would like to use any available extra vertical
1368 * space.
1370 bool get_vexpand() const;
1371 void set_vexpand(bool bExpand);
1374 * Whether the widget would like to use any available extra space.
1376 bool get_expand() const;
1377 void set_expand(bool bExpand);
1380 * Whether the widget should receive extra space when the parent grows
1382 bool get_fill() const;
1383 void set_fill(bool bFill);
1385 void set_border_width(sal_Int32 nBorderWidth);
1386 sal_Int32 get_border_width() const;
1388 void set_margin_left(sal_Int32 nWidth);
1389 sal_Int32 get_margin_left() const;
1391 void set_margin_right(sal_Int32 nWidth);
1392 sal_Int32 get_margin_right() const;
1394 void set_margin_top(sal_Int32 nWidth);
1395 sal_Int32 get_margin_top() const;
1397 void set_margin_bottom(sal_Int32 nWidth);
1398 sal_Int32 get_margin_bottom() const;
1401 * How the widget is packed with reference to the start or end of the parent
1403 VclPackType get_pack_type() const;
1404 void set_pack_type(VclPackType ePackType);
1407 * The extra space to put between the widget and its neighbors
1409 sal_Int32 get_padding() const;
1410 void set_padding(sal_Int32 nPadding);
1413 * The number of columns that the widget spans
1415 sal_Int32 get_grid_width() const;
1416 void set_grid_width(sal_Int32 nCols);
1419 * The column number to attach the left side of the widget to
1421 sal_Int32 get_grid_left_attach() const;
1422 void set_grid_left_attach(sal_Int32 nAttach);
1425 * The number of row that the widget spans
1427 sal_Int32 get_grid_height() const;
1428 void set_grid_height(sal_Int32 nRows);
1431 * The row number to attach the top side of the widget to
1433 sal_Int32 get_grid_top_attach() const;
1434 void set_grid_top_attach(sal_Int32 nAttach);
1437 * If true this child appears in a secondary layout group of children
1438 * e.g. help buttons in a buttonbox
1440 bool get_secondary() const;
1441 void set_secondary(bool bSecondary);
1444 * If true this child is exempted from homogenous sizing
1445 * e.g. special button in a buttonbox
1447 bool get_non_homogeneous() const;
1448 void set_non_homogeneous(bool bNonHomogeneous);
1451 * Sets a widget property
1453 * @return false if property is unknown
1455 virtual bool set_property(const OString &rKey, const OString &rValue);
1458 * Sets a font attribute
1460 * @return false if attribute is unknown
1462 bool set_font_attribute(const OString &rKey, const OString &rValue);
1465 * Adds this widget to the xGroup VclSizeGroup
1468 void add_to_size_group(std::shared_ptr<VclSizeGroup> xGroup);
1469 void remove_from_all_size_groups();
1472 * add/remove mnemonic label
1474 void add_mnemonic_label(FixedText *pLabel);
1475 void remove_mnemonic_label(FixedText *pLabel);
1476 std::vector<VclPtr<FixedText> > list_mnemonic_labels() const;
1479 * Move this widget to be the nNewPosition'd child of its parent
1481 void reorderWithinParent(sal_uInt16 nNewPosition);
1484 // Native Widget Rendering functions
1487 // form controls must never use native widgets, this can be toggled here
1488 void EnableNativeWidget( bool bEnable = true );
1489 bool IsNativeWidgetEnabled() const;
1491 // a helper method for a Control's Draw method
1492 void PaintToDevice( ::OutputDevice* pDevice, const Point& rPos, const Size& rSize );
1494 /* mark Window for deletion in top of event queue
1496 void doLazyDelete();
1499 // Keyboard access functions
1502 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1503 Scroll Lock. Use the following mask to retrieve the state of each
1504 indicator:
1506 KeyIndicatorState::CAPS_LOCK
1507 KeyIndicatorState::NUM_LOCK
1508 KeyIndicatorState::SCROLL_LOCK
1510 KeyIndicatorState GetIndicatorState() const;
1512 void SimulateKeyPress( sal_uInt16 nKeyCode ) const;
1514 virtual OUString GetSurroundingText() const;
1515 virtual Selection GetSurroundingTextSelection() const;
1520 // Only for compatibility - because many people outside haven't included event.hxx
1521 // These require Window to be defined for VclPtr<Window>
1522 #include <vcl/vclevent.hxx>
1523 #include <vcl/event.hxx>
1525 #endif // INCLUDED_VCL_WINDOW_HXX
1527 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */