home *** CD-ROM | disk | FTP | other *** search
/ Windows Graphics Programming / Feng_Yuan_Win32_GDI_DirectX.iso / Samples / include / listview.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-11  |  2.3 KB  |  75 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   : listview.h                                                             //
  12. //  Description: List view wrapper                                                   //
  13. //  Version    : 1.00.000, May 31, 2000                                              //
  14. //-----------------------------------------------------------------------------------//
  15.  
  16. #include <commctrl.h>
  17.  
  18. // List View
  19. class KListView
  20. {
  21.     HWND       m_hWnd;
  22.     
  23.     HIMAGELIST hImage_Normal, hImage_Small, hImage_State;
  24.     int        nRow;
  25.  
  26. public:
  27.  
  28.     HWND GetHWND(void) const
  29.     {
  30.         return m_hWnd;
  31.     }
  32.  
  33.     KListView()
  34.     {
  35.         m_hWnd        = NULL;
  36.     
  37.         hImage_Normal = NULL;
  38.         hImage_Small  = NULL;
  39.         hImage_State  = NULL;
  40.  
  41.         nRow          = -1;
  42.     }
  43.  
  44.     void DeleteAll(void)
  45.     {
  46.         nRow = -1;
  47.  
  48.         ListView_DeleteAllItems(m_hWnd);
  49.     }
  50.  
  51.     void FromDlgItem(HWND hWnd, int id);
  52.  
  53.     void AddIcon(int iImageList, HINSTANCE hInst, int iIcon);
  54.  
  55.     void AddColumn(int col, int width, const TCHAR *title, BOOL left=TRUE);
  56.         
  57.     void AddItem(int col, const TCHAR *text, int iImage=-1);
  58.     void AddItem(int col, int value, int iImage=-1);
  59.  
  60.     int GetNextItem(int from, int option)
  61.     {
  62.         return ListView_GetNextItem(m_hWnd, from, option);
  63.     }
  64.     
  65.     void GetItemText(int item, int subitem, TCHAR *rslt, int maxlen)
  66.     {
  67.         ListView_GetItemText(m_hWnd, item, subitem, rslt, maxlen);
  68.     }
  69.  
  70.     void SetItem(int row, int col, int value);
  71.  
  72.     HWND Create(HWND hParent, int id, int left, int top, int width, int height, HINSTANCE hInst);
  73. };
  74.  
  75.