00001 /****************************************************************************** 00002 * ftvhelp.h,v 1.0 2000/09/06 16:09:00 00003 * 00004 * Kenney Wong <kwong@ea.com> 00005 * 00006 * Folder Tree View for offline help on browsers that do not support HTML Help. 00007 * Uses the FTV structure from: 00008 * http://www.geocities.com/Paris/LeftBank/2178/ftexample.html 00009 */ 00010 00011 #ifndef FTVHELP_H 00012 #define FTVHELP_H 00013 00014 #include "qtbc.h" 00015 #include <qtextstream.h> 00016 #include <qlist.h> 00017 #include "index.h" 00018 00019 class QFile; 00020 struct FTVNode; 00021 00022 struct FTVImageInfo 00023 { 00024 const char *alt; 00025 const char *name; 00026 const unsigned char *data; 00027 unsigned int len; 00028 unsigned short width, height; 00029 }; 00030 00031 extern FTVImageInfo image_info[]; 00032 00033 #define FTVIMG_blank 0 00034 #define FTVIMG_doc 1 00035 #define FTVIMG_folderclosed 2 00036 #define FTVIMG_folderopen 3 00037 #define FTVIMG_lastnode 4 00038 #define FTVIMG_link 5 00039 #define FTVIMG_mlastnode 6 00040 #define FTVIMG_mnode 7 00041 #define FTVIMG_node 8 00042 #define FTVIMG_plastnode 9 00043 #define FTVIMG_pnode 10 00044 #define FTVIMG_vertline 11 00045 00046 #define FTV_S(name) #name 00047 #define FTV_ICON_FILE(name) "ftv2" FTV_S(name) ".png" 00048 #define FTVIMG_INDEX(name) FTVIMG_ ## name 00049 #define FTV_INFO(name) ( image_info[FTVIMG_INDEX(name)] ) 00050 #define FTV_IMGATTRIBS(name) \ 00051 "src=\"" FTV_ICON_FILE(name) "\" " \ 00052 "alt=\"" << FTV_INFO(name).alt << "\" " \ 00053 "width=" << FTV_INFO(name).width << " " \ 00054 "height=" << FTV_INFO(name).height << " " 00055 00058 class FTVHelp : public IndexIntf 00059 { 00060 public: 00061 FTVHelp(); 00062 //static FTVHelp *getInstance(); 00063 void initialize(); 00064 void finalize(); 00065 void incContentsDepth(); 00066 void decContentsDepth(); 00067 void addContentsItem(bool isDir, 00068 const char *name, 00069 const char *ref, 00070 const char *file, 00071 const char *anchor); 00072 void addIndexItem(const char *, const char *, 00073 const char *, const char *, 00074 const char *, const MemberDef *) {} 00075 void addIndexFile(const char *) {} 00076 00077 private: 00078 void generateTreeViewImages(); 00079 void generateTreeView(); 00080 void generateTree(QTextStream &t,const QList<FTVNode> &nl,int level); 00081 void generateIndent(QTextStream &t,FTVNode *n,int level); 00082 void generateLink(QTextStream &t,FTVNode *n); 00083 ~FTVHelp(); 00084 static FTVHelp *m_theInstance; 00085 QList<FTVNode> *m_indentNodes; 00086 int m_indent; 00087 }; 00088 00089 00090 #endif /* FTVHELP_H */ 00091