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.

81 lines
2.6 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // MMENU.H: Declares custom menu interface for multimedia applet
  4. //
  5. // Copyright (c) Microsoft Corporation 1998
  6. //
  7. // 1/28/98 David Stewart / dstewart
  8. //
  9. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  10. #ifndef _MMENUHEADER_
  11. #define _MMENUHEADER_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. class CustomMenu;
  16. class CCustomMenu;
  17. class CustomMenu
  18. {
  19. public:
  20. //append a string value
  21. virtual BOOL AppendMenu(int nMenuID, TCHAR* szMenu) = 0;
  22. //append a string from your resources
  23. virtual BOOL AppendMenu(int nMenuID, HINSTANCE hInst, int nStringID) = 0;
  24. //append a string and an icon from your resources
  25. virtual BOOL AppendMenu(int nMenuID, HINSTANCE hInst, int nIconID, int nStringID) = 0;
  26. //append another custom menu, with a resource string
  27. virtual BOOL AppendMenu(HINSTANCE hInst, int nStringID, CustomMenu* pMenu) = 0;
  28. virtual BOOL AppendSeparator() = 0;
  29. virtual BOOL TrackPopupMenu(UINT uFlags, int x, int y, HWND hwnd, CONST RECT* pRect) = 0;
  30. virtual BOOL SetMenuDefaultItem(UINT uItem, UINT fByPos) = 0;
  31. virtual void MeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT pMeasure) = 0;
  32. virtual void DrawItem(HWND hwnd, LPDRAWITEMSTRUCT pDraw) = 0;
  33. virtual LRESULT MenuChar(TCHAR tChar, UINT fuFlag, HMENU hMenu) = 0;
  34. virtual HMENU GetMenuHandle() = 0;
  35. virtual void Destroy() = 0;
  36. };
  37. class CCustomMenu : CustomMenu
  38. {
  39. public:
  40. friend HRESULT AllocCustomMenu(CustomMenu** ppMenu);
  41. CCustomMenu();
  42. BOOL AppendMenu(int nMenuID, TCHAR* szMenu);
  43. BOOL AppendMenu(int nMenuID, HINSTANCE hInst, int nStringID);
  44. BOOL AppendMenu(int nMenuID, HINSTANCE hInst, int nIconID, int nStringID);
  45. BOOL AppendMenu(HINSTANCE hInst, int nStringID, CustomMenu* pMenu);
  46. BOOL AppendSeparator();
  47. BOOL TrackPopupMenu(UINT uFlags, int x, int y, HWND hwnd, CONST RECT* pRect);
  48. BOOL SetMenuDefaultItem(UINT uItem, UINT fByPos);
  49. void MeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT pMeasure);
  50. void DrawItem(HWND hwnd, LPDRAWITEMSTRUCT pDraw);
  51. LRESULT MenuChar(TCHAR tChar, UINT fuFlag, HMENU hMenu);
  52. HMENU GetMenuHandle() {return m_hMenu;}
  53. void Destroy();
  54. protected:
  55. ~CCustomMenu();
  56. BOOL IsItemFirst(int nMenuID);
  57. BOOL IsItemLast(int nMenuID);
  58. private:
  59. HMENU m_hMenu;
  60. HFONT m_hFont;
  61. HFONT m_hBoldFont;
  62. };
  63. #ifdef __cplusplus
  64. };
  65. #endif //c++
  66. #endif //_MMENUHEADER_