Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class 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_CopyLink,
00039         ID_PopupForward,
00040         ID_PopupBack,
00041         ID_PopupFind,
00042 };
00043 
00044 
00046 class CHMFrame;
00047 
00048 
00059 class CHMHtmlWindow : public wxHtmlWindow {
00060 
00061 public:
00069         CHMHtmlWindow(wxWindow *parent, wxTreeCtrl *tc, CHMFrame* frame);
00070 
00072         ~CHMHtmlWindow();
00073 
00075         bool LoadPage(const wxString& location);
00076 
00083         void SetSync(bool value) { _syncTree = value; }
00084         
00090         bool IsCaller() const { return _found; }
00091 
00096         void AbsoluteFollows() { _absolute = true; }
00097 
00098 #ifdef _ENABLE_COPY_AND_FIND
00099 public:
00113         wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word, 
00114                               bool wholeWords, bool caseSensitive);
00115         
00120         wxHtmlCell* FindNext(wxHtmlCell *start, 
00121                              const wxString& word, bool wholeWords,
00122                              bool caseSensitive);
00123 
00125         void ClearSelection();
00126         
00127         // Needs to be public, cause I call it from CHMHtmlFrame.
00129         void OnFind(wxCommandEvent& event);
00130 
00131 protected:      
00133         void OnCopy(wxCommandEvent& event);
00134 #endif
00135 
00136         void OnForward(wxCommandEvent& event);
00137 
00139         void OnBack(wxCommandEvent& event);
00140         
00142         void OnCopyLink(wxCommandEvent& event);
00143 
00144 protected:      
00146         void OnRightClick(wxMouseEvent& event);
00147 #ifdef __WXMAC__
00148 
00149         void HandleOnMouseWheel(wxMouseEvent& event);
00150 #endif 
00151 
00152         wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
00153                                          const wxString& url,
00154                                          wxString *redirect) const;
00155 
00157         void OnLinkClicked(const wxHtmlLinkInfo& link);
00158 
00159 private:
00161         void Sync(wxTreeItemId root, const wxString& page);
00162 
00164         wxString GetPrefix(const wxString& location) const;
00165 
00167         bool FixRelativePath(wxString& location, const wxString& prefix) const;
00168         
00169 private:
00170         wxTreeCtrl* _tcl;
00171         bool _syncTree;
00172         bool _found;
00173         wxMenu *_menu;
00174         wxString _prefix;
00175         bool _absolute;
00176         CHMFrame *_frame;
00177         wxHtmlLinkInfo *_link;
00178 
00179 #ifdef _ENABLE_COPY_AND_FIND
00180         CHMFindDialog* _fdlg;
00181 #endif
00182 
00183 private:
00184         DECLARE_EVENT_TABLE()
00185 };
00186 
00187 
00188 #endif // __CHMHTMLWINDOW_H_
00189 

Generated on Mon Feb 21 11:08:37 2005 for xCHM by  doxygen 1.4.0