diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-06-16 21:26:29 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-06-16 21:31:38 +0200 |
commit | 1abcfd8a9e5e0b4829c04cfea055a21021ca2ab1 (patch) | |
tree | 84e61a16a2ae317932112a6ea24ee74653793bb2 | |
parent | 8eb89bc4becd2abb47eefbe26ecfd029df043538 (diff) |
widget layout: Honor explicitly set tooltip text for toolbox items.
Change-Id: I067abb53783655dddc2130aa126dd032c803d58d
-rw-r--r-- | vcl/source/window/builder.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 7d44293f3196..542c4c56ddcf 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -652,6 +652,20 @@ namespace return Size(sWidthRequest.toInt32(), sHeightRequest.toInt32()); } + OString extractTooltipText(VclBuilder::stringmap &rMap) + { + OString sTooltipText; + VclBuilder::stringmap::iterator aFind = rMap.find(OString("tooltip-text")); + if (aFind == rMap.end()) + aFind = rMap.find(OString("tooltip-markup")); + if (aFind != rMap.end()) + { + sTooltipText = aFind->second; + rMap.erase(aFind); + } + return sTooltipText; + } + Window * extractStockAndBuildPushButton(Window *pParent, VclBuilder::stringmap &rMap) { WinBits nBits = WB_CENTER|WB_VCENTER|WB_3DLOOK; @@ -1272,14 +1286,20 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri if (pToolBox) { OUString aCommand(OStringToOUString(extractActionName(rMap), RTL_TEXTENCODING_UTF8)); + OUString aTooltip(OStringToOUString(extractTooltipText(rMap), RTL_TEXTENCODING_UTF8)); ToolBoxItemBits nBits = 0; if (name == "GtkMenuToolButton") nBits |= TIB_DROPDOWN; if (!aCommand.isEmpty()) + { pToolBox->InsertItem(aCommand, m_xFrame, nBits, extractSizeRequest(rMap)); + if (!aTooltip.isEmpty()) + pToolBox->SetQuickHelpText(pToolBox->GetItemId(aCommand), aTooltip); + } + return NULL; // no widget to be created } } |