Adding a Generate menu item. default tip
authorviric@mandarina
Thu, 03 Apr 2008 00:16:12 +0200
changeset 1 5b075fa903ae
parent 0 97dd4d2c08b6
Adding a Generate menu item.
MainWindow.cpp
MainWindow.hpp
PageList.cpp
PageList.hpp
--- a/MainWindow.cpp	Wed Apr 02 21:47:47 2008 +0200
+++ b/MainWindow.cpp	Thu Apr 03 00:16:12 2008 +0200
@@ -3,6 +3,7 @@
 #include "PageList.hpp"
 
 BEGIN_EVENT_TABLE(MainWindow, wxFrame)
+    EVT_MENU(ID_MENU_GENERATE, MainWindow::on_generate)
     EVT_MENU(wxID_OPEN, MainWindow::on_open)
     EVT_MENU(wxID_CLOSE, MainWindow::on_quit)
 END_EVENT_TABLE()
@@ -30,7 +31,11 @@
     _menufile->Append(wxID_OPEN, _("&Open"));
     _menufile->Append(wxID_CLOSE, _("&Quit"));
 
+    wxMenu *menuplay = new wxMenu();
+    menuplay->Append(ID_MENU_GENERATE, _("&Generate"));
+
     _menubar->Append(_menufile, _("&File"));
+    _menubar->Append(menuplay, _("&Document"));
 
     SetMenuBar(_menubar);
 }
@@ -55,3 +60,9 @@
 {
     Close();
 }
+
+void
+MainWindow::on_generate(wxCommandEvent &event)
+{
+    _pagelist->generate(wxT("out.djvu"));
+}
--- a/MainWindow.hpp	Wed Apr 02 21:47:47 2008 +0200
+++ b/MainWindow.hpp	Thu Apr 03 00:16:12 2008 +0200
@@ -4,15 +4,19 @@
 
 class MainWindow : public wxFrame
 {
+    enum
+    {
+        ID_MENU_GENERATE
+    };
 public:
     MainWindow();
 
-
 private:
     void create_menus();
 
     void on_open(wxCommandEvent &event);
     void on_quit(wxCommandEvent &event);
+    void on_generate(wxCommandEvent &event);
 
     wxMenuBar *_menubar;
     wxMenu *_menufile;
--- a/PageList.cpp	Wed Apr 02 21:47:47 2008 +0200
+++ b/PageList.cpp	Thu Apr 03 00:16:12 2008 +0200
@@ -57,3 +57,10 @@
 
     PopupMenu(menu);
 }
+
+void
+PageList::generate(const wxString &outputfile)
+{
+    wxMessageDialog w(this, outputfile);
+    w.ShowModal();
+}
--- a/PageList.hpp	Wed Apr 02 21:47:47 2008 +0200
+++ b/PageList.hpp	Thu Apr 03 00:16:12 2008 +0200
@@ -7,6 +7,7 @@
 
     void add_files(const wxArrayString &filenames);
     void on_context_menu(wxContextMenuEvent &event);
+    void generate(const wxString &outputfile);
 
 private: