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.

85 lines
2.4 KiB

  1. /*****************************************************************************
  2. *
  3. * tlframe.cpp
  4. *
  5. * Frame window that hosts a treelist.
  6. *
  7. *****************************************************************************/
  8. #include "sdview.h"
  9. /*****************************************************************************
  10. *
  11. * TLFrame
  12. *
  13. *****************************************************************************/
  14. LRESULT TLFrame::ON_WM_NOTIFY(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  15. {
  16. NMHDR *pnm = RECAST(NMHDR *, lParam);
  17. if (pnm->idFrom == IDC_LIST) {
  18. switch (pnm->code) {
  19. case LVN_GETDISPINFO:
  20. return _tree.OnGetDispInfo(CONTAINING_RECORD(pnm, NMLVDISPINFO, hdr));
  21. case LVN_ODCACHEHINT:
  22. return _tree.OnCacheHint(CONTAINING_RECORD(pnm, NMLVCACHEHINT, hdr));
  23. case LVN_KEYDOWN:
  24. return _tree.OnKeyDown(CONTAINING_RECORD(pnm, NMLVKEYDOWN, hdr));
  25. case NM_CLICK:
  26. return _tree.OnClick(CONTAINING_RECORD(pnm, NMITEMACTIVATE, hdr));
  27. }
  28. }
  29. return super::HandleMessage(uiMsg, wParam, lParam);
  30. }
  31. LRESULT TLFrame::ON_LM_ITEMACTIVATE(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  32. {
  33. return _tree.OnItemActivate((int)wParam);
  34. }
  35. LRESULT TLFrame::ON_LM_GETINFOTIP(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  36. {
  37. return _tree.OnGetInfoTip(RECAST(NMLVGETINFOTIP *, lParam));
  38. }
  39. LRESULT TLFrame::ON_LM_GETCONTEXTMENU(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  40. {
  41. return _tree.OnGetContextMenu((int)wParam);
  42. }
  43. LRESULT TLFrame::ON_LM_COPYTOCLIPBOARD(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  44. {
  45. return _tree.OnCopyToClipboard((int)wParam, (int)lParam);
  46. }
  47. BOOL TLFrame::CreateChild(DWORD dwStyle, DWORD dwExStyle)
  48. {
  49. BOOL fResult = super::CreateChild(dwStyle | LVS_OWNERDATA, dwExStyle);
  50. if (fResult) {
  51. _tree.SetHWND(_hwndChild);
  52. HIMAGELIST himl = ImageList_LoadBitmap(g_hinst, MAKEINTRESOURCE(IDB_IMAGES),
  53. 16, 0, RGB(0xFF, 0x00, 0xFF));
  54. _tree.SetImageList(himl);
  55. ImageList_SetOverlayImage(himl, 7, 1);
  56. }
  57. return fResult;
  58. }
  59. LRESULT
  60. TLFrame::HandleMessage(UINT uiMsg, WPARAM wParam, LPARAM lParam)
  61. {
  62. switch (uiMsg) {
  63. FW_MSG(WM_NOTIFY);
  64. FW_MSG(LM_ITEMACTIVATE);
  65. FW_MSG(LM_GETINFOTIP);
  66. FW_MSG(LM_GETCONTEXTMENU);
  67. FW_MSG(LM_COPYTOCLIPBOARD);
  68. }
  69. return super::HandleMessage(uiMsg, wParam, lParam);
  70. }