00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
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
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
00202 private:
00204 wxMenuBar *CreateMenu();
00205
00207 bool InitToolBar(wxToolBar *toolbar);
00208
00210 wxPanel* CreateContentsPanel();
00211
00213 void LoadBookmarks();
00214
00216 void SaveBookmarks();
00217
00219 void SaveExitInfo();
00220
00221 private:
00222 CHMHtmlWindow* _html;
00223 wxTreeCtrl* _tcl;
00224 wxSplitterWindow* _sw;
00225 wxMenu* _menuFile;
00226 wxToolBar* _tb;
00227 wxHtmlEasyPrinting* _ep;
00228 wxNotebook* _nb;
00229 wxComboBox* _cb;
00230 CHMSearchPanel* _csp;
00231 CHMIndexPanel* _cip;
00232
00233 wxString _openPath;
00234 wxArrayString* _normalFonts;
00235 wxArrayString* _fixedFonts;
00236 wxString _normalFont;
00237 wxString _fixedFont;
00238 int _fontSize;
00239 bool _bookmarkSel;
00240 bool _bookmarksDeleted;
00241 int _sashPos;
00242 wxFont _font;
00243 wxFileHistory _fh;
00244 wxString _fullAppPath;
00245
00246 private:
00247 DECLARE_EVENT_TABLE()
00248 };
00249
00250
00251 #endif // __CHMFRAME_H_
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265