Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

chmframe.h

00001 /*
00002 
00003   Copyright (C) 2003  Razvan Cojocaru <razvanco@gmx.net>
00004  
00005   This program is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009   
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU General Public License for more details.
00014   
00015   You should have received a copy of the GNU General Public License
00016   along with this program; if not, write to the Free Software
00017   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 
00022 #ifndef __CHMFRAME_H_
00023 #define __CHMFRAME_H_
00024 
00025 #include <wx/wx.h>
00026 #include <wx/html/htmprint.h>
00027 #include <wx/splitter.h>
00028 #include <wx/notebook.h>
00029 #include <wx/treectrl.h>
00030 #include <wx/panel.h>
00031 #include <wx/combobox.h>
00032 #include <wx/font.h>
00033 #include <wx/docview.h>
00034 #include <wx/thread.h>
00035 
00036 
00037 // Forward declarations.
00038 class CHMHtmlWindow;
00039 class CHMSearchPanel;
00040 class CHMIndexPanel;
00041 
00042 
00044 #define CHM_DEFAULT_FONT_SIZE 12
00045 
00047 #define CONTENTS_MARGIN 170
00048 
00049 
00050 #ifdef HAVE_CONFIG_H
00051 #       include <config.h>
00052 #else
00053         // this should never happen
00054 #       define VERSION "unknown"
00055 #endif
00056 
00057 
00059 enum
00060 {
00061         ID_Quit = 1,
00062         ID_About,
00063         ID_Open,
00064         ID_Fonts,
00065         ID_Print,
00066         ID_Home,
00067         ID_Forward,
00068         ID_Back,
00069         ID_Contents,
00070         ID_Bookmarks,
00071         ID_Add,
00072         ID_Remove,
00073         ID_FindInPage,
00074         ID_Recent,
00075         ID_Notebook,
00076         ID_TreeCtrl = 1000,
00077 };
00078 
00079 
00090 class CHMFrame : public wxFrame {
00091 public:
00092 
00108         CHMFrame(const wxString& title, const wxString& booksDir,
00109                  const wxPoint& pos, const wxSize& size,
00110                  const wxString& normalFont = wxEmptyString,
00111                  const wxString& fixedFont = wxEmptyString,
00112                  const int fontSize = CHM_DEFAULT_FONT_SIZE,
00113                  const int sashPosition = CONTENTS_MARGIN);
00114 
00116         ~CHMFrame();
00117 
00123         bool LoadCHM(const wxString& archive);
00124         
00125 
00131         bool LoadContextID( const int contextID );
00132 
00133 
00135         void UpdateCHMInfo();
00136 
00137 protected:
00139         void OnQuit(wxCommandEvent& event);
00140 
00142         void OnAbout(wxCommandEvent& event);
00143 
00145         void OnOpen(wxCommandEvent& event);
00146 
00148         void OnChangeFonts(wxCommandEvent& event);
00149 
00151         void OnHome(wxCommandEvent& event);
00152 
00154         void OnHistoryForward(wxCommandEvent& event);
00155 
00157         void OnHistoryBack(wxCommandEvent& event);      
00158 
00163         void OnShowContents(wxCommandEvent& event);     
00164 
00166         void OnPrint(wxCommandEvent& event);
00167 
00169         void CHMFrame::OnHistFile(wxCommandEvent& event);
00170 
00172         void OnFind(wxCommandEvent& event);
00173 
00175         void OnAddBookmark(wxCommandEvent& event);
00176 
00178         void OnRemoveBookmark(wxCommandEvent& event);
00179 
00181         void OnBookmarkSel(wxCommandEvent &event);
00182 
00184         void OnSelectionChanged(wxTreeEvent& event);
00185 
00187         void OnCloseWindow(wxCloseEvent& event);
00188         
00189 private:
00191         wxMenuBar *CreateMenu();
00192 
00194         bool InitToolBar(wxToolBar *toolbar);
00195 
00197         wxPanel* CreateContentsPanel();
00198 
00200         void LoadBookmarks();
00201 
00203         void SaveBookmarks();
00204 
00206         void SaveExitInfo();
00207 
00208 private:
00209         CHMHtmlWindow* _html;
00210         wxTreeCtrl* _tcl;
00211         wxSplitterWindow* _sw;
00212         wxMenu* _menuFile;
00213         wxToolBar* _tb;
00214         wxHtmlEasyPrinting* _ep;
00215         wxNotebook* _nb;
00216         wxComboBox* _cb;
00217         CHMSearchPanel* _csp;
00218         CHMIndexPanel* _cip;
00219 
00220         wxString _openPath;
00221         wxArrayString* _normalFonts;
00222         wxArrayString* _fixedFonts;
00223         wxString _normalFont;
00224         wxString _fixedFont;
00225         int _fontSize;
00226         bool _bookmarkSel;
00227         bool _bookmarksDeleted;
00228         int _sashPos;   
00229         wxFont _font;
00230         wxFileHistory _fh;
00231         wxMutex _mutex;
00232 
00233 private:
00234         DECLARE_EVENT_TABLE()   
00235 };
00236 
00237 
00238 #endif // __CHMFRAME_H_

Generated on Mon Aug 29 12:19:43 2005 for xCHM by  doxygen 1.4.0