xCHM  1.23
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CHMHtmlWindow Class Reference

Custom HTML widget class. Needed for sychnronization between the topics tree control and the currently displayed page. More...

#include <chmhtmlwindow.h>

Inheritance diagram for CHMHtmlWindow:
wxHtmlWindow

Public Member Functions

 CHMHtmlWindow (wxWindow *parent, wxTreeCtrl *tc, CHMFrame *frame)
 Initializes the widget. More...
 
 ~CHMHtmlWindow ()
 Destructor. Deletes heap objects allocated in the constructor.
 
virtual void OnSetTitle (const wxString &title)
 
bool LoadPage (const wxString &location)
 Override. Looks up the wanted page in the tree and selects it.
 
void SetSync (bool value)
 Dictates the behaviour of LoadPage(). If SetSync() has been called with a true parameter, the tree control will be updated by LoadPage(). Otherwise, it will not be updated. More...
 
bool IsCaller () const
 
wxHtmlCell * FindFirst (wxHtmlCell *parent, const wxString &word, bool wholeWords, bool caseSensitive)
 Finds the first occurence of word in the displayed page. More...
 
wxHtmlCell * FindNext (wxHtmlCell *start, const wxString &word, bool wholeWords, bool caseSensitive)
 Same as FindFirst(), but continues the search from start (start is considered in the search process).
 
void ClearSelection ()
 Clears the current selection.
 
void OnFind (wxCommandEvent &event)
 Called when the user selects 'Find' from the popup menu.
 
void OnCopy (wxCommandEvent &event)
 Called when the user selects 'Copy' from the popup menu.
 

Protected Member Functions

void OnForward (wxCommandEvent &event)
 Called when the user selects 'Forward' from the popup menu.
 
void OnBack (wxCommandEvent &event)
 Called when the user selects 'Back' from the popup menu.
 
void OnCopyLink (wxCommandEvent &event)
 Called when the user selects 'Copy link' from the popup menu.
 
void OnSaveLinkAs (wxCommandEvent &event)
 Called when the user selects 'Save link as' from the popup menu.
 
void OnChar (wxKeyEvent &event)
 Called when the user presses a key.
 
void OnSize (wxSizeEvent &event)
 Called on widget resize.
 
void OnOpenInNewTab (wxCommandEvent &event)
 Called when the user selects 'Save link as' from the popup menu.
 
void OnToggleFullScreen (wxCommandEvent &event)
 Called when the 'Toggle fullscreen' is selected from the popup menu.
 
void OnRightClick (wxMouseEvent &event)
 Called when the user right clicks the HTML window.
 
void OnLinkClicked (const wxHtmlLinkInfo &link)
 Overridden. Called when the user clicks on a link.
 

Private Member Functions

void Sync (wxTreeItemId root, const wxString &page)
 Helper. Recursively looks for the opened page in the tree.
 
wxString GetPrefix (const wxString &location) const
 Helper. Returns the prefix of the currently loaded page.
 

Private Attributes

wxTreeCtrl * _tcl
 
bool _syncTree
 
bool _found
 
wxMenu * _menu
 
CHMFrame_frame
 
wxString _link
 
CHMFindDialog_fdlg
 

Detailed Description

Custom HTML widget class. Needed for sychnronization between the topics tree control and the currently displayed page.

Constructor & Destructor Documentation

CHMHtmlWindow::CHMHtmlWindow ( wxWindow *  parent,
wxTreeCtrl *  tc,
CHMFrame frame 
)

Initializes the widget.

Parameters
parentThe parent widget.
tcPointer to the tree control we want to synchronize with.
frameOuter frame.

Member Function Documentation

wxHtmlCell * CHMHtmlWindow::FindFirst ( wxHtmlCell *  parent,
const wxString &  word,
bool  wholeWords,
bool  caseSensitive 
)

Finds the first occurence of word in the displayed page.

Parameters
parentRoot of the wxHtmlCell tree where the search should begin.
wordThe word we're looking for. If more words separated by spaces are typed in, only the first one is taken into account.
wholeWordsIf true, will search for words that match word exactly.
caseSensitiveIf true, the search will be performed case sensitive.
Returns
A valid cell if the result was found, NULL otherwise.

Referenced by FindNext(), and CHMFindDialog::OnFind().

bool CHMHtmlWindow::IsCaller ( ) const
inline

Returns true if the tree control's EVT_TREE_SEL_CHANGED event happened as a result of the CHMHtmlWindow calling SelectItem() on it.

Referenced by CHMFrame::OnSelectionChanged().

void CHMHtmlWindow::SetSync ( bool  value)
inline

Dictates the behaviour of LoadPage(). If SetSync() has been called with a true parameter, the tree control will be updated by LoadPage(). Otherwise, it will not be updated.

Parameters
valueSynchronize the tree widget on load?

Referenced by CHMFrame::OnSelectionChanged().


The documentation for this class was generated from the following files: