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

The frame, owner of the wxHtmlWindow, contents tree control and all the other nifty stuff. More...

#include <chmframe.h>

Inheritance diagram for CHMFrame:
wxFrame

Public Member Functions

 CHMFrame (const wxString &title, const wxString &booksDir, const wxPoint &pos, const wxSize &size, const wxString &normalFont=wxEmptyString, const wxString &fixedFont=wxEmptyString, const int fontSize=CHM_DEFAULT_FONT_SIZE, const int sashPosition=CONTENTS_MARGIN, const wxString &fullAppPath=wxEmptyString, bool loadTopics=true, bool loadIndex=true)
 Brings the frame into existence. More...
 
 ~CHMFrame ()
 Cleans up.
 
bool LoadCHM (const wxString &archive)
 Attempts to load a .chm file and display it's home page. More...
 
bool LoadContextID (const int contextID)
 Attempts to load a context-ID from within the current chm file. More...
 
void UpdateCHMInfo ()
 Fills the index and the contents tree.
 
void AddHtmlView (const wxString &path, const wxString &link)
 Add html view.
 
void ToggleFullScreen (bool onlyIfFullScreenOn=false)
 Toggles fullscreen mode.
 

Protected Member Functions

void OnQuit (wxCommandEvent &event)
 Called when the user closes the window.
 
void OnAbout (wxCommandEvent &event)
 Called when the user clicks on About.
 
void OnOpen (wxCommandEvent &event)
 Called when the user wants to open a file.
 
void OnChangeFonts (wxCommandEvent &event)
 Called when the user wants to change the fonts.
 
void OnHome (wxCommandEvent &event)
 Called when the user wants to see the default page.
 
void OnHistoryForward (wxCommandEvent &event)
 Called when the user wants to go forward in the history.
 
void OnHistoryBack (wxCommandEvent &event)
 Called when the user wants to go back in the history.
 
void OnShowContents (wxCommandEvent &event)
 Called when the user wants to either disable or enable the contents tree panel on the left.
 
void OnPrint (wxCommandEvent &event)
 Called when the user wants to print the displayed page.
 
void OnHistFile (wxCommandEvent &event)
 Called when the user selects a file from the file history.
 
void OnFind (wxCommandEvent &event)
 Called when the user types Ctrl-F.
 
void OnCopySelection (wxCommandEvent &event)
 Called when the user types Ctrl-F.
 
void OnFullScreen (wxCommandEvent &event)
 Called when fullscreen mode is being toggled.
 
void OnAddBookmark (wxCommandEvent &event)
 Called when the user clicks on the Add button.
 
void OnRemoveBookmark (wxCommandEvent &event)
 Called when the user clicks on the Remove button.
 
void OnBookmarkSel (wxCommandEvent &event)
 Called when the user chooses a bookmark from the wxChoice control.
 
void OnSelectionChanged (wxTreeEvent &event)
 Called when an item in the contents tree is clicked.
 
void OnCloseWindow (wxCloseEvent &event)
 Cleanup code. This saves the window position and last open dir.
 
void OnChar (wxKeyEvent &event)
 Called when the user presses a key.
 
void OnCloseTab (wxCommandEvent &event)
 Called when the user types Ctrl-F4.
 
void OnNewTab (wxCommandEvent &event)
 Called when the user types Ctrl-N.
 

Private Member Functions

wxMenuBar * CreateMenu ()
 Helper. Creates the menu.
 
bool InitToolBar (wxToolBar *toolbar)
 Helper. Initializes the frame toolbar.
 
wxPanelCreateContentsPanel ()
 Helper. Creates the contents panel.
 
void LoadBookmarks ()
 Helper. Loads the bookmarks for the currently opened CHM file.
 
void SaveBookmarks ()
 Helper. Saves the bookmarks for the currently opened CHM file.
 
void SaveExitInfo ()
 Helper. Saves exit information (size, history, etc.)
 

Private Attributes

CHMHtmlNotebook_nbhtml
 
wxTreeCtrl * _tcl
 
wxSplitterWindow * _sw
 
wxMenu * _menuFile
 
wxToolBar * _tb
 
wxHtmlEasyPrinting * _ep
 
wxNotebook_nb
 
wxComboBox * _cb
 
CHMSearchPanel_csp
 
CHMIndexPanel_cip
 
wxString _openPath
 
wxArrayString * _normalFonts
 
wxArrayString * _fixedFonts
 
wxString _normalFont
 
wxString _fixedFont
 
int _fontSize
 
bool _bookmarkSel
 
bool _bookmarksDeleted
 
int _sashPos
 
wxFont _font
 
wxFileHistory _fh
 
wxString _fullAppPath
 
bool _loadTopics
 
bool _loadIndex
 
bool _fullScreen
 

Detailed Description

The frame, owner of the wxHtmlWindow, contents tree control and all the other nifty stuff.

Constructor & Destructor Documentation

CHMFrame::CHMFrame ( const wxString &  title,
const wxString &  booksDir,
const wxPoint &  pos,
const wxSize &  size,
const wxString &  normalFont = wxEmptyString,
const wxString &  fixedFont = wxEmptyString,
const int  fontSize = CHM_DEFAULT_FONT_SIZE,
const int  sashPosition = CONTENTS_MARGIN,
const wxString &  fullAppPath = wxEmptyString,
bool  loadTopics = true,
bool  loadIndex = true 
)

Brings the frame into existence.

Parameters
titleThe text that shows up on the titlebar.
booksDirWhere to go when you click Open.. on the toolbar. This is used to remember the last directory where a book was sucessfully opened. For the current working directory just pass the empty string.
posThe upper left corner of the frame.
sizeThe size of the frame.
normalFontName of the font face to use for normal text.
fixedFontName of the font face to use for fixed text.
fontSizeThe font size.
sashPositionDistance from the left of the frame to
fullAppPathThe absolute path to the executable of the process the end of the contents / search panel.
loadTopicsIf set to false, don't try to load the topics tree.
loadIndexIf set to false, don't try to load the index list.

References CreateContentsPanel(), CreateMenu(), CHMHtmlNotebook::GetCurrentPage(), InitToolBar(), and CHMHtmlNotebook::SetChildrenFonts().

Member Function Documentation

bool CHMFrame::LoadCHM ( const wxString &  archive)

Attempts to load a .chm file and display it's home page.

Parameters
archiveThe .chm file name on disk.
Returns
TRUE if the operation was successful.

References CHMHtmlNotebook::CloseAllPagesExceptFirst(), CHMInputStream::GetCache(), LoadBookmarks(), CHMHtmlNotebook::LoadPageInCurrentView(), CHMIndexPanel::Reset(), CHMSearchPanel::Reset(), SaveBookmarks(), and UpdateCHMInfo().

Referenced by OnHistFile(), CHMApp::OnInit(), and OnOpen().

bool CHMFrame::LoadContextID ( const int  contextID)

Attempts to load a context-ID from within the current chm file.

Parameters
contextIDthe context-ID to load.
Returns
TRUE if the operation was successful.

References CHMFile::ArchiveName(), CHMInputStream::GetCache(), CHMFile::GetPageByCID(), CHMFile::IsValidCID(), and CHMHtmlNotebook::LoadPageInCurrentView().

Referenced by CHMApp::OnInit().


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