summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-03-04 16:05:10 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-05-15 10:08:01 +0200
commit10eb738689fbd9b49a59ae0cd446e42d51061b35 (patch)
tree5fe93abfc727f01cb11c6ee3c99715b654423315 /vcl
parenteaddcdf4fe79e9a1c393bd0ed737c898a7113844 (diff)
jsdialog: refresh on notebook changes
Change-Id: I81159d043add3d8bdd1b81f26f642f99c1430f73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94183 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx17
-rw-r--r--vcl/inc/salvtables.hxx2
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx42
3 files changed, 59 insertions, 2 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 24b1ef7808c1..0104756b7b55 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -37,6 +37,8 @@ public:
bool bTakeOwnership = false) override;
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
bool bTakeOwnership = false) override;
+ virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id,
+ bool bTakeOwnership = false) override;
};
template <class BaseInstanceClass, class VclClass>
@@ -113,4 +115,19 @@ public:
virtual void set_entry_text(const OUString& rText) override;
};
+class VCL_DLLPUBLIC JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl>
+{
+public:
+ JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pControl,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+ virtual void set_current_page(int nPage) override;
+
+ virtual void set_current_page(const OString& rIdent) override;
+
+ virtual void remove_page(const OString& rIdent) override;
+
+ virtual void append_page(const OString& rIdent, const OUString& rLabel) override;
+};
+
#endif \ No newline at end of file
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 977f8e343c99..0fb282d385c7 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -700,7 +700,7 @@ class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::No
{
private:
VclPtr<TabControl> m_xNotebook;
- mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
+ mutable std::vector<std::shared_ptr<SalInstanceContainer>> m_aPages;
std::vector<VclPtr<TabPage>> m_aAddedPages;
std::vector<VclPtr<VclGrid>> m_aAddedGrids;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 2d104e424bd9..64f78c295bed 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -68,7 +68,7 @@ std::unique_ptr<weld::Label> JSInstanceBuilder::weld_label(const OString& id, bo
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)
+ return pButton ? std::make_unique<JSButton>(m_aOwnedToplevel, pButton, this, bTakeOwnership)
: nullptr;
}
@@ -91,6 +91,15 @@ std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OString&
: nullptr;
}
+std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString& id,
+ bool bTakeOwnership)
+{
+ TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
+ return pNotebook
+ ? std::make_unique<JSNotebook>(m_aOwnedToplevel, pNotebook, this, bTakeOwnership)
+ : nullptr;
+}
+
JSLabel::JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
: JSWidget<SalInstanceLabel, FixedText>(aOwnedToplevel, pLabel, pBuilder, bTakeOwnership)
@@ -166,3 +175,34 @@ void JSComboBox::set_entry_text(const OUString& rText)
SalInstanceComboBoxWithEdit::set_entry_text(rText);
notifyDialogState();
}
+
+JSNotebook::JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pControl,
+ SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+ : JSWidget<SalInstanceNotebook, ::TabControl>(aOwnedToplevel, pControl, pBuilder,
+ bTakeOwnership)
+{
+}
+
+void JSNotebook::set_current_page(int nPage)
+{
+ SalInstanceNotebook::set_current_page(nPage);
+ notifyDialogState();
+}
+
+void JSNotebook::set_current_page(const OString& rIdent)
+{
+ SalInstanceNotebook::set_current_page(rIdent);
+ notifyDialogState();
+}
+
+void JSNotebook::remove_page(const OString& rIdent)
+{
+ SalInstanceNotebook::remove_page(rIdent);
+ notifyDialogState();
+}
+
+void JSNotebook::append_page(const OString& rIdent, const OUString& rLabel)
+{
+ SalInstanceNotebook::append_page(rIdent, rLabel);
+ notifyDialogState();
+}