Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

chmhtmlwindow.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 __CHMHTMLWINDOW_H_
00023 #define __CHMHTMLWINDOW_H_
00024 
00025 
00026 #include <wx/html/htmlwin.h>
00027 #include <wx/treectrl.h>
00028 #include <wx/menu.h>
00029 
00030 #ifdef _ENABLE_COPY_AND_FIND
00031 #       include <chmfinddialog.h>
00032 #endif
00033 
00034 
00036 enum {
00037         ID_CopySel = 1216,
00038         ID_PopupForward,
00039         ID_PopupBack,
00040         ID_PopupFind,
00041 };
00042 
00043 
00054 class CHMHtmlWindow : public wxHtmlWindow {
00055 
00056 public:
00063         CHMHtmlWindow(wxWindow *parent, wxTreeCtrl *tc);
00064 
00066         ~CHMHtmlWindow();
00067 
00069         bool LoadPage(const wxString& location);
00070 
00077         void SetSync(bool value) { _syncTree = value; }
00078         
00084         bool IsCaller() const { return _found; }
00085 
00086 #ifdef _ENABLE_COPY_AND_FIND
00087 public:
00101         wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word, 
00102                               bool wholeWords, bool caseSensitive);
00103         
00108         wxHtmlCell* FindNext(wxHtmlCell *start, 
00109                              const wxString& word, bool wholeWords,
00110                              bool caseSensitive);
00111 
00113         void ClearSelection();
00114         
00115         // Needs to be public, cause I call it from CHMHtmlFrame.
00117         void OnFind(wxCommandEvent& event);
00118 
00119 protected:      
00121         void OnCopy(wxCommandEvent& event);
00122 #endif
00123 
00124         void OnForward(wxCommandEvent& event);
00125 
00127         void OnBack(wxCommandEvent& event);
00128 
00129 protected:      
00131         void OnRightClick(wxMouseEvent& event);
00132 
00134         virtual 
00135         wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
00136                                          const wxString& url,
00137                                          wxString *redirect) const;
00138 
00139 private:
00141         void Sync(wxTreeItemId root, const wxString& page);
00142 
00144         wxString GetPrefix(const wxString& location) const;
00145 
00147         bool FixRelativePath(wxString& location, const wxString& prefix) const;
00148         
00149 private:
00150         wxTreeCtrl* _tcl;
00151         bool _syncTree;
00152         bool _found;
00153         wxMenu *_menu;
00154         wxString _prefix;
00155 
00156 #ifdef _ENABLE_COPY_AND_FIND
00157         CHMFindDialog* _fdlg;
00158 #endif
00159 
00160 private:
00161         DECLARE_EVENT_TABLE()
00162 };
00163 
00164 
00165 #endif // __CHMHTMLWINDOW_H_
00166 

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