include/vcl/weld.hxx | 10 ++++++++++ vcl/inc/salvtables.hxx | 5 ++++- vcl/source/app/salvtables.cxx | 31 +++++++++++++++++++++++++++++++ vcl/unx/gtk3/gtk3gtkinst.cxx | 31 +++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 1 deletion(-)
New commits: commit 7c902087c9cef04cd8eff4249755f527249b0300 Author: Caolán McNamara <[email protected]> AuthorDate: Tue May 12 11:12:18 2020 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Tue May 12 13:39:56 2020 +0200 add Paned access Change-Id: I5da0125a8f76d201e8dab2892b1f205c759599b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94045 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 63f774e3af06..79b0de0ae508 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -294,6 +294,15 @@ public: virtual void reorder_child(weld::Widget* pWidget, int position) = 0; }; +class VCL_DLLPUBLIC Paned : virtual public Container +{ +public: + // set pixel position of divider + virtual void set_position(int nPos) = 0; + // get pixel position of divider + virtual int get_position() const = 0; +}; + class VCL_DLLPUBLIC ScrolledWindow : virtual public Container { protected: @@ -2188,6 +2197,7 @@ public: bool bTakeOwnership = false) = 0; virtual std::unique_ptr<Box> weld_box(const OString& id, bool bTakeOwnership = false) = 0; + virtual std::unique_ptr<Paned> weld_paned(const OString& id, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<Button> weld_button(const OString& id, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id, bool bTakeOwnership = false) 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())); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
