#endif
#ifndef WX_PRECOMP
-#include "wx/defs.h"
-#include "wx/list.h"
-#include "wx/utils.h"
+#include "wx/wx.h"
#endif
#include "wx/help.h"
#endif
wxMenu *popupMenu = NULL;
-void PopupFunction(wxMenu& menu, wxCommandEvent& event);
-wxHelpController *HelpController = NULL;
+#if wxUSE_HELP
+ wxHelpController *HelpController = NULL;
+#endif // wxUSE_HELP
IMPLEMENT_APP(MyApp)
BEGIN_EVENT_TABLE(MainWindow, wxFrame)
EVT_CLOSE(MainWindow::OnCloseWindow)
EVT_CHAR(MainWindow::OnChar)
+ EVT_MENU(-1, MainWindow::OnPopup)
END_EVENT_TABLE()
MainWindow::MainWindow(wxFrame *frame, wxWindowID id, const wxString& title,
DarkGreyPen = new wxPen("GREY", THICK_LINE_WIDTH, wxSOLID);
WhitePen = new wxPen("WHITE", THICK_LINE_WIDTH, wxSOLID);
+#if wxUSE_HELP
HelpController = new wxHelpController();
HelpController->Initialize("wxpoem");
+#endif // wxUSE_HELP
CreateFonts();
// randomize();
pages[0] = 0;
- TheMainWindow = new MainWindow(NULL, -1, "wxPoem", wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
+ TheMainWindow = new MainWindow(NULL, 500, "wxPoem", wxPoint(XPos, YPos), wxSize(100, 100), wxCAPTION|wxMINIMIZE_BOX|wxSYSTEM_MENU);
#ifdef wx_x
TheMainWindow->SetIcon(Icon("wxpoem"));
#endif
- TheMainWindow->canvas = new MyCanvas(TheMainWindow, -1, wxDefaultPosition, wxDefaultSize);
+ TheMainWindow->canvas = new MyCanvas(TheMainWindow, 501, wxDefaultPosition, wxDefaultSize);
- popupMenu = new wxMenu("", (wxFunction)PopupFunction);
+ popupMenu = new wxMenu;
popupMenu->Append(POEM_NEXT, "Next poem/page");
popupMenu->Append(POEM_PREVIOUS, "Previous page");
popupMenu->AppendSeparator();
{
if (backingBitmap)
delete backingBitmap;
+#if wxUSE_HELP
delete HelpController;
+#endif // wxUSE_HELP
delete GreyPen;
delete DarkGreyPen;
delete WhitePen;
canvas->OnChar(event);
}
-BEGIN_EVENT_TABLE(MyCanvas, wxPanel)
+BEGIN_EVENT_TABLE(MyCanvas, wxWindow)
EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
EVT_CHAR(MyCanvas::OnChar)
EVT_PAINT(MyCanvas::OnPaint)
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxFrame *frame, wxWindowID id, const wxPoint& pos, const wxSize& size):
- wxPanel(frame, id, pos, size)
+ wxWindow(frame, id, pos, size)
{
}
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
- long x, y;
- event.Position(&x, &y);
static int startPosX, startPosY, startFrameX, startFrameY;
- event.Position(&x, &y);
+ long x, y;
+ event.GetPosition(&x, &y);
if (event.RightDown())
{
return TRUE;
}
-void PopupFunction(wxMenu& /*menu*/, wxCommandEvent& event)
+void MainWindow::OnPopup(wxCommandEvent& event)
{
switch (event.GetId())
{
}
case POEM_HELP_CONTENTS:
{
+#if wxUSE_HELP
HelpController->LoadFile("wxpoem");
HelpController->DisplayContents();
+#endif // wxUSE_HELP
break;
}
case POEM_ABOUT: