[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/vcl vcl/jsdialog
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 19 08:12:09 UTC 2020
include/vcl/jsdialog/jsdialogbuilder.hxx | 23 ++++++++++++
vcl/jsdialog/jsdialogbuilder.cxx | 56 +++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+)
New commits:
commit e1afc5ace91f9d46660ee4aa541defc908f39dfb
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Mar 10 17:10:38 2020 +0100
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue May 19 10:11:36 2020 +0200
jsdialog: weld SpinButton and CheckButton
Change-Id: I0dfa163b8a52594cde9e3529df8f433dc93bc459
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94432
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx
index 660be3ea75d3..32b279dea66d 100644
--- a/include/vcl/jsdialog/jsdialogbuilder.hxx
+++ b/include/vcl/jsdialog/jsdialogbuilder.hxx
@@ -9,6 +9,7 @@
#include <vcl/salvtables.hxx>
#include <vcl/combobox.hxx>
#include <vcl/button.hxx>
+#include <vcl/fmtfield.hxx>
typedef std::map<OString, weld::Widget*> WidgetMap;
@@ -51,6 +52,10 @@ public:
bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id,
bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::SpinButton>
+ weld_spin_button(const OString& id, bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::CheckButton>
+ weld_check_button(const OString& id, bool bTakeOwnership = false) override;
static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
@@ -150,6 +155,15 @@ public:
virtual void append_page(const OString& rIdent, const OUString& rLabel) override;
};
+class VCL_DLLPUBLIC JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField>
+{
+public:
+ JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void set_value(int value) override;
+};
+
class VCL_DLLPUBLIC JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender
{
public:
@@ -160,4 +174,13 @@ public:
virtual void set_secondary_text(const OUString& rText) override;
};
+class VCL_DLLPUBLIC JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox>
+{
+public:
+ JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void set_active(bool active) override;
+};
+
#endif
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 15a482e0ac48..9246bda13b86 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -204,6 +204,36 @@ std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString&
return pWeldWidget;
}
+std::unique_ptr<weld::SpinButton> JSInstanceBuilder::weld_spin_button(const OString& id,
+ bool bTakeOwnership)
+{
+ FormattedField* pSpinButton = m_xBuilder->get<FormattedField>(id);
+ auto pWeldWidget = pSpinButton ? std::make_unique<JSSpinButton>(
+ m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog,
+ pSpinButton, this, bTakeOwnership)
+ : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
+std::unique_ptr<weld::CheckButton> JSInstanceBuilder::weld_check_button(const OString& id,
+ bool bTakeOwnership)
+{
+ CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
+ auto pWeldWidget = pCheckButton ? std::make_unique<JSCheckButton>(
+ m_bHasTopLevelDialog ? m_aOwnedToplevel : m_aParentDialog,
+ pCheckButton, this, bTakeOwnership)
+ : nullptr;
+
+ if (pWeldWidget)
+ RememberWidget(id, pWeldWidget.get());
+
+ return pWeldWidget;
+}
+
weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
VclMessageType eMessageType,
VclButtonsType eButtonType,
@@ -347,6 +377,19 @@ void JSNotebook::append_page(const OString& rIdent, const OUString& rLabel)
notifyDialogState();
}
+JSSpinButton::JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceSpinButton, ::FormattedField>(aOwnedToplevel, pSpin, pBuilder,
+ bTakeOwnership)
+{
+}
+
+void JSSpinButton::set_value(int value)
+{
+ SalInstanceSpinButton::set_value(value);
+ notifyDialogState();
+}
+
JSMessageDialog::JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
bool bTakeOwnership)
: SalInstanceMessageDialog(pDialog, pBuilder, bTakeOwnership)
@@ -365,3 +408,16 @@ void JSMessageDialog::set_secondary_text(const OUString& rText)
SalInstanceMessageDialog::set_secondary_text(rText);
notifyDialogState();
}
+
+JSCheckButton::JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceCheckButton, ::CheckBox>(aOwnedToplevel, pCheckBox, pBuilder,
+ bTakeOwnership)
+{
+}
+
+void JSCheckButton::set_active(bool active)
+{
+ SalInstanceCheckButton::set_active(active);
+ notifyDialogState();
+}
More information about the Libreoffice-commits
mailing list