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
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
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