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 
00090         void AbsoluteFollows() { _absolute = true; }
00091 
00092 #ifdef _ENABLE_COPY_AND_FIND
00093 public:
00107         wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word, 
00108                               bool wholeWords, bool caseSensitive);
00109         
00114         wxHtmlCell* FindNext(wxHtmlCell *start, 
00115                              const wxString& word, bool wholeWords,
00116                              bool caseSensitive);
00117 
00119         void ClearSelection();
00120         
00121         // Needs to be public, cause I call it from CHMHtmlFrame.
00123         void OnFind(wxCommandEvent& event);
00124 
00125 protected:      
00127         void OnCopy(wxCommandEvent& event);
00128 #endif
00129 
00130         void OnForward(wxCommandEvent& event);
00131 
00133         void OnBack(wxCommandEvent& event);
00134 
00135 protected:      
00137         void OnRightClick(wxMouseEvent& event);
00138 #ifdef __WXMAC__
00139 
00140         void HandleOnMouseWheel(wxMouseEvent& event);
00141 #endif 
00142 
00143         wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
00144                                          const wxString& url,
00145                                          wxString *redirect) const;
00146 
00147 private:
00149         void Sync(wxTreeItemId root, const wxString& page);
00150 
00152         wxString GetPrefix(const wxString& location) const;
00153 
00155         bool FixRelativePath(wxString& location, const wxString& prefix) const;
00156         
00157 private:
00158         wxTreeCtrl* _tcl;
00159         bool _syncTree;
00160         bool _found;
00161         wxMenu *_menu;
00162         wxString _prefix;
00163         bool _absolute;
00164 
00165 #ifdef _ENABLE_COPY_AND_FIND
00166         CHMFindDialog* _fdlg;
00167 #endif
00168 
00169 private:
00170         DECLARE_EVENT_TABLE()
00171 };
00172 
00173 
00174 #endif // __CHMHTMLWINDOW_H_
00175 

Generated on Wed Jul 7 12:46:01 2004 for xCHM by doxygen 1.3.3