+void wxPlotWindow::AddChartTitle(const wxString& title, wxFont font,
+ wxColour colour)
+{
+ m_title = title;
+ m_titleFont = font;
+ m_titleColour = colour;
+ DrawChartTitle();
+}
+
+void wxPlotWindow::DrawChartTitle()
+{
+ if(m_title.size() != 0)
+ {
+ //If it is already added, remove child and delete
+ if(m_titleStaticText)
+ {
+ RemoveChild( m_titleStaticText );
+ m_titleStaticText->Destroy();
+ }
+
+ //Create the text control and set the font, colour
+ m_titleStaticText = new wxStaticText( this, -1, m_title );
+ m_titleStaticText->SetFont( m_titleFont );
+ m_titleStaticText->SetForegroundColour( m_titleColour );
+
+ //Create a sizer for the title. Prepend it to the Plot + Title sizer.
+ wxBoxSizer* titleSizer = new wxBoxSizer( wxHORIZONTAL );
+ titleSizer->Add( m_titleStaticText, 0, wxALIGN_CENTER | wxALL, 10 );
+ m_plotAndTitleSizer->Prepend( titleSizer, 0, wxALIGN_CENTER_HORIZONTAL );
+
+ //Finally, force layout
+ m_plotAndTitleSizer->Layout();
+ }
+}
+