Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound 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 
00035 
00036 // Forward declarations.
00037 class CHMHtmlWindow;
00038 class CHMSearchPanel;
00039 class CHMIndexPanel;
00040 
00041 
00043 #define CHM_DEFAULT_FONT_SIZE 12
00044 
00046 #define CONTENTS_MARGIN 170
00047 
00048 
00049 #ifdef HAVE_CONFIG_H
00050 #       include <config.h>
00051 #else
00052         // this should never happen
00053 #       define VERSION "unknown"
00054 #endif
00055 
00056 
00058 enum
00059 {
00060         ID_Quit = 1,
00061         ID_About,
00062         ID_Open,
00063         ID_Fonts,
00064         ID_Print,
00065         ID_Home,
00066         ID_Forward,
00067         ID_Back,
00068         ID_Contents,
00069         ID_Bookmarks,
00070         ID_Add,
00071         ID_Remove,
00072         ID_FindInPage,
00073         ID_Recent,
00074         ID_Notebook,
00075         ID_TreeCtrl = 1000,
00076 };
00077 
00078 
00089 class CHMFrame : public wxFrame {
00090 public:
00091 
00107         CHMFrame(const wxString& title, const wxString& booksDir,
00108                  const wxPoint& pos, const wxSize& size,
00109                  const wxString& normalFont = wxEmptyString,
00110                  const wxString& fixedFont = wxEmptyString,
00111                  const int fontSize = CHM_DEFAULT_FONT_SIZE,
00112                  const int sashPosition = CONTENTS_MARGIN);
00113 
00115         ~CHMFrame();
00116 
00123         void LoadCHM(const wxString& archive);
00124 
00125 protected:
00127         void OnQuit(wxCommandEvent& event);
00128 
00130         void OnAbout(wxCommandEvent& event);
00131 
00133         void OnOpen(wxCommandEvent& event);
00134 
00136         void OnChangeFonts(wxCommandEvent& event);
00137 
00139         void OnHome(wxCommandEvent& event);
00140 
00142         void OnHistoryForward(wxCommandEvent& event);
00143 
00145         void OnHistoryBack(wxCommandEvent& event);      
00146 
00151         void OnShowContents(wxCommandEvent& event);     
00152 
00154         void OnPrint(wxCommandEvent& event);
00155 
00157         void CHMFrame::OnHistFile(wxCommandEvent& event);
00158 
00159 #ifdef _ENABLE_COPY_AND_FIND
00160 
00161         void OnFind(wxCommandEvent& event);
00162 #endif
00163 
00165         void OnAddBookmark(wxCommandEvent& event);
00166 
00168         void OnRemoveBookmark(wxCommandEvent& event);
00169 
00171         void OnBookmarkSel(wxCommandEvent &event);
00172 
00174         void OnSelectionChanged(wxTreeEvent& event);
00175 
00177         void OnCloseWindow(wxCloseEvent& event);
00178         
00179 private:
00181         wxMenuBar *CreateMenu();
00182 
00184         bool InitToolBar(wxToolBar *toolbar);
00185 
00187         wxPanel* CreateContentsPanel();
00188 
00190         void LoadBookmarks();
00191 
00193         void SaveBookmarks();
00194 
00195 private:
00196         CHMHtmlWindow* _html;
00197         wxTreeCtrl* _tcl;
00198         wxSplitterWindow* _sw;
00199         wxMenu* _menuFile;
00200         wxToolBar* _tb;
00201         wxHtmlEasyPrinting* _ep;
00202         wxNotebook* _nb;
00203         wxComboBox* _cb;
00204         CHMSearchPanel* _csp;
00205         CHMIndexPanel* _cip;
00206 
00207         wxString _openPath;
00208         wxArrayString* _normalFonts;
00209         wxArrayString* _fixedFonts;
00210         wxString _normalFont;
00211         wxString _fixedFont;
00212         int _fontSize;
00213         bool _bookmarkSel;
00214         bool _bookmarksDeleted;
00215         int _sashPos;   
00216         wxFont _font;
00217         wxFileHistory _fh;
00218 
00219 private:
00220         DECLARE_EVENT_TABLE()   
00221 };
00222 
00223 
00224 #endif // __CHMFRAME_H_

Generated on Fri Jan 23 11:06:47 2004 for xCHM by doxygen 1.3.3