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 <vcl/dllapi.h>
14 #include <vcl/button.hxx>
15 #include <vcl/dialog.hxx>
16 #include <vcl/fixed.hxx>
17 #include <vcl/scrbar.hxx>
18 #include <vcl/vclmedit.hxx>
19 #include <vcl/window.hxx>
20 #include <vcl/vclptr.hxx>
21 #include <boost/multi_array.hpp>
24 class VCL_DLLPUBLIC VclContainer
: public vcl::Window
27 VclContainer(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
);
29 //These take into account the external margins of the rWindow widget
30 //while GetOptimalSize/get_preferred_size and SetPosSizePixel are
32 static Size
getLayoutRequisition(const vcl::Window
&rWindow
);
33 static void setLayoutPosSize(vcl::Window
&rWindow
, const Point
&rPos
, const Size
&rSize
);
35 //applies the allocation pos and size onto rWindow via setLayoutPosSize taking into account
36 //the rWindows alignment desires within that allocation
37 static void setLayoutAllocation(vcl::Window
&rWindow
, const Point
&rPos
, const Size
&rSize
);
39 void markLayoutDirty()
41 m_bLayoutDirty
= true;
44 virtual void queue_resize(StateChangedType eReason
= StateChangedType::Layout
) SAL_OVERRIDE
;
46 //these are the two that need to be implemented by
47 //containers, figure out how much space you want...
48 virtual Size
calculateRequisition() const = 0;
49 //..and decide what to do when set to this size
50 virtual void setAllocation(const Size
&rAllocation
) = 0;
52 virtual sal_uInt16
getDefaultAccessibleRole() const SAL_OVERRIDE
;
54 //you don't want to override these
55 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
56 virtual void SetPosSizePixel(const Point
& rNewPos
, const Size
& rNewSize
) SAL_OVERRIDE
;
57 virtual void SetPosPixel(const Point
& rAllocPos
) SAL_OVERRIDE
;
58 virtual void SetSizePixel(const Size
& rAllocation
) SAL_OVERRIDE
;
63 class VCL_DLLPUBLIC VclBox
: public VclContainer
67 bool m_bVerticalContainer
;
70 VclBox(vcl::Window
*pParent
, bool bHomogeneous
, int nSpacing
)
71 : VclContainer(pParent
)
72 , m_bHomogeneous(bHomogeneous
)
73 , m_bVerticalContainer(false)
74 , m_nSpacing(nSpacing
)
77 void set_spacing(int nSpacing
)
79 m_nSpacing
= nSpacing
;
81 int get_spacing() const
85 void set_homogeneous(bool bHomogeneous
)
87 m_bHomogeneous
= bHomogeneous
;
89 bool get_homogeneous() const
91 return m_bHomogeneous
;
93 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
95 virtual sal_uInt16
getDefaultAccessibleRole() const SAL_OVERRIDE
;
96 void accumulateMaxes(const Size
&rChildSize
, Size
&rSize
) const;
97 Size
finalizeMaxes(const Size
&rSize
, sal_uInt16 nVisibleChildren
) const;
99 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
100 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
102 virtual long getPrimaryDimension(const Size
&rSize
) const = 0;
103 virtual void setPrimaryDimension(Size
&rSize
, long) const = 0;
104 virtual long getPrimaryCoordinate(const Point
&rPos
) const = 0;
105 virtual void setPrimaryCoordinate(Point
&rPos
, long) const = 0;
106 virtual long getSecondaryDimension(const Size
&rSize
) const = 0;
107 virtual void setSecondaryDimension(Size
&rSize
, long) const = 0;
108 virtual long getSecondaryCoordinate(const Point
&rPos
) const = 0;
109 virtual void setSecondaryCoordinate(Point
&rPos
, long) const = 0;
111 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const = 0;
114 class VCL_DLLPUBLIC VclVBox
: public VclBox
117 VclVBox(vcl::Window
*pParent
, bool bHomogeneous
= false, int nSpacing
= 0)
118 : VclBox(pParent
, bHomogeneous
, nSpacing
)
120 m_bVerticalContainer
= true;
123 virtual long getPrimaryDimension(const Size
&rSize
) const SAL_OVERRIDE
125 return rSize
.getHeight();
127 virtual void setPrimaryDimension(Size
&rSize
, long nHeight
) const SAL_OVERRIDE
129 rSize
.setHeight(nHeight
);
131 virtual long getPrimaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
135 virtual void setPrimaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
139 virtual long getSecondaryDimension(const Size
&rSize
) const SAL_OVERRIDE
141 return rSize
.getWidth();
143 virtual void setSecondaryDimension(Size
&rSize
, long nWidth
) const SAL_OVERRIDE
145 rSize
.setWidth(nWidth
);
147 virtual long getSecondaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
151 virtual void setSecondaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
155 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const SAL_OVERRIDE
157 return rWindow
.get_expand() || rWindow
.get_vexpand();
161 class VCL_DLLPUBLIC VclHBox
: public VclBox
164 VclHBox(vcl::Window
*pParent
, bool bHomogeneous
= false, int nSpacing
= 0)
165 : VclBox(pParent
, bHomogeneous
, nSpacing
)
167 m_bVerticalContainer
= false;
170 virtual long getPrimaryDimension(const Size
&rSize
) const SAL_OVERRIDE
172 return rSize
.getWidth();
174 virtual void setPrimaryDimension(Size
&rSize
, long nWidth
) const SAL_OVERRIDE
176 rSize
.setWidth(nWidth
);
178 virtual long getPrimaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
182 virtual void setPrimaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
186 virtual long getSecondaryDimension(const Size
&rSize
) const SAL_OVERRIDE
188 return rSize
.getHeight();
190 virtual void setSecondaryDimension(Size
&rSize
, long nHeight
) const SAL_OVERRIDE
192 rSize
.setHeight(nHeight
);
194 virtual long getSecondaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
198 virtual void setSecondaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
202 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const SAL_OVERRIDE
204 return rWindow
.get_expand() || rWindow
.get_hexpand();
208 enum VclButtonBoxStyle
210 VCL_BUTTONBOX_DEFAULT_STYLE
,
211 VCL_BUTTONBOX_SPREAD
,
218 class VCL_DLLPUBLIC VclButtonBox
: public VclBox
221 VclButtonBox(vcl::Window
*pParent
, int nSpacing
)
222 : VclBox(pParent
, false, nSpacing
)
223 , m_eLayoutStyle(VCL_BUTTONBOX_DEFAULT_STYLE
)
226 void set_layout(VclButtonBoxStyle eStyle
)
228 m_eLayoutStyle
= eStyle
;
230 VclButtonBoxStyle
get_layout() const
232 return m_eLayoutStyle
;
234 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
235 void sort_native_button_order();
237 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
238 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
239 Size
addSpacing(const Size
&rSize
, sal_uInt16 nVisibleChildren
) const;
241 VclButtonBoxStyle m_eLayoutStyle
;
244 std::vector
<long> m_aMainGroupDimensions
;
245 std::vector
<long> m_aSubGroupDimensions
;
246 Size m_aMainGroupSize
;
247 Size m_aSubGroupSize
;
249 Requisition
calculatePrimarySecondaryRequisitions() const;
250 Size
addReqGroups(const VclButtonBox::Requisition
&rReq
) const;
253 class VCL_DLLPUBLIC VclVButtonBox
: public VclButtonBox
256 VclVButtonBox(vcl::Window
*pParent
, int nSpacing
= 0)
257 : VclButtonBox(pParent
, nSpacing
)
259 m_bVerticalContainer
= true;
262 virtual long getPrimaryDimension(const Size
&rSize
) const SAL_OVERRIDE
264 return rSize
.getHeight();
266 virtual void setPrimaryDimension(Size
&rSize
, long nHeight
) const SAL_OVERRIDE
268 rSize
.setHeight(nHeight
);
270 virtual long getPrimaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
274 virtual void setPrimaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
278 virtual long getSecondaryDimension(const Size
&rSize
) const SAL_OVERRIDE
280 return rSize
.getWidth();
282 virtual void setSecondaryDimension(Size
&rSize
, long nWidth
) const SAL_OVERRIDE
284 rSize
.setWidth(nWidth
);
286 virtual long getSecondaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
290 virtual void setSecondaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
294 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const SAL_OVERRIDE
296 return rWindow
.get_expand() || rWindow
.get_vexpand();
300 class VCL_DLLPUBLIC VclHButtonBox
: public VclButtonBox
303 VclHButtonBox(vcl::Window
*pParent
, int nSpacing
= 0)
304 : VclButtonBox(pParent
, nSpacing
)
306 m_bVerticalContainer
= false;
309 virtual long getPrimaryDimension(const Size
&rSize
) const SAL_OVERRIDE
311 return rSize
.getWidth();
313 virtual void setPrimaryDimension(Size
&rSize
, long nWidth
) const SAL_OVERRIDE
315 rSize
.setWidth(nWidth
);
317 virtual long getPrimaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
321 virtual void setPrimaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
325 virtual long getSecondaryDimension(const Size
&rSize
) const SAL_OVERRIDE
327 return rSize
.getHeight();
329 virtual void setSecondaryDimension(Size
&rSize
, long nHeight
) const SAL_OVERRIDE
331 rSize
.setHeight(nHeight
);
333 virtual long getSecondaryCoordinate(const Point
&rPos
) const SAL_OVERRIDE
337 virtual void setSecondaryCoordinate(Point
&rPos
, long nPos
) const SAL_OVERRIDE
341 virtual bool getPrimaryDimensionChildExpand(const vcl::Window
&rWindow
) const SAL_OVERRIDE
343 return rWindow
.get_expand() || rWindow
.get_hexpand();
347 class VCL_DLLPUBLIC VclGrid
: public VclContainer
350 bool m_bRowHomogeneous
;
351 bool m_bColumnHomogeneous
;
353 int m_nColumnSpacing
;
357 VclPtr
<vcl::Window
> pChild
;
358 sal_Int32 nSpanWidth
;
359 sal_Int32 nSpanHeight
;
368 typedef boost::multi_array
<GridEntry
, 2> array_type
;
370 struct ExtendedGridEntry
: GridEntry
381 typedef boost::multi_array
<ExtendedGridEntry
, 2> ext_array_type
;
383 array_type
assembleGrid() const;
384 static bool isNullGrid(const array_type
& A
);
390 Value() : m_nValue(0), m_bExpand(false) {}
393 static void calcMaxs(const array_type
&A
, std::vector
<Value
> &rWidths
, std::vector
<Value
> &rHeights
);
395 Size
calculateRequisitionForSpacings(sal_Int32 nRowSpacing
, sal_Int32 nColSpacing
) const;
396 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
397 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
399 VclGrid(vcl::Window
*pParent
)
400 : VclContainer(pParent
)
401 , m_bRowHomogeneous(false), m_bColumnHomogeneous(false)
402 , m_nRowSpacing(0), m_nColumnSpacing(0)
405 void set_row_homogeneous(bool bHomogeneous
)
407 m_bRowHomogeneous
= bHomogeneous
;
409 void set_column_homogeneous(bool bHomogeneous
)
411 m_bColumnHomogeneous
= bHomogeneous
;
413 bool get_row_homogeneous() const
415 return m_bRowHomogeneous
;
417 bool get_column_homogeneous() const
419 return m_bColumnHomogeneous
;
421 void set_row_spacing(int nSpacing
)
423 m_nRowSpacing
= nSpacing
;
425 void set_column_spacing(int nSpacing
)
427 m_nColumnSpacing
= nSpacing
;
429 int get_row_spacing() const
431 return m_nRowSpacing
;
433 int get_column_spacing() const
435 return m_nColumnSpacing
;
437 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
440 VCL_DLLPUBLIC
void setGridAttach(vcl::Window
&rWidget
, sal_Int32 nLeft
, sal_Int32 nTop
,
441 sal_Int32 nWidth
= 1, sal_Int32 nHeight
= 1);
443 class VCL_DLLPUBLIC VclBin
: public VclContainer
446 VclBin(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
)
447 : VclContainer(pParent
, nStyle
)
450 virtual vcl::Window
*get_child();
451 virtual const vcl::Window
*get_child() const;
452 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
453 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
456 class VCL_DLLPUBLIC VclFrame
: public VclBin
459 VclPtr
<vcl::Window
> m_pLabel
;
461 friend class VclBuilder
;
462 void designate_label(vcl::Window
*pWindow
);
463 DECL_LINK(WindowEventListener
, VclSimpleEvent
*);
465 VclFrame(vcl::Window
*pParent
)
471 virtual void dispose() SAL_OVERRIDE
;
472 void set_label(const OUString
&rLabel
);
473 OUString
get_label() const;
474 virtual vcl::Window
*get_child() SAL_OVERRIDE
;
475 virtual const vcl::Window
*get_child() const SAL_OVERRIDE
;
476 vcl::Window
*get_label_widget();
477 const vcl::Window
*get_label_widget() const;
479 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
480 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
481 virtual OUString
getDefaultAccessibleName() const SAL_OVERRIDE
;
484 class VCL_DLLPUBLIC VclAlignment
: public VclBin
487 VclAlignment(vcl::Window
*pParent
)
489 , m_nBottomPadding(0)
499 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
501 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
502 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
504 sal_Int32 m_nBottomPadding
;
505 sal_Int32 m_nLeftPadding
;
506 sal_Int32 m_nRightPadding
;
507 sal_Int32 m_nTopPadding
;
514 class VCL_DLLPUBLIC VclExpander
: public VclBin
517 VclExpander(vcl::Window
*pParent
)
519 , m_bResizeTopLevel(true)
520 , m_pDisclosureButton(VclPtr
<DisclosureButton
>::Create(this))
522 m_pDisclosureButton
->SetToggleHdl(LINK(this, VclExpander
, ClickHdl
));
523 m_pDisclosureButton
->Show();
525 virtual ~VclExpander() { disposeOnce(); }
526 virtual void dispose() SAL_OVERRIDE
;
527 virtual vcl::Window
*get_child() SAL_OVERRIDE
;
528 virtual const vcl::Window
*get_child() const SAL_OVERRIDE
;
529 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
530 bool get_expanded() const
532 return m_pDisclosureButton
->IsChecked();
534 void set_expanded(bool bExpanded
)
536 m_pDisclosureButton
->Check(bExpanded
);
538 void set_label(const OUString
& rLabel
)
540 m_pDisclosureButton
->SetText(rLabel
);
542 OUString
get_label() const
544 return m_pDisclosureButton
->GetText();
546 virtual void StateChanged(StateChangedType nType
) SAL_OVERRIDE
;
547 void SetExpandedHdl( const Link
<>& rLink
) { maExpandedHdl
= rLink
; }
548 const Link
<>& GetExpandedHdl() const { return maExpandedHdl
; }
550 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
551 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
553 bool m_bResizeTopLevel
;
554 VclPtr
<DisclosureButton
> m_pDisclosureButton
;
555 Link
<> maExpandedHdl
;
556 DECL_DLLPRIVATE_LINK(ClickHdl
, DisclosureButton
* pBtn
);
559 class VCL_DLLPUBLIC VclScrolledWindow
: public VclBin
562 VclScrolledWindow(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
| WB_AUTOHSCROLL
| WB_AUTOVSCROLL
| WB_TABSTOP
);
563 virtual ~VclScrolledWindow() { disposeOnce(); }
564 virtual void dispose() SAL_OVERRIDE
;
565 virtual vcl::Window
*get_child() SAL_OVERRIDE
;
566 virtual const vcl::Window
*get_child() const SAL_OVERRIDE
;
567 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
568 ScrollBar
& getVertScrollBar() { return *m_pVScroll
; }
569 ScrollBar
& getHorzScrollBar() { return *m_pHScroll
; }
570 Size
getVisibleChildSize() const;
571 //set to true to disable the built-in scrolling callbacks to allow the user
573 void setUserManagedScrolling(bool bUserManagedScrolling
) { m_bUserManagedScrolling
= bUserManagedScrolling
;}
575 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
576 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
577 DECL_LINK(ScrollBarHdl
, void *);
578 void InitScrollBars(const Size
&rRequest
);
579 virtual bool Notify(NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
581 bool m_bUserManagedScrolling
;
582 VclPtr
<ScrollBar
> m_pVScroll
;
583 VclPtr
<ScrollBar
> m_pHScroll
;
584 VclPtr
<ScrollBarBox
> m_aScrollBarBox
;
587 class VCL_DLLPUBLIC VclViewport
: public VclBin
590 VclViewport(vcl::Window
*pParent
, WinBits nStyle
= WB_HIDE
| WB_CLIPCHILDREN
)
591 : VclBin(pParent
, nStyle
)
595 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
598 //Enforces that its children are always the same size as itself.
599 //Intercepts any Commands intended for its children.
601 //by default the Commands are discarded, inherit from this
602 //and implement "Command" to get them
603 class VCL_DLLPUBLIC VclEventBox
: public VclBin
606 //Any Commands an EventBoxHelper receives are forwarded to its parent
607 //The VclEventBox ensures that m_aEventBoxHelper is the
608 //first child and is transparent, but covers the rest of the children
609 class EventBoxHelper
: public vcl::Window
612 EventBoxHelper(vcl::Window
* pParent
)
615 SetSizePixel(pParent
->GetSizePixel());
616 EnableChildTransparentMode();
617 SetPaintTransparent(true);
620 virtual void Command(const CommandEvent
& rCEvt
) SAL_OVERRIDE
622 GetParent()->Command(rCEvt
);
626 VclPtr
<EventBoxHelper
> m_aEventBoxHelper
;
628 virtual void dispose() SAL_OVERRIDE
;
629 virtual ~VclEventBox();
631 VclEventBox(vcl::Window
* pParent
)
633 , m_aEventBoxHelper(VclPtr
<EventBoxHelper
>::Create(this))
635 m_aEventBoxHelper
->Show();
637 virtual vcl::Window
*get_child() SAL_OVERRIDE
;
638 virtual const vcl::Window
*get_child() const SAL_OVERRIDE
;
639 virtual Size
calculateRequisition() const SAL_OVERRIDE
;
640 virtual void setAllocation(const Size
&rAllocation
) SAL_OVERRIDE
;
642 virtual void Command(const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
645 enum VclSizeGroupMode
648 VCL_SIZE_GROUP_HORIZONTAL
,
649 VCL_SIZE_GROUP_VERTICAL
,
653 class VCL_DLLPUBLIC VclSizeGroup
656 std::set
< VclPtr
<vcl::Window
> > m_aWindows
;
657 bool m_bIgnoreHidden
;
658 VclSizeGroupMode m_eMode
;
660 void trigger_queue_resize();
663 : m_bIgnoreHidden(false)
664 , m_eMode(VCL_SIZE_GROUP_HORIZONTAL
)
667 void insert(vcl::Window
*pWindow
)
669 m_aWindows
.insert(VclPtr
<vcl::Window
>(pWindow
));
671 void erase(vcl::Window
*pWindow
)
673 m_aWindows
.erase(VclPtr
<vcl::Window
>(pWindow
));
675 const std::set
< VclPtr
<vcl::Window
> >& get_widgets() const
679 std::set
< VclPtr
<vcl::Window
> >& get_widgets()
683 void set_ignore_hidden(bool bIgnoreHidden
);
684 bool get_ignore_hidden() const
686 return m_bIgnoreHidden
;
688 void set_mode(VclSizeGroupMode eMode
);
689 VclSizeGroupMode
get_mode() const
693 bool set_property(const OString
&rKey
, const OString
&rValue
);
703 VCL_BUTTONS_OK_CANCEL
710 VCL_MESSAGE_QUESTION
,
714 class VCL_DLLPUBLIC MessageDialog
: public Dialog
717 VclButtonsType m_eButtonsType
;
718 VclMessageType m_eMessageType
;
719 VclPtr
<VclBox
> m_pOwnedContentArea
;
720 VclPtr
<VclButtonBox
> m_pOwnedActionArea
;
721 VclPtr
<VclGrid
> m_pGrid
;
722 VclPtr
<FixedImage
> m_pImage
;
723 VclPtr
<VclMultiLineEdit
> m_pPrimaryMessage
;
724 VclPtr
<VclMultiLineEdit
> m_pSecondaryMessage
;
725 std::vector
<VclPtr
<PushButton
> > m_aOwnedButtons
;
726 std::map
< VclPtr
<const vcl::Window
>, short> m_aResponses
;
727 OUString m_sPrimaryString
;
728 OUString m_sSecondaryString
;
729 DECL_DLLPRIVATE_LINK(ButtonHdl
, Button
*);
730 void setButtonHandlers(VclButtonBox
*pButtonBox
);
731 short get_response(const vcl::Window
*pWindow
) const;
732 void create_owned_areas();
734 friend class VclPtr
<MessageDialog
>;
735 MessageDialog(vcl::Window
* pParent
, WinBits nStyle
= WB_MOVEABLE
| WB_3DLOOK
| WB_CLOSEABLE
);
738 MessageDialog(vcl::Window
* pParent
,
739 const OUString
&rMessage
,
740 VclMessageType eMessageType
= VCL_MESSAGE_ERROR
,
741 VclButtonsType eButtonsType
= VCL_BUTTONS_OK
,
742 WinBits nStyle
= WB_MOVEABLE
| WB_3DLOOK
| WB_CLOSEABLE
);
743 MessageDialog(vcl::Window
* pParent
, const OString
& rID
, const OUString
& rUIXMLDescription
);
744 virtual bool set_property(const OString
&rKey
, const OString
&rValue
) SAL_OVERRIDE
;
745 virtual short Execute() SAL_OVERRIDE
;
746 ///Emitted when an action widget is clicked
747 virtual void response(short nResponseId
);
748 OUString
get_primary_text() const;
749 OUString
get_secondary_text() const;
750 void set_primary_text(const OUString
&rPrimaryString
);
751 void set_secondary_text(const OUString
&rSecondaryString
);
752 virtual ~MessageDialog();
753 virtual void dispose() SAL_OVERRIDE
;
755 static void SetMessagesWidths(vcl::Window
*pParent
, VclMultiLineEdit
*pPrimaryMessage
,
756 VclMultiLineEdit
*pSecondaryMessage
);
759 VCL_DLLPUBLIC Size
bestmaxFrameSizeForScreenSize(const Size
&rScreenSize
);
761 //Get first window of a pTopLevel window as
762 //if any intermediate layout widgets didn't exist
763 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::FirstChild);
764 //in a flat hierarchy where dialogs only have one layer
766 VCL_DLLPUBLIC
vcl::Window
* firstLogicalChildOfParent(vcl::Window
*pTopLevel
);
768 //Get next window after pChild of a pTopLevel window as
769 //if any intermediate layout widgets didn't exist
770 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Next);
771 //in a flat hierarchy where dialogs only have one layer
773 VCL_DLLPUBLIC
vcl::Window
* nextLogicalChildOfParent(vcl::Window
*pTopLevel
, vcl::Window
*pChild
);
775 //Get previous window before pChild of a pTopLevel window as
776 //if any intermediate layout widgets didn't exist
777 //i.e. acts like pChild = pChild->GetWindow(GetWindowType::Prev);
778 //in a flat hierarchy where dialogs only have one layer
780 VCL_DLLPUBLIC
vcl::Window
* prevLogicalChildOfParent(vcl::Window
*pTopLevel
, vcl::Window
*pChild
);
782 //Returns true is the Window has a single child which is a container
783 VCL_DLLPUBLIC
bool isLayoutEnabled(const vcl::Window
*pWindow
);
785 inline bool isContainerWindow(const vcl::Window
&rWindow
)
787 WindowType eType
= rWindow
.GetType();
788 return eType
== WINDOW_CONTAINER
|| eType
== WINDOW_SCROLLWINDOW
||
789 (eType
== WINDOW_DOCKINGWINDOW
&& ::isLayoutEnabled(&rWindow
));
792 inline bool isContainerWindow(const vcl::Window
*pWindow
)
794 return pWindow
&& isContainerWindow(*pWindow
);
797 //Returns true if the containing dialog is doing its initial
798 //layout and isn't visible yet
799 VCL_DLLPUBLIC
bool isInitialLayout(const vcl::Window
*pWindow
);
801 // retro-fitting utilities
803 //Get a Size which is large enough to contain all children with
804 //an equal amount of space at top left and bottom right
805 Size
getLegacyBestSizeForChildren(const vcl::Window
&rWindow
);
807 //Get first parent which is not a layout widget
808 VCL_DLLPUBLIC
vcl::Window
* getNonLayoutParent(vcl::Window
*pParent
);
810 //Get first real parent which is not a layout widget
811 vcl::Window
* getNonLayoutRealParent(vcl::Window
*pParent
);
813 //return true if this window and its stack of containers are all shown
814 bool isVisibleInLayout(const vcl::Window
*pWindow
);
816 //return true if this window and its stack of containers are all enabled
817 bool isEnabledInLayout(const vcl::Window
*pWindow
);
821 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */