summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx23
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx16
2 files changed, 39 insertions, 0 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c0967e15f66a..00f31f36f702 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1025,6 +1025,8 @@ class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::No
private:
VclPtr<TabControl> m_xNotebook;
mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages;
+ std::vector<VclPtr<TabPage>> m_aAddedPages;
+ std::vector<VclPtr<VclGrid>> m_aAddedGrids;
DECL_LINK(DeactivatePageHdl, TabControl*, bool);
DECL_LINK(ActivatePageHdl, TabControl*, void);
@@ -1078,6 +1080,23 @@ public:
m_xNotebook->RemovePage(m_xNotebook->GetPageId(rIdent));
}
+ virtual void append_page(const OString& rIdent, const OUString& rLabel) override
+ {
+ sal_uInt16 nNewPageCount = m_xNotebook->GetPageCount() + 1;
+ sal_uInt16 nNewPageId = nNewPageCount;
+ m_xNotebook->InsertPage(nNewPageId, rLabel);
+ VclPtrInstance<TabPage> xPage(m_xNotebook);
+ VclPtrInstance<VclGrid> xGrid(xPage);
+ xPage->Show();
+ xGrid->set_hexpand(true);
+ xGrid->set_vexpand(true);
+ xGrid->Show();
+ m_xNotebook->SetTabPage(nNewPageId, xPage);
+ m_xNotebook->SetPageName(nNewPageId, rIdent);
+ m_aAddedPages.push_back(xPage);
+ m_aAddedGrids.push_back(xGrid);
+ }
+
virtual int get_n_pages() const override
{
return m_xNotebook->GetPageCount();
@@ -1090,6 +1109,10 @@ public:
virtual ~SalInstanceNotebook() override
{
+ for (auto &rGrid : m_aAddedGrids)
+ rGrid.disposeAndClear();
+ for (auto &rPage : m_aAddedPages)
+ rPage.disposeAndClear();
m_xNotebook->SetActivatePageHdl(Link<TabControl*,void>());
m_xNotebook->SetDeactivatePageHdl(Link<TabControl*,bool>());
}
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f43d6dc46da4..13c1f3b49c96 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2937,6 +2937,22 @@ public:
enable_notify_events();
}
+ virtual void append_page(const OString& rIdent, const OUString& rLabel) override
+ {
+ disable_notify_events();
+
+ GtkWidget *pTabWidget = gtk_label_new(MapToGtkAccelerator(rLabel).getStr());
+ gtk_buildable_set_name(GTK_BUILDABLE(pTabWidget), rIdent.getStr());
+
+ GtkWidget *pChild = gtk_grid_new();
+ gtk_notebook_append_page(m_pNotebook, pChild, pTabWidget);
+ gtk_widget_show_all(pChild);
+ gtk_widget_show_all(pTabWidget);
+
+ update_tab_pos();
+ enable_notify_events();
+ }
+
virtual ~GtkInstanceNotebook() override
{
g_signal_handler_disconnect(m_pNotebook, m_nSwitchPageSignalId);