diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2023-03-03 02:16:08 +0530 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2023-03-04 19:51:58 +0000 |
commit | 542cef171ceed4577c1c71735726b1e7c7c9c8c9 (patch) | |
tree | 561244e96e5d90b514d328230c9c7c5a301fffac /vcl/jsdialog | |
parent | e1fb2dd31dd17752c1573f341876bde7c7f12142 (diff) |
JSDialog: implemented jsdialog support for the toggle buttons
Change-Id: I21408f7344f7e100373c368036f81503302b93ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148240
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 5 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 18 |
2 files changed, 23 insertions, 0 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index acd0e084ae76..be17d4ef353c 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -141,6 +141,11 @@ bool ExecuteAction(const std::string& nWindowId, const OString& rWidget, StringM pButton->clicked(); return true; } + else if (sAction == "toggle") + { + LOKTrigger::trigger_toggled(*dynamic_cast<weld::Toggleable*>(pWidget)); + return true; + } } } else if (sControlType == "menubutton") diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 50c1e5d7f097..cc1ca91262c8 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -945,6 +945,18 @@ std::unique_ptr<weld::LinkButton> JSInstanceBuilder::weld_link_button(const OStr return pWeldWidget; } +std::unique_ptr<weld::ToggleButton> JSInstanceBuilder::weld_toggle_button(const OString& id) +{ + ::PushButton* pButton = m_xBuilder->get<::PushButton>(id); + auto pWeldWidget + = pButton ? std::make_unique<JSToggleButton>(this, pButton, this, false) : nullptr; + + if (pWeldWidget) + RememberWidget(id, pWeldWidget.get()); + + return pWeldWidget; +} + std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id) { Edit* pEntry = m_xBuilder->get<Edit>(id); @@ -1366,6 +1378,12 @@ JSLinkButton::JSLinkButton(JSDialogSender* pSender, ::FixedHyperlink* pButton, { } +JSToggleButton::JSToggleButton(JSDialogSender* pSender, ::PushButton* pButton, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : JSWidget<SalInstanceToggleButton, ::PushButton>(pSender, pButton, pBuilder, bTakeOwnership) +{ +} + JSEntry::JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceEntry, ::Edit>(pSender, pEntry, pBuilder, bTakeOwnership) |