]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/wxpoem/wxpoem.cpp
wxLongLongWx::Assign(double) works - thanks Guillermo
[wxWidgets.git] / samples / wxpoem / wxpoem.cpp
index 49833dd30d968587f3138cf93e76118e1ee4295c..2a2d89c03166c89552208c26e779dd7e2b505147 100644 (file)
@@ -26,9 +26,7 @@
 #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"
@@ -133,9 +131,10 @@ void            CopyToClipboard(HWND, char *);
 #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)
 
@@ -152,6 +151,7 @@ void CreateFonts()
 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,
@@ -590,8 +590,10 @@ bool MyApp::OnInit()
   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();
 
@@ -614,7 +616,7 @@ bool MyApp::OnInit()
 
   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();
@@ -666,7 +668,9 @@ int MyApp::OnExit()
 {
   if (backingBitmap)
     delete backingBitmap;
+#if wxUSE_HELP
   delete HelpController;
+#endif // wxUSE_HELP
   delete GreyPen;
   delete DarkGreyPen;
   delete WhitePen;
@@ -725,11 +729,10 @@ void MyCanvas::OnPaint(wxPaintEvent& WXUNUSED(event))
 
 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())
   {
@@ -1070,7 +1073,7 @@ bool Compile(void)
     return TRUE;
 }
 
-void PopupFunction(wxMenu& /*menu*/, wxCommandEvent& event)
+void MainWindow::OnPopup(wxCommandEvent& event)
 {
   switch (event.GetId())
   {
@@ -1122,8 +1125,10 @@ void PopupFunction(wxMenu& /*menu*/, wxCommandEvent& event)
      }
      case POEM_HELP_CONTENTS:
      {
+#if wxUSE_HELP
        HelpController->LoadFile("wxpoem");
        HelpController->DisplayContents();
+#endif // wxUSE_HELP
        break;
      }
      case POEM_ABOUT: