[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - vcl/inc vcl/jsdialog
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 5 04:28:22 UTC 2021
vcl/inc/jsdialog/jsdialogbuilder.hxx | 11 +++++++++++
vcl/jsdialog/executor.cxx | 21 +++++++++++++++++++--
vcl/jsdialog/jsdialogbuilder.cxx | 27 +++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 2 deletions(-)
New commits:
commit d25609cbd53404d3e53739a5fa3ccd9aeee10f21
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 19 09:19:03 2021 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Feb 5 05:27:51 2021 +0100
jsdialog: implemented RadioButton
Change-Id: Iad182d96cb4ff86b1a3fc8bfcca37ea62763fe67
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109615
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109610
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 4693393bdabb..4e6ce0d2f909 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -206,6 +206,8 @@ public:
bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id,
bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::RadioButton>
+ weld_radio_button(const OString& id, bool bTakeOwnership = false) override;
static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
@@ -494,4 +496,13 @@ public:
virtual void unselect(int pos) override;
};
+class JSRadioButton : public JSWidget<SalInstanceRadioButton, ::RadioButton>
+{
+public:
+ JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void set_active(bool active) override;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 834962561acb..75a474b08433 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -122,8 +122,10 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
if (separatorPos > 0)
{
// x;y
- OString clickPosX = OUStringToOString(rData["data"].copy(0, separatorPos), RTL_TEXTENCODING_ASCII_US);
- OString clickPosY = OUStringToOString(rData["data"].copy(separatorPos + 1), RTL_TEXTENCODING_ASCII_US);
+ OString clickPosX = OUStringToOString(rData["data"].copy(0, separatorPos),
+ RTL_TEXTENCODING_ASCII_US);
+ OString clickPosY = OUStringToOString(rData["data"].copy(separatorPos + 1),
+ RTL_TEXTENCODING_ASCII_US);
if (!clickPosX.isEmpty() && !clickPosY.isEmpty())
{
double posX = std::atof(clickPosX.getStr());
@@ -332,6 +334,21 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
}
}
}
+ else if (sControlType == "radiobutton")
+ {
+ auto pRadioButton = dynamic_cast<weld::RadioButton*>(pWidget);
+ if (pRadioButton)
+ {
+ if (sAction == "change")
+ {
+ bool bChecked = rData["data"] == "true";
+ pRadioButton->set_state(bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
+ LOKTrigger::trigger_clicked(*static_cast<weld::Button*>(pRadioButton));
+ LOKTrigger::trigger_toggled(*static_cast<weld::ToggleButton*>(pRadioButton));
+ return true;
+ }
+ }
+ }
}
return false;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 765177ad8a9d..dca72aa5ebf1 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -688,6 +688,20 @@ std::unique_ptr<weld::IconView> JSInstanceBuilder::weld_icon_view(const OString&
return pWeldWidget;
}
+std::unique_ptr<weld::RadioButton> JSInstanceBuilder::weld_radio_button(const OString& id,
+ bool bTakeOwnership)
+{
+ ::RadioButton* pRadioButton = m_xBuilder->get<::RadioButton>(id);
+ auto pWeldWidget
+ = pRadioButton ? std::make_unique<JSRadioButton>(this, pRadioButton, this, bTakeOwnership)
+ : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
VclButtonsType eButtonType,
@@ -1118,4 +1132,17 @@ void JSIconView::unselect(int pos)
notifyDialogState();
}
+JSRadioButton::JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceRadioButton, ::RadioButton>(pSender, pRadioButton, pBuilder,
+ bTakeOwnership)
+{
+}
+
+void JSRadioButton::set_active(bool active)
+{
+ SalInstanceRadioButton::set_active(active);
+ notifyDialogState();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
More information about the Libreoffice-commits
mailing list