wdlview.cpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // WDLView.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "wdump.h"
  22. #include "WDLView.h"
  23. #include "WDumpDoc.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CWDumpListView
  31. IMPLEMENT_DYNCREATE(CWDumpListView, CListView)
  32. CWDumpListView::CWDumpListView()
  33. {
  34. }
  35. CWDumpListView::~CWDumpListView()
  36. {
  37. }
  38. BEGIN_MESSAGE_MAP(CWDumpListView, CListView)
  39. //{{AFX_MSG_MAP(CWDumpListView)
  40. // NOTE - the ClassWizard will add and remove mapping macros here.
  41. //}}AFX_MSG_MAP
  42. END_MESSAGE_MAP()
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CWDumpListView drawing
  45. void CWDumpListView::OnDraw(CDC* pDC)
  46. {
  47. CDocument* pDoc = GetDocument();
  48. // TODO: add draw code here
  49. }
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CWDumpListView diagnostics
  52. #ifdef _DEBUG
  53. void CWDumpListView::AssertValid() const
  54. {
  55. CListView::AssertValid();
  56. }
  57. void CWDumpListView::Dump(CDumpContext& dc) const
  58. {
  59. CListView::Dump(dc);
  60. }
  61. #endif //_DEBUG
  62. /////////////////////////////////////////////////////////////////////////////
  63. // CWDumpListView message handlers
  64. void CWDumpListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
  65. {
  66. CListCtrl &list = GetListCtrl();
  67. CWdumpDoc *doc= (CWdumpDoc *) GetDocument();
  68. ChunkItem *item = doc->m_ChunkItem;
  69. list.DeleteAllItems();
  70. if((item != 0) && (item->Type != 0) && (item->Type->Callback != 0)) {
  71. (*item->Type->Callback)(item, &list);
  72. }
  73. }
  74. void CWDumpListView::OnInitialUpdate()
  75. {
  76. CListView::OnInitialUpdate();
  77. CListCtrl &list = GetListCtrl();
  78. long flags = list.GetStyle();
  79. flags |= LVS_REPORT;
  80. SetWindowLong(list.GetSafeHwnd(), GWL_STYLE, flags);
  81. static LV_COLUMN Name_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 230, "Name", 0,0 };
  82. static LV_COLUMN Type_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 70, "Type", 0,0 };
  83. static LV_COLUMN Value_Column = { LVCF_TEXT | LVCF_WIDTH | LVCF_FMT, LVCFMT_LEFT, 300, "Value", 0,0 };
  84. list.InsertColumn(0, &Name_Column);
  85. list.InsertColumn(1, &Type_Column);
  86. list.InsertColumn(2, &Value_Column);
  87. }