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 class wxFileType;
00042 
00043 
00045 #define CHM_DEFAULT_FONT_SIZE 12
00046 
00048 #define CONTENTS_MARGIN 170
00049 
00050 
00051 #ifdef HAVE_CONFIG_H
00052 #       include <config.h>
00053 #else
00054         // this should never happen
00055 #       define VERSION "unknown"
00056 #endif
00057 
00058 
00060 enum
00061 {
00062         ID_Quit = 1,
00063         ID_About,
00064         ID_Open,
00065         ID_Fonts,
00066         ID_Print,
00067         ID_Home,
00068         ID_Forward,
00069         ID_Back,
00070         ID_Contents,
00071         ID_Bookmarks,
00072         ID_Add,
00073         ID_Remove,
00074         ID_FindInPage,
00075         ID_CopySelection,
00076         ID_Recent,
00077         ID_Notebook,
00078         ID_RegisterExtension,
00079         ID_TreeCtrl = 1000,
00080 };
00081 
00082 
00093 class CHMFrame : public wxFrame {
00094 public:
00095 
00112         CHMFrame(const wxString& title, const wxString& booksDir,
00113                  const wxPoint& pos, const wxSize& size,
00114                  const wxString& normalFont = wxEmptyString,
00115                  const wxString& fixedFont = wxEmptyString,
00116                  const int fontSize = CHM_DEFAULT_FONT_SIZE,
00117                  const int sashPosition = CONTENTS_MARGIN,
00118                  const wxString& fullAppPath = wxEmptyString);
00119 
00121         ~CHMFrame();
00122 
00128         bool LoadCHM(const wxString& archive);
00129         
00130 
00136         bool LoadContextID( const int contextID );
00137 
00138 
00140         void UpdateCHMInfo();
00141 
00142 protected:
00144         void OnQuit(wxCommandEvent& event);
00145 
00147         void OnAbout(wxCommandEvent& event);
00148 
00150         void OnOpen(wxCommandEvent& event);
00151 
00153         void OnChangeFonts(wxCommandEvent& event);
00154 
00156         void OnHome(wxCommandEvent& event);
00157 
00159         void OnHistoryForward(wxCommandEvent& event);
00160 
00162         void OnHistoryBack(wxCommandEvent& event);      
00163 
00168         void OnShowContents(wxCommandEvent& event);     
00169 
00171         void OnPrint(wxCommandEvent& event);
00172 
00174         void OnHistFile(wxCommandEvent& event);
00175 
00177         void OnFind(wxCommandEvent& event);
00178 
00180         void OnCopySelection(wxCommandEvent& event);
00181 
00183         void OnAddBookmark(wxCommandEvent& event);
00184 
00185 #if defined(__WXMSW__) || defined(__WXMAC__)
00186 
00187         void OnRegisterExtension(wxCommandEvent& event);        
00188 #endif// __WXMSW__
00189 
00191         void OnRemoveBookmark(wxCommandEvent& event);
00192 
00194         void OnBookmarkSel(wxCommandEvent &event);
00195 
00197         void OnSelectionChanged(wxTreeEvent& event);
00198 
00200         void OnCloseWindow(wxCloseEvent& event);
00201 
00203         void OnChar(wxKeyEvent &event);
00204         
00205 private:
00207         wxMenuBar *CreateMenu();
00208 
00210         bool InitToolBar(wxToolBar *toolbar);
00211 
00213         wxPanel* CreateContentsPanel();
00214 
00216         void LoadBookmarks();
00217 
00219         void SaveBookmarks();
00220 
00222         void SaveExitInfo();
00223 
00224 private:
00225         CHMHtmlWindow* _html;
00226         wxTreeCtrl* _tcl;
00227         wxSplitterWindow* _sw;
00228         wxMenu* _menuFile;
00229         wxToolBar* _tb;
00230         wxHtmlEasyPrinting* _ep;
00231         wxNotebook* _nb;
00232         wxComboBox* _cb;
00233         CHMSearchPanel* _csp;
00234         CHMIndexPanel* _cip;
00235 
00236         wxString _openPath;
00237         wxArrayString* _normalFonts;
00238         wxArrayString* _fixedFonts;
00239         wxString _normalFont;
00240         wxString _fixedFont;
00241         int _fontSize;
00242         bool _bookmarkSel;
00243         bool _bookmarksDeleted;
00244         int _sashPos;   
00245         wxFont _font;
00246         wxFileHistory _fh;
00247         wxString _fullAppPath;
00248 
00249 private:
00250         DECLARE_EVENT_TABLE()   
00251 };
00252 
00253 
00254 #endif // __CHMFRAME_H_
00255 
00256 
00257 /*
00258   Local Variables:
00259   mode: c++
00260   c-basic-offset: 8
00261   tab-width: 8
00262   c-indent-comments-syntactically-p: t
00263   c-tab-always-indent: t
00264   indent-tabs-mode: t
00265   End:
00266 */
00267 
00268 // vim:shiftwidth=8:autoindent:tabstop=8:noexpandtab:softtabstop=8

Generated on Fri Nov 17 12:35:46 2006 for xCHM by  doxygen 1.4.4