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.

184 lines
4.6 KiB

  1. /***********************************************************************
  2. *
  3. * X16MENU.H
  4. *
  5. * Copyright Microsoft Corporation 1997. All Rights Reserved.
  6. *
  7. * This module contains a set of functions to provide Win32 specific
  8. * windows menu handling ability.
  9. *
  10. *
  11. * This file provides following features:
  12. *
  13. * - 32bit specific APIs
  14. * - Menu ID associated with Popup menu (32bit API only)
  15. * - Application-defined 32bit value associated with a menu item
  16. * - (TBD)Read values like hBitmap, hbmpChecked, hbmpUnchecked, MFS_HILIGHT
  17. *
  18. * In order to provide these features, following things happen inside:
  19. *
  20. * - Provide 32bit specific APIs
  21. * - Replace 16bit menu APIs to keep track of changes to menus
  22. * - (TBD)Hook WH_CBT to clean up when a window (and its menu) is destroyed
  23. *
  24. * To use these functionalities, you need to do followings:
  25. *
  26. * - If you want to associate ID to a popup menu in RC file, add one menu
  27. * item at the beginning of the popup menu. Define the menu item to
  28. * have menu string of STR_POPUPMENUID and ID value for the popup menu.
  29. * - Call "InitX16Menu" in the beginning of your application (usually
  30. * before creating any Windows, and before entering message loop.)
  31. *
  32. ***********************************************************************/
  33. #ifndef __INC_X16MENU_H__
  34. #define __INC_X16MENU_H__
  35. #ifdef __cplusplus
  36. extern "C"{
  37. #endif
  38. #define MIIM_STATE 0x00000001
  39. #define MIIM_ID 0x00000002
  40. #define MIIM_SUBMENU 0x00000004
  41. #define MIIM_CHECKMARKS 0x00000008
  42. #define MIIM_TYPE 0x00000010
  43. #define MIIM_DATA 0x00000020
  44. #define MF_DEFAULT 0x00001000L
  45. #define MF_RIGHTJUSTIFY 0x00004000L
  46. #define MFT_STRING MF_STRING
  47. #define MFT_BITMAP MF_BITMAP
  48. #define MFT_MENUBARBREAK MF_MENUBARBREAK
  49. #define MFT_MENUBREAK MF_MENUBREAK
  50. #define MFT_OWNERDRAW MF_OWNERDRAW
  51. #define MFT_RADIOCHECK 0x00000200L
  52. #define MFT_SEPARATOR MF_SEPARATOR
  53. #define MFT_RIGHTORDER 0x00002000L
  54. #define MFT_RIGHTJUSTIFY MF_RIGHTJUSTIFY
  55. /* Menu flags for Add/Check/EnableMenuItem() */
  56. #define MFS_GRAYED 0x00000003L
  57. #define MFS_DISABLED MFS_GRAYED
  58. #define MFS_CHECKED MF_CHECKED
  59. #define MFS_HILITE MF_HILITE
  60. #define MFS_ENABLED MF_ENABLED
  61. #define MFS_UNCHECKED MF_UNCHECKED
  62. #define MFS_UNHILITE MF_UNHILITE
  63. #define MFS_DEFAULT MF_DEFAULT
  64. #if 0 // win16x now has this definition
  65. typedef struct tagMENUITEMINFO
  66. {
  67. UINT cbSize;
  68. UINT fMask;
  69. UINT fType; // used if MIIM_TYPE (4.0) or MIIM_FTYPE (>4.0)
  70. UINT fState; // used if MIIM_STATE
  71. UINT wID; // used if MIIM_ID
  72. HMENU hSubMenu; // used if MIIM_SUBMENU
  73. HBITMAP hbmpChecked; // used if MIIM_CHECKMARKS
  74. HBITMAP hbmpUnchecked; // used if MIIM_CHECKMARKS
  75. DWORD dwItemData; // used if MIIM_DATA
  76. LPSTR dwTypeData; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
  77. UINT cch; // used if MIIM_TYPE (4.0) or MIIM_STRING (>4.0)
  78. } MENUITEMINFO, FAR *LPMENUITEMINFO, CONST FAR *LPCMENUITEMINFO;
  79. //typedef MENUITEMINFO MENUITEMINFOA;
  80. //typedef MENUITEMINFO CONST FAR *LPCMENUITEMINFOA;
  81. #endif
  82. #define STR_POPUPMENUID "Popup Menu ID"
  83. #define DEFINE_POPUP(name,id) POPUP name \
  84. BEGIN \
  85. MENUITEM STR_POPUPMENUID id
  86. // EXTERNAL HELPER APIs
  87. void
  88. WINAPI
  89. X16MenuInitialize(
  90. HMENU hMenu
  91. );
  92. void
  93. WINAPI
  94. X16MenuDeInitialize(
  95. HMENU hMenu
  96. );
  97. // 16bit Old MENU APIs
  98. BOOL
  99. WINAPI __export
  100. X16EnableMenuItem(
  101. HMENU hMenu,
  102. UINT idEnableItem,
  103. UINT uEnable
  104. );
  105. #ifndef DONT_USE_16BIT_MENU_WRAPPER
  106. #define EnableMenuItem X16EnableMenuItem
  107. #endif
  108. // 32bit New MENU APIs
  109. BOOL
  110. WINAPI
  111. GetMenuItemInfo(
  112. HMENU hMenu,
  113. UINT uItem,
  114. BOOL fByPosition,
  115. LPMENUITEMINFO lpmii
  116. );
  117. //#define GetMenuItemInfoA GetMenuItemInfo
  118. BOOL
  119. WINAPI
  120. SetMenuItemInfo(
  121. HMENU hMenu,
  122. UINT uItem,
  123. BOOL fByPosition,
  124. LPCMENUITEMINFO lpmii
  125. );
  126. //#define SetMenuItemInfoA SetMenuItemInfo
  127. BOOL
  128. WINAPI
  129. InsertMenuItem(
  130. HMENU hMenu,
  131. UINT uItem,
  132. BOOL fByPosition,
  133. LPCMENUITEMINFO lpmii );
  134. //#define InsertMenuItemA InsertMenuItem
  135. BOOL
  136. WINAPI
  137. GetMenuItemRect(
  138. HWND hWnd,
  139. HMENU hMenu,
  140. UINT uItem,
  141. LPRECT lprcItem
  142. );
  143. BOOL
  144. WINAPI
  145. CheckMenuRadioItem(
  146. HMENU hMenu,
  147. UINT idFirst,
  148. UINT idLast,
  149. UINT idCheck,
  150. UINT uFlags
  151. );
  152. #ifdef __cplusplus
  153. }
  154. #endif
  155. #endif //__INC_X16MENU_H__