summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-12 09:35:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-12 09:40:00 +0100
commitbc937896e255f1372726e36b00ca0d3b0afce35e (patch)
tree94fd866bad5e3915c1b5de264af9175a64fe3c2e /svx
parent98973e40e8753e96c7ae271a2a13078646fadb1b (diff)
convert preset menu to .ui
Change-Id: I31cbe438f5f5b790ca8f4373010b28d948c2b53e
Diffstat (limited to 'svx')
-rw-r--r--svx/UIConfig_svx.mk1
-rw-r--r--svx/source/tbxctrls/SvxPresetListBox.cxx18
-rw-r--r--svx/source/tbxctrls/tbcontrl.src17
-rw-r--r--svx/uiconfig/ui/presetmenu.ui25
4 files changed, 33 insertions, 28 deletions
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index ab20c8360c73..82e6e7ad7c64 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/paralrspacing \
svx/uiconfig/ui/paraulspacing \
svx/uiconfig/ui/passwd \
+ svx/uiconfig/ui/presetmenu \
svx/uiconfig/ui/profileexporteddialog \
svx/uiconfig/ui/querydeletecontourdialog \
svx/uiconfig/ui/querydeleteobjectdialog \
diff --git a/svx/source/tbxctrls/SvxPresetListBox.cxx b/svx/source/tbxctrls/SvxPresetListBox.cxx
index 0bda5d1831b4..e9916bb52ced 100644
--- a/svx/source/tbxctrls/SvxPresetListBox.cxx
+++ b/svx/source/tbxctrls/SvxPresetListBox.cxx
@@ -59,7 +59,8 @@ void SvxPresetListBox::Command( const CommandEvent& rEvent )
if(nIndex > 0)
{
Point aPos(rEvent.GetMousePosPixel());
- ScopedVclPtrInstance<PopupMenu> pMenu(SVX_RES(RID_SVX_PRESET_MENU));
+ VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/presetmenu.ui", "");
+ VclPtr<PopupMenu> pMenu(aBuilder.get_menu("menu"));
FloatingWindow* pMenuWindow = dynamic_cast<FloatingWindow*>(pMenu->GetWindow());
if(pMenuWindow != nullptr)
{
@@ -123,16 +124,11 @@ IMPL_LINK(SvxPresetListBox, OnMenuItemSelected, Menu*, pMenu, bool)
return false;
}
pMenu->Deactivate();
- switch(pMenu->GetCurItemId())
- {
- default:
- case RID_SVX_PRESET_RENAME:
- maRenameHdl.Call(this);
- break;
- case RID_SVX_PRESET_DELETE:
- maDeleteHdl.Call(this);
- break;
- }
+ OString sIdent = pMenu->GetCurItemIdent();
+ if (sIdent == "rename")
+ maRenameHdl.Call(this);
+ else if (sIdent == "delete")
+ maDeleteHdl.Call(this);
return false;
}
diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src
index 5d3fe57b4285..6b22d064dce0 100644
--- a/svx/source/tbxctrls/tbcontrl.src
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -131,23 +131,6 @@ Menu RID_SVX_STYLE_MENU
};
};
-Menu RID_SVX_PRESET_MENU
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_SVX_PRESET_RENAME;
- Text [ en-US ] = "Rename";
- };
- MenuItem
- {
- Identifier = RID_SVX_PRESET_DELETE;
- Text [ en-US ] = "Delete";
- };
- };
-};
-
String RID_SVXSTR_BY_AUTHOR
{
Text [ en-US ] = "By author";
diff --git a/svx/uiconfig/ui/presetmenu.ui b/svx/uiconfig/ui/presetmenu.ui
new file mode 100644
index 000000000000..c67b3de6c67a
--- /dev/null
+++ b/svx/uiconfig/ui/presetmenu.ui
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.10"/>
+ <object class="GtkMenu" id="menu">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkMenuItem" id="rename">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Rename</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="delete">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Delete</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+</interface>