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/.
10 #ifndef INCLUDED_VCL_LAYOUT_HXX
11 #define INCLUDED_VCL_LAYOUT_HXX
13 #include <config_options.h>
14 #include <vcl/dllapi.h>
15 #include <vcl/ctrl.hxx>
16 #include <vcl/svapp.hxx>
17 #include <vcl/window.hxx>
18 #include <vcl/settings.hxx>
19 #include <vcl/event.hxx>
20 #include <vcl/transfer.hxx>
21 #include <vcl/vclptr.hxx>
22 #include <vcl/IContext.hxx>
23 #include <vcl/commandevent.hxx>
31 class VCL_DLLPUBLIC VclContainer
: public vcl::Window
,
35 VclContainer(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
);
37 //These take into account the external margins of the rWindow widget
38 //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
40 static Size
getLayoutRequisition(const vcl::Window
&rWindow
);
41 static void setLayoutPosSize(vcl::Window
&rWindow
, const Point
&rPos
, const Size
&rSize
);
43 //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
44 //the rWindows alignment desires within that allocation
45 static void setLayoutAllocation(vcl::Window
&rWindow
, const Point
&rPos
, const Size
&rSize
);
47 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
) override
;
49 //these are the two that need to be implemented by
50 //containers, figure out how much space you want...
51 virtual Size
calculateRequisition() const = 0;
52 //..and decide what to do when set to this size
53 virtual void setAllocation(const Size
&rAllocation
) = 0;
55 virtual sal_uInt16
getDefaultAccessibleRole() const override
;
57 // support for screenshot context menu
58 virtual void Command(const CommandEvent
& rCEvt
) override
;
61 //you don't want to override these
62 virtual Size
GetOptimalSize() const override
;
63 virtual void SetPosSizePixel(const Point
& rNewPos
, const Size
& rNewSize
) override
;
64 virtual void SetPosPixel(const Point
& rAllocPos
) override
;
65 virtual void SetSizePixel(const Size
& rAllocation
) override
;
70 class VCL_DLLPUBLIC VclBox
: public VclContainer
74 bool m_bVerticalContainer
;
77 VclBox(vcl::Window
*pParent
, bool bHomogeneous
, int nSpacing
)
78 : VclContainer(pParent
)
79 , m_bHomogeneous(bHomogeneous
)
80 , m_bVerticalContainer(false)
81 , m_nSpacing(nSpacing
)
84 void set_spacing(int nSpacing
)
86 m_nSpacing
= nSpacing
;
88 int get_spacing() const
92 void set_homogeneous(bool bHomogeneous
)
94 m_bHomogeneous
= bHomogeneous
;
96 bool get_orientation() const
98 return m_bVerticalContainer
;
100 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
101 virtual void DumpAsPropertyTree(tools::JsonWriter
&) override
;
103 virtual sal_uInt16
getDefaultAccessibleRole() const override
;
104 void accumulateMaxes(const Size
&rChildSize
, Size
&rSize
) const;
105 Size
finalizeMaxes(const Size
&rSize
, sal_uInt16 nVisibleChildren
) const;
107 virtual Size
calculateRequisition() const override
;
108 virtual void setAllocation(const Size
&rAllocation
) override
;
110 virtual tools::Long
getPrimaryDimension(const Size
&rSize
) const = 0;
111 virtual void setPrimaryDimension(Size
&rSize
, tools::Long
) const = 0;
112 virtual tools::Long
getPrimaryCoordinate(const Point
&rPos
) const = 0;
113 virtual void setPrimaryCoordinate(Point
&rPos
, tools::Long
) const = 0;
114 virtual tools::Long
getSecondaryDimension(const Size
&rSize
) const = 0;
115 virtual void setSecondaryDimension(Size
&rSize
, tools::Long
) const = 0;
117 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const = 0;
120 class VCL_DLLPUBLIC VclVBox
: public VclBox
123 VclVBox(vcl::Window
*pParent
, bool bHomogeneous
= false, int nSpacing
= 0)
124 : VclBox(pParent
, bHomogeneous
, nSpacing
)
126 m_bVerticalContainer
= true;
129 virtual tools::Long
getPrimaryDimension(const Size
&rSize
) const override
131 return rSize
.getHeight();
133 virtual void setPrimaryDimension(Size
&rSize
, tools::Long nHeight
) const override
135 rSize
.setHeight(nHeight
);
137 virtual tools::Long
getPrimaryCoordinate(const Point
&rPos
) const override
141 virtual void setPrimaryCoordinate(Point
&rPos
, tools::Long nPos
) const override
145 virtual tools::Long
getSecondaryDimension(const Size
&rSize
) const override
147 return rSize
.getWidth();
149 virtual void setSecondaryDimension(Size
&rSize
, tools::Long nWidth
) const override
151 rSize
.setWidth(nWidth
);
153 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const override
155 return rWindow
.get_expand() || rWindow
.get_vexpand();
159 class VCL_DLLPUBLIC VclHBox
: public VclBox
162 VclHBox(vcl::Window
*pParent
, bool bHomogeneous
= false, int nSpacing
= 0)
163 : VclBox(pParent
, bHomogeneous
, nSpacing
)
165 m_bVerticalContainer
= false;
168 virtual tools::Long
getPrimaryDimension(const Size
&rSize
) const override
170 return rSize
.getWidth();
172 virtual void setPrimaryDimension(Size
&rSize
, tools::Long nWidth
) const override
174 rSize
.setWidth(nWidth
);
176 virtual tools::Long
getPrimaryCoordinate(const Point
&rPos
) const override
180 virtual void setPrimaryCoordinate(Point
&rPos
, tools::Long nPos
) const override
184 virtual tools::Long
getSecondaryDimension(const Size
&rSize
) const override
186 return rSize
.getHeight();
188 virtual void setSecondaryDimension(Size
&rSize
, tools::Long nHeight
) const override
190 rSize
.setHeight(nHeight
);
192 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const override
194 return rWindow
.get_expand() || rWindow
.get_hexpand();
198 enum class VclButtonBoxStyle
208 class VCL_DLLPUBLIC VclButtonBox
: public VclBox
211 VclButtonBox(vcl::Window
*pParent
)
212 : VclBox(pParent
, false, Application::GetSettings().GetStyleSettings().GetDialogStyle().button_spacing
)
213 , m_eLayoutStyle(VclButtonBoxStyle::Default
)
216 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
217 virtual void DumpAsPropertyTree(tools::JsonWriter
&) override
;
219 virtual Size
calculateRequisition() const override
;
220 virtual void setAllocation(const Size
&rAllocation
) override
;
221 Size
addSpacing(const Size
&rSize
, sal_uInt16 nVisibleChildren
) const;
223 VclButtonBoxStyle m_eLayoutStyle
;
226 std::vector
<tools::Long
> m_aMainGroupDimensions
;
227 std::vector
<tools::Long
> m_aSubGroupDimensions
;
228 Size m_aMainGroupSize
;
229 Size m_aSubGroupSize
;
231 Requisition
calculatePrimarySecondaryRequisitions() const;
232 Size
addReqGroups(const VclButtonBox::Requisition
&rReq
) const;
235 class VCL_DLLPUBLIC VclVButtonBox
: public VclButtonBox
238 VclVButtonBox(vcl::Window
*pParent
)
239 : VclButtonBox(pParent
)
241 m_bVerticalContainer
= true;
244 virtual tools::Long
getPrimaryDimension(const Size
&rSize
) const override
246 return rSize
.getHeight();
248 virtual void setPrimaryDimension(Size
&rSize
, tools::Long nHeight
) const override
250 rSize
.setHeight(nHeight
);
252 virtual tools::Long
getPrimaryCoordinate(const Point
&rPos
) const override
256 virtual void setPrimaryCoordinate(Point
&rPos
, tools::Long nPos
) const override
260 virtual tools::Long
getSecondaryDimension(const Size
&rSize
) const override
262 return rSize
.getWidth();
264 virtual void setSecondaryDimension(Size
&rSize
, tools::Long nWidth
) const override
266 rSize
.setWidth(nWidth
);
268 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const override
270 return rWindow
.get_expand() || rWindow
.get_vexpand();
274 class VCL_DLLPUBLIC VclHButtonBox final
: public VclButtonBox
277 VclHButtonBox(vcl::Window
*pParent
)
278 : VclButtonBox(pParent
)
280 m_bVerticalContainer
= false;
283 virtual tools::Long
getPrimaryDimension(const Size
&rSize
) const override
285 return rSize
.getWidth();
287 virtual void setPrimaryDimension(Size
&rSize
, tools::Long nWidth
) const override
289 rSize
.setWidth(nWidth
);
291 virtual tools::Long
getPrimaryCoordinate(const Point
&rPos
) const override
295 virtual void setPrimaryCoordinate(Point
&rPos
, tools::Long nPos
) const override
299 virtual tools::Long
getSecondaryDimension(const Size
&rSize
) const override
301 return rSize
.getHeight();
303 virtual void setSecondaryDimension(Size
&rSize
, tools::Long nHeight
) const override
305 rSize
.setHeight(nHeight
);
307 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const override
309 return rWindow
.get_expand() || rWindow
.get_hexpand();
313 class VCL_DLLPUBLIC VclGrid final
: public VclContainer
316 bool m_bRowHomogeneous
;
317 bool m_bColumnHomogeneous
;
319 int m_nColumnSpacing
;
324 tools::Long m_nValue
;
326 Value() : m_nValue(0), m_bExpand(false) {}
330 Size
calculateRequisitionForSpacings(sal_Int32 nRowSpacing
, sal_Int32 nColSpacing
) const;
331 virtual Size
calculateRequisition() const override
;
332 virtual void setAllocation(const Size
&rAllocation
) override
;
333 virtual void DumpAsPropertyTree(tools::JsonWriter
&) override
;
335 VclGrid(vcl::Window
*pParent
)
336 : VclContainer(pParent
)
337 , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
338 , m_nRowSpacing(0), m_nColumnSpacing(0)
341 bool get_row_homogeneous() const
343 return m_bRowHomogeneous
;
345 bool get_column_homogeneous() const
347 return m_bColumnHomogeneous
;
349 void set_row_spacing(int nSpacing
)
351 m_nRowSpacing
= nSpacing
;
353 void set_column_spacing(int nSpacing
)
355 m_nColumnSpacing
= nSpacing
;
357 int get_row_spacing() const
359 return m_nRowSpacing
;
361 int get_column_spacing() const
363 return m_nColumnSpacing
;
365 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
368 class UNLESS_MERGELIBS(VCL_DLLPUBLIC
) VclBin
: public VclContainer
371 VclBin(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
)
372 : VclContainer(pParent
, nStyle
)
375 virtual vcl::Window
*get_child();
376 virtual const vcl::Window
*get_child() const;
377 virtual Size
calculateRequisition() const override
;
378 virtual void setAllocation(const Size
&rAllocation
) override
;
381 class VclPaned
: public VclContainer
384 VclPtr
<Splitter
> m_pSplitter
;
385 tools::Long m_nPosition
;
387 VclPaned(vcl::Window
*pParent
, bool bVertical
);
389 virtual ~VclPaned() override
;
390 virtual void dispose() override
;
391 tools::Long
get_position() const { return m_nPosition
; }
392 virtual void set_position(tools::Long nPosition
) { m_nPosition
= nPosition
; }
395 class VclVPaned final
: public VclPaned
398 DECL_LINK(SplitHdl
, Splitter
*, void);
399 void arrange(const Size
& rAllocation
, tools::Long nFirstHeight
, tools::Long nSecondHeight
);
402 VclVPaned(vcl::Window
*pParent
);
403 virtual ~VclVPaned() override
;
404 virtual Size
calculateRequisition() const override
;
405 virtual void setAllocation(const Size
&rAllocation
) override
;
406 virtual void set_position(tools::Long nPosition
) override
;
409 class VclHPaned final
: public VclPaned
412 DECL_LINK(SplitHdl
, Splitter
*, void);
413 void arrange(const Size
& rAllocation
, tools::Long nFirstHeight
, tools::Long nSecondHeight
);
416 VclHPaned(vcl::Window
*pParent
);
417 virtual ~VclHPaned() override
;
418 virtual Size
calculateRequisition() const override
;
419 virtual void setAllocation(const Size
&rAllocation
) override
;
420 virtual void set_position(tools::Long nPosition
) override
;
423 class VclFrame final
: public VclBin
426 VclPtr
<vcl::Window
> m_pLabel
;
428 friend class VclBuilder
;
429 void designate_label(vcl::Window
*pWindow
);
430 DECL_LINK(WindowEventListener
, VclWindowEvent
&, void);
432 VclFrame(vcl::Window
*pParent
)
437 virtual ~VclFrame() override
;
438 virtual void dispose() override
;
439 void set_label(const OUString
&rLabel
);
440 OUString
get_label() const;
441 virtual vcl::Window
*get_child() override
;
442 virtual const vcl::Window
*get_child() const override
;
443 vcl::Window
*get_label_widget();
444 const vcl::Window
*get_label_widget() const;
445 virtual void DumpAsPropertyTree(tools::JsonWriter
&) override
;
447 virtual Size
calculateRequisition() const override
;
448 virtual void setAllocation(const Size
&rAllocation
) override
;
449 virtual OUString
getDefaultAccessibleName() const override
;
452 class DisclosureButton
;
455 class VclExpander final
: public VclBin
458 VclExpander(vcl::Window
*pParent
);
459 virtual ~VclExpander() override
;
460 virtual void dispose() override
;
461 virtual vcl::Window
*get_child() override
;
462 virtual const vcl::Window
*get_child() const override
;
463 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
464 bool get_expanded() const;
465 void set_expanded(bool bExpanded
);
466 void set_label(const OUString
& rLabel
);
467 OUString
get_label() const;
468 vcl::Window
*get_label_widget();
469 const vcl::Window
*get_label_widget() const;
470 virtual void StateChanged(StateChangedType nType
) override
;
471 void SetExpandedHdl( const Link
<VclExpander
&,void>& rLink
) { maExpandedHdl
= rLink
; }
472 virtual void DumpAsPropertyTree(tools::JsonWriter
& rJsonWriter
) override
;
473 virtual FactoryFunction
GetUITestFactory() const override
;
475 virtual Size
calculateRequisition() const override
;
476 virtual void setAllocation(const Size
&rAllocation
) override
;
477 bool m_bResizeTopLevel
;
478 VclPtr
<DisclosureButton
> m_pDisclosureButton
;
479 Link
<VclExpander
&,void> maExpandedHdl
;
480 DECL_LINK(ClickHdl
, CheckBox
&, void);
483 class VclScrolledWindow final
: public VclBin
486 VclScrolledWindow(vcl::Window
*pParent
);
487 virtual ~VclScrolledWindow() override
;
488 virtual void dispose() override
;
489 virtual vcl::Window
*get_child() override
;
490 virtual const vcl::Window
*get_child() const override
;
491 virtual bool set_property(const OUString
&rKey
, const OUString
&rValue
) override
;
492 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
493 bool HasVisibleBorder() const { return m_eDrawFrameStyle
!= DrawFrameStyle::NONE
; }
494 ScrollBar
& getVertScrollBar() { return *m_pVScroll
; }
495 ScrollBar
& getHorzScrollBar() { return *m_pHScroll
; }
496 Size
getVisibleChildSize() const;
497 //set to true to disable the built-in scrolling callbacks to allow the user
499 void setUserManagedScrolling(bool bUserManagedScrolling
) { m_bUserManagedScrolling
= bUserManagedScrolling
;}
500 void doSetAllocation(const Size
&rAllocation
, bool bRetryOnFailure
);
501 virtual void DumpAsPropertyTree(::tools::JsonWriter
& rJsonWriter
) override
;
503 virtual Size
calculateRequisition() const override
;
504 virtual void setAllocation(const Size
&rAllocation
) override
;
505 int CalcBorderWidth() const;
506 DECL_LINK(ScrollBarHdl
, ScrollBar
*, void);
507 void InitScrollBars(const Size
&rRequest
);
508 virtual bool EventNotify(NotifyEvent
& rNEvt
) override
;
509 bool m_bUserManagedScrolling
;
510 tools::Long m_nBorderWidth
;
511 DrawFrameStyle m_eDrawFrameStyle
;
512 DrawFrameFlags m_eDrawFrameFlags
;
513 VclPtr
<ScrollBar
> m_pVScroll
;
514 VclPtr
<ScrollBar
> m_pHScroll
;
515 VclPtr
<ScrollBarBox
> m_aScrollBarBox
;
518 class VclViewport final
: public VclBin
521 VclViewport(vcl::Window
*pParent
)
522 : VclBin(pParent
, WB_HIDE
| WB_CLIPCHILDREN
)
523 , m_bInitialAllocation(true)
527 virtual void setAllocation(const Size
&rAllocation
) override
;
528 bool m_bInitialAllocation
;
531 //Enforces that its children are always the same size as itself.
532 //Intercepts any Commands intended for its children.
534 //by default the Commands are discarded, inherit from this
535 //and implement "Command" to get them
536 class VclEventBox final
: public VclBin
539 //Any Commands an EventBoxHelper receives are forwarded to its parent
540 //The VclEventBox ensures that m_aEventBoxHelper is the
541 //first child and is transparent, but covers the rest of the children
542 class EventBoxHelper final
: public vcl::Window
545 EventBoxHelper(vcl::Window
* pParent
)
548 SetSizePixel(pParent
->GetSizePixel());
549 EnableChildTransparentMode();
550 SetPaintTransparent(true);
553 virtual void Command(const CommandEvent
& rCEvt
) override
555 GetParent()->Command(rCEvt
);
559 VclPtr
<EventBoxHelper
> m_aEventBoxHelper
;
560 virtual void dispose() override
;
561 virtual ~VclEventBox() override
;
563 VclEventBox(vcl::Window
* pParent
)
565 , m_aEventBoxHelper(VclPtr
<EventBoxHelper
>::Create(this))
567 m_aEventBoxHelper
->Show();
569 virtual vcl::Window
*get_child() override
;
570 virtual const vcl::Window
*get_child() const override
;
571 virtual Size
calculateRequisition() const override
;
572 virtual void setAllocation(const Size
&rAllocation
) override
;
574 virtual void Command(const CommandEvent
& rCEvt
) override
;
580 std::set
< VclPtr
<vcl::Window
> > m_aWindows
;
581 bool m_bIgnoreHidden
;
582 VclSizeGroupMode m_eMode
;
584 void trigger_queue_resize();
587 : m_bIgnoreHidden(false)
588 , m_eMode(VclSizeGroupMode::Horizontal
)
591 void insert(vcl::Window
*pWindow
)
593 m_aWindows
.insert(VclPtr
<vcl::Window
>(pWindow
));
595 void erase(vcl::Window
*pWindow
)
597 m_aWindows
.erase(VclPtr
<vcl::Window
>(pWindow
));
599 const std::set
< VclPtr
<vcl::Window
> >& get_widgets() const
603 std::set
< VclPtr
<vcl::Window
> >& get_widgets()
607 void set_ignore_hidden(bool bIgnoreHidden
);
608 bool get_ignore_hidden() const
610 return m_bIgnoreHidden
;
612 void set_mode(VclSizeGroupMode eMode
);
613 VclSizeGroupMode
get_mode() const
617 void set_property(const OUString
&rKey
, const OUString
&rValue
);
620 class VCL_DLLPUBLIC VclDrawingArea final
: public Control
621 , public DragSourceHelper
624 FactoryFunction m_pFactoryFunction
;
626 rtl::Reference
<TransferDataContainer
> m_xTransferHelper
;
627 sal_Int8 m_nDragAction
;
628 Link
<std::pair
<vcl::RenderContext
&, const tools::Rectangle
&>, void> m_aPaintHdl
;
629 Link
<const Size
&, void> m_aResizeHdl
;
630 Link
<const MouseEvent
&, bool> m_aMousePressHdl
;
631 Link
<const MouseEvent
&, bool> m_aMouseMotionHdl
;
632 Link
<const MouseEvent
&, bool> m_aMouseReleaseHdl
;
633 Link
<const KeyEvent
&, bool> m_aKeyPressHdl
;
634 Link
<const KeyEvent
&, bool> m_aKeyReleaseHdl
;
635 Link
<VclDrawingArea
&, void> m_aStyleUpdatedHdl
;
636 Link
<const CommandEvent
&, bool> m_aCommandHdl
;
637 Link
<tools::Rectangle
&, OUString
> m_aQueryTooltipHdl
;
638 Link
<OUString
&, int> m_aGetSurroundingHdl
;
639 Link
<const Selection
&, bool> m_aDeleteSurroundingHdl
;
640 Link
<VclDrawingArea
*, bool> m_aStartDragHdl
;
642 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
644 m_aPaintHdl
.Call(std::pair
<vcl::RenderContext
&, const tools::Rectangle
&>(rRenderContext
, rRect
));
646 virtual void Resize() override
648 m_aResizeHdl
.Call(GetOutputSizePixel());
650 virtual void KeyInput(const KeyEvent
& rKEvt
) override
652 if (!m_aKeyPressHdl
.Call(rKEvt
))
653 Control::KeyInput(rKEvt
);
656 virtual void KeyUp(const KeyEvent
& rKEvt
) override
658 if (!m_aKeyReleaseHdl
.Call(rKEvt
))
659 Control::KeyUp(rKEvt
);
661 virtual void StateChanged(StateChangedType nType
) override
663 Control::StateChanged(nType
);
664 if (nType
== StateChangedType::ControlForeground
|| nType
== StateChangedType::ControlBackground
)
666 m_aStyleUpdatedHdl
.Call(*this);
670 virtual void DataChanged(const DataChangedEvent
& rDCEvt
) override
672 Control::DataChanged(rDCEvt
);
673 if ((rDCEvt
.GetType() == DataChangedEventType::SETTINGS
) && (rDCEvt
.GetFlags() & AllSettingsFlags::STYLE
))
675 m_aStyleUpdatedHdl
.Call(*this);
679 virtual void Command(const CommandEvent
& rEvent
) override
681 if (m_aCommandHdl
.Call(rEvent
))
683 Control::Command(rEvent
);
685 virtual void RequestHelp(const HelpEvent
& rHelpEvent
) override
;
686 virtual void StartDrag(sal_Int8 nAction
, const Point
& rPosPixel
) override
;
687 virtual FactoryFunction
GetUITestFactory() const override
;
690 VclDrawingArea(vcl::Window
*pParent
, WinBits nStyle
)
691 : Control(pParent
, nStyle
)
692 , DragSourceHelper(this)
693 , m_pFactoryFunction(nullptr)
694 , m_pUserData(nullptr)
699 virtual void MouseButtonDown(const MouseEvent
& rMEvt
) override
701 if (!m_aMousePressHdl
.Call(rMEvt
))
702 Control::MouseButtonDown(rMEvt
);
704 virtual void MouseButtonUp(const MouseEvent
& rMEvt
) override
706 if (!m_aMouseReleaseHdl
.Call(rMEvt
))
707 Control::MouseButtonUp(rMEvt
);
709 virtual void MouseMove(const MouseEvent
& rMEvt
) override
711 if (!m_aMouseMotionHdl
.Call(rMEvt
))
712 Control::MouseMove(rMEvt
);
714 virtual OUString
GetSurroundingText() const override
;
715 virtual Selection
GetSurroundingTextSelection() const override
;
716 virtual bool DeleteSurroundingText(const Selection
& rSelection
) override
;
717 void SetUITestFactory(FactoryFunction pFactoryFunction
, void* pUserData
)
719 m_pFactoryFunction
= pFactoryFunction
;
720 m_pUserData
= pUserData
;
722 void* GetUserData() const
726 void SetPaintHdl(const Link
<std::pair
<vcl::RenderContext
&, const tools::Rectangle
&>, void>& rLink
)
730 void SetResizeHdl(const Link
<const Size
&, void>& rLink
)
732 m_aResizeHdl
= rLink
;
734 void SetMousePressHdl(const Link
<const MouseEvent
&, bool>& rLink
)
736 m_aMousePressHdl
= rLink
;
738 void SetMouseMoveHdl(const Link
<const MouseEvent
&, bool>& rLink
)
740 m_aMouseMotionHdl
= rLink
;
742 void SetMouseReleaseHdl(const Link
<const MouseEvent
&, bool>& rLink
)
744 m_aMouseReleaseHdl
= rLink
;
746 void SetKeyPressHdl(const Link
<const KeyEvent
&, bool>& rLink
)
748 m_aKeyPressHdl
= rLink
;
750 void SetKeyReleaseHdl(const Link
<const KeyEvent
&, bool>& rLink
)
752 m_aKeyReleaseHdl
= rLink
;
754 void SetStyleUpdatedHdl(const Link
<VclDrawingArea
&, void>& rLink
)
756 m_aStyleUpdatedHdl
= rLink
;
758 void SetCommandHdl(const Link
<const CommandEvent
&, bool>& rLink
)
760 m_aCommandHdl
= rLink
;
762 void SetQueryTooltipHdl(const Link
<tools::Rectangle
&, OUString
>& rLink
)
764 m_aQueryTooltipHdl
= rLink
;
766 void SetGetSurroundingHdl(const Link
<OUString
&, int>& rLink
)
768 m_aGetSurroundingHdl
= rLink
;
770 void SetDeleteSurroundingHdl(const Link
<const Selection
&, bool>& rLink
)
772 m_aDeleteSurroundingHdl
= rLink
;
774 void SetStartDragHdl(const Link
<VclDrawingArea
*, bool>& rLink
)
776 m_aStartDragHdl
= rLink
;
778 void SetDragHelper(const rtl::Reference
<TransferDataContainer
>& rHelper
, sal_uInt8 eDNDConstants
)
780 m_xTransferHelper
= rHelper
;
781 m_nDragAction
= eDNDConstants
;
783 virtual void DumpAsPropertyTree(tools::JsonWriter
&) override
;
786 //Get first window of a pTopLevel window as
787 //if any intermediate layout widgets didn't exist
788 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
789 //in a flat hierarchy where dialogs only have one layer
791 vcl::Window
* firstLogicalChildOfParent(const vcl::Window
*pTopLevel
);
793 //Get last window of a pTopLevel window as
794 //if any intermediate layout widgets didn't exist
795 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::LastChild);
796 //in a flat hierarchy where dialogs only have one layer
798 vcl::Window
* lastLogicalChildOfParent(const vcl::Window
*pTopLevel
);
800 //Get next window after pChild of a pTopLevel window as
801 //if any intermediate layout widgets didn't exist
802 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
803 //in a flat hierarchy where dialogs only have one layer
805 vcl::Window
* nextLogicalChildOfParent(const vcl::Window
*pTopLevel
, const vcl::Window
*pChild
);
807 //Get previous window before pChild of a pTopLevel window as
808 //if any intermediate layout widgets didn't exist
809 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
810 //in a flat hierarchy where dialogs only have one layer
812 vcl::Window
* prevLogicalChildOfParent(const vcl::Window
*pTopLevel
, const vcl::Window
*pChild
);
814 //Returns true is the Window has a single child which is a container
815 VCL_DLLPUBLIC
bool isLayoutEnabled(const vcl::Window
*pWindow
);
817 inline bool isContainerWindow(const vcl::Window
&rWindow
)
819 WindowType eType
= rWindow
.GetType();
820 return eType
== WindowType::CONTAINER
|| eType
== WindowType::SCROLLWINDOW
||
821 (eType
== WindowType::DOCKINGWINDOW
&& ::isLayoutEnabled(&rWindow
));
824 inline bool isContainerWindow(const vcl::Window
*pWindow
)
826 return pWindow
&& isContainerWindow(*pWindow
);
829 // retro-fitting utilities
831 //Get a Size which is large enough to contain all children with
832 //an equal amount of space at top left and bottom right
833 Size
getLegacyBestSizeForChildren(const vcl::Window
&rWindow
);
835 //Get first parent which is not a layout widget
836 vcl::Window
* getNonLayoutParent(vcl::Window
*pParent
);
838 //Sort ok/cancel etc buttons in platform order
839 void sort_native_button_order(const VclBox
& rContainer
);
843 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */