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.

109 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000
  6. //
  7. // File: tasksymbol.cpp
  8. //
  9. // History: 17-Jan-2000 Vivekj added
  10. //--------------------------------------------------------------------------
  11. #include "stdafx.h"
  12. #include "TaskSymbol.h"
  13. #include "tasks.h"
  14. //############################################################################
  15. //############################################################################
  16. //
  17. // Traces
  18. //
  19. //############################################################################
  20. //############################################################################
  21. #ifdef DBG
  22. CTraceTag tagTaskSymbol(TEXT("CTaskSymbol"), TEXT("CTaskSymbol"));
  23. #endif //DBG
  24. //############################################################################
  25. //############################################################################
  26. //
  27. // Implementation of class CTaskSymbol
  28. //
  29. //############################################################################
  30. //############################################################################
  31. extern CEOTSymbol s_rgEOTSymbol[];
  32. CTaskSymbol::CTaskSymbol()
  33. : m_dwConsoleTaskID(0),
  34. m_bSmall(0)
  35. {
  36. }
  37. /*+-------------------------------------------------------------------------*
  38. *
  39. * CTaskSymbol::OnDraw
  40. *
  41. * PURPOSE: Draws out the symbol onto the DC specified in the ATL_DRAWINFO structure.
  42. *
  43. * PARAMETERS:
  44. * ATL_DRAWINFO& di :
  45. *
  46. * RETURNS:
  47. * HRESULT
  48. *
  49. *+-------------------------------------------------------------------------*/
  50. HRESULT
  51. CTaskSymbol::OnDraw(ATL_DRAWINFO& di)
  52. {
  53. DECLARE_SC(sc, TEXT("CTaskSymbol::OnDraw"));
  54. RECT * pRect = (RECT *)di.prcBounds;
  55. sc = ScCheckPointers(pRect);
  56. if(sc)
  57. return sc.ToHr();
  58. CConsoleTask *pConsoleTask = CConsoleTask::GetConsoleTask(m_dwConsoleTaskID); // get the console task from the unique ID
  59. COLORREF colorOld = SetTextColor (di.hdcDraw, ::GetSysColor (COLOR_WINDOWTEXT));
  60. if(pConsoleTask)
  61. pConsoleTask->Draw(di.hdcDraw, pRect, m_bSmall);
  62. SetTextColor(di.hdcDraw, colorOld);
  63. return sc.ToHr();
  64. }
  65. LRESULT
  66. CTaskSymbol::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  67. {
  68. Fire_Click();
  69. return 0;
  70. }
  71. // from winuser.h, for Windows 2000 and above only.
  72. #define IDC_HAND MAKEINTRESOURCE(32649)
  73. LRESULT
  74. CTaskSymbol::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
  75. {
  76. static HCURSOR s_hCursorHand = ::LoadCursor(NULL, IDC_HAND);
  77. // if the hand cursor is available, use it.
  78. if(s_hCursorHand)
  79. ::SetCursor(s_hCursorHand);
  80. return 0;
  81. }