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 
00171 #ifdef _ENABLE_COPY_AND_FIND
00172 
00173         void OnFind(wxCommandEvent& event);
00174 #endif
00175 
00177         void OnAddBookmark(wxCommandEvent& event);
00178 
00180         void OnRemoveBookmark(wxCommandEvent& event);
00181 
00183         void OnBookmarkSel(wxCommandEvent &event);
00184 
00186         void OnSelectionChanged(wxTreeEvent& event);
00187 
00189         void OnCloseWindow(wxCloseEvent& event);
00190         
00191 private:
00193         wxMenuBar *CreateMenu();
00194 
00196         bool InitToolBar(wxToolBar *toolbar);
00197 
00199         wxPanel* CreateContentsPanel();
00200 
00202         void LoadBookmarks();
00203 
00205         void SaveBookmarks();
00206 
00207 private:
00208         CHMHtmlWindow* _html;
00209         wxTreeCtrl* _tcl;
00210         wxSplitterWindow* _sw;
00211         wxMenu* _menuFile;
00212         wxToolBar* _tb;
00213         wxHtmlEasyPrinting* _ep;
00214         wxNotebook* _nb;
00215         wxComboBox* _cb;
00216         CHMSearchPanel* _csp;
00217         CHMIndexPanel* _cip;
00218 
00219         wxString _openPath;
00220         wxArrayString* _normalFonts;
00221         wxArrayString* _fixedFonts;
00222         wxString _normalFont;
00223         wxString _fixedFont;
00224         int _fontSize;
00225         bool _bookmarkSel;
00226         bool _bookmarksDeleted;
00227         int _sashPos;   
00228         wxFont _font;
00229         wxFileHistory _fh;
00230         wxMutex _mutex;
00231 
00232 private:
00233         DECLARE_EVENT_TABLE()   
00234 };
00235 
00236 
00237 #endif // __CHMFRAME_H_

Generated on Mon Feb 21 11:08:37 2005 for xCHM by  doxygen 1.4.0