diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-02-28 15:10:24 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-05-14 10:12:46 +0200 |
commit | ef434bf7d62861142848889f43b356c06fdf8ffa (patch) | |
tree | 312d76b2152da58b14ff62b21671dc78d9e080e9 | |
parent | 8dce0b1a703ee45efd952a652c10b7fefe246271 (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>
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 16 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 13 |
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 52fa6a19a8e1..2d104e424bd9 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -65,6 +65,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 ? o3tl::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); @@ -96,6 +103,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) |