summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-02-28 15:10:24 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-05-20 11:50:21 +0200
commitc2ead5a142be19cb74127294641ec35da9e0f5c5 (patch)
tree4ad647ec79099d409a29e28085b576c8179eb6dc
parentc8406011eef27571529b2f497fdca449b9ab37bf (diff)
jsdialog: react on button state change
Change-Id: I19b8b4f123373da1acc7e2815086a67bcdb43e76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94148 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94556 Tested-by: Jenkins
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx16
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx13
2 files changed, 29 insertions, 0 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 98126bfcc12f..24b1ef7808c1 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -8,6 +8,7 @@
#include <vcl/builder.hxx>
#include <salvtables.hxx>
#include <vcl/combobox.hxx>
+#include <vcl/button.hxx>
class JSDialogSender
{
@@ -30,6 +31,8 @@ public:
bool bTakeOwnership = true) override;
virtual std::unique_ptr<weld::Label> weld_label(const OString& id,
bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::Button> weld_button(const OString& id,
+ bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id,
bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
@@ -58,6 +61,12 @@ public:
BaseInstanceClass::hide();
notifyDialogState();
}
+
+ virtual void set_sensitive(bool sensitive) override
+ {
+ BaseInstanceClass::set_sensitive(sensitive);
+ notifyDialogState();
+ }
};
class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText>
@@ -68,6 +77,13 @@ public:
virtual void set_label(const OUString& rText) override;
};
+class VCL_DLLPUBLIC JSButton : public JSWidget<SalInstanceButton, ::Button>
+{
+public:
+ JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder,
+ bool bTakeOwnership);
+};
+
class VCL_DLLPUBLIC JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
{
public:
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index e23e8f1a75e2..dc6951105763 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -63,6 +63,13 @@ std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id, bo
return std::make_unique<JSLabel>(m_aOwnedToplevel, pLabel, this, bTakeOwnership);
}
+std::unique_ptr<weld::Button> JSInstanceBuilder::weld_button(const OString& id, bool bTakeOwnership)
+{
+ ::Button* pButton = m_xBuilder->get<::Button>(id);
+ return pButton ? std::make_unique<JSButton>(m_aOwnedToplevel, pButton, this, bTakeOwnership)
+ : nullptr;
+}
+
std::unique_ptr<weld::Entry> JSInstanceBuilder::weld_entry(const OString& id, bool bTakeOwnership)
{
Edit* pEntry = m_xBuilder->get<Edit>(id);
@@ -94,6 +101,12 @@ void JSLabel::set_label(const OUString& rText)
notifyDialogState();
};
+JSButton::JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceButton, ::Button>(aOwnedToplevel, pButton, pBuilder, bTakeOwnership)
+{
+}
+
JSEntry::JSEntry(VclPtr<vcl::Window> aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
bool bTakeOwnership)
: JSWidget<SalInstanceEntry, ::Edit>(aOwnedToplevel, pEntry, pBuilder, bTakeOwnership)