Logo Search packages:      
Sourcecode: xchm version File versions

bool CHMFile::GetTopicsTree ( wxTreeCtrl *  toBuild  ) 

Attempts to fill a wxTreeCtrl by parsing the topics file.

Parameters:
toBuild Pointer to the tree to be filled. If the topics file is not available, the tree is unmodified. The tree must be empty before passing it to this function.
Returns:
true if it's possible to build the tree, false otherwise.

Definition at line 142 of file chmfile.cpp.

References GetFileAsString(), and ResolveObject().

Referenced by CHMFrame::UpdateCHMInfo().

{
      chmUnitInfo ui;

      if(!toBuild)
            return false;

      if(_topicsFile.IsEmpty() || !ResolveObject(_topicsFile, &ui))
            return false;

      wxString src;
      src.Alloc(ui.length);
      GetFileAsString(src, &ui);

      if(src.IsEmpty())
            return false;

      ContentParser parser;
      parser.AddTagHandler(new ContentTagHandler(_enc,
#ifdef wxUSE_UNICODE
                                       !_font.IsEmpty(),
#else
                                       false,
#endif                                    
                                       toBuild));     
      parser.Parse(src);

      return true;
}


Generated by  Doxygen 1.6.0   Back to index