GUI_WinZipView.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:9k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // GUI_WinZipView.cpp : implementation of the CGUI_WinZipView class
  2. //
  3. // This file is a part of the XTREME TOOLKIT PRO MFC class library.
  4. // (c)1998-2008 Codejock Software, All Rights Reserved.
  5. //
  6. // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
  7. // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
  8. // CONSENT OF CODEJOCK SOFTWARE.
  9. //
  10. // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
  11. // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
  12. // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
  13. // SINGLE COMPUTER.
  14. //
  15. // CONTACT INFORMATION:
  16. // support@codejock.com
  17. // http://www.codejock.com
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #include "stdafx.h"
  21. #include "GUI_WinZip.h"
  22. #include "GUI_WinZipDoc.h"
  23. #include "GUI_WinZipView.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CGUI_WinZipView
  31. IMPLEMENT_DYNCREATE(CGUI_WinZipView, CListViewBase)
  32. BEGIN_MESSAGE_MAP(CGUI_WinZipView, CListViewBase)
  33. //{{AFX_MSG_MAP(CGUI_WinZipView)
  34. //}}AFX_MSG_MAP
  35. // Standard printing commands
  36. ON_COMMAND(ID_FILE_PRINT, CListView::OnFilePrint)
  37. ON_COMMAND(ID_FILE_PRINT_DIRECT, CListView::OnFilePrint)
  38. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CListView::OnFilePrintPreview)
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CGUI_WinZipView construction/destruction
  42. CGUI_WinZipView::CGUI_WinZipView()
  43. {
  44. // TODO: add construction code here
  45. }
  46. CGUI_WinZipView::~CGUI_WinZipView()
  47. {
  48. }
  49. BOOL CGUI_WinZipView::PreCreateWindow(CREATESTRUCT& cs)
  50. {
  51. cs.style |= LVS_REPORT|LVS_AUTOARRANGE;
  52. return CListView::PreCreateWindow(cs);
  53. }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CGUI_WinZipView drawing
  56. void CGUI_WinZipView::OnDraw(CDC* /*pDC*/)
  57. {
  58. CGUI_WinZipDoc* pDoc = GetDocument();
  59. ASSERT_VALID(pDoc);
  60. // TODO: add draw code for native data here
  61. }
  62. struct col_data
  63. {
  64. LPCTSTR name;
  65. int width;
  66. int fmt;
  67. };
  68. static col_data columns[] =
  69. {
  70. { _T("Name"),       200, LVCFMT_LEFT},
  71. { _T("Type"),       100, LVCFMT_LEFT},
  72. { _T("Modified"),   120, LVCFMT_LEFT},
  73. { _T("Size"),        80, LVCFMT_RIGHT},
  74. { _T("Ratio"),       70, LVCFMT_RIGHT},
  75. { _T("Packed"),     100, LVCFMT_RIGHT},
  76. { _T("Attributes"),  90, LVCFMT_LEFT},
  77. { _T("Path"),       200, LVCFMT_LEFT}
  78. };
  79. struct file_info
  80. {
  81. LPCSTR info[_countof(columns)];
  82. };
  83. static file_info infoarr[] =
  84. {
  85. // Name                 Type                    Modified        Size        Ratio   Packed     Attributes  Path
  86. { "GUI_WinZip.aps",    "APS file",             "18/06/2002",   "134908",   "66%",  "45965",    "A",        "" },
  87. { "GUI_WinZip.clw",    "CLW file",             "18/06/2002",   "4474",     "78%",  "1029",     "A",        "" },
  88. { "GUI_WinZip.cpp",    "C++ Source File",      "06/06/2002",   "4364",     "62%",  "1679",     "RA",       "" },
  89. { "GUI_WinZip.dsp",    "Project File",         "18/06/2002",   "5231",     "76%",  "1276",     "A",        "" },
  90. { "GUI_WinZip.dsw",    "Project Workspace",    "07/06/2002",   "626",      "61%",  "246",      "RA",       "" },
  91. { "GUI_WinZip.h",      "C Header File",        "06/06/2002",   "1400",     "55%",  "640",      "RA",       "" },
  92. { "GUI_WinZip.ico",    "Icon",                 "06/06/2002",   "1078",     "73%",  "298",      "RA",       "res" },
  93. { "GUI_WinZip.obj",    "Intermediate file",    "18/06/2002",   "24855",    "69%",  "7785",     "A",        "Debug" },
  94. { "GUI_WinZip.pch",    "Intermediate file",    "18/06/2002",   "8326332",  "68%",  "689319",   "A",        "Debug" },
  95. { "GUI_WinZip.rc",     "Resource Template",    "18/06/2002",   "16370",    "78%",  "3644",     "A",        "" },
  96. { "GUI_WinZip.rc2",    "RC2 file",             "06/06/2002",   "402",      "57%",  "175",      "RA",       "res" },
  97. { "GUI_WinZip.res",    "RES file",             "18/06/2002",   "93564",    "62%",  "35772",    "A",        "Debug" },
  98. { "GUI_WinZip.Tags.WW","WW file",              "18/06/2002",   "1044",     "81%",  "208",      "A",        "" },
  99. { "GUI_WinZipD.pdb",   "Intermediate file",    "18/06/2002",   "508928",   "77%",  "20292",    "A",        "Debug" },
  100. { "GUI_WinZipDoc.cpp", "C++ Source File",      "06/06/2002",   "1822",     "67%",  "619",      "RA",       "" },
  101. { "GUI_WinZipDoc.h",   "C Header File",        "06/06/2002",   "1519",     "57%",  "666",      "RA",       "" },
  102. { "GUI_WinZipDoc.ico", "Icon",                 "06/06/2002",   "1078",     "68%",  "352",      "RA",       "res" },
  103. { "GUI_WinZipDoc.obj", "Intermediate file",    "18/06/2002",   "16481",    "69%",  "5272",     "A",        "Debug" },
  104. { "GUI_WinZipView.cpp","C++ Source File",      "18/06/2002",   "3680",     "65%",  "1295",     "A",        "" },
  105. { "GUI_WinZipView.h",  "C Header File",        "18/06/2002",   "1995",     "58%",  "838",      "A",        "" },
  106. { "GUI_WinZipView.obj","Intermediate file",    "18/06/2002",   "27203",    "69%",  "8468",     "A",        "Debug" },
  107. { "highclr1.bmp",      "Bitmap Image",         "06/06/2002",   "35334",    "67%",  "11879",    "RA",       "res" },
  108. { "highclr2.bmp",      "Bitmap Image",         "06/06/2002",   "35334",    "65%",  "12594",    "RA",       "res" },
  109. { "highclrsm1.bmp",    "Bitmap Image",         "07/06/2002",   "5814",     "31%",  "4053",     "RA",       "res" },
  110. { "highclrsm2.bmp",    "Bitmap Image",         "07/06/2002",   "5814",     "36%",  "3758",     "RA",       "res" },
  111. { "MainFrm.cpp",       "C++ Source File",      "18/06/2002",   "8535",     "75%",  "2201",     "A",        "" },
  112. { "MainFrm.h",         "C Header File",        "17/06/2002",   "2153",     "63%",  "807",      "RA",       "" },
  113. { "MainFrm.obj",       "Intermediate file",    "18/06/2002",   "41818",    "72%",  "11972",    "A",        "Debug" },
  114. { "manifest.xml",      "XML Document",         "17/06/2002",   "599",      "46%",  "329",      "RA",       "res" },
  115. { "ReadMe.txt",        "Readme Document",      "06/06/2002",   "4407",     "64%",  "1590",     "RA",       "" },
  116. { "resource.h",        "C Header File",        "17/06/2002",   "1713",     "70%",  "516",      "A",        "" },
  117. { "StdAfx.cpp",        "C++ Source File",      "06/06/2002",   "212",      "32%",  "145",      "RA",       "" },
  118. { "StdAfx.h",          "C Header File",        "06/06/2002",   "1148",     "52%",  "557",      "RA",       "" },
  119. { "StdAfx.obj",        "Intermediate file",    "18/06/2002",   "113867",   "58%",  "48738",    "A",        "Debug" },
  120. { "Toolbar.bmp",       "Bitmap Image",         "06/06/2002",   "1078",     "61%",  "424",      "RA",       "res" },
  121. { "vc60.idb",          "Intermediate file",    "18/06/2002",   "427008",   "75%",  "8543",     "A",        "Debug" },
  122. { "vc60.pdb",          "Intermediate file",    "18/06/2002",   "651264",   "69%",  "2461",     "A",        "Debug" }
  123. };
  124. ////////
  125. void CGUI_WinZipView::OnInitialUpdate()
  126. {
  127. CListView::OnInitialUpdate();
  128. CListCtrl& listCtrl = GetListCtrl();
  129. int i;
  130. for (i = 0; i < _countof(columns); ++i)
  131. {
  132. listCtrl.InsertColumn(i, columns[i].name, columns[i].fmt,
  133. columns[i].width);
  134. }
  135. ::SendMessage(listCtrl.GetSafeHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
  136. int j;
  137. for (i = 0; i < _countof(infoarr); ++i)
  138. {
  139. CString strItem1 = infoarr[i].info[0];
  140. listCtrl.InsertItem(i, strItem1);
  141. for (j = 1; j < _countof(columns); ++j)
  142. {
  143. CString strItem2 = infoarr[i].info[j];
  144. listCtrl.SetItem(i, j, LVIF_TEXT, strItem2, 0, 0, 0, 0);
  145. }
  146. }
  147. }
  148. /////////////////////////////////////////////////////////////////////////////
  149. // CGUI_WinZipView printing
  150. BOOL CGUI_WinZipView::OnPreparePrinting(CPrintInfo* pInfo)
  151. {
  152. // default preparation
  153. return DoPreparePrinting(pInfo);
  154. }
  155. void CGUI_WinZipView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  156. {
  157. // TODO: add extra initialization before printing
  158. }
  159. void CGUI_WinZipView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  160. {
  161. // TODO: add cleanup after printing
  162. }
  163. /////////////////////////////////////////////////////////////////////////////
  164. // CGUI_WinZipView diagnostics
  165. #ifdef _DEBUG
  166. void CGUI_WinZipView::AssertValid() const
  167. {
  168. CListView::AssertValid();
  169. }
  170. void CGUI_WinZipView::Dump(CDumpContext& dc) const
  171. {
  172. CListView::Dump(dc);
  173. }
  174. CGUI_WinZipDoc* CGUI_WinZipView::GetDocument() // non-debug version is inline
  175. {
  176. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGUI_WinZipDoc)));
  177. return (CGUI_WinZipDoc*)m_pDocument;
  178. }
  179. #endif //_DEBUG