X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/760fdb67552d34ba113d3a26186641bed0eb50d0..40e5ebbf98728d627e4d3c9e3a57f28f5bb8fcb9:/src/aui/auibook.cpp diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index a30edc27f8..405ae7bffa 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -230,7 +230,12 @@ wxAuiDefaultTabArt::~wxAuiDefaultTabArt() wxAuiTabArt* wxAuiDefaultTabArt::Clone() { - return static_cast(new wxAuiDefaultTabArt); + wxAuiDefaultTabArt* art = new wxAuiDefaultTabArt; + art->SetNormalFont(m_normal_font); + art->SetSelectedFont(m_selected_font); + art->SetMeasuringFont(m_measuring_font); + + return art; } void wxAuiDefaultTabArt::SetFlags(unsigned int flags) @@ -666,7 +671,14 @@ int wxAuiDefaultTabArt::ShowDropDown(wxWindow* wnd, for (i = 0; i < count; ++i) { const wxAuiNotebookPage& page = pages.Item(i); - menuPopup.AppendCheckItem(1000+i, page.caption); + wxString caption = page.caption; + + // if there is no caption, make it a space. This will prevent + // an assert in the menu code. + if (caption.IsEmpty()) + caption = wxT(" "); + + menuPopup.AppendCheckItem(1000+i, caption); } if (active_idx != -1) @@ -2225,6 +2237,11 @@ public: m_tab_ctrl_height = 20; } + ~wxTabFrame() + { + wxDELETE(m_tabs); + } + void SetTabCtrlHeight(int h) { m_tab_ctrl_height = h; @@ -3583,7 +3600,57 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) } } +// Sets the normal font +void wxAuiNotebook::SetNormalFont(const wxFont& font) +{ + m_normal_font = font; + GetArtProvider()->SetNormalFont(font); +} + +// Sets the selected tab font +void wxAuiNotebook::SetSelectedFont(const wxFont& font) +{ + m_selected_font = font; + GetArtProvider()->SetSelectedFont(font); +} + +// Sets the measuring font +void wxAuiNotebook::SetMeasuringFont(const wxFont& font) +{ + GetArtProvider()->SetMeasuringFont(font); +} +// Sets the tab font +bool wxAuiNotebook::SetFont(const wxFont& font) +{ + wxControl::SetFont(font); + + wxFont normalFont(font); + wxFont selectedFont(normalFont); + selectedFont.SetWeight(wxBOLD); + + SetNormalFont(normalFont); + SetSelectedFont(selectedFont); + SetMeasuringFont(selectedFont); + + return true; +} + +// Gets the tab control height +int wxAuiNotebook::GetTabCtrlHeight() const +{ + return m_tab_ctrl_height; +} + +// Gets the height of the notebook for a given page height +int wxAuiNotebook::GetHeightForPageHeight(int pageHeight) +{ + UpdateTabCtrlHeight(); + + int tabCtrlHeight = GetTabCtrlHeight(); + int decorHeight = 2; + return tabCtrlHeight + pageHeight + decorHeight; +} #endif // wxUSE_AUI