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 #include <chmfinddialog.h>
00030 
00031 
00033 enum {
00034         ID_CopySel = 1216,
00035         ID_CopyLink,
00036         ID_SaveLinkAs,
00037         ID_PopupForward,
00038         ID_PopupBack,
00039         ID_PopupFind,
00040 };
00041 
00042 
00044 class CHMFrame;
00045 
00046 
00057 class CHMHtmlWindow : public wxHtmlWindow {
00058 
00059 public:
00067         CHMHtmlWindow(wxWindow *parent, wxTreeCtrl *tc, CHMFrame* frame);
00068 
00070         ~CHMHtmlWindow();
00071 
00073         bool LoadPage(const wxString& location);
00074 
00081         void SetSync(bool value) { _syncTree = value; }
00082         
00088         bool IsCaller() const { return _found; }
00089 
00090 public:
00104         wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word, 
00105                               bool wholeWords, bool caseSensitive);
00106         
00111         wxHtmlCell* FindNext(wxHtmlCell *start, 
00112                              const wxString& word, bool wholeWords,
00113                              bool caseSensitive);
00114 
00116         void ClearSelection();
00117         
00118         // Needs to be public, cause I call it from CHMHtmlFrame.
00120         void OnFind(wxCommandEvent& event);
00121 
00123         void OnCopy(wxCommandEvent& event);
00124 
00125 protected:      
00127         void OnForward(wxCommandEvent& event);
00128 
00130         void OnBack(wxCommandEvent& event);
00131         
00133         void OnCopyLink(wxCommandEvent& event);
00134 
00136         void OnSaveLinkAs(wxCommandEvent& event);
00137 
00139         void OnChar(wxKeyEvent &event);
00140 
00142         void OnSize(wxSizeEvent& event);
00143 
00144 protected:      
00146         void OnRightClick(wxMouseEvent& event);
00147 
00149         void OnLinkClicked(const wxHtmlLinkInfo& link);
00150 
00151 private:
00153         void Sync(wxTreeItemId root, const wxString& page);
00154 
00156         wxString GetPrefix(const wxString& location) const;
00157         
00158 private:
00159         wxTreeCtrl* _tcl;
00160         bool _syncTree;
00161         bool _found;
00162         wxMenu *_menu;
00163         CHMFrame *_frame;
00164         wxString _link;
00165         CHMFindDialog* _fdlg;
00166 
00167 private:
00168         DECLARE_EVENT_TABLE()
00169 };
00170 
00171 
00172 #endif // __CHMHTMLWINDOW_H_
00173 
00174 
00175 /*
00176   Local Variables:
00177   mode: c++
00178   c-basic-offset: 8
00179   tab-width: 8
00180   c-indent-comments-syntactically-p: t
00181   c-tab-always-indent: t
00182   indent-tabs-mode: t
00183   End:
00184 */
00185 
00186 // vim:shiftwidth=8:autoindent:tabstop=8:noexpandtab:softtabstop=8
00187 

Generated on Tue Apr 24 20:17:36 2007 for xCHM by  doxygen 1.4.7