summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-06-23 14:31:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-06-23 14:31:24 +0100
commit1413c5d39a45329b47c85511a3161c6f5a43c4f8 (patch)
tree60d5dff8dfbe71b76bfabb591438dc61f51589ea
parent3881fffe4233ce3aa02051b205c114c1cb520d67 (diff)
map MenuToggleButton to GtkToggleButton with a custom menu property
we don't have non-menu ToggleButtons yet, so thats not done here. since we first started with GtkPushButton:menu_attrib to indicate menubuttons gtk has grown menu buttons, but they don't have the idea of a gtktogglemenu button, so this attribute still has a role to play I guess Change-Id: Iebfe5ccf996e22784cf9aaf2bcf367eed79ae686
-rw-r--r--sfx2/uiconfig/ui/startcenter.ui4
-rw-r--r--vcl/source/window/builder.cxx27
2 files changed, 29 insertions, 2 deletions
diff --git a/sfx2/uiconfig/ui/startcenter.ui b/sfx2/uiconfig/ui/startcenter.ui
index 68ab54835d88..79b1484983c0 100644
--- a/sfx2/uiconfig/ui/startcenter.ui
+++ b/sfx2/uiconfig/ui/startcenter.ui
@@ -171,7 +171,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="open_recent:clearmenu">
+ <object class="GtkToggleButton" id="open_recent:clearmenu">
<property name="label" translatable="yes">_Recent Files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -190,7 +190,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="templates_all:filtermenu">
+ <object class="GtkToggleButton" id="templates_all:filtermenu">
<property name="label" translatable="yes">T_emplates</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index fc8069e3a9eb..2f1fd3df4e7f 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -942,6 +942,22 @@ namespace
return xWindow;
}
+ VclPtr<Button> extractStockAndBuildMenuToggleButton(vcl::Window *pParent, VclBuilder::stringmap &rMap)
+ {
+ WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
+
+ nBits |= extractRelief(rMap);
+
+ VclPtr<Button> xWindow = VclPtr<MenuToggleButton>::Create(pParent, nBits);
+
+ if (extractStock(rMap))
+ {
+ xWindow->SetText(getStockText(extractLabel(rMap)));
+ }
+
+ return xWindow;
+ }
+
OString extractUnit(const OString& sPattern)
{
OString sUnit(sPattern);
@@ -1370,6 +1386,17 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
setupFromActionName(xButton, rMap, m_xFrame);
xWindow = xButton;
}
+ else if (name == "GtkToggleButton")
+ {
+ VclPtr<Button> xButton;
+ OString sMenu = extractCustomProperty(rMap);
+ assert(sMenu.getLength() && "not implemented yet");
+ xButton = extractStockAndBuildMenuToggleButton(pParent, rMap);
+ m_pParserState->m_aButtonMenuMaps.push_back(ButtonMenuMap(id, sMenu));
+ xButton->SetImageAlign(ImageAlign::Left); //default to left
+ setupFromActionName(xButton, rMap, m_xFrame);
+ xWindow = xButton;
+ }
else if (name == "GtkRadioButton")
{
extractGroup(id, rMap);