00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __CHMHTMLWINDOW_H_
00024 #define __CHMHTMLWINDOW_H_
00025
00026
00027 #include <wx/html/htmlwin.h>
00028 #include <wx/treectrl.h>
00029 #include <wx/menu.h>
00030 #include <wx/notebook.h>
00031 #include <chmfinddialog.h>
00032
00033
00034
00036 enum {
00037 ID_CopySel = 1216,
00038 ID_CopyLink,
00039 ID_SaveLinkAs,
00040 ID_PopupForward,
00041 ID_PopupBack,
00042 ID_PopupFind,
00043 ID_OpenInNewTab,
00044 };
00045
00046
00048 class CHMFrame;
00049
00050
00061 class CHMHtmlWindow : public wxHtmlWindow {
00062
00063 public:
00071 CHMHtmlWindow(wxWindow *parent, wxTreeCtrl *tc, CHMFrame* frame);
00072
00074 ~CHMHtmlWindow();
00075 virtual void OnSetTitle(const wxString& title);
00077 bool LoadPage(const wxString& location);
00078
00085 void SetSync(bool value) { _syncTree = value; }
00086
00092 bool IsCaller() const { return _found; }
00093
00094 public:
00108 wxHtmlCell* FindFirst(wxHtmlCell* parent, const wxString& word,
00109 bool wholeWords, bool caseSensitive);
00110
00115 wxHtmlCell* FindNext(wxHtmlCell *start,
00116 const wxString& word, bool wholeWords,
00117 bool caseSensitive);
00118
00120 void ClearSelection();
00121
00122
00124 void OnFind(wxCommandEvent& event);
00125
00127 void OnCopy(wxCommandEvent& event);
00128
00129 protected:
00131 void OnForward(wxCommandEvent& event);
00132
00134 void OnBack(wxCommandEvent& event);
00135
00137 void OnCopyLink(wxCommandEvent& event);
00138
00140 void OnSaveLinkAs(wxCommandEvent& event);
00141
00143 void OnChar(wxKeyEvent &event);
00144
00146 void OnSize(wxSizeEvent& event);
00147
00149 void OnOpenInNewTab(wxCommandEvent& event);
00150 protected:
00152 void OnRightClick(wxMouseEvent& event);
00153
00155 void OnLinkClicked(const wxHtmlLinkInfo& link);
00156
00157 private:
00159 void Sync(wxTreeItemId root, const wxString& page);
00160
00162 wxString GetPrefix(const wxString& location) const;
00163
00164 private:
00165 wxTreeCtrl* _tcl;
00166 bool _syncTree;
00167 bool _found;
00168 wxMenu *_menu;
00169 CHMFrame *_frame;
00170 wxString _link;
00171 CHMFindDialog* _fdlg;
00172
00173 private:
00174 DECLARE_EVENT_TABLE()
00175 };
00176
00177
00178
00179 #endif // __CHMHTMLWINDOW_H_
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194