X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/abfdefede3209ac777bdac8a65bae8bf008f327b..45cecdf9436fbfb7776f8ac610b280311d497ad7:/src/gtk/notebook.cpp diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index 9cf75ee56b..e8e55440c3 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -304,9 +304,34 @@ bool wxNotebook::SetPageImage( size_t page, int image ) return true; } -void wxNotebook::SetPageSize( const wxSize &WXUNUSED(size) ) +wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const { - wxFAIL_MSG( wxT("wxNotebook::SetPageSize not implemented") ); + // Compute the max size of the tab labels. + wxSize sizeTabMax; + const size_t pageCount = GetPageCount(); + for ( size_t n = 0; n < pageCount; n++ ) + { + GtkRequisition req; + gtk_widget_size_request(GetNotebookPage(n)->m_box, &req); + sizeTabMax.IncTo(wxSize(req.width, req.height)); + } + + // Unfortunately this doesn't account for the real tab size and I don't + // know how to find it, e.g. where do the margins below come from. + const int PAGE_MARGIN = 3; + const int TAB_MARGIN = 4; + + sizeTabMax.IncBy(3*TAB_MARGIN); + + wxSize sizeFull(sizePage); + if ( IsVertical() ) + sizeFull.y += sizeTabMax.y; + else + sizeFull.x += sizeTabMax.x; + + sizeFull.IncBy(2*PAGE_MARGIN); + + return sizeFull; } void wxNotebook::SetPadding( const wxSize &padding ) @@ -352,8 +377,6 @@ wxNotebookPage *wxNotebook::DoRemovePage( size_t page ) if ( !client ) return NULL; - gtk_widget_unrealize( client->m_widget ); - // we don't need to unparent the client->m_widget; GTK+ will do // that for us (and will throw a warning if we do it!) gtk_notebook_remove_page( GTK_NOTEBOOK(m_widget), page );