[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 15 16:30:38 UTC 2020


 include/vcl/menu.hxx          |   12 ++++++++++++
 vcl/source/window/builder.cxx |    2 ++
 2 files changed, 14 insertions(+)

New commits:
commit 3dfbf8d7f1aee70920aaa4f8001d78669aa7b85f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 15 13:16:15 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 15 17:29:59 2020 +0100

    add set_id/get_id to Menus like Windows
    
    Change-Id: Idcbb4e8fc67bf04d0959ba9ab59342240434727c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107768
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 6e27a9157a87..935fc68eac11 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -137,6 +137,8 @@ private:
 
     std::list<Link<VclMenuEvent&,void> >  maEventListeners;
 
+    OUString maID;
+
     OUString aTitleText;         // PopupMenu text
     sal_uInt16 nTitleHeight;
 
@@ -388,6 +390,16 @@ public:
     bool HandleMenuCommandEvent(Menu *pMenu, sal_uInt16 nEventId) const;
     bool HandleMenuActivateEvent(Menu *pMenu) const;
     bool HandleMenuDeActivateEvent(Menu *pMenu) const;
+
+    /**
+     * Sets an ID.
+     */
+    void set_id(const OUString& rID) { maID = rID; }
+
+    /**
+     * Get the ID of the window.
+     */
+    const OUString& get_id() const { return maID; }
 };
 
 class VCL_DLLPUBLIC MenuBar : public Menu
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 0fbcb066ed3f..2e46a942cd4b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3330,6 +3330,8 @@ VclPtr<Menu> VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString
     else
         pCurrentMenu = VclPtr<PopupMenu>::Create();
 
+    pCurrentMenu->set_id(OStringToOUString(rID, RTL_TEXTENCODING_UTF8));
+
     int nLevel = 1;
 
     stringmap aProperties;


More information about the Libreoffice-commits mailing list