Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

menu.c File Reference

Go to the source code of this file.

Functions

DWORD _GetMenuDefaultItem (PMENU pMenu, BOOL fByPosition, UINT uFlags)
BOOL xxxMNCanClose (PWND pwnd)
RTLMENU xxxLoadSysMenu (UINT uMenuId)


Function Documentation

DWORD _GetMenuDefaultItem PMENU  pMenu,
BOOL  fByPosition,
UINT  uFlags
 

Definition at line 26 of file ntuser/rtl/menu.c.

References tagMENU::cItems, DWORD, MFMWFP_NOITEM, NULL, REBASEALWAYS, REBASEPTR, tagITEM::spSubMenu, TestMFS, and tagITEM::wID.

Referenced by GetMenuDefaultItem(), SetupFakeMDIAppStuff(), and xxxMNDoubleClick().

00027 { 00028 int iItem; 00029 int cItems; 00030 PITEM pItem; 00031 PMENU pSubMenu; 00032 00033 pItem = REBASEALWAYS(pMenu, rgItems); 00034 cItems = pMenu->cItems; 00035 00036 /* 00037 * Walk the list of items sequentially until we find one that has 00038 * MFS_DEFAULT set. 00039 */ 00040 for (iItem = 0; iItem < cItems; iItem++, pItem++) { 00041 if (TestMFS(pItem, MFS_DEFAULT)) { 00042 if ((uFlags & GMDI_USEDISABLED) || !TestMFS(pItem, MFS_GRAYED)) { 00043 if ((uFlags & GMDI_GOINTOPOPUPS) && (pItem->spSubMenu != NULL)) { 00044 DWORD id; 00045 00046 /* 00047 * Is there a valid submenu default? If not, we'll use 00048 * this one. 00049 */ 00050 pSubMenu = REBASEPTR(pMenu, pItem->spSubMenu); 00051 id = _GetMenuDefaultItem(pSubMenu, fByPosition, uFlags); 00052 if (id != MFMWFP_NOITEM) 00053 return(id); 00054 } 00055 00056 break; 00057 } 00058 } 00059 } 00060 00061 if (iItem < cItems) { 00062 return (fByPosition ? iItem : pItem->wID); 00063 } else { 00064 return (MFMWFP_NOITEM); 00065 } 00066 }

RTLMENU xxxLoadSysMenu UINT  uMenuId  ) 
 

Definition at line 117 of file ntuser/rtl/menu.c.

References hmodUser, ID_DIALOGSYSMENU, NULL, RtlInitUnicodeStringOrId(), RTLMENU, ThreadLockAlways, ThreadUnlock, xxxClientLoadMenu(), xxxRtlSetMenuInfo, and xxxRtlSetMenuItemInfo.

Referenced by CreateMDIChild(), xxxGetSystemMenu(), and xxxLoadSysDesktopMenu().

00118 { 00119 RTLMENU rtlMenu; 00120 MENUINFO mi; 00121 MENUITEMINFO mii; 00122 TL tlMenu; 00123 00124 #ifdef _USERK_ 00125 UNICODE_STRING strMenuName; 00126 RtlInitUnicodeStringOrId(&strMenuName, MAKEINTRESOURCE(uMenuId)); 00127 rtlMenu = xxxClientLoadMenu(NULL, &strMenuName); 00128 #else 00129 rtlMenu = LoadMenu(hmodUser, MAKEINTRESOURCE(uMenuId)); 00130 #endif 00131 00132 if (rtlMenu == NULL) { 00133 RIPMSG1(RIP_WARNING, "xxxLoadSysMenu failed to load:%#lx", uMenuId); 00134 return NULL; 00135 } 00136 00137 ThreadLockAlways(rtlMenu, &tlMenu); 00138 /* 00139 * Add the checkorbmp style. (draw bitmaps and checkmarks on the 00140 * same column) 00141 */ 00142 mi.cbSize = sizeof(mi); 00143 mi.fMask = MIM_STYLE | MIM_APPLYTOSUBMENUS; 00144 mi.dwStyle = MNS_CHECKORBMP; 00145 xxxRtlSetMenuInfo(rtlMenu, &mi); 00146 /* 00147 * Add the bitmaps for close, minimize, maximize and restore items. 00148 */ 00149 mii.cbSize = sizeof(mii); 00150 mii.fMask = MIIM_BITMAP; 00151 mii.hbmpItem = HBMMENU_POPUP_CLOSE; 00152 xxxRtlSetMenuItemInfo (rtlMenu, SC_CLOSE, &mii); 00153 if (uMenuId != ID_DIALOGSYSMENU) { 00154 mii.hbmpItem = HBMMENU_POPUP_MINIMIZE; 00155 xxxRtlSetMenuItemInfo (rtlMenu, SC_MINIMIZE, &mii); 00156 mii.hbmpItem = HBMMENU_POPUP_MAXIMIZE; 00157 xxxRtlSetMenuItemInfo (rtlMenu, SC_MAXIMIZE, &mii); 00158 mii.hbmpItem = HBMMENU_POPUP_RESTORE; 00159 xxxRtlSetMenuItemInfo (rtlMenu, SC_RESTORE, &mii); 00160 } 00161 00162 ThreadUnlock(&tlMenu); 00163 return rtlMenu; 00164 }

BOOL xxxMNCanClose PWND  pwnd  ) 
 

Definition at line 78 of file ntuser/rtl/menu.c.

References BOOL, CFNOCLOSE, CheckLock, FALSE, MNLookUpItem(), NULL, REBASEALWAYS, REBASEPTR, TestCF2, TestMFS, and xxxGetSysMenuHandle().

Referenced by DefFrameProcWorker(), MDIAddSysMenu(), xxxCalcCaptionButton(), xxxDrawCaptionBar(), and xxxGetTitleBarInfo().

00079 { 00080 PMENU pMenu; 00081 PITEM pItem; 00082 PCLS pcls; 00083 00084 CheckLock(pwnd); 00085 00086 pcls = (PCLS)REBASEALWAYS(pwnd, pcls); 00087 if ( TestCF2(pcls, CFNOCLOSE) ) 00088 return FALSE; 00089 00090 pMenu = xxxGetSysMenuHandle(pwnd); 00091 if (!pMenu || !(pMenu = REBASEPTR(pwnd, pMenu))) 00092 return(FALSE); 00093 00094 /* 00095 * Note how this parallels the code in SetCloseDefault--we check for 00096 * 3 different IDs. 00097 */ 00098 pItem = MNLookUpItem(pMenu, SC_CLOSE, FALSE, NULL); 00099 00100 if (!(pItem)) 00101 pItem = MNLookUpItem(pMenu, SC_CLOSE-0x7000, FALSE, NULL); 00102 00103 if (!(pItem)) 00104 pItem = MNLookUpItem(pMenu, 0xC070, FALSE, NULL); 00105 00106 return((pItem) && !TestMFS(pItem, MFS_GRAYED)); 00107 }


Generated on Sat May 15 19:44:38 2004 for test by doxygen 1.3.7