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

List of all members.

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)
 Brings the frame into existence.
 ~CHMFrame ()
 Cleans up.
bool LoadCHM (const wxString &archive)
 Attempts to load a .chm file and display it's home page.
bool LoadContextID (const int contextID)
 Attempts to load a context-ID from within the current chm file.
void UpdateCHMInfo ()
 Fills the index and the contents tree.
void AddHtmlView (const wxString &path, const wxString &link)
 Add html view.

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


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 
)

Brings the frame into existence.

Parameters:
title The text that shows up on the titlebar.
booksDir Where 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.
pos The upper left corner of the frame.
size The size of the frame.
normalFont Name of the font face to use for normal text.
fixedFont Name of the font face to use for fixed text.
fontSize The font size.
sashPosition Distance from the left of the frame to
fullAppPath The absolute path to the executable of the process the end of the contents / search panel.

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:
archive The .chm file name on disk.
Returns:
TRUE if the operation was successful.

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

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

bool CHMFrame::LoadContextID ( const int  contextID  ) 

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

Parameters:
contextID the 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:

Generated on Wed Oct 28 17:35:58 2009 for xCHM by  doxygen 1.5.8