diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-04 11:19:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-04 12:49:27 +0100 |
commit | c5850f4b25d2b735ea59bb0ac8c2bc58527ac17e (patch) | |
tree | 8cce2ea35512412d95c38e1cba931bce00dfb505 /vcl/source/window/builder.cxx | |
parent | d3b7a3acb481ef530094296eb4461dd343270879 (diff) |
Use MenuButton for non-editable GtkComboBoxText instead of ComboBox
its more similar for the non-editable list. Requires some love
to MenuButton to reflect the selected entry and resize appropiately
Change-Id: I4b37931e35a5f326d6fd4e445eb741bece6b55a6
Diffstat (limited to 'vcl/source/window/builder.cxx')
-rw-r--r-- | vcl/source/window/builder.cxx | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 63fce3934281..3ef828965363 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -17,6 +17,7 @@ #include <vcl/fixed.hxx> #include <vcl/layout.hxx> #include <vcl/lstbox.hxx> +#include <vcl/menubtn.hxx> #include <vcl/svapp.hxx> #include <vcl/tabctrl.hxx> #include <vcl/tabpage.hxx> @@ -242,7 +243,7 @@ namespace bool extractResizable(VclBuilder::stringmap &rMap) { bool bResizable = true; - VclBuilder::stringmap::iterator aFind = rMap.find(OString(RTL_CONSTASCII_STRINGPARAM("resizable"))); + VclBuilder::stringmap::iterator aFind = rMap.find(OString("resizable")); if (aFind != rMap.end()) { bResizable = toBool(aFind->second); @@ -251,10 +252,22 @@ namespace return bResizable; } + bool extractEntry(VclBuilder::stringmap &rMap) + { + bool bHasEntry = false; + VclBuilder::stringmap::iterator aFind = rMap.find(OString("has-entry")); + if (aFind != rMap.end()) + { + bHasEntry = toBool(aFind->second); + rMap.erase(aFind); + } + return bHasEntry; + } + bool extractOrientation(VclBuilder::stringmap &rMap) { bool bVertical = false; - VclBuilder::stringmap::iterator aFind = rMap.find(OString(RTL_CONSTASCII_STRINGPARAM("orientation"))); + VclBuilder::stringmap::iterator aFind = rMap.find(OString("orientation")); if (aFind != rMap.end()) { bVertical = aFind->second.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("vertical")); @@ -597,9 +610,20 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkComboBoxText"))) { extractModel(id, rMap); - ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK); - pComboBox->SetBestDropDownLineCount(); - pWindow = pComboBox; + if (extractEntry(rMap)) + { + ComboBox* pComboBox = new ComboBox(pParent, WB_LEFT|WB_DROPDOWN|WB_VCENTER|WB_3DLOOK); + pComboBox->SetBestDropDownLineCount(); + pWindow = pComboBox; + } + else + { + MenuButton *pMenuButton = new MenuButton(pParent, WB_LEFT|WB_VCENTER|WB_3DLOOK); + pMenuButton->mpOwnMenu = new PopupMenu; //this now belongs to the menubutton + pMenuButton->SetPopupMenu(pMenuButton->mpOwnMenu); + pMenuButton->SetShowDisplaySelectedItem(true); + pWindow = pMenuButton; + } } else if (name.equalsL(RTL_CONSTASCII_STRINGPARAM("GtkTreeView"))) { |