summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-07-30 12:12:36 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-07-30 12:12:36 +0100
commit5718ffbf0e3e68e43f87541ce0368a15de8ec90e (patch)
tree1ca1b8ae7723d80373c2fa25c3d40056256bb619
parent83195e2821f24c182098740fb506db215185917f (diff)
Resolves: fdo#67378 merge the label into the disclosure button
Change-Id: I43df94c16a178c90da9c006565390a81c2fda29b
-rw-r--r--include/vcl/builder.hxx3
-rw-r--r--include/vcl/layout.hxx8
-rw-r--r--vcl/source/window/builder.cxx22
-rw-r--r--vcl/source/window/layout.cxx10
4 files changed, 32 insertions, 11 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index bdf0c8218d00..71f24a7f51d8 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -31,6 +31,7 @@ class PopupMenu;
class ScrollBar;
class DateField;
class TimeField;
+class VclExpander;
class VclMultiLineEdit;
class VCL_DLLPUBLIC VclBuilder: private boost::noncopyable
@@ -209,6 +210,8 @@ private:
AtkMap m_aAtkInfo;
std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps;
+
+ std::vector<VclExpander*> m_aExpanderWidgets;
};
void loadTranslations(const LanguageTag &rLanguageTag, const OUString &rUri);
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index bdcbedf48e3d..9c46acd375e3 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -525,6 +525,14 @@ public:
{
m_aDisclosureButton.Check(bExpanded);
}
+ void set_label(const OUString& rLabel)
+ {
+ m_aDisclosureButton.SetText(rLabel);
+ }
+ OUString get_label() const
+ {
+ return m_aDisclosureButton.GetText();
+ }
virtual void StateChanged(StateChangedType nType);
void SetExpandedHdl( const Link& rLink ) { maExpandedHdl = rLink; }
const Link& GetExpandedHdl() const { return maExpandedHdl; }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index da45c56b5831..2dbd0af1de7a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -411,6 +411,22 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
delete_by_window(aI->first);
}
+ //fdo#67378 merge the label into the disclosure button
+ for (std::vector<VclExpander*>::iterator aI = m_pParserState->m_aExpanderWidgets.begin(),
+ aEnd = m_pParserState->m_aExpanderWidgets.end(); aI != aEnd; ++aI)
+ {
+ VclExpander *pOne = *aI;
+
+ Window *pChild = pOne->get_child();
+ Window* pLabel = pOne->GetWindow(WINDOW_LASTCHILD);
+ if (pLabel && pLabel != pChild && pLabel->GetType() == WINDOW_FIXEDTEXT)
+ {
+ FixedText *pLabelWidget = static_cast<FixedText*>(pLabel);
+ pOne->set_label(pLabelWidget->GetText());
+ delete_by_window(pLabel);
+ }
+ }
+
//drop maps, etc. that we don't need again
delete m_pParserState;
@@ -1116,7 +1132,11 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
else if (name == "GtkFrame")
pWindow = new VclFrame(pParent);
else if (name == "GtkExpander")
- pWindow = new VclExpander(pParent);
+ {
+ VclExpander *pExpander = new VclExpander(pParent);
+ m_pParserState->m_aExpanderWidgets.push_back(pExpander);
+ pWindow = pExpander;
+ }
else if (name == "GtkAlignment")
pWindow = new VclAlignment(pParent);
else if (name == "GtkButton")
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index d458a8a2ea79..513dab4dd977 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1504,17 +1504,7 @@ void VclExpander::StateChanged(StateChangedType nType)
if (nType == STATE_CHANGE_INITSHOW)
{
- //The label widget is the last (of two) children
Window *pChild = get_child();
- WindowImpl* pWindowImpl = ImplGetWindowImpl();
- Window *pLabel = pChild != pWindowImpl->mpLastChild ? pWindowImpl->mpLastChild : NULL;
- if (pLabel && pLabel->GetType() == WINDOW_FIXEDTEXT)
- {
- FixedText *pLabelWidget = static_cast<FixedText*>(pLabel);
- if (!pLabelWidget->get_mnemonic_widget())
- pLabelWidget->set_mnemonic_widget(&m_aDisclosureButton);
- }
-
if (pChild)
pChild->Show(m_aDisclosureButton.IsChecked());
}