00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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_PopupForward,
00037 ID_PopupBack,
00038 ID_PopupFind,
00039 };
00040
00041
00043 class CHMFrame;
00044
00045
00056 class CHMHtmlWindow : public wxHtmlWindow {
00057
00058 public:
00066 CHMHtmlWindow(wxWindow *parent, wxTreeCtrl *tc, CHMFrame* frame);
00067
00069 ~CHMHtmlWindow();
00070
00072 bool LoadPage(const wxString& location);
00073
00080 void SetSync(bool value) { _syncTree = value; }
00081
00087 bool IsCaller() const { return _found; }
00088
00093 void AbsoluteFollows() { _absolute = true; }
00094
00095 public:
00109 wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word,
00110 bool wholeWords, bool caseSensitive);
00111
00116 wxHtmlCell* FindNext(wxHtmlCell *start,
00117 const wxString& word, bool wholeWords,
00118 bool caseSensitive);
00119
00121 void ClearSelection();
00122
00123
00125 void OnFind(wxCommandEvent& event);
00126
00128 void OnCopy(wxCommandEvent& event);
00129
00130 protected:
00132 void OnForward(wxCommandEvent& event);
00133
00135 void OnBack(wxCommandEvent& event);
00136
00138 void OnCopyLink(wxCommandEvent& event);
00139
00141 void OnChar(wxKeyEvent &event);
00142
00143 protected:
00145 void OnRightClick(wxMouseEvent& event);
00147 wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
00148 const wxString& url,
00149 wxString *redirect) const;
00150
00152 void OnLinkClicked(const wxHtmlLinkInfo& link);
00153
00154 private:
00156 void Sync(wxTreeItemId root, const wxString& page);
00157
00159 wxString GetPrefix(const wxString& location) const;
00160
00162 bool FixPath(wxString& location, const wxString& prefix) const;
00163
00164 private:
00165 wxTreeCtrl* _tcl;
00166 bool _syncTree;
00167 bool _found;
00168 wxMenu *_menu;
00169 wxString _prefix;
00170 bool _absolute;
00171 CHMFrame *_frame;
00172 wxString _link;
00173 CHMFindDialog* _fdlg;
00174
00175 private:
00176 DECLARE_EVENT_TABLE()
00177 };
00178
00179
00180 #endif // __CHMHTMLWINDOW_H_
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195