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_WINDOW_HXX
21 #define INCLUDED_VCL_WINDOW_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/outdev.hxx>
26 #include <vcl/pointr.hxx>
27 #include <tools/wintypes.hxx>
28 #include <rsc/rsc-vcl-shared-types.hxx>
29 #include <vcl/inputtypes.hxx>
30 #include <vcl/cursor.hxx>
31 #include <vcl/inputctx.hxx>
32 #include <vcl/keycodes.hxx>
33 #include <vcl/region.hxx>
34 #include <vcl/salnativewidgets.hxx>
35 #include <vcl/uitest/factory.hxx>
36 #include <vcl/vclevent.hxx>
37 #include <rtl/ustring.hxx>
38 #include <rtl/ref.hxx>
39 #include <cppuhelper/weakref.hxx>
40 #include <com/sun/star/uno/Reference.hxx>
47 struct ImplCalcToTopData
;
49 struct SystemParentData
;
50 class ImplBorderWindow
;
63 class DataChangedEvent
;
68 class MenuFloatingWindow
;
71 enum class ImplPaintFlags
;
72 enum class VclEventId
;
74 namespace com
{ namespace sun
{ namespace star
{
75 namespace accessibility
{
93 namespace datatransfer
{ namespace clipboard
{
97 class XDragGestureRecognizer
;
103 struct ControlLayoutData
;
106 namespace svt
{ class PopupWindowControllerImpl
; }
108 template<class T
> class VclPtr
;
110 enum class TrackingEventFlags
118 DontCallHdl
= 0x8000,
122 template<> struct typed_flags
<TrackingEventFlags
> : is_typed_flags
<TrackingEventFlags
, 0x9107> {};
126 // Type fuer GetWindow()
127 enum class GetWindowType
141 FirstTopWindowChild
= 13,
142 NextTopWindowSibling
= 16,
145 // Flags for setPosSizePixel()
146 // These must match the definitions in css::awt::PosSize
147 enum class PosSizeFlags
155 Size
= Width
| Height
,
156 PosSize
= Pos
| Size
,
162 template<> struct typed_flags
<PosSizeFlags
> : is_typed_flags
<PosSizeFlags
, 0x000f> {};
169 NoParentUpdate
= 0x0001,
170 NoFocusChange
= 0x0002,
172 ForegroundTask
= 0x0008,
176 template<> struct typed_flags
<ShowFlags
> : is_typed_flags
<ShowFlags
, 0x000f> {};
179 // Flags for SetZOrder()
180 enum class ZOrderFlags
190 template<> struct typed_flags
<ZOrderFlags
> : is_typed_flags
<ZOrderFlags
, 0x000f> {};
194 enum class ActivateModeFlags
201 template<> struct typed_flags
<ActivateModeFlags
> : is_typed_flags
<ActivateModeFlags
, 0x0001> {};
205 enum class ToTopFlags
208 RestoreWhenMin
= 0x0001,
209 ForegroundTask
= 0x0002,
210 NoGrabFocus
= 0x0004,
211 GrabFocusOnly
= 0x0008,
215 template<> struct typed_flags
<ToTopFlags
> : is_typed_flags
<ToTopFlags
, 0x000f> {};
218 // Flags for Invalidate
219 // must match css::awt::InvalidateStyle
220 enum class InvalidateFlags
227 Transparent
= 0x0010,
228 NoTransparent
= 0x0020,
229 NoClipChildren
= 0x4000,
233 template<> struct typed_flags
<InvalidateFlags
> : is_typed_flags
<InvalidateFlags
, 0x403f> {};
236 // Flags for Validate
237 enum class ValidateFlags
245 template<> struct typed_flags
<ValidateFlags
> : is_typed_flags
<ValidateFlags
, 0x0003> {};
249 enum class ScrollFlags
255 UseClipRegion
= 0x0008,
260 template<> struct typed_flags
<ScrollFlags
> : is_typed_flags
<ScrollFlags
, 0x001f> {};
263 // Flags for ParentClipMode
264 enum class ParentClipMode
272 template<> struct typed_flags
<ParentClipMode
> : is_typed_flags
<ParentClipMode
, 0x0003> {};
275 // Flags for ShowTracking()
276 enum class ShowTrackFlags
{
283 TrackWindow
= 0x1000,
288 template<> struct typed_flags
<ShowTrackFlags
> : is_typed_flags
<ShowTrackFlags
, 0x300f> {};
291 // Flags for StartTracking()
292 enum class StartTrackingFlags
297 NoKeyCancel
= 0x0004,
298 ScrollRepeat
= 0x0008,
299 ButtonRepeat
= 0x0010,
300 MouseButtonDown
= 0x0020,
301 FocusCancel
= 0x0040,
306 template<> struct typed_flags
<StartTrackingFlags
> : is_typed_flags
<StartTrackingFlags
, 0x007f> {};
309 // Flags for StartAutoScroll()
310 enum class StartAutoScrollFlags
318 template<> struct typed_flags
<StartAutoScrollFlags
> : is_typed_flags
<StartAutoScrollFlags
, 0x0003> {};
321 // Flags for StateChanged()
322 enum class StateChangedType
: sal_uInt16
334 ControlForeground
= 14,
335 ControlBackground
= 15,
344 // must match constants in css:awt::FocusChangeReason
345 enum class GetFocusFlags
349 CURSOR
= 0x0002, // avoid name-clash with X11 #define
355 UniqueMnemonic
= 0x0100,
357 FloatWinPopupModeEndCancel
= 0x0400,
361 template<> struct typed_flags
<GetFocusFlags
> : is_typed_flags
<GetFocusFlags
, 0x077f> {};
374 NoSelection
= 0x0020,
375 NoBackground
= 0x0040,
380 template<> struct typed_flags
<DrawFlags
> : is_typed_flags
<DrawFlags
, 0x00ff> {};
383 // DialogControl-Flags
384 enum class DialogControlFlags
389 FloatWinPopupModeEndCancel
= 0x0004,
393 template<> struct typed_flags
<DialogControlFlags
> : is_typed_flags
<DialogControlFlags
, 0x0007> {};
396 // EndExtTextInput() Flags
397 enum class EndExtTextInputFlags
404 template<> struct typed_flags
<EndExtTextInputFlags
> : is_typed_flags
<EndExtTextInputFlags
, 0x0001> {};
407 #define IMPL_MINSIZE_BUTTON_WIDTH 70
408 #define IMPL_MINSIZE_BUTTON_HEIGHT 22
409 #define IMPL_EXTRA_BUTTON_WIDTH 18
410 #define IMPL_EXTRA_BUTTON_HEIGHT 10
411 #define IMPL_SEP_BUTTON_X 5
412 #define IMPL_SEP_BUTTON_Y 5
413 #define IMPL_MINSIZE_MSGBOX_WIDTH 150
414 #define IMPL_DIALOG_OFFSET 5
415 #define IMPL_DIALOG_BAR_OFFSET 3
416 #define IMPL_MSGBOX_OFFSET_EXTRA_X 0
417 #define IMPL_MSGBOX_OFFSET_EXTRA_Y 2
418 #define IMPL_SEP_MSGBOX_IMAGE 8
420 // ImplGetDlgWindow()
421 enum class GetDlgWindowType
428 const char* ImplDbgCheckWindow( const void* pObj
);
431 namespace vcl
{ class Window
; }
432 namespace vcl
{ class Cursor
; }
445 class FloatingWindow
;
449 class SystemChildWindow
;
450 class ImplBorderWindow
;
452 class ImplDockingWindowWrapper
;
453 class ImplPopupFloatWin
;
454 class MenuFloatingWindow
;
457 namespace svt
{ class PopupWindowControllerImpl
; }
458 enum class WindowHitTest
{
464 template<> struct typed_flags
<WindowHitTest
> : is_typed_flags
<WindowHitTest
, 0x0003> {};
469 class VCL_DLLPUBLIC RenderTools
472 // transparent background for selected or checked items in toolboxes etc.
473 // + selection Color with a text color complementing the selection background
475 static void DrawSelectionBackground(vcl::RenderContext
& rRenderContext
, vcl::Window
& rWindow
,
476 const tools::Rectangle
& rRect
, sal_uInt16 nHighlight
,
477 bool bChecked
, bool bDrawBorder
, bool bDrawExtBorderOnly
,
478 Color
* pSelectionTextColor
= nullptr, long nCornerRadius
= 0,
479 Color
* pPaintColor
= nullptr);
482 class VCL_DLLPUBLIC Window
: public ::OutputDevice
484 friend class ::vcl::Cursor
;
485 friend class ::OutputDevice
;
486 friend class ::Application
;
487 friend class ::SystemWindow
;
488 friend class ::WorkWindow
;
489 friend class ::Dialog
;
490 friend class ::MessBox
;
491 friend class ::DockingWindow
;
492 friend class ::FloatingWindow
;
493 friend class ::GroupBox
;
494 friend class ::PushButton
;
495 friend class ::RadioButton
;
496 friend class ::SystemChildWindow
;
497 friend class ::ImplBorderWindow
;
498 friend class ::VclBuilder
;
499 friend class ::PaintHelper
;
500 friend class ::LifecycleTest
;
502 // TODO: improve missing functionality
503 // only required because of SetFloatingMode()
504 friend class ::ImplDockingWindowWrapper
;
505 friend class ::ImplPopupFloatWin
;
506 friend class ::MenuFloatingWindow
;
508 friend class ::svt::PopupWindowControllerImpl
;
511 // NOTE: to remove many dependencies of other modules
512 // to this central file, all members are now hidden
513 // in the WindowImpl class and all inline functions
515 // (WindowImpl is a pImpl pattern)
517 // Please do *not* add new members or inline functions to class Window,
518 // but use class WindowImpl instead
520 std::unique_ptr
<WindowImpl
> mpWindowImpl
;
523 friend const char* ::ImplDbgCheckWindow( const void* pObj
);
528 DECL_DLLPRIVATE_LINK( ImplHandlePaintHdl
, Timer
*, void );
529 DECL_DLLPRIVATE_LINK( ImplGenerateMouseMoveHdl
, void*, void );
530 DECL_DLLPRIVATE_LINK( ImplTrackTimerHdl
, Timer
*, void );
531 DECL_DLLPRIVATE_LINK( ImplAsyncFocusHdl
, void*, void );
532 DECL_DLLPRIVATE_LINK( ImplHandleResizeTimerHdl
, Timer
*, void );
535 SAL_DLLPRIVATE
static void ImplInitAppFontData( vcl::Window
* pWindow
);
537 SAL_DLLPRIVATE
vcl::Window
* ImplGetFrameWindow() const;
538 SalFrame
* ImplGetFrame() const;
539 SAL_DLLPRIVATE ImplFrameData
* ImplGetFrameData();
541 SAL_DLLPRIVATE
vcl::Window
* ImplGetWindow();
542 SAL_DLLPRIVATE ImplWinData
* ImplGetWinData() const;
543 SAL_DLLPRIVATE
vcl::Window
* ImplGetClientWindow() const;
544 SAL_DLLPRIVATE
vcl::Window
* ImplGetDlgWindow( sal_uInt16 n
, GetDlgWindowType nType
, sal_uInt16 nStart
= 0, sal_uInt16 nEnd
= 0xFFFF, sal_uInt16
* pIndex
= nullptr );
545 SAL_DLLPRIVATE
vcl::Window
* ImplGetParent() const;
546 SAL_DLLPRIVATE
vcl::Window
* ImplFindWindow( const Point
& rFramePos
);
548 SAL_DLLPRIVATE
void ImplInvalidateFrameRegion( const vcl::Region
* pRegion
, InvalidateFlags nFlags
);
549 SAL_DLLPRIVATE
void ImplInvalidateOverlapFrameRegion( const vcl::Region
& rRegion
);
551 SAL_DLLPRIVATE
bool ImplSetClipFlag( bool bSysObjOnlySmaller
= false );
553 SAL_DLLPRIVATE
bool ImplIsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
554 SAL_DLLPRIVATE
bool ImplIsChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
555 SAL_DLLPRIVATE
bool ImplIsFloatingWindow() const;
556 SAL_DLLPRIVATE
bool ImplIsPushButton() const;
557 SAL_DLLPRIVATE
bool ImplIsSplitter() const;
558 SAL_DLLPRIVATE
bool ImplIsOverlapWindow() const;
560 SAL_DLLPRIVATE
void ImplIsInTaskPaneList( bool mbIsInTaskList
);
562 SAL_DLLPRIVATE WindowImpl
* ImplGetWindowImpl() const { return mpWindowImpl
.get(); }
564 SAL_DLLPRIVATE Point
ImplFrameToOutput( const Point
& rPos
);
566 SAL_DLLPRIVATE
void ImplGrabFocus( GetFocusFlags nFlags
);
567 SAL_DLLPRIVATE
void ImplGrabFocusToDocument( GetFocusFlags nFlags
);
568 SAL_DLLPRIVATE
void ImplInvertFocus( const tools::Rectangle
& rRect
);
570 SAL_DLLPRIVATE PointerStyle
ImplGetMousePointer() const;
571 SAL_DLLPRIVATE
void ImplCallMouseMove( sal_uInt16 nMouseCode
, bool bModChanged
= false );
572 SAL_DLLPRIVATE
void ImplGenerateMouseMove();
574 SAL_DLLPRIVATE
void ImplNotifyKeyMouseCommandEventListeners( NotifyEvent
& rNEvt
);
575 SAL_DLLPRIVATE
void ImplNotifyIconifiedState( bool bIconified
);
577 SAL_DLLPRIVATE
void ImplUpdateAll();
579 SAL_DLLPRIVATE
void ImplControlFocus( GetFocusFlags nFlags
= GetFocusFlags::NONE
);
581 SAL_DLLPRIVATE
void ImplMirrorFramePos( Point
&pt
) const;
583 SAL_DLLPRIVATE
void ImplPosSizeWindow( long nX
, long nY
, long nWidth
, long nHeight
, PosSizeFlags nFlags
);
585 SAL_DLLPRIVATE
void ImplCallResize();
586 SAL_DLLPRIVATE
void ImplCallMove();
588 SAL_DLLPRIVATE
void ImplIncModalCount();
589 SAL_DLLPRIVATE
void ImplDecModalCount();
591 SAL_DLLPRIVATE
static void ImplCalcSymbolRect( tools::Rectangle
& rRect
);
595 /** This is intended to be used to clear any locally held references to other Window-subclass objects */
596 virtual void dispose() override
;
598 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
, SystemParentData
* pSystemParentData
);
600 SAL_DLLPRIVATE Point
ImplOutputToFrame( const Point
& rPos
);
602 SAL_DLLPRIVATE
void ImplInvalidateParentFrameRegion( vcl::Region
& rRegion
);
603 SAL_DLLPRIVATE
void ImplValidateFrameRegion( const vcl::Region
* rRegion
, ValidateFlags nFlags
);
604 SAL_DLLPRIVATE
void ImplValidate();
605 SAL_DLLPRIVATE
void ImplMoveInvalidateRegion( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, bool bChildren
);
606 SAL_DLLPRIVATE
void ImplMoveAllInvalidateRegions( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, bool bChildren
);
608 SAL_DLLPRIVATE
vcl::Window
* ImplGetBorderWindow() const;
610 SAL_DLLPRIVATE
void ImplInvalidate( const vcl::Region
* rRegion
, InvalidateFlags nFlags
);
612 SAL_DLLPRIVATE WindowHitTest
ImplHitTest( const Point
& rFramePos
);
614 SAL_DLLPRIVATE
void ImplSetMouseTransparent( bool bTransparent
);
616 SAL_DLLPRIVATE
void ImplScroll( const tools::Rectangle
& rRect
, long nHorzScroll
, long nVertScroll
, ScrollFlags nFlags
);
618 SAL_DLLPRIVATE
bool ImplSetClipFlagChildren( bool bSysObjOnlySmaller
);
619 SAL_DLLPRIVATE
bool ImplSetClipFlagOverlapWindows( bool bSysObjOnlySmaller
= false );
621 SAL_DLLPRIVATE
void PushPaintHelper(PaintHelper
* pHelper
, vcl::RenderContext
& rRenderContext
);
622 SAL_DLLPRIVATE
void PopPaintHelper(PaintHelper
* pHelper
);
626 SAL_DLLPRIVATE
void ImplSetFrameParent( const vcl::Window
* pParent
);
628 SAL_DLLPRIVATE
void ImplInsertWindow( vcl::Window
* pParent
);
629 SAL_DLLPRIVATE
void ImplRemoveWindow( bool bRemoveFrameData
);
631 SAL_DLLPRIVATE SalGraphics
* ImplGetFrameGraphics() const;
633 SAL_DLLPRIVATE
static void ImplCallFocusChangeActivate( vcl::Window
* pNewOverlapWindow
, vcl::Window
* pOldOverlapWindow
);
634 SAL_DLLPRIVATE
vcl::Window
* ImplGetFirstOverlapWindow();
635 SAL_DLLPRIVATE
const vcl::Window
* ImplGetFirstOverlapWindow() const;
637 SAL_DLLPRIVATE
bool ImplIsRealParentPath( const vcl::Window
* pWindow
) const;
639 SAL_DLLPRIVATE
bool ImplTestMousePointerSet();
641 SAL_DLLPRIVATE
void ImplResetReallyVisible();
642 SAL_DLLPRIVATE
void ImplSetReallyVisible();
644 SAL_DLLPRIVATE
void ImplCallInitShow();
646 SAL_DLLPRIVATE
void ImplInitResolutionSettings();
648 SAL_DLLPRIVATE
void ImplPointToLogic(vcl::RenderContext
& rRenderContext
, vcl::Font
& rFont
) const;
649 SAL_DLLPRIVATE
void ImplLogicToPoint(vcl::RenderContext
& rRenderContext
, vcl::Font
& rFont
) const;
651 SAL_DLLPRIVATE
bool ImplSysObjClip( const vcl::Region
* pOldRegion
);
652 SAL_DLLPRIVATE
void ImplUpdateSysObjChildrenClip();
653 SAL_DLLPRIVATE
void ImplUpdateSysObjOverlapsClip();
654 SAL_DLLPRIVATE
void ImplUpdateSysObjClip();
656 SAL_DLLPRIVATE
void ImplIntersectWindowClipRegion( vcl::Region
& rRegion
);
657 SAL_DLLPRIVATE
void ImplIntersectWindowRegion( vcl::Region
& rRegion
);
658 SAL_DLLPRIVATE
void ImplExcludeWindowRegion( vcl::Region
& rRegion
);
659 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows( vcl::Region
& rRegion
);
660 SAL_DLLPRIVATE
void ImplExcludeOverlapWindows2( vcl::Region
& rRegion
);
662 SAL_DLLPRIVATE
void ImplClipBoundaries( vcl::Region
& rRegion
, bool bThis
, bool bOverlaps
);
663 SAL_DLLPRIVATE
bool ImplClipChildren( vcl::Region
& rRegion
);
664 SAL_DLLPRIVATE
void ImplClipAllChildren( vcl::Region
& rRegion
);
665 SAL_DLLPRIVATE
void ImplClipSiblings( vcl::Region
& rRegion
);
667 SAL_DLLPRIVATE
void ImplInitWinClipRegion();
668 SAL_DLLPRIVATE
void ImplInitWinChildClipRegion();
669 SAL_DLLPRIVATE
vcl::Region
* ImplGetWinChildClipRegion();
671 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
672 SAL_DLLPRIVATE
void ImplIntersectAndUnionOverlapWindows2( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
673 SAL_DLLPRIVATE
void ImplCalcOverlapRegionOverlaps( const vcl::Region
& rInterRegion
, vcl::Region
& rRegion
);
674 SAL_DLLPRIVATE
void ImplCalcOverlapRegion( const tools::Rectangle
& rSourceRect
, vcl::Region
& rRegion
,
675 bool bChildren
, bool bSiblings
);
677 /** Invoke the actual painting.
679 This function is kind of recursive - it may be called from the
680 PaintHelper destructor; and on the other hand it creates PaintHelper
681 that (when destructed) calls other ImplCallPaint()'s.
683 SAL_DLLPRIVATE
void ImplCallPaint(const vcl::Region
* pRegion
, ImplPaintFlags nPaintFlags
);
685 SAL_DLLPRIVATE
void ImplCallOverlapPaint();
687 SAL_DLLPRIVATE
void ImplUpdateWindowPtr( vcl::Window
* pWindow
);
688 SAL_DLLPRIVATE
void ImplUpdateWindowPtr();
689 SAL_DLLPRIVATE
void ImplUpdateOverlapWindowPtr( bool bNewFrame
);
691 SAL_DLLPRIVATE
bool ImplUpdatePos();
692 SAL_DLLPRIVATE
void ImplUpdateSysObjPos();
694 SAL_DLLPRIVATE
void ImplUpdateGlobalSettings( AllSettings
& rSettings
, bool bCallHdl
= true );
696 SAL_DLLPRIVATE
void ImplToBottomChild();
698 SAL_DLLPRIVATE
void ImplCalcToTop( ImplCalcToTopData
* pPrevData
);
699 SAL_DLLPRIVATE
void ImplToTop( ToTopFlags nFlags
);
700 SAL_DLLPRIVATE
void ImplStartToTop( ToTopFlags nFlags
);
701 SAL_DLLPRIVATE
void ImplFocusToTop( ToTopFlags nFlags
, bool bReallyVisible
);
703 SAL_DLLPRIVATE
void ImplShowAllOverlaps();
704 SAL_DLLPRIVATE
void ImplHideAllOverlaps();
706 SAL_DLLPRIVATE
bool ImplDlgCtrl( const KeyEvent
& rKEvt
, bool bKeyInput
);
707 SAL_DLLPRIVATE
bool ImplHasDlgCtrl();
708 SAL_DLLPRIVATE
void ImplDlgCtrlNextWindow();
709 SAL_DLLPRIVATE
void ImplDlgCtrlFocusChanged( vcl::Window
* pWindow
, bool bGetFocus
);
710 SAL_DLLPRIVATE
vcl::Window
* ImplFindDlgCtrlWindow( vcl::Window
* pWindow
);
712 SAL_DLLPRIVATE
static void ImplNewInputContext();
714 SAL_DLLPRIVATE
void ImplCallActivateListeners(vcl::Window
*);
715 SAL_DLLPRIVATE
void ImplCallDeactivateListeners(vcl::Window
*);
717 SAL_DLLPRIVATE
static void ImplHandleScroll(ScrollBar
* pHScrl
, double nX
, ScrollBar
* pVScrl
, double nY
);
719 SAL_DLLPRIVATE
tools::Rectangle
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle
& rRect
) const;
720 SAL_DLLPRIVATE
long ImplGetUnmirroredOutOffX();
722 // retrieves the list of owner draw decorated windows for this window hiearchy
723 SAL_DLLPRIVATE ::std::vector
<VclPtr
<vcl::Window
> >& ImplGetOwnerDrawList();
725 SAL_DLLPRIVATE
vcl::Window
* ImplGetTopmostFrameWindow();
727 SAL_DLLPRIVATE
tools::Rectangle
ImplGetWindowExtentsRelative( vcl::Window
*pRelativeWindow
, bool bClientOnly
) const;
729 SAL_DLLPRIVATE
bool ImplStopDnd();
730 SAL_DLLPRIVATE
void ImplStartDnd();
732 SAL_DLLPRIVATE
void ImplPaintToDevice( ::OutputDevice
* pTargetOutDev
, const Point
& rPos
);
734 SAL_DLLPRIVATE
css::uno::Reference
< css::rendering::XCanvas
>
735 ImplGetCanvas( bool bSpriteCanvas
) const;
738 virtual vcl::Region
GetActiveClipRegion() const override
;
741 // Single argument ctors shall be explicit.
742 explicit Window( WindowType nType
);
744 void SetCompoundControl( bool bCompound
);
746 void CallEventListeners( VclEventId nEvent
, void* pData
= nullptr );
747 static void FireVclEvent( VclSimpleEvent
& rEvent
);
749 virtual bool AcquireGraphics() const override
;
750 virtual void ReleaseGraphics( bool bRelease
= true ) override
;
752 virtual void InitClipRegion() override
;
754 // FIXME: this is a hack to workaround missing layout functionality
755 SAL_DLLPRIVATE
void ImplAdjustNWFSizes();
757 virtual void CopyDeviceArea( SalTwoRect
& aPosAry
, bool bWindowInvalidate
) override
;
758 virtual void ClipToPaintRegion( tools::Rectangle
& rDstRect
) override
;
759 virtual bool UsePolyPolygonForComplexGradient() override
;
761 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
);
763 bool HasMirroredGraphics() const override
;
766 // Single argument ctors shall be explicit.
767 explicit Window( vcl::Window
* pParent
, WinBits nStyle
= 0 );
769 virtual ~Window() override
;
771 ::OutputDevice
const* GetOutDev() const;
772 ::OutputDevice
* GetOutDev();
774 virtual void EnableRTL ( bool bEnable
= true ) override
;
775 virtual void MouseMove( const MouseEvent
& rMEvt
);
776 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
777 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
778 virtual void KeyInput( const KeyEvent
& rKEvt
);
779 virtual void KeyUp( const KeyEvent
& rKEvt
);
780 virtual void PrePaint(vcl::RenderContext
& rRenderContext
);
781 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
);
782 virtual void PostPaint(vcl::RenderContext
& rRenderContext
);
784 using OutputDevice::Erase
;
785 void Erase(vcl::RenderContext
& rRenderContext
);
787 virtual void Draw( ::OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, DrawFlags nFlags
);
789 virtual void Resize();
790 virtual void Activate();
791 virtual void Deactivate();
792 virtual void GetFocus();
793 virtual void LoseFocus();
794 virtual void RequestHelp( const HelpEvent
& rHEvt
);
795 virtual void Command( const CommandEvent
& rCEvt
);
796 virtual void Tracking( const TrackingEvent
& rTEvt
);
797 virtual void StateChanged( StateChangedType nStateChange
);
798 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
799 virtual bool PreNotify( NotifyEvent
& rNEvt
);
800 virtual bool EventNotify( NotifyEvent
& rNEvt
);
802 // These methods call the relevant virtual method when not in/post dispose
803 void CompatGetFocus();
804 void CompatLoseFocus();
805 void CompatStateChanged( StateChangedType nStateChange
);
806 void CompatDataChanged( const DataChangedEvent
& rDCEvt
);
807 bool CompatPreNotify( NotifyEvent
& rNEvt
);
808 bool CompatNotify( NotifyEvent
& rNEvt
);
810 void AddEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
811 void RemoveEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
812 void AddChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
813 void RemoveChildEventListener( const Link
<VclWindowEvent
&,void>& rEventListener
);
815 ImplSVEvent
* PostUserEvent( const Link
<void*,void>& rLink
, void* pCaller
= nullptr, bool bReferenceLink
= false );
816 void RemoveUserEvent( ImplSVEvent
* nUserEvent
);
818 void IncrementLockCount();
819 void DecrementLockCount();
820 bool IsLocked() const;
822 // returns the input language used for the last key stroke
823 // may be LANGUAGE_DONTKNOW if not supported by the OS
824 LanguageType
GetInputLanguage() const;
826 void SetStyle( WinBits nStyle
);
827 WinBits
GetStyle() const;
828 WinBits
GetPrevStyle() const;
829 void SetExtendedStyle( WinBits nExtendedStyle
);
830 WinBits
GetExtendedStyle() const;
831 void SetType( WindowType nType
);
832 WindowType
GetType() const;
833 bool IsSystemWindow() const;
834 bool IsDockingWindow() const;
835 bool IsDialog() const;
836 bool IsMenuFloatingWindow() const;
837 bool IsToolbarFloatingWindow() const;
838 bool IsTopWindow() const;
839 bool IsDisposed() const;
840 SystemWindow
* GetSystemWindow() const;
842 /// Can the widget derived from this Window do the double-buffering via RenderContext properly?
843 bool SupportsDoubleBuffering() const;
844 /// Enable/disable double-buffering of the frame window and all its children.
845 void RequestDoubleBuffering(bool bRequest
);
847 void EnableAllResize();
849 void SetBorderStyle( WindowBorderStyle nBorderStyle
);
850 WindowBorderStyle
GetBorderStyle() const;
851 void GetBorder( sal_Int32
& rLeftBorder
, sal_Int32
& rTopBorder
,
852 sal_Int32
& rRightBorder
, sal_Int32
& rBottomBorder
) const;
853 Size
CalcWindowSize( const Size
& rOutSz
) const;
854 Size
CalcOutputSize( const Size
& rWinSz
) const;
855 long CalcTitleWidth() const;
857 void EnableClipSiblings( bool bClipSiblings
= true );
859 void EnableChildTransparentMode( bool bEnable
= true );
860 bool IsChildTransparentModeEnabled() const;
862 void SetMouseTransparent( bool bTransparent
);
863 bool IsMouseTransparent() const;
864 void SetPaintTransparent( bool bTransparent
);
865 bool IsPaintTransparent() const;
866 void SetDialogControlStart( bool bStart
);
867 bool IsDialogControlStart() const;
868 void SetDialogControlFlags( DialogControlFlags nFlags
);
869 DialogControlFlags
GetDialogControlFlags() const;
873 sal_uLong mnState
; // the button state
874 Point maPos
; // mouse position in output coordinates
876 PointerState
GetPointerState();
879 void SetInputContext( const InputContext
& rInputContext
);
880 const InputContext
& GetInputContext() const;
881 void EndExtTextInput();
882 void SetCursorRect( const tools::Rectangle
* pRect
= nullptr, long nExtTextInputWidth
= 0 );
883 const tools::Rectangle
* GetCursorRect() const;
884 long GetCursorExtTextInputWidth() const;
886 void SetCompositionCharRect( const tools::Rectangle
* pRect
, long nCompositionLength
, bool bVertical
= false );
888 using ::OutputDevice::SetSettings
;
889 virtual void SetSettings( const AllSettings
& rSettings
) override
;
890 void SetSettings( const AllSettings
& rSettings
, bool bChild
);
891 void UpdateSettings( const AllSettings
& rSettings
, bool bChild
= false );
892 void NotifyAllChildren( DataChangedEvent
& rDCEvt
);
894 void SetPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
895 vcl::Font
GetPointFont(vcl::RenderContext
& rRenderContext
) const;
896 void SetZoomedPointFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rFont
);
897 long GetDrawPixel( ::OutputDevice
* pDev
, long nPixels
) const;
898 vcl::Font
GetDrawPixelFont( ::OutputDevice
* pDev
) const;
900 void SetControlFont();
901 void SetControlFont( const vcl::Font
& rFont
);
902 vcl::Font
GetControlFont() const;
903 bool IsControlFont() const;
904 void ApplyControlFont(vcl::RenderContext
& rRenderContext
, const vcl::Font
& rDefaultFont
);
906 void SetControlForeground();
907 void SetControlForeground(const Color
& rColor
);
908 const Color
& GetControlForeground() const;
909 bool IsControlForeground() const;
910 void ApplyControlForeground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
912 void SetControlBackground();
913 void SetControlBackground( const Color
& rColor
);
914 const Color
& GetControlBackground() const;
915 bool IsControlBackground() const;
916 void ApplyControlBackground(vcl::RenderContext
& rRenderContext
, const Color
& rDefaultColor
);
918 void SetParentClipMode( ParentClipMode nMode
= ParentClipMode::NONE
);
919 ParentClipMode
GetParentClipMode() const;
921 void SetWindowRegionPixel();
922 void SetWindowRegionPixel( const vcl::Region
& rRegion
);
923 const vcl::Region
& GetWindowRegionPixel() const;
924 bool IsWindowRegionPixel() const;
925 vcl::Region
GetWindowClipRegionPixel() const;
926 vcl::Region
GetPaintRegion() const;
927 bool IsInPaint() const;
928 // while IsInPaint returns true ExpandPaintClipRegion adds the
929 // submitted region to the paint clip region so you can
930 // paint additional parts of your window if necessary
931 void ExpandPaintClipRegion( const vcl::Region
& rRegion
);
933 void SetParent( vcl::Window
* pNewParent
);
934 vcl::Window
* GetParent() const;
935 // return the dialog we are contained in or NULL if un-contained
936 Dialog
* GetParentDialog() const;
938 void Show( bool bVisible
= true, ShowFlags nFlags
= ShowFlags::NONE
);
939 void Hide() { Show( false ); }
940 bool IsVisible() const;
941 bool IsReallyVisible() const;
942 bool IsReallyShown() const;
943 bool IsInInitShow() const;
945 void Enable( bool bEnable
= true, bool bChild
= true );
946 void Disable( bool bChild
= true ) { Enable( false, bChild
); }
947 bool IsEnabled() const;
949 void EnableInput( bool bEnable
= true, bool bChild
= true );
950 void EnableInput( bool bEnable
, const vcl::Window
* pExcludeWindow
);
951 bool IsInputEnabled() const;
953 /** Override <code>EnableInput</code>. This can be necessary due to other people
954 using EnableInput for whole window hierarchies.
957 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
958 mutually exclusive; the last setter wins.
960 sets always enabled flag
963 if true children are recursively set to AlwaysEnableInput
965 void AlwaysEnableInput( bool bAlways
, bool bChild
= true );
966 /** returns the current AlwaysEnableInput state
968 true if window is in AlwaysEnableInput state
970 bool IsAlwaysEnableInput() const;
971 /** Override <code>EnableInput</code>, counterpart to AlwaysEnableInput.
972 Windows with AlwaysDisableInput will not get key events even if enabled
973 and input enabled.This can be necessary due to other people using EnableInput
974 for whole window hierarchies.
976 <code>AlwaysEnableInput</code> and <code>AlwaysDisableInput</code> are
977 mutually exclusive; the last setter wins.
980 sets always disable flag
983 if true children are recursively set to AlwaysDisableInput
985 void AlwaysDisableInput( bool bAlways
, bool bChild
= true );
987 /** usually event handlers (see AddEventListener and AddChildEventListener)
988 are not called on disabled, modal or input disabled windows. There are however rare cases
989 in which one wants a Window or rather one of its Control subclasses to
990 not evaluate events but still react to those events externally. In these
991 rare cases call SetCallHandlersOnInputDisabled( true ) to have your handler
994 Currently only mouse events get this special treatment.
996 Use this sparingly, chances are if you want to use it you're working around
1000 Enable/Disable calling event handlers for this disabled, modal or input disabled window.
1001 This call is implicity done recursively for possible child windows.
1003 void SetCallHandlersOnInputDisabled( bool bCall
);
1004 /** get state of SetCallHandlersOnInputDisabled
1006 @returns whether handlers are called regardless of input enabled state
1008 bool IsCallHandlersOnInputDisabled() const;
1009 /** A window is in modal mode if one of its children or subchildren
1010 is a running modal window (a modal dialog)
1012 @returns sal_True if a child or subchild is a running modal window
1014 bool IsInModalMode() const;
1016 void SetActivateMode( ActivateModeFlags nMode
);
1017 ActivateModeFlags
GetActivateMode() const;
1019 void ToTop( ToTopFlags nFlags
= ToTopFlags::NONE
);
1020 void SetZOrder( vcl::Window
* pRefWindow
, ZOrderFlags nFlags
);
1021 void EnableAlwaysOnTop( bool bEnable
= true );
1022 bool IsAlwaysOnTopEnabled() const;
1024 virtual void setPosSizePixel( long nX
, long nY
,
1025 long nWidth
, long nHeight
,
1026 PosSizeFlags nFlags
= PosSizeFlags::All
);
1027 virtual void SetPosPixel( const Point
& rNewPos
);
1028 virtual Point
GetPosPixel() const;
1029 virtual void SetSizePixel( const Size
& rNewSize
);
1030 virtual Size
GetSizePixel() const;
1031 virtual void SetPosSizePixel( const Point
& rNewPos
,
1032 const Size
& rNewSize
);
1033 virtual void SetOutputSizePixel( const Size
& rNewSize
);
1034 bool IsDefaultPos() const;
1035 bool IsDefaultSize() const;
1037 // those conversion routines might deliver different results during UI mirroring
1038 Point
OutputToScreenPixel( const Point
& rPos
) const;
1039 Point
ScreenToOutputPixel( const Point
& rPos
) const;
1040 // the normalized screen methods work independent from UI mirroring
1041 Point
OutputToNormalizedScreenPixel( const Point
& rPos
) const;
1042 Point
NormalizedScreenToOutputPixel( const Point
& rPos
) const;
1043 Point
OutputToAbsoluteScreenPixel( const Point
& rPos
) const;
1044 Point
AbsoluteScreenToOutputPixel( const Point
& rPos
) const;
1045 tools::Rectangle
GetDesktopRectPixel() const;
1046 // window extents including border and decoration
1047 tools::Rectangle
GetWindowExtentsRelative( vcl::Window
*pRelativeWindow
) const;
1048 // window extents of the client window, coordinates to be used in SetPosPixel
1049 tools::Rectangle
GetClientWindowExtentsRelative() const;
1051 bool IsScrollable() const;
1052 virtual void Scroll( long nHorzScroll
, long nVertScroll
,
1053 ScrollFlags nFlags
= ScrollFlags::NONE
);
1054 void Scroll( long nHorzScroll
, long nVertScroll
,
1055 const tools::Rectangle
& rRect
, ScrollFlags nFlags
= ScrollFlags::NONE
);
1056 virtual void Invalidate( InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1057 virtual void Invalidate( const tools::Rectangle
& rRect
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1058 virtual void Invalidate( const vcl::Region
& rRegion
, InvalidateFlags nFlags
= InvalidateFlags::NONE
);
1060 bool HasPaintEvent() const;
1064 // toggles new docking support, enabled via toolkit
1065 void EnableDocking( bool bEnable
= true );
1066 // retrieves the single dockingmanager instance
1067 static DockingManager
* GetDockingManager();
1069 void EnablePaint( bool bEnable
);
1070 bool IsPaintEnabled() const;
1071 void SetUpdateMode( bool bUpdate
);
1072 bool IsUpdateMode() const;
1073 void SetParentUpdateMode( bool bUpdate
);
1076 bool HasFocus() const;
1077 bool HasChildPathFocus( bool bSystemWindow
= false ) const;
1078 bool IsActive() const;
1079 bool HasActiveChildFrame();
1080 GetFocusFlags
GetGetFocusFlags() const;
1081 void GrabFocusToDocument();
1084 * Set this when you need to act as if the window has focus even if it
1085 * doesn't. This is necessary for implementing tab stops inside floating
1086 * windows, but floating windows don't get focus from the system.
1088 void SetFakeFocus( bool bFocus
);
1090 bool IsCompoundControl() const;
1092 static VclPtr
<vcl::Window
> SaveFocus();
1093 static void EndSaveFocus(const VclPtr
<vcl::Window
>& xFocusWin
);
1095 void CaptureMouse();
1096 void ReleaseMouse();
1097 bool IsMouseCaptured() const;
1099 void SetPointer( const Pointer
& rPointer
);
1100 const Pointer
& GetPointer() const;
1101 void EnableChildPointerOverwrite( bool bOverwrite
);
1102 void SetPointerPosPixel( const Point
& rPos
);
1103 Point
GetPointerPosPixel();
1104 Point
GetLastPointerPosPixel();
1105 /// Similar to SetPointerPosPixel(), but sets the frame data's last mouse position instead.
1106 void SetLastMousePos(const Point
& rPos
);
1107 void ShowPointer( bool bVisible
);
1110 bool IsWait() const;
1112 void SetCursor( vcl::Cursor
* pCursor
);
1113 vcl::Cursor
* GetCursor() const;
1115 void SetZoom( const Fraction
& rZoom
);
1116 const Fraction
& GetZoom() const;
1117 bool IsZoom() const;
1118 long CalcZoom( long n
) const;
1120 virtual void SetText( const OUString
& rStr
);
1121 virtual OUString
GetText() const;
1122 // return the actual text displayed
1123 // this may have e.g. accelerators removed or portions
1124 // replaced by ellipses
1125 virtual OUString
GetDisplayText() const;
1126 // gets the visible background color. for transparent windows
1127 // this may be the parent's background color; for controls
1128 // this may be a child's background color (e.g. ListBox)
1129 virtual const Wallpaper
& GetDisplayBackground() const;
1131 void SetHelpText( const OUString
& rHelpText
);
1132 const OUString
& GetHelpText() const;
1134 void SetQuickHelpText( const OUString
& rHelpText
);
1135 const OUString
& GetQuickHelpText() const;
1137 void SetHelpId( const OString
& );
1138 const OString
& GetHelpId() const;
1140 /** String ID of this window for the purpose of creating a screenshot
1142 In default implementation this ID is the same as HelpId. Override this method
1143 in windows (dialogs,tabpages) that need different IDs for different configurations
1146 @return screenshot ID of this window
1148 virtual OString
GetScreenshotId() const;
1150 vcl::Window
* FindWindow( const Point
& rPos
) const;
1152 sal_uInt16
GetChildCount() const;
1153 vcl::Window
* GetChild( sal_uInt16 nChild
) const;
1154 vcl::Window
* GetWindow( GetWindowType nType
) const;
1155 bool IsChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
1156 bool IsWindowOrChild( const vcl::Window
* pWindow
, bool bSystemWindow
= false ) const;
1158 /// Add all children to rAllChildren recursively.
1159 SAL_DLLPRIVATE
void CollectChildren(::std::vector
<vcl::Window
*>& rAllChildren
);
1161 virtual void ShowFocus(const tools::Rectangle
& rRect
);
1164 // transparent background for selected or checked items in toolboxes etc.
1165 void DrawSelectionBackground( const tools::Rectangle
& rRect
, sal_uInt16 highlight
, bool bChecked
, bool bDrawBorder
);
1167 void ShowTracking( const tools::Rectangle
& rRect
,
1168 ShowTrackFlags nFlags
= ShowTrackFlags::Small
);
1169 void HideTracking();
1170 void InvertTracking( const tools::Rectangle
& rRect
, ShowTrackFlags nFlags
);
1171 void InvertTracking( const tools::Polygon
& rPoly
, ShowTrackFlags nFlags
);
1173 void StartTracking( StartTrackingFlags nFlags
= StartTrackingFlags::NONE
);
1174 void EndTracking( TrackingEventFlags nFlags
= TrackingEventFlags::NONE
);
1175 bool IsTracking() const;
1177 void StartAutoScroll( StartAutoScrollFlags nFlags
);
1178 void EndAutoScroll();
1180 bool HandleScrollCommand( const CommandEvent
& rCmd
,
1182 ScrollBar
* pVScrl
);
1184 void SaveBackground( const Point
& rPos
, const Size
& rSize
,
1185 VirtualDevice
& rSaveDevice
);
1187 virtual const SystemEnvData
* GetSystemData() const;
1188 css::uno::Any
GetSystemDataAny() const;
1190 // API to set/query the component interfaces
1191 virtual css::uno::Reference
< css::awt::XWindowPeer
>
1192 GetComponentInterface( bool bCreate
= true );
1194 void SetComponentInterface( css::uno::Reference
< css::awt::XWindowPeer
> const & xIFace
);
1196 /** @name Accessibility
1201 css::uno::Reference
< css::accessibility::XAccessible
>
1202 GetAccessible( bool bCreate
= true );
1204 virtual css::uno::Reference
< css::accessibility::XAccessible
>
1207 void SetAccessible( const css::uno::Reference
< css::accessibility::XAccessible
>& );
1209 vcl::Window
* GetAccessibleParentWindow() const;
1210 sal_uInt16
GetAccessibleChildWindowCount();
1211 vcl::Window
* GetAccessibleChildWindow( sal_uInt16 n
);
1213 void SetAccessibleRole( sal_uInt16 nRole
);
1214 sal_uInt16
GetAccessibleRole() const;
1216 void SetAccessibleName( const OUString
& rName
);
1217 OUString
GetAccessibleName() const;
1219 void SetAccessibleDescription( const OUString
& rDescr
);
1220 OUString
GetAccessibleDescription() const;
1222 void SetAccessibleRelationLabeledBy( vcl::Window
* pLabeledBy
);
1223 vcl::Window
* GetAccessibleRelationLabeledBy() const;
1225 void SetAccessibleRelationLabelFor( vcl::Window
* pLabelFor
);
1226 vcl::Window
* GetAccessibleRelationLabelFor() const;
1228 void SetAccessibleRelationMemberOf( vcl::Window
* pMemberOf
);
1229 vcl::Window
* GetAccessibleRelationMemberOf() const;
1232 // to avoid sending accessibility events in cases like closing dialogs
1233 // by default checks complete parent path
1234 bool IsAccessibilityEventsSuppressed( bool bTraverseParentPath
= true );
1235 void SetAccessibilityEventsSuppressed(bool bSuppressed
);
1237 // Deprecated - can use SetAccessibleRelationLabelFor/By nowadays
1238 virtual vcl::Window
* GetParentLabelFor( const vcl::Window
* pLabel
) const;
1239 virtual vcl::Window
* GetParentLabeledBy( const vcl::Window
* pLabeled
) const;
1240 KeyEvent
GetActivationKey() const;
1244 // These eventually are supposed to go when everything is converted to .ui
1245 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationMemberOf() const;
1246 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabeledBy() const;
1247 SAL_DLLPRIVATE
vcl::Window
* getLegacyNonLayoutAccessibleRelationLabelFor() const;
1249 // Let Label override the code part of GetAccessibleRelationLabelFor
1250 virtual vcl::Window
* getAccessibleRelationLabelFor() const;
1251 virtual sal_uInt16
getDefaultAccessibleRole() const;
1252 virtual OUString
getDefaultAccessibleName() const;
1255 * Advisory Sizing - what is a good size for this widget
1257 * Retrieves the preferred size of a widget ignoring
1258 * "width-request" and "height-request" properties.
1260 * Implement this in sub-classes to tell layout
1261 * the preferred widget size.
1263 * Use get_preferred_size to retrieve this value
1264 * cached and mediated via height and width requests
1266 virtual Size
GetOptimalSize() const;
1267 /// clear OptimalSize cache
1268 void InvalidateSizeCache();
1271 SAL_DLLPRIVATE
bool ImplIsAccessibleCandidate() const;
1272 SAL_DLLPRIVATE
bool ImplIsAccessibleNativeFrame() const;
1276 * Retrieves the preferred size of a widget taking
1277 * into account the "width-request" and "height-request" properties.
1279 * Overrides the result of GetOptimalSize to honor the
1280 * width-request and height-request properties.
1282 * So the same as get_ungrouped_preferred_size except
1283 * it ignores groups. A building block of get_preferred_size
1284 * that access the size cache
1286 * @see get_preferred_size
1288 Size
get_ungrouped_preferred_size() const;
1290 /// request XCanvas render interface for this window
1291 css::uno::Reference
< css::rendering::XCanvas
>
1293 /// request XSpriteCanvas render interface for this window
1294 css::uno::Reference
< css::rendering::XSpriteCanvas
>
1295 GetSpriteCanvas() const;
1297 /* records all DrawText operations within the passed rectangle;
1298 * a synchronous paint is sent to achieve this
1300 void RecordLayoutData( vcl::ControlLayoutData
* pLayout
, const tools::Rectangle
& rRect
);
1302 // set and retrieve for Toolkit
1303 VCLXWindow
* GetWindowPeer() const;
1304 void SetWindowPeer( css::uno::Reference
< css::awt::XWindowPeer
> const & xPeer
, VCLXWindow
* pVCLXWindow
);
1306 // remember if it was generated by Toolkit
1307 bool IsCreatedWithToolkit() const;
1308 void SetCreatedWithToolkit( bool b
);
1310 // Drag and Drop interfaces
1311 css::uno::Reference
< css::datatransfer::dnd::XDropTarget
> GetDropTarget();
1312 css::uno::Reference
< css::datatransfer::dnd::XDragSource
> GetDragSource();
1313 css::uno::Reference
< css::datatransfer::dnd::XDragGestureRecognizer
> GetDragGestureRecognizer();
1315 // Clipboard/Selection interfaces
1316 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetClipboard();
1317 /// Sets a custom clipboard for the window's frame, instead of creating it on-demand using css::datatransfer::clipboard::SystemClipboard.
1318 void SetClipboard(css::uno::Reference
<css::datatransfer::clipboard::XClipboard
> const & xClipboard
);
1319 css::uno::Reference
< css::datatransfer::clipboard::XClipboard
> GetPrimarySelection();
1322 * Widgets call this to inform their owner container that the widget wants
1323 * to renegotiate its size. Should be called when a widget has a new size
1324 * request. e.g. a FixedText Control gets a new label.
1326 * akin to gtk_widget_queue_resize
1328 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
);
1331 * Sets the "height-request" property
1333 * Override for height request of the widget, or -1 if natural request
1336 * @see get_preferred_size, set_width_request
1338 void set_height_request(sal_Int32 nHeightRequest
);
1339 sal_Int32
get_height_request() const;
1342 * Sets the "width-request" property
1344 * Override for width request of the widget, or -1 if natural request
1347 * @see get_preferred_size, set_height_request
1349 void set_width_request(sal_Int32 nWidthRequest
);
1350 sal_Int32
get_width_request() const;
1353 * Retrieves the preferred size of a widget taking
1354 * into account the "width-request" and "height-request" properties.
1356 * Overrides the result of GetOptimalSize to honor the
1357 * width-request and height-request properties.
1359 * @see GetOptimalSize
1361 * akin to gtk_widget_get_preferred_size
1363 Size
get_preferred_size() const;
1366 * How to horizontally align this widget
1368 VclAlign
get_halign() const;
1369 void set_halign(VclAlign eAlign
);
1372 * How to vertically align this widget
1374 VclAlign
get_valign() const;
1375 void set_valign(VclAlign eAlign
);
1378 * Whether the widget would like to use any available extra horizontal
1381 bool get_hexpand() const;
1382 void set_hexpand(bool bExpand
);
1385 * Whether the widget would like to use any available extra vertical
1388 bool get_vexpand() const;
1389 void set_vexpand(bool bExpand
);
1392 * Whether the widget would like to use any available extra space.
1394 bool get_expand() const;
1395 void set_expand(bool bExpand
);
1398 * Whether the widget should receive extra space when the parent grows
1400 bool get_fill() const;
1401 void set_fill(bool bFill
);
1403 void set_border_width(sal_Int32 nBorderWidth
);
1404 sal_Int32
get_border_width() const;
1406 void set_margin_left(sal_Int32 nWidth
);
1407 sal_Int32
get_margin_left() const;
1409 void set_margin_right(sal_Int32 nWidth
);
1410 sal_Int32
get_margin_right() const;
1412 void set_margin_top(sal_Int32 nWidth
);
1413 sal_Int32
get_margin_top() const;
1415 void set_margin_bottom(sal_Int32 nWidth
);
1416 sal_Int32
get_margin_bottom() const;
1419 * How the widget is packed with reference to the start or end of the parent
1421 VclPackType
get_pack_type() const;
1422 void set_pack_type(VclPackType ePackType
);
1425 * The extra space to put between the widget and its neighbors
1427 sal_Int32
get_padding() const;
1428 void set_padding(sal_Int32 nPadding
);
1431 * The number of columns that the widget spans
1433 sal_Int32
get_grid_width() const;
1434 void set_grid_width(sal_Int32 nCols
);
1437 * The column number to attach the left side of the widget to
1439 sal_Int32
get_grid_left_attach() const;
1440 void set_grid_left_attach(sal_Int32 nAttach
);
1443 * The number of row that the widget spans
1445 sal_Int32
get_grid_height() const;
1446 void set_grid_height(sal_Int32 nRows
);
1449 * The row number to attach the top side of the widget to
1451 sal_Int32
get_grid_top_attach() const;
1452 void set_grid_top_attach(sal_Int32 nAttach
);
1455 * If true this child appears in a secondary layout group of children
1456 * e.g. help buttons in a buttonbox
1458 bool get_secondary() const;
1459 void set_secondary(bool bSecondary
);
1462 * If true this child is exempted from homogenous sizing
1463 * e.g. special button in a buttonbox
1465 bool get_non_homogeneous() const;
1466 void set_non_homogeneous(bool bNonHomogeneous
);
1469 * Sets a widget property
1471 * @return false if property is unknown
1473 virtual bool set_property(const OString
&rKey
, const OUString
&rValue
);
1476 * Sets a font attribute
1478 * @return false if attribute is unknown
1480 bool set_font_attribute(const OString
&rKey
, const OUString
&rValue
);
1483 * Adds this widget to the xGroup VclSizeGroup
1486 void add_to_size_group(const std::shared_ptr
<VclSizeGroup
>& xGroup
);
1487 void remove_from_all_size_groups();
1490 * add/remove mnemonic label
1492 void add_mnemonic_label(FixedText
*pLabel
);
1493 void remove_mnemonic_label(FixedText
*pLabel
);
1494 const std::vector
<VclPtr
<FixedText
> >& list_mnemonic_labels() const;
1497 * Move this widget to be the nNewPosition'd child of its parent
1499 void reorderWithinParent(sal_uInt16 nNewPosition
);
1504 void set_id(const OUString
& rID
);
1507 * Get the ID of the window.
1509 const OUString
& get_id() const;
1512 // Native Widget Rendering functions
1515 // form controls must never use native widgets, this can be toggled here
1516 void EnableNativeWidget( bool bEnable
= true );
1517 bool IsNativeWidgetEnabled() const;
1519 // a helper method for a Control's Draw method
1520 void PaintToDevice( ::OutputDevice
* pDevice
, const Point
& rPos
, const Size
& rSize
);
1522 /* mark Window for deletion in top of event queue
1524 void doLazyDelete();
1527 // Keyboard access functions
1530 /** Query the states of keyboard indicators - Caps Lock, Num Lock and
1531 Scroll Lock. Use the following mask to retrieve the state of each
1534 KeyIndicatorState::CAPS_LOCK
1535 KeyIndicatorState::NUM_LOCK
1536 KeyIndicatorState::SCROLL_LOCK
1538 KeyIndicatorState
GetIndicatorState() const;
1540 void SimulateKeyPress( sal_uInt16 nKeyCode
) const;
1542 virtual OUString
GetSurroundingText() const;
1543 virtual Selection
GetSurroundingTextSelection() const;
1545 virtual FactoryFunction
GetUITestFactory() const;
1550 // Only for compatibility - because many people outside haven't included event.hxx
1551 // These require Window to be defined for VclPtr<Window>
1552 #include <vcl/event.hxx>
1554 #endif // INCLUDED_VCL_WINDOW_HXX
1556 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */