Source code of Windows XP (NT5)
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.

97 lines
2.5 KiB

  1. #include "stdafx.h"
  2. #include "TreeViewWnd.h"
  3. #include "resource.h"
  4. LRESULT CTreeViewWnd::OnCommand( WPARAM wParam, LPARAM lParam )
  5. {
  6. SC_BEGIN_COMMAND_HANDLERS()
  7. {
  8. }
  9. SC_END_COMMAND_HANDLERS();
  10. }
  11. LRESULT CTreeViewWnd::OnPaint( WPARAM wParam, LPARAM lParam )
  12. {
  13. PAINTSTRUCT ps;
  14. HDC hDC = BeginPaint( m_hWnd, &ps );
  15. if (hDC) {
  16. EndPaint( m_hWnd, &ps );
  17. }
  18. return(0);
  19. }
  20. LRESULT CTreeViewWnd::OnDestroy( WPARAM wParam, LPARAM lParam )
  21. {
  22. PostQuitMessage(0);
  23. return(0);
  24. }
  25. LRESULT CTreeViewWnd::OnCreate( WPARAM wParam, LPARAM lParam )
  26. {
  27. return(0);
  28. }
  29. LPARAM CTreeViewWnd::OnSize( WPARAM wParam, LPARAM lParam )
  30. {
  31. InvalidateRect( m_hWnd, NULL, FALSE );
  32. return(0);
  33. }
  34. LRESULT CTreeViewWnd::OnSizing ( WPARAM wParam, LPARAM lParam )
  35. {
  36. Trace(TEXT("TreeViewWnd is Sizing"));
  37. return (0);
  38. }
  39. LPARAM CTreeViewWnd::OnSetFocus( WPARAM wParam, LPARAM lParam )
  40. {
  41. InvalidateRect( m_hWnd, NULL, FALSE );
  42. return(0);
  43. }
  44. HTREEITEM CTreeViewWnd::InsertItem( LPTVINSERTSTRUCT lpInsertStruct )
  45. {
  46. Trace(TEXT("Inserting Item [%s] into the Tree"),lpInsertStruct->item.pszText);
  47. return TreeView_InsertItem(m_hWnd, lpInsertStruct);
  48. }
  49. HIMAGELIST CTreeViewWnd::SetImageList(HIMAGELIST hImageList, INT iImage)
  50. {
  51. //
  52. // ( iImage ) can be one of the following
  53. //
  54. // TVSIL_NORMAL Indicates the normal image list,
  55. // which contains selected, nonselected,
  56. // and overlay images for the items of a
  57. // tree view control.
  58. //
  59. // TVSIL_STATE Indicates the state image list.
  60. // You can use state images to indicate
  61. // application-defined item states. A state
  62. // image is displayed to the left of an item's
  63. // selected or nonselected image.
  64. return TreeView_SetImageList(m_hWnd, hImageList, iImage);
  65. }
  66. VOID CTreeViewWnd::SetWindowHandle(HWND hWnd)
  67. {
  68. m_hWnd = hWnd;
  69. }
  70. LRESULT CTreeViewWnd::OnRButtonDown(WPARAM wParam, LPARAM lParam)
  71. {
  72. MessageBox(NULL,TEXT("You Right Clicked on the TreeView!"),TEXT("Right Click"),MB_OK);
  73. return (0);
  74. }
  75. LRESULT CTreeViewWnd::OnParentResize(WPARAM wParam, LPARAM lParam)
  76. {
  77. RECT WindowRect;
  78. GetWindowRect(m_hWnd,&WindowRect);
  79. INT nWidth = LOWORD(lParam); // width of client area
  80. INT nHeight = HIWORD(lParam); // height of client area
  81. MoveWindow(m_hWnd,0,0,(WindowRect.right - WindowRect.left),nHeight,TRUE);
  82. return (0);
  83. }