summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-11 17:31:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-10-11 17:31:25 +0100
commitc08c67c8a02f88413deb78d7b136ec03cf0ef618 (patch)
treea63615dad88db65636ab2041b50647756a5e6e2c /vcl
parentf935d4b8bd9358dbe9160693622fb77e7b64d639 (diff)
add a get_label_widget to VclFrame
Change-Id: Ia0561a5f185878342b15be54c6147aa1c81fa9ef
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/layout.hxx2
-rw-r--r--vcl/source/window/layout.cxx17
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);
}