#include "wx/wx.h"
#endif
-#include "wx/plot.h"
+#include "wx/plot/plot.h"
#include "wx/image.h"
#include "wx/listctrl.h"
void OnPlotDClick( wxPlotEvent &event );
wxPlotWindow *m_plot;
+#if wxUSE_LOG
wxTextCtrl *m_log;
+#endif // wxUSE_LOG
private:
DECLARE_DYNAMIC_CLASS(MyFrame)
END_EVENT_TABLE()
MyFrame::MyFrame()
- : wxFrame( (wxFrame *)NULL, -1, "wxPlotWindow sample",
+ : wxFrame( (wxFrame *)NULL, -1, _T("wxPlotWindow sample"),
wxPoint(20,20), wxSize(470,500) )
{
wxMenu *file_menu = new wxMenu();
- file_menu->Append( ID_ABOUT, "&About..");
- file_menu->Append( ID_QUIT, "E&xit\tAlt-X");
+ file_menu->Append( ID_ABOUT, _T("&About.."));
+ file_menu->Append( ID_QUIT, _T("E&xit\tAlt-X"));
wxMenuBar *menu_bar = new wxMenuBar();
- menu_bar->Append(file_menu, "&File");
+ menu_bar->Append(file_menu, _T("&File"));
SetMenuBar( menu_bar );
+#if wxUSE_STATUSBAR
CreateStatusBar(2);
int widths[] = { -1, 100 };
SetStatusWidths( 2, widths );
+#endif // wxUSE_STATUSBAR
m_plot = new wxPlotWindow( this, -1, wxPoint(0,0), wxSize(100,100), wxSUNKEN_BORDER | wxPLOT_DEFAULT );
m_plot->SetUnitsPerValue( 0.01 );
- m_plot->SetScrollOnThumbRelease( TRUE );
+// m_plot->SetScrollOnThumbRelease( TRUE );
m_plot->Add( new MyPlotCurve( 0, -1.5, 1.5 ) );
m_plot->Add( new MyPlotCurve( 50, -1.5, 1.5 ) );
oo->Add( 1000, 2000 );
m_plot->Add( oo );
- m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
+#if wxUSE_LOG
+ m_log = new wxTextCtrl( this, -1, _T("This is the log window.\n"), wxPoint(0,0), wxSize(100,100), wxTE_MULTILINE );
wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
delete old_log;
+#endif // wxUSE_LOG
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
topsizer->Add( m_plot, 1, wxEXPAND );
+#if wxUSE_LOG
topsizer->Add( m_log, 0, wxEXPAND );
+#endif // wxUSE_LOG
- SetAutoLayout( TRUE );
+ SetAutoLayout( true );
SetSizer( topsizer );
}
void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
{
- Close( TRUE );
+ Close( true );
}
void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
{
- (void)wxMessageBox( "wxPlotWindow Demo\n"
- "Robert Roebling (c) 1999,2000",
- "About wxPlotWindow Demo", wxICON_INFORMATION | wxOK );
+ (void)wxMessageBox( _T("wxPlotWindow Demo\n")
+ _T("Robert Roebling (c) 1999,2000"),
+ _T("About wxPlotWindow Demo"), wxICON_INFORMATION | wxOK );
}
void MyFrame::OnPlotClick( wxPlotEvent &event )
{
double x = event.GetPosition() * m_plot->GetUnitsPerValue();
double y = event.GetCurve()->GetY( event.GetPosition() );
- wxLogMessage( "Clicked on curve at x coordinate: %f, value: %f", x, y );
+ wxLogMessage( _T("Clicked on curve at x coordinate: %f, value: %f"), x, y );
}
void MyFrame::OnPlotDClick( wxPlotEvent &event )
{
double x = event.GetPosition() * m_plot->GetUnitsPerValue();
double y = event.GetCurve()->GetY( event.GetPosition() );
- wxLogMessage( "Double clicked on curve at x coordinate: %f, value: %f", x, y );
+ wxLogMessage( _T("Double clicked on curve at x coordinate: %f, value: %f"), x, y );
}
//-----------------------------------------------------------------------------