home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / treeview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.5 KB  |  78 lines

  1. #pragma once
  2.  
  3. //-----------------------------------------------------------------------------------//
  4. //              Windows Graphics Programming: Win32 GDI and DirectDraw               //
  5. //                             ISBN  0-13-086985-6                                   //
  6. //                                                                                   //
  7. //  Written            by  Yuan, Feng                             www.fengyuan.com   //
  8. //  Copyright (c) 2000 by  Hewlett-Packard Company                www.hp.com         //
  9. //  Published          by  Prentice Hall PTR, Prentice-Hall, Inc. www.phptr.com      //
  10. //                                                                                   //
  11. //  FileName   : treeview.h                                                             //
  12. //  Description: Tree view wrapper, with data decoding                               //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. // Use a single character to desribe the format of a structure, which can be inserted 
  17. // into a TreeView
  18.  
  19. // { <tag> <format> }
  20. // <tag>::= g |   // dword, dword, dword, dword
  21. //          8 |   // dword, dword
  22. //          4 |   // dword
  23. //          2 |   // unsigned short
  24. //          1 |   // unsigned char
  25. //          &     // address of input data
  26.  
  27. // Example:
  28. //
  29. //const TCHAR Format_LOGFONT [] =
  30. //    "4lfHeight: %d\0"
  31. //    "4lfWidth:  %d\0"
  32. //    "4lfEscapement: %d\0"
  33. //    "4lfOrientation: %d\0"
  34. //    "4lfWeight: %d\0"
  35. //  "1lfItalic: %d\0"
  36. //    "1lfUnderline: %d\0"
  37. //    "1lfStrikeOut: %d\0"
  38. //  "1lfCharSet: %d\0"
  39. //    "1lfOutPrecision: %d\0"
  40. //    "1lfClipPrecision: %d\0"
  41. //    "1lfQuality: %d\0"
  42. //    "1lfPitchAndFamily: 0x%x\0"
  43. //    "&lfFaceName: %s\0";
  44.  
  45. typedef struct
  46. {
  47.     unsigned      mask;
  48.     const TCHAR * desp;
  49. } term;
  50.  
  51.  
  52. class KTreeView
  53. {
  54. public:
  55.     HWND        m_hWnd;
  56.  
  57.     void Create(HWND hParent, int id, int x, int y, int width, int height, HINSTANCE hInst);
  58.  
  59.     void DeleteAllItems(void)
  60.     {
  61.         TreeView_DeleteAllItems(m_hWnd);
  62.     }        
  63.  
  64.     HTREEITEM InsertItem(HTREEITEM hLast, HTREEITEM hParent, const TCHAR * mess);
  65.  
  66.     HTREEITEM InsertItem(const TCHAR * mess)
  67.     {
  68.         return InsertItem(TVI_LAST, TVI_ROOT, mess);
  69.     }
  70.  
  71.     HTREEITEM InsertTree(HTREEITEM hLast, HTREEITEM hParent, 
  72.                    const TCHAR * rootname, const TCHAR * pField, 
  73.                    const void * data);
  74.  
  75.     void AddFlags(HTREEITEM hRoot, DWORD flags, const term * Dict);
  76. };
  77.  
  78.