Our ideas is to draw time pointer into some kind of layer that is put over the plot and only this layer is redrawn when time changes. There is some wxDCOverlay in wxWidgets. Is it suitable for this purpose? Application will run on Win and GTK+3.
I declare "wxOverlay m_overlay" in the main class and call the following code when time changes:
Code: Select all
CAnalysisPanel contructor:
m_pPlot = new wxPanel(this);
m_pPlot->SetBackgroundStyle(wxBG_STYLE_CUSTOM);
m_pPlot->Bind(wxEVT_PAINT, &CAnalysisPanel::OnPaint, this);
void CAnalysisPanel::SetCurrentFrame(unsigned int i) {
wxClientDC dc(m_pPlot) ; // m_pCanvas is wxPanel
wxDCOverlay overlaydc( m_overlay, &dc );
overlaydc.Clear();
dc.DrawLine(...); // code to draw the pointer
}
Is something wrong with the code? Did I forget something? Why wxEVT_PAINT is called?