[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Wed May 20 09:51:01 UTC 2020


 vcl/inc/jsdialog/jsdialogbuilder.hxx |   16 ++++++++++++++++
 vcl/jsdialog/jsdialogbuilder.cxx     |   13 +++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit c2ead5a142be19cb74127294641ec35da9e0f5c5
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Feb 28 15:10:24 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Wed May 20 11:50:21 2020 +0200

    jsdialog: react on button state change
    
    Change-Id: I19b8b4f123373da1acc7e2815086a67bcdb43e76
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94148
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94556
    Tested-by: Jenkins

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)


More information about the Libreoffice-commits mailing list