home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / ole / oleview / iviewers / tlblist.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.8 KB  |  129 lines

  1. // tlblist.cpp : implementation file
  2. //
  3.  
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992-1998 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and related
  10. // electronic documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #include "stdafx.h"
  15. #include "iview.h"
  16. #include "util.h"
  17. #include "iviewers.h"
  18. #include "iviewer.h"
  19. #include "typelib.h"
  20. #include "tlblist.h"
  21.  
  22. #ifdef _DEBUG
  23. #undef THIS_FILE
  24. static char BASED_CODE THIS_FILE[] = __FILE__;
  25. #endif
  26.  
  27. #define ID_LISTVIEW 43
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CTypeLibListView
  30.  
  31. IMPLEMENT_DYNCREATE(CTypeLibListView, CView)
  32.  
  33. CTypeLibListView::CTypeLibListView()
  34. {
  35. }
  36.  
  37. CTypeLibListView::~CTypeLibListView()
  38. {
  39. }
  40.  
  41.  
  42. BEGIN_MESSAGE_MAP(CTypeLibListView, CView)
  43.     //{{AFX_MSG_MAP(CTypeLibListView)
  44.     ON_WM_CREATE()
  45.     ON_WM_DESTROY()
  46.     ON_WM_SIZE()
  47.     //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49.  
  50.  
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CTypeLibListView diagnostics
  54.  
  55. #ifdef _DEBUG
  56. void CTypeLibListView::AssertValid() const
  57. {
  58.     CView::AssertValid();
  59. }
  60.  
  61. void CTypeLibListView::Dump(CDumpContext& dc) const
  62. {
  63.     CView::Dump(dc);
  64. }
  65. #endif //_DEBUG
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CTypeLibListView message handlers
  69.  
  70. int CTypeLibListView::OnCreate(LPCREATESTRUCT lpCreateStruct)
  71. {
  72.     if (CView::OnCreate(lpCreateStruct) == -1)
  73.         return -1;
  74.  
  75.     RECT rect ;
  76.     rect.top = lpCreateStruct->y ;
  77.     rect.left = lpCreateStruct->x ;
  78.     rect.bottom = lpCreateStruct->cy ;
  79.     rect.right = lpCreateStruct->cx ;
  80.  
  81.     if (!m_list.Create( WS_CHILD | WS_VISIBLE |
  82.                                 WS_BORDER |
  83.                                 LVS_REPORT |
  84. //                                LVS_BUTTON |
  85.                                 LVS_SINGLESEL |
  86.                                 LVS_NOSORTHEADER,
  87.                                 rect, this, ID_LISTVIEW ))
  88.     {
  89.         TRACE( _T("List control failed to create!") ) ;
  90.         return -1 ;
  91.     }
  92.  
  93.     return 0;
  94. }
  95.  
  96. void CTypeLibListView::OnDestroy()
  97. {
  98.     CView::OnDestroy();
  99.     m_list.DeleteAllItems() ;
  100. }
  101.  
  102. void CTypeLibListView::OnDraw(CDC* pDC)
  103. {
  104.     // TODO: Add your specialized code here and/or call the base class
  105.  
  106. }
  107.  
  108. void CTypeLibListView::OnSize(UINT nType, int cx, int cy)
  109. {
  110.     CView::OnSize(nType, cx, cy);
  111.  
  112.     m_list.SetWindowPos( NULL, -1, -1, cx+2, cy+2, SWP_NOZORDER ) ;
  113.  
  114. }
  115.  
  116. void CTypeLibListView::OnInitialUpdate()
  117. {
  118.     TRACE(_T("OnInitialUpdate\n")) ;
  119.     CTypeLibWnd* pFrame = (CTypeLibWnd*)GetParent()->GetParent() ;
  120.     ASSERT(pFrame->IsKindOf(RUNTIME_CLASS(CTypeLibWnd)));
  121.  
  122.  
  123.     CView::OnInitialUpdate();
  124. }
  125.  
  126. void CTypeLibListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
  127. {
  128. }
  129.