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.

168 lines
5.7 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998 - 1999
  5. //
  6. // File: tasksym.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 10/29/1998 DavidPe Adapted from BackOffice snapin
  15. //____________________________________________________________________________
  16. //
  17. #ifndef __TASKSYM_H__
  18. #define __TASKSYM_H__
  19. #include "tstring.h"
  20. #include "dlgs.h"
  21. #include "task.h" // for CSmartIcon
  22. extern const int NUM_SYMBOLS; // the total number of symbols available.
  23. class CConsoleTask;
  24. /*+-------------------------------------------------------------------------*
  25. * class CEOTSymbol
  26. *
  27. *
  28. * PURPOSE: encapsulates information about glyphs that are internal to MMC. These
  29. * have description text along with them.
  30. *+-------------------------------------------------------------------------*/
  31. class CEOTSymbol
  32. {
  33. public:
  34. CEOTSymbol(WORD iconResource, int value, int ID, int IDSecondary=0)
  35. {m_iconResource = iconResource; m_value = value; m_ID = ID; m_IDSecondary = IDSecondary;}
  36. ~CEOTSymbol();
  37. void Draw (HDC hdc, RECT *lpRect, bool bSmall = false) const ; // Draw into a DC.
  38. public:
  39. int GetID() const {return m_ID;}
  40. int GetIDSecondary() const {return m_IDSecondary;}
  41. int GetValue() const {return m_value;}
  42. bool operator == (const CEOTSymbol &rhs);
  43. static bool IsMatch(CStr &str1, CStr &str2);
  44. static int FindMatchingSymbol(LPCTSTR szDescription); // finds a symbol matching the given description.
  45. void SetIcon(const CSmartIcon & smartIconSmall, const CSmartIcon & smartIconLarge);
  46. CSmartIcon & GetSmallIcon() {return m_smartIconSmall;}
  47. CSmartIcon & GetLargeIcon() {return m_smartIconLarge;}
  48. private:
  49. WORD m_iconResource; // the resource id of the icon
  50. int m_value; // the number of the symbol
  51. int m_ID; // description text resource ID
  52. int m_IDSecondary; // secondary description\
  53. protected:
  54. mutable CSmartIcon m_smartIconSmall;
  55. mutable CSmartIcon m_smartIconLarge;
  56. };
  57. /*+-------------------------------------------------------------------------*
  58. * class CTaskSymbolDlg
  59. *
  60. *
  61. * PURPOSE:
  62. *
  63. *+-------------------------------------------------------------------------*/
  64. class CTaskSymbolDlg :
  65. public WTL::CPropertyPageImpl<CTaskSymbolDlg>
  66. {
  67. typedef WTL::CPropertyPageImpl<CTaskSymbolDlg> BC;
  68. public:
  69. CTaskSymbolDlg(CConsoleTask& rConsoleTask, bool bFindMatchingSymbol= false);
  70. enum { IDD = IDD_TASK_PROPS_SYMBOL_PAGE,
  71. IDD_WIZ = IDD_TASK_WIZARD_SYMBOL_PAGE};
  72. BEGIN_MSG_MAP(CTaskSymbolDlg)
  73. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  74. MESSAGE_HANDLER(WM_CTLCOLORSTATIC, OnCtlColorStatic)
  75. CONTEXT_HELP_HANDLER()
  76. NOTIFY_HANDLER (IDC_GLYPH_LIST, NM_CUSTOMDRAW, OnCustomDraw)
  77. NOTIFY_HANDLER (IDC_GLYPH_LIST, LVN_ITEMCHANGED, OnSymbolChanged)
  78. COMMAND_ID_HANDLER(IDB_SELECT_TASK_ICON, OnSelectTaskIcon)
  79. COMMAND_HANDLER(IDC_CustomIconRadio, BN_CLICKED, OnIconSourceChanged)
  80. COMMAND_HANDLER(IDC_MMCIconsRadio, BN_CLICKED, OnIconSourceChanged)
  81. CHAIN_MSG_MAP(BC)
  82. REFLECT_NOTIFICATIONS()
  83. END_MSG_MAP()
  84. IMPLEMENT_CONTEXT_HELP(g_aHelpIDs_IDD_TASK_PROPS_SYMBOL_PAGE);
  85. //
  86. // message handlers
  87. //
  88. LRESULT OnInitDialog(UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& handled);
  89. LRESULT OnCtlColorStatic(UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& handled);
  90. LRESULT OnCustomDraw(int id, LPNMHDR pnmh, BOOL& bHandled );
  91. LRESULT OnSymbolChanged(int id, LPNMHDR pnmh, BOOL& bHandled );
  92. LRESULT OnSelectTaskIcon(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  93. LRESULT OnIconSourceChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  94. int OnWizardNext() {return OnOK() ? 0 : -1;}
  95. bool OnApply () {return OnOK();}
  96. BOOL OnOK();
  97. // implementation
  98. void DrawItem(NMCUSTOMDRAW *pnmcd);
  99. private:
  100. SC ScEnableControls (int id);
  101. protected:
  102. CConsoleTask& m_ConsoleTask; // get the name to match from here.
  103. // No need to destroy the CImageList, it is destroyed by the CListViewCtrl
  104. // as it is not a shared imagelist.
  105. WTL::CImageList m_imageList;
  106. WTL::CListViewCtrl m_listGlyphs; // the list control for the glyphs
  107. WTL::CStatic m_wndCustomIcon;
  108. CSmartIcon m_CustomIconSmall;
  109. CSmartIcon m_CustomIconLarge;
  110. bool m_bFindMatchingSymbol; // should we try to guess a symbol?
  111. bool m_bCustomIcon; // does this task use a custom icon?
  112. };
  113. class CTaskSymbolWizardPage: public CTaskSymbolDlg
  114. {
  115. typedef CTaskSymbolDlg BC;
  116. public:
  117. CTaskSymbolWizardPage(CConsoleTask& rConsoleTask): BC(rConsoleTask, true)
  118. {
  119. m_psp.pszTemplate = MAKEINTRESOURCE(BC::IDD_WIZ);
  120. /*
  121. * Wizard97-style pages have titles, subtitles and header bitmaps
  122. */
  123. VERIFY (m_strTitle. LoadString(GetStringModule(), IDS_TaskWiz_SymbolPageTitle));
  124. VERIFY (m_strSubtitle.LoadString(GetStringModule(), IDS_TaskWiz_SymbolPageSubtitle));
  125. m_psp.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  126. m_psp.pszHeaderTitle = m_strTitle.data();
  127. m_psp.pszHeaderSubTitle = m_strSubtitle.data();
  128. }
  129. BOOL OnSetActive()
  130. {
  131. // add the Finish button.
  132. WTL::CPropertySheetWindow(::GetParent(m_hWnd)).SetWizardButtons (PSWIZB_BACK | PSWIZB_NEXT);
  133. return TRUE;
  134. }
  135. private:
  136. tstring m_strTitle;
  137. tstring m_strSubtitle;
  138. };
  139. #endif // __TASKSYM_H__