Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
5.8 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ModRes.cpp
  7. //
  8. // Abstract:
  9. // Implementation of the CModifyResourcesDlg dialog.
  10. //
  11. // Author:
  12. // David Potter (davidp) November 26, 1996
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "stdafx.h"
  20. #include "ModRes.h"
  21. #ifdef _DEBUG
  22. #define new DEBUG_NEW
  23. #undef THIS_FILE
  24. static char THIS_FILE[] = __FILE__;
  25. #endif
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CModifyResourcesDlg
  28. /////////////////////////////////////////////////////////////////////////////
  29. IMPLEMENT_DYNCREATE(CModifyResourcesDlg, CListCtrlPairDlg)
  30. /////////////////////////////////////////////////////////////////////////////
  31. // Message Maps
  32. BEGIN_MESSAGE_MAP(CModifyResourcesDlg, CListCtrlPairDlg)
  33. //{{AFX_MSG_MAP(CModifyResourcesDlg)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. //++
  38. //
  39. // CModifyResourcesDlg::CModifyResourcesDlg
  40. //
  41. // Routine Description:
  42. // Default constructor.
  43. //
  44. // Arguments:
  45. // None.
  46. //
  47. // Return Value:
  48. // None.
  49. //
  50. //--
  51. /////////////////////////////////////////////////////////////////////////////
  52. CModifyResourcesDlg::CModifyResourcesDlg(void)
  53. {
  54. } //*** CModifyResourcesDlg::CModifyResourcesDlg()
  55. /////////////////////////////////////////////////////////////////////////////
  56. //++
  57. //
  58. // CModifyResourcesDlg::CModifyResourcesDlg
  59. //
  60. // Routine Description:
  61. // Constructor.
  62. //
  63. // Arguments:
  64. // idd [IN] Dialog ID.
  65. // pdwHelpMap [IN] Control-to-Help ID mapping array.
  66. // rlpciRight [IN OUT] List for the right list control.
  67. // rlpciLeft [IN] List for the left list control.
  68. // dwStyle [IN] Style:
  69. // LCPS_SHOW_IMAGES Show images to left of items.
  70. // LCPS_ALLOW_EMPTY Allow right list to be empty.
  71. // LCPS_ORDERED Ordered right list.
  72. // pParent [IN OUT] Parent window.
  73. //
  74. // Return Value:
  75. // None.
  76. //
  77. //--
  78. /////////////////////////////////////////////////////////////////////////////
  79. CModifyResourcesDlg::CModifyResourcesDlg(
  80. IN UINT idd,
  81. IN const DWORD * pdwHelpMap,
  82. IN OUT CResourceList & rlpciRight,
  83. IN const CResourceList & rlpciLeft,
  84. IN DWORD dwStyle,
  85. IN OUT CWnd * pParent //=NULL
  86. ) : CListCtrlPairDlg(
  87. idd,
  88. pdwHelpMap,
  89. &rlpciRight,
  90. &rlpciLeft,
  91. dwStyle | LCPS_PROPERTIES_BUTTON | (dwStyle & LCPS_ORDERED ? LCPS_CAN_BE_ORDERED : 0),
  92. GetColumn,
  93. BDisplayProperties,
  94. pParent
  95. )
  96. {
  97. //{{AFX_DATA_INIT(CModifyResourcesDlg)
  98. //}}AFX_DATA_INIT
  99. } //*** CModifyResourcesDlg::CModifyResourcesDlg()
  100. /////////////////////////////////////////////////////////////////////////////
  101. //++
  102. //
  103. // CModifyResourcesDlg::OnInitDialog
  104. //
  105. // Routine Description:
  106. // Handler for the WM_INITDIALOG message.
  107. //
  108. // Arguments:
  109. // None.
  110. //
  111. // Return Value:
  112. // TRUE Focus needs to be set.
  113. // FALSE Focus already set.
  114. //
  115. //--
  116. /////////////////////////////////////////////////////////////////////////////
  117. BOOL CModifyResourcesDlg::OnInitDialog(void)
  118. {
  119. // Add columns.
  120. try
  121. {
  122. NAddColumn(IDS_COLTEXT_NAME, COLI_WIDTH_NAME);
  123. NAddColumn(IDS_COLTEXT_RESTYPE, COLI_WIDTH_RESTYPE);
  124. } // try
  125. catch (CException * pe)
  126. {
  127. pe->ReportError();
  128. pe->Delete();
  129. } // catch: CException
  130. // Call the base class method.
  131. CListCtrlPairDlg::OnInitDialog();
  132. return TRUE; // return TRUE unless you set the focus to a control
  133. // EXCEPTION: OCX Property Pages should return FALSE
  134. } //*** CModifyResourcesDlg::OnInitDialog()
  135. /////////////////////////////////////////////////////////////////////////////
  136. //++
  137. //
  138. // CModifyResourcesDlg::GetColumn [static]
  139. //
  140. // Routine Description:
  141. // Returns a column for an item.
  142. //
  143. // Arguments:
  144. // pobj [IN OUT] Object for which the column is to be displayed.
  145. // iItem [IN] Index of the item in the list.
  146. // icol [IN] Column number whose text is to be retrieved.
  147. // pdlg [IN OUT] Dialog to which object belongs.
  148. // rstr [OUT] String in which to return column text.
  149. // piimg [OUT] Image index for the object.
  150. //
  151. // Return Value:
  152. // None.
  153. //
  154. //--
  155. /////////////////////////////////////////////////////////////////////////////
  156. void CALLBACK CModifyResourcesDlg::GetColumn(
  157. IN OUT CObject * pobj,
  158. IN int iItem,
  159. IN int icol,
  160. IN OUT CDialog * pdlg,
  161. OUT CString & rstr,
  162. OUT int * piimg
  163. )
  164. {
  165. CResource * pciRes = (CResource *) pobj;
  166. int colid;
  167. ASSERT_VALID(pciRes);
  168. ASSERT((0 <= icol) && (icol <= 1));
  169. switch (icol)
  170. {
  171. // Sorting by resource name.
  172. case 0:
  173. colid = IDS_COLTEXT_RESOURCE;
  174. break;
  175. // Sorting by resource type.
  176. case 1:
  177. colid = IDS_COLTEXT_RESTYPE;
  178. break;
  179. default:
  180. colid = IDS_COLTEXT_RESOURCE;
  181. break;
  182. } // switch: icol
  183. pciRes->BGetColumnData(colid, rstr);
  184. if (piimg != NULL)
  185. *piimg = pciRes->IimgObjectType();
  186. } //*** CModifyResourcesDlg::GetColumn()
  187. /////////////////////////////////////////////////////////////////////////////
  188. //++
  189. //
  190. // CModifyResourcesDlg::BDisplayProperties [static]
  191. //
  192. // Routine Description:
  193. // Display the properties of the specified object.
  194. //
  195. // Arguments:
  196. // pobj [IN OUT] Cluster item whose properties are to be displayed.
  197. //
  198. // Return Value:
  199. // TRUE Properties where accepted.
  200. // FALSE Properties where cancelled.
  201. //
  202. //--
  203. /////////////////////////////////////////////////////////////////////////////
  204. BOOL CALLBACK CModifyResourcesDlg::BDisplayProperties(IN OUT CObject * pobj)
  205. {
  206. CClusterItem * pci = (CClusterItem *) pobj;
  207. ASSERT_KINDOF(CClusterItem, pobj);
  208. return pci->BDisplayProperties();
  209. } //*** CModifyResourcesDlg::BDisplayProperties();