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.

103 lines
3.0 KiB

  1. #ifndef __LVPROPS_H_INCLUDED
  2. #define __LVPROPS_H_INCLUDED
  3. #include <windows.h>
  4. class CListviewPropsDialog
  5. {
  6. public:
  7. class CData
  8. {
  9. public:
  10. bool bFullItemSelect;
  11. bool bCustomIcon;
  12. SIZE sizeItemSpacing;
  13. };
  14. private:
  15. HWND m_hWnd;
  16. CData *m_pData;
  17. private:
  18. CListviewPropsDialog(void);
  19. CListviewPropsDialog( const CListviewPropsDialog & );
  20. CListviewPropsDialog &operator=( const CListviewPropsDialog & );
  21. private:
  22. explicit CListviewPropsDialog( HWND hWnd )
  23. : m_hWnd(hWnd),
  24. m_pData(NULL)
  25. {
  26. }
  27. ~CListviewPropsDialog(void)
  28. {
  29. }
  30. LRESULT OnInitDialog( WPARAM, LPARAM lParam )
  31. {
  32. m_pData = reinterpret_cast<CData*>(lParam);
  33. if (!m_pData)
  34. {
  35. EndDialog(m_hWnd,IDCANCEL);
  36. return 0;
  37. }
  38. if (m_pData->bFullItemSelect)
  39. {
  40. SendDlgItemMessage( m_hWnd, IDC_FULLSELECT, BM_SETCHECK, BST_CHECKED, 0 );
  41. }
  42. SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_X_SPIN, UDM_SETRANGE, 0, MAKELONG(50,4) );
  43. SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_X_SPIN, UDM_SETPOS, 0, m_pData->sizeItemSpacing.cx );
  44. SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_Y_SPIN, UDM_SETRANGE, 0, MAKELONG(50,4) );
  45. SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_Y_SPIN, UDM_SETPOS, 0, m_pData->sizeItemSpacing.cy );
  46. return 0;
  47. }
  48. void OnOK( WPARAM wParam, LPARAM )
  49. {
  50. m_pData->sizeItemSpacing.cx = static_cast<LONG>(SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_X_SPIN, UDM_GETPOS, 0, 0 ));
  51. m_pData->sizeItemSpacing.cy = static_cast<LONG>(SendDlgItemMessage( m_hWnd, IDC_ICONSPACING_Y_SPIN, UDM_GETPOS, 0, 0 ));
  52. m_pData->bFullItemSelect = (BST_CHECKED == SendDlgItemMessage( m_hWnd, IDC_FULLSELECT, BM_GETCHECK, 0, 0 ) );
  53. m_pData->bCustomIcon = (BST_CHECKED == SendDlgItemMessage( m_hWnd, IDC_CUSTOMICON, BM_GETCHECK, 0, 0 ) );
  54. EndDialog(m_hWnd,IDOK);
  55. }
  56. void OnCancel( WPARAM wParam, LPARAM )
  57. {
  58. EndDialog(m_hWnd,LOWORD(wParam));
  59. }
  60. LRESULT OnNotify( WPARAM wParam, LPARAM lParam )
  61. {
  62. SC_BEGIN_NOTIFY_MESSAGE_HANDLERS()
  63. {
  64. }
  65. SC_END_NOTIFY_MESSAGE_HANDLERS();
  66. }
  67. LRESULT OnCommand( WPARAM wParam, LPARAM lParam )
  68. {
  69. SC_BEGIN_COMMAND_HANDLERS()
  70. {
  71. SC_HANDLE_COMMAND(IDOK,OnOK);
  72. SC_HANDLE_COMMAND(IDCANCEL,OnCancel);
  73. }
  74. SC_END_COMMAND_HANDLERS();
  75. }
  76. public:
  77. static INT_PTR CALLBACK DialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  78. {
  79. SC_BEGIN_DIALOG_MESSAGE_HANDLERS(CListviewPropsDialog)
  80. {
  81. SC_HANDLE_DIALOG_MESSAGE( WM_INITDIALOG, OnInitDialog );
  82. SC_HANDLE_DIALOG_MESSAGE( WM_COMMAND, OnCommand );
  83. SC_HANDLE_DIALOG_MESSAGE( WM_NOTIFY, OnNotify );
  84. }
  85. SC_END_DIALOG_MESSAGE_HANDLERS();
  86. }
  87. };
  88. #endif // __LVPROPS_H_INCLUDED