diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-17 16:16:09 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-17 22:02:15 +0100 |
commit | 853df3ce24d4daa113a15d4211be682ada1fa6f2 (patch) | |
tree | 5a22acdcb6fe978952bc0b5dca9d30352090dbb2 /vcl | |
parent | 493429cc91d41b719d446e43415f43fb9fa5aee4 (diff) |
add Menu::get_sensitive
Change-Id: I242ace497d7f049d9908cc6461b7eefc6d4a2b87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107889
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salvtables.hxx | 1 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 10 |
3 files changed, 15 insertions, 0 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 0a6cbad7038e..b68a2fdeba96 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -143,6 +143,7 @@ public: SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership); virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) override; virtual void set_sensitive(const OString& rIdent, bool bSensitive) override; + virtual bool get_sensitive(const OString& rIdent) const override; virtual void set_active(const OString& rIdent, bool bActive) override; virtual bool get_active(const OString& rIdent) const override; virtual void set_label(const OString& rIdent, const OUString& rLabel) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 167ff5766084..0524244ed6d2 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -737,6 +737,10 @@ void SalInstanceMenu::set_sensitive(const OString& rIdent, bool bSensitive) { m_xMenu->EnableItem(rIdent, bSensitive); } +bool SalInstanceMenu::get_sensitive(const OString& rIdent) const +{ + return m_xMenu->IsItemEnabled(m_xMenu->GetItemId(rIdent)); +} void SalInstanceMenu::set_active(const OString& rIdent, bool bActive) { m_xMenu->CheckItem(rIdent, bActive); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 602246395aaa..829a3a4ca58f 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3593,6 +3593,11 @@ public: gtk_widget_set_sensitive(GTK_WIDGET(m_aMap[rIdent]), bSensitive); } + bool get_item_sensitive(const OString& rIdent) const + { + return gtk_widget_get_sensitive(GTK_WIDGET(m_aMap.find(rIdent)->second)); + } + void set_item_active(const OString& rIdent, bool bActive) { disable_item_notify_events(); @@ -8199,6 +8204,11 @@ public: set_item_sensitive(rIdent, bSensitive); } + virtual bool get_sensitive(const OString& rIdent) const override + { + return get_item_sensitive(rIdent); + } + virtual void set_active(const OString& rIdent, bool bActive) override { set_item_active(rIdent, bActive); |