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 <chmsearchpanel.h>
00034 #include <chmhtmlwindow.h>
00035 
00036 
00038 #define CHM_DEFAULT_FONT_SIZE 14
00039 
00040 
00041 #ifdef HAVE_CONFIG_H
00042 #       include <config.h>
00043 #else
00044         // this should never happen
00045 #       define VERSION "unknown"
00046 #endif
00047 
00048 
00050 enum
00051 {
00052         ID_Quit = 1,
00053         ID_About,
00054         ID_Open,
00055         ID_Fonts,
00056         ID_Print,
00057         ID_Home,
00058         ID_Forward,
00059         ID_Back,
00060         ID_Contents,
00061         ID_Bookmarks,
00062         ID_Add,
00063         ID_Remove,
00064         ID_FindInPage,
00065         ID_TreeCtrl = 1000,
00066 };
00067 
00068 
00079 class CHMFrame : public wxFrame {
00080 public:
00081 
00095         CHMFrame(const wxString& title, const wxString& booksDir,
00096                  const wxPoint& pos, const wxSize& size,
00097                  const wxString& normalFont = wxEmptyString,
00098                  const wxString& fixedFont = wxEmptyString,
00099                  const int fontSize = CHM_DEFAULT_FONT_SIZE);
00100 
00102         ~CHMFrame();
00103 
00110         void LoadCHM(const wxString& archive);
00111 
00112 protected:
00114         void OnQuit(wxCommandEvent& event);
00115 
00117         void OnAbout(wxCommandEvent& event);
00118 
00120         void OnOpen(wxCommandEvent& event);
00121 
00123         void OnChangeFonts(wxCommandEvent& event);
00124 
00126         void OnHome(wxCommandEvent& event);
00127 
00129         void OnHistoryForward(wxCommandEvent& event);
00130 
00132         void OnHistoryBack(wxCommandEvent& event);      
00133 
00138         void OnShowContents(wxCommandEvent& event);     
00139 
00141         void OnPrint(wxCommandEvent& event);
00142 
00143 #ifdef _ENABLE_COPY_AND_FIND
00144 
00145         void OnFind(wxCommandEvent& event);
00146 #endif
00147 
00149         void OnAddBookmark(wxCommandEvent& event);
00150 
00152         void OnRemoveBookmark(wxCommandEvent& event);
00153 
00155         void OnBookmarkSel(wxCommandEvent &event);
00156 
00158         void OnSelectionChanged(wxTreeEvent& event);
00159 
00161         void OnCloseWindow(wxCloseEvent& event);
00162         
00163 private:
00165         wxMenuBar *CreateMenu();
00166 
00168         bool InitToolBar(wxToolBar *toolbar);
00169 
00171         wxPanel* CreateContentsPanel();
00172 
00174         void LoadBookmarks();
00175 
00177         void SaveBookmarks();
00178 
00180         wxFontEncoding GetFontEncFromCharSet(int cs);
00181 
00182 private:
00183         CHMHtmlWindow* _html;
00184         wxTreeCtrl* _tcl;
00185         wxSplitterWindow* _sw;
00186         wxMenu* _menuFile;
00187         wxToolBar* _tb;
00188         wxHtmlEasyPrinting* _ep;
00189         wxNotebook* _nb;
00190         wxComboBox* _cb;
00191         CHMSearchPanel* _csp;
00192 
00193         wxString _openPath;
00194         wxArrayString* _normalFonts;
00195         wxArrayString* _fixedFonts;
00196         wxString _normalFont;
00197         wxString _fixedFont;
00198         int _fontSize;
00199         bool _bookmarkSel;
00200         bool _bookmarksDeleted;
00201         int _sashPos;   
00202         wxFont _font;
00203 
00204 private:
00205         DECLARE_EVENT_TABLE()   
00206 };
00207 
00208 
00209 #endif // __CHMFRAME_H_

Generated on Thu Oct 2 11:14:59 2003 for xCHM by doxygen 1.3.3