diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-12 11:12:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-12 13:39:56 +0200 |
commit | 7c902087c9cef04cd8eff4249755f527249b0300 (patch) | |
tree | 8d2efbfe8be4fa995dac51bcf91d481e2eac4f95 /vcl | |
parent | c6842c2cb84ad6b3151021b537dc5a70da49446f (diff) |
add Paned access
Change-Id: I5da0125a8f76d201e8dab2892b1f205c759599b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94045
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salvtables.hxx | 5 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 31 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 31 |
3 files changed, 66 insertions, 1 deletions
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 1553538ea932..78dfb91d23f4 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -42,6 +42,9 @@ public: virtual std::unique_ptr<weld::Box> weld_box(const OString& id, bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::Paned> weld_paned(const OString& id, + bool bTakeOwnership = false) override; + virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id, bool bTakeOwnership = false) override; @@ -612,4 +615,4 @@ public: virtual ~SalInstanceSpinButton() override; }; -#endif
\ No newline at end of file +#endif diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index f513a44c4d98..a5e027a5de1f 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1869,6 +1869,29 @@ public: virtual std::unique_ptr<weld::Label> weld_label_widget() const override; }; +class SalInstancePaned : public SalInstanceContainer, public virtual weld::Paned +{ +private: + VclPtr<VclPaned> m_xPaned; + +public: + SalInstancePaned(VclPaned* pPaned, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceContainer(pPaned, pBuilder, bTakeOwnership) + , m_xPaned(pPaned) + { + } + + virtual void set_position(int nPos) override + { + m_xPaned->set_position(nPos); + } + + virtual int get_position() const override + { + return m_xPaned->get_position(); + } +}; + class SalInstanceScrolledWindow : public SalInstanceContainer, public virtual weld::ScrolledWindow { private: @@ -6511,6 +6534,14 @@ std::unique_ptr<weld::Box> SalInstanceBuilder::weld_box(const OString& id, bool : nullptr; } +std::unique_ptr<weld::Paned> SalInstanceBuilder::weld_paned(const OString& id, + bool bTakeOwnership) +{ + VclPaned* pPaned = m_xBuilder->get<VclPaned>(id); + return pPaned ? std::make_unique<SalInstancePaned>(pPaned, this, bTakeOwnership) + : nullptr; +} + std::unique_ptr<weld::Frame> SalInstanceBuilder::weld_frame(const OString& id, bool bTakeOwnership) { VclFrame* pFrame = m_xBuilder->get<VclFrame>(id); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 934d52f8f6f5..04fc440f50c6 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -5089,6 +5089,28 @@ public: virtual std::unique_ptr<weld::Label> weld_label_widget() const override; }; +class GtkInstancePaned : public GtkInstanceContainer, public virtual weld::Paned +{ +private: + GtkPaned* m_pPaned; +public: + GtkInstancePaned(GtkPaned* pPaned, GtkInstanceBuilder* pBuilder, bool bTakeOwnership) + : GtkInstanceContainer(GTK_CONTAINER(pPaned), pBuilder, bTakeOwnership) + , m_pPaned(pPaned) + { + } + + virtual void set_position(int nPos) override + { + gtk_paned_set_position(m_pPaned, nPos); + } + + virtual int get_position() const override + { + return gtk_paned_get_position(m_pPaned); + } +}; + } static GType crippled_viewport_get_type(); @@ -15243,6 +15265,15 @@ public: return std::make_unique<GtkInstanceBox>(pBox, this, bTakeOwnership); } + virtual std::unique_ptr<weld::Paned> weld_paned(const OString &id, bool bTakeOwnership) override + { + GtkPaned* pPaned = GTK_PANED(gtk_builder_get_object(m_pBuilder, id.getStr())); + if (!pPaned) + return nullptr; + auto_add_parentless_widgets_to_container(GTK_WIDGET(pPaned)); + return std::make_unique<GtkInstancePaned>(pPaned, this, bTakeOwnership); + } + virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id, bool bTakeOwnership) override { GtkFrame* pFrame = GTK_FRAME(gtk_builder_get_object(m_pBuilder, id.getStr())); |