EVT_RADIOBUTTON(wxID_ANY, StdButtonSizerDialog::OnEvent)
END_EVENT_TABLE()
-MyCanvas *myCanvas = (MyCanvas *) NULL;
-
// `Main program' equivalent, creating windows and returning main app frame
bool MyApp::OnInit()
{
frame->SetMenuBar(menubar);
- myCanvas = new MyCanvas(frame);
- myCanvas->SetBackgroundColour(*wxWHITE);
-
frame->Centre(wxBOTH);
// Show the frame
#if wxUSE_STATUSBAR
CreateStatusBar();
#endif // wxUSE_STATUSBAR
+
+ m_canvas = new MyCanvas(this);
}
MyFrame::~MyFrame()
void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event))
{
- m_clrData.SetColour(myCanvas->GetBackgroundColour());
+ m_clrData.SetColour(m_canvas->GetBackgroundColour());
wxColourDialog dialog(this, &m_clrData);
dialog.SetTitle(_("Please choose the background colour"));
if ( dialog.ShowModal() == wxID_OK )
{
m_clrData = dialog.GetColourData();
- myCanvas->SetBackgroundColour(m_clrData.GetColour());
- myCanvas->ClearBackground();
- myCanvas->Refresh();
+ m_canvas->SetBackgroundColour(m_clrData.GetColour());
+ m_canvas->ClearBackground();
+ m_canvas->Refresh();
}
}
if ( clr.IsOk() )
{
wxGetApp().m_canvasTextColour = clr;
- myCanvas->Refresh();
+ m_canvas->Refresh();
}
//else: dialog cancelled by user
}
#if USE_COLOURDLG_GENERIC
void MyFrame::ChooseColourGeneric(wxCommandEvent& WXUNUSED(event))
{
- m_clrData.SetColour(myCanvas->GetBackgroundColour());
+ m_clrData.SetColour(m_canvas->GetBackgroundColour());
//FIXME:TODO:This has no effect...
m_clrData.SetChooseFull(true);
if (dialog->ShowModal() == wxID_OK)
{
m_clrData = dialog->GetColourData();
- myCanvas->SetBackgroundColour(m_clrData.GetColour());
- myCanvas->ClearBackground();
- myCanvas->Refresh();
+ m_canvas->SetBackgroundColour(m_clrData.GetColour());
+ m_canvas->ClearBackground();
+ m_canvas->Refresh();
}
dialog->Destroy();
}
wxFontData retData = dialog.GetFontData();
wxGetApp().m_canvasFont = retData.GetChosenFont();
wxGetApp().m_canvasTextColour = retData.GetColour();
- myCanvas->Refresh();
+ m_canvas->Refresh();
}
//else: cancelled by the user, don't change the font
}
wxFontData retData = dialog->GetFontData();
wxGetApp().m_canvasFont = retData.GetChosenFont();
wxGetApp().m_canvasTextColour = retData.GetColour();
- myCanvas->Refresh();
+ m_canvas->Refresh();
}
dialog->Destroy();
}
wxColourData m_clrData;
+ // just a window which we use to show the effect of font/colours selection
+ wxWindow *m_canvas;
+
DECLARE_EVENT_TABLE()
};
class MyCanvas: public wxScrolledWindow
{
public:
- MyCanvas(wxWindow *parent) :
- wxScrolledWindow(parent,wxID_ANY,wxDefaultPosition,wxDefaultSize,wxNO_FULL_REPAINT_ON_RESIZE) { }
+ MyCanvas(wxWindow *parent) : wxScrolledWindow(parent, wxID_ANY)
+ {
+ SetBackgroundColour(*wxWHITE);
+ }
+private:
void OnPaint(wxPaintEvent& event);
DECLARE_EVENT_TABLE()