[Libreoffice-commits] .: vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 11 09:31:50 PDT 2012


 vcl/inc/vcl/layout.hxx       |    2 ++
 vcl/source/window/layout.cxx |   17 ++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit c08c67c8a02f88413deb78d7b136ec03cf0ef618
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 11 17:31:07 2012 +0100

    add a get_label_widget to VclFrame
    
    Change-Id: Ia0561a5f185878342b15be54c6147aa1c81fa9ef

diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 6aeefe7..29fa382 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 1b4e252..836b6a8 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);
 }


More information about the Libreoffice-commits mailing list