diff options
-rw-r--r-- | vcl/inc/vcl/layout.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 6aeefe795b3e..29fa382f9c4b 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -392,6 +392,8 @@ class VCL_DLLPUBLIC VclFrame : public VclBin public: VclFrame(Window *pParent) : VclBin(pParent) {} void set_label(const rtl::OUString &rLabel); + Window *get_label_widget(); + const Window *get_label_widget() const; protected: virtual Size calculateRequisition() const; virtual void setAllocation(const Size &rAllocation); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 1b4e2527b655..836b6a802688 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -912,12 +912,23 @@ void VclFrame::setAllocation(const Size &rAllocation) setLayoutAllocation(*pChild, aChildPos, aAllocation); } +const Window *VclFrame::get_label_widget() const +{ + //The label widget is the last (of two) children + const Window *pChild = get_child(); + const WindowImpl* pWindowImpl = ImplGetWindowImpl(); + return pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL; +} + +Window *VclFrame::get_label_widget() +{ + return const_cast<Window*>(const_cast<const VclFrame*>(this)->get_label_widget()); +} + void VclFrame::set_label(const rtl::OUString &rLabel) { //The label widget is the last (of two) children - Window *pChild = get_child(); - WindowImpl* pWindowImpl = ImplGetWindowImpl(); - Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL; + Window *pLabel = get_label_widget(); assert(pLabel); pLabel->SetText(rLabel); } |