ReactOS 0.4.15-dev-8127-g6338913
shlmenu.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <undocshell.h>
#include <shlwapi.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "pidl.h"
#include "shell32_main.h"
Include dependency graph for shlmenu.c:

Go to the source code of this file.

Classes

struct  FMINFO
 
struct  FMITEM
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COBJMACROS
 
#define FM_SEPARATOR   (LPCWSTR)1
 
#define CCH_MAXITEMTEXT   256
 
#define FM_ICON_SIZE   16
 
#define FM_Y_SPACE   4
 
#define FM_SPACE1   4
 
#define FM_SPACE2   2
 
#define FM_LEFTBORDER   2
 
#define FM_RIGHTBORDER   8
 

Typedefs

typedef struct FMINFOLPFMINFO
 
typedef struct FMITEMLPFMITEM
 

Functions

static BOOL FileMenu_AppendItemW (HMENU hMenu, LPCWSTR lpText, UINT uID, int icon, HMENU hMenuPopup, int nItemHeight)
 
 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
static LPFMINFO FM_GetMenuInfo (HMENU hmenu)
 
static LPFMINFO FM_SetMenuParameter (HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
 
static int FM_InitMenuPopup (HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
 
HMENU WINAPI FileMenu_Create (COLORREF crBorderColor, int nBorderWidth, HBITMAP hBorderBmp, int nSelHeight, UINT uFlags)
 
void WINAPI FileMenu_Destroy (HMENU hmenu)
 
BOOL WINAPI FileMenu_AppendItemAW (HMENU hMenu, LPCVOID lpText, UINT uID, int icon, HMENU hMenuPopup, int nItemHeight)
 
int WINAPI FileMenu_InsertUsingPidl (HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
 
int WINAPI FileMenu_ReplaceUsingPidl (HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
 
void WINAPI FileMenu_Invalidate (HMENU hMenu)
 
HMENU WINAPI FileMenu_FindSubMenuByPidl (HMENU hMenu, LPCITEMIDLIST pidl)
 
int WINAPI FileMenu_AppendFilesForPidl (HMENU hmenu, LPCITEMIDLIST pidl, BOOL bAddSeparator)
 
int WINAPI FileMenu_AddFilesForPidl (HMENU hmenu, UINT uReserved, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
 
BOOL WINAPI FileMenu_TrackPopupMenuEx (HMENU hMenu, UINT uFlags, int x, int y, HWND hWnd, LPTPMPARAMS lptpm)
 
BOOL WINAPI FileMenu_GetLastSelectedItemPidls (UINT uReserved, LPCITEMIDLIST *ppidlFolder, LPCITEMIDLIST *ppidlItem)
 
LRESULT WINAPI FileMenu_MeasureItem (HWND hWnd, LPMEASUREITEMSTRUCT lpmis)
 
LRESULT WINAPI FileMenu_DrawItem (HWND hWnd, LPDRAWITEMSTRUCT lpdis)
 
BOOL WINAPI FileMenu_InitMenuPopup (HMENU hmenu)
 
LRESULT WINAPI FileMenu_HandleMenuChar (HMENU hMenu, WPARAM wParam)
 
BOOL WINAPI FileMenu_DeleteAllItems (HMENU hmenu)
 
BOOL WINAPI FileMenu_DeleteItemByCmd (HMENU hMenu, UINT uID)
 
BOOL WINAPI FileMenu_DeleteItemByIndex (HMENU hMenu, UINT uPos)
 
BOOL WINAPI FileMenu_DeleteItemByFirstID (HMENU hMenu, UINT uID)
 
BOOL WINAPI FileMenu_DeleteSeparator (HMENU hMenu)
 
BOOL WINAPI FileMenu_EnableItemByCmd (HMENU hMenu, UINT uID, BOOL bEnable)
 
DWORD WINAPI FileMenu_GetItemExtent (HMENU hMenu, UINT uPos)
 
void WINAPI FileMenu_AbortInitMenu (void)
 
IContextMenu *WINAPI SHFind_InitMenuPopup (HMENU hMenu, HWND hWndParent, UINT w, UINT x)
 
static BOOL _SHIsMenuSeparator (HMENU hm, int i)
 
UINT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
 

Variables

static BOOL bAbortInit
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 22 of file shlmenu.c.

◆ CCH_MAXITEMTEXT

#define CCH_MAXITEMTEXT   256

Definition at line 70 of file shlmenu.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file shlmenu.c.

◆ FM_ICON_SIZE

#define FM_ICON_SIZE   16

Definition at line 549 of file shlmenu.c.

◆ FM_LEFTBORDER

#define FM_LEFTBORDER   2

Definition at line 553 of file shlmenu.c.

◆ FM_RIGHTBORDER

#define FM_RIGHTBORDER   8

Definition at line 554 of file shlmenu.c.

◆ FM_SEPARATOR

#define FM_SEPARATOR   (LPCWSTR)1

Definition at line 39 of file shlmenu.c.

◆ FM_SPACE1

#define FM_SPACE1   4

Definition at line 551 of file shlmenu.c.

◆ FM_SPACE2

#define FM_SPACE2   2

Definition at line 552 of file shlmenu.c.

◆ FM_Y_SPACE

#define FM_Y_SPACE   4

Definition at line 550 of file shlmenu.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 21 of file shlmenu.c.

Typedef Documentation

◆ LPFMINFO

typedef struct FMINFO * LPFMINFO

◆ LPFMITEM

typedef struct FMITEM * LPFMITEM

Function Documentation

◆ _SHIsMenuSeparator()

static BOOL _SHIsMenuSeparator ( HMENU  hm,
int  i 
)
static

Definition at line 833 of file shlmenu.c.

834{
835 MENUITEMINFOW mii;
836
837 mii.cbSize = sizeof(MENUITEMINFOW);
838 mii.fMask = MIIM_TYPE;
839 mii.cch = 0; /* WARNING: We MUST initialize it to 0*/
840 if (!GetMenuItemInfoW(hm, i, TRUE, &mii))
841 {
842 return(FALSE);
843 }
844
845 if (mii.fType & MFT_SEPARATOR)
846 {
847 return(TRUE);
848 }
849
850 return(FALSE);
851}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MFT_SEPARATOR
Definition: winuser.h:744
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MIIM_TYPE
Definition: winuser.h:725
struct tagMENUITEMINFOW MENUITEMINFOW

Referenced by Shell_MergeMenus().

◆ FileMenu_AbortInitMenu()

void WINAPI FileMenu_AbortInitMenu ( void  )

Definition at line 802 of file shlmenu.c.

803{ TRACE("\n");
805}
static BOOL bAbortInit
Definition: shlmenu.c:68
#define TRACE(s)
Definition: solgame.cpp:4

◆ FileMenu_AddFilesForPidl()

int WINAPI FileMenu_AddFilesForPidl ( HMENU  hmenu,
UINT  uReserved,
UINT  uID,
LPCITEMIDLIST  pidl,
UINT  uFlags,
UINT  uEnumFlags,
LPFNFMCALLBACK  lpfnCallback 
)

Definition at line 504 of file shlmenu.c.

512{
513 TRACE("%p 0x%08x 0x%08x %p 0x%08x 0x%08x %p\n",
514 hmenu, uReserved, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
515
516 return FileMenu_InsertUsingPidl ( hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
517
518}
UINT uFlags
Definition: api.c:59
int WINAPI FileMenu_InsertUsingPidl(HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
Definition: shlmenu.c:414
static HMENU hmenu
Definition: win.c:66

◆ FileMenu_AppendFilesForPidl()

int WINAPI FileMenu_AppendFilesForPidl ( HMENU  hmenu,
LPCITEMIDLIST  pidl,
BOOL  bAddSeparator 
)

Definition at line 478 of file shlmenu.c.

482{
483 LPFMINFO menudata;
484
485 menudata = FM_GetMenuInfo(hmenu);
486
487 menudata->bInitialized = FALSE;
488
489 FM_InitMenuPopup(hmenu, pidl);
490
491 if (bAddSeparator)
493
494 TRACE("%p %p 0x%08x\n",hmenu, pidl,bAddSeparator);
495
496 return 0;
497}
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
Definition: shlmenu.c:129
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74
static BOOL FileMenu_AppendItemW(HMENU hMenu, LPCWSTR lpText, UINT uID, int icon, HMENU hMenuPopup, int nItemHeight)
Definition: shlmenu.c:304
#define FM_SEPARATOR
Definition: shlmenu.c:39
Definition: shlmenu.c:45
BOOL bInitialized
Definition: shlmenu.c:46
#define FM_DEFAULT_HEIGHT
Definition: undocshell.h:285

◆ FileMenu_AppendItemAW()

BOOL WINAPI FileMenu_AppendItemAW ( HMENU  hMenu,
LPCVOID  lpText,
UINT  uID,
int  icon,
HMENU  hMenuPopup,
int  nItemHeight 
)

Definition at line 381 of file shlmenu.c.

388{
389 BOOL ret;
390
391 if (!lpText) return FALSE;
392
393 if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR)
394 ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight);
395 else
396 {
397 DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
398 LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) );
399 if (!lpszText) return FALSE;
400 MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
401 ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
402 HeapFree( GetProcessHeap(), 0, lpszText );
403 }
404
405 return ret;
406}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:140
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ FileMenu_AppendItemW()

static BOOL FileMenu_AppendItemW ( HMENU  hMenu,
LPCWSTR  lpText,
UINT  uID,
int  icon,
HMENU  hMenuPopup,
int  nItemHeight 
)
static

Definition at line 304 of file shlmenu.c.

311{
312 MENUITEMINFOW mii;
313 LPFMITEM myItem;
314 LPFMINFO menudata;
316
317
318 TRACE("%p %s 0x%08x 0x%08x %p 0x%08x\n",
319 hMenu, (lpText!=FM_SEPARATOR) ? debugstr_w(lpText) : NULL,
320 uID, icon, hMenuPopup, nItemHeight);
321
322 ZeroMemory (&mii, sizeof(MENUITEMINFOW));
323
324 mii.cbSize = sizeof(MENUITEMINFOW);
325
326 if (lpText != FM_SEPARATOR)
327 {
328 int len = strlenW (lpText);
329 myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR));
330 strcpyW (myItem->szItemText, lpText);
331 myItem->cchItemText = len;
332 myItem->iIconIndex = icon;
333 myItem->hMenu = hMenu;
334 mii.fMask = MIIM_DATA;
335 mii.dwItemData = (ULONG_PTR) myItem;
336 }
337
338 if ( hMenuPopup )
339 { /* sub menu */
341 mii.fType = MFT_OWNERDRAW;
342 mii.hSubMenu = hMenuPopup;
343 }
344 else if (lpText == FM_SEPARATOR )
345 { mii.fMask |= MIIM_ID | MIIM_TYPE;
346 mii.fType = MFT_SEPARATOR;
347 }
348 else
349 { /* normal item */
352 mii.fType = MFT_OWNERDRAW;
353 }
354 mii.wID = uID;
355
356 InsertMenuItemW (hMenu, (UINT)-1, TRUE, &mii);
357
358 /* set bFixedItems to true */
359 MenuInfo.cbSize = sizeof(MENUINFO);
360 MenuInfo.fMask = MIM_MENUDATA;
361
362 if (! GetMenuInfo(hMenu, &MenuInfo))
363 return FALSE;
364
365 menudata = (LPFMINFO)MenuInfo.dwMenuData;
366 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))
367 {
368 ERR("menudata corrupt: %p %u\n", menudata, MenuInfo.cbSize);
369 return FALSE;
370 }
371
372 menudata->bFixedItems = TRUE;
373 SetMenuInfo(hMenu, &MenuInfo);
374
375 return TRUE;
376
377}
#define ERR(fmt,...)
Definition: debug.h:113
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:304
#define ULONG_PTR
Definition: config.h:101
#define debugstr_w
Definition: kernel32.h:32
if(dx< 0)
Definition: linetemp.h:194
unsigned int UINT
Definition: ndis.h:50
#define strlenW(s)
Definition: unicode.h:34
#define strcpyW(d, s)
Definition: unicode.h:35
struct FMINFO * LPFMINFO
BOOL bFixedItems
Definition: shlmenu.c:47
Definition: shlmenu.c:62
int cchItemText
Definition: shlmenu.c:62
int iIconIndex
Definition: shlmenu.c:63
HMENU hMenu
Definition: shlmenu.c:64
WCHAR szItemText[1]
Definition: shlmenu.c:65
menu info structure
Definition: window.h:276
ULONG_PTR dwItemData
Definition: winuser.h:3268
#define ZeroMemory
Definition: winbase.h:1712
#define MIIM_ID
Definition: winuser.h:722
#define MIIM_STATE
Definition: winuser.h:721
#define MFS_DEFAULT
Definition: winuser.h:748
#define MFT_OWNERDRAW
Definition: winuser.h:741
#define MIIM_SUBMENU
Definition: winuser.h:723
BOOL WINAPI SetMenuInfo(_In_ HMENU, _In_ LPCMENUINFO)
BOOL WINAPI GetMenuInfo(_In_ HMENU, _Inout_ LPMENUINFO)
#define MFS_ENABLED
Definition: winuser.h:750
struct tagMENUINFO MENUINFO
#define MIIM_DATA
Definition: winuser.h:726
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)

Referenced by FileMenu_AppendFilesForPidl(), FileMenu_AppendItemAW(), and FM_InitMenuPopup().

◆ FileMenu_Create()

HMENU WINAPI FileMenu_Create ( COLORREF  crBorderColor,
int  nBorderWidth,
HBITMAP  hBorderBmp,
int  nSelHeight,
UINT  uFlags 
)

Definition at line 250 of file shlmenu.c.

256{
258 LPFMINFO menudata;
259
260 HMENU hMenu = CreatePopupMenu();
261
262 TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n",
263 crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
264
265 menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
266 menudata->crBorderColor = crBorderColor;
267 menudata->nBorderWidth = nBorderWidth;
268 menudata->hBorderBmp = hBorderBmp;
269
270 MenuInfo.cbSize = sizeof(MENUINFO);
271 MenuInfo.fMask = MIM_MENUDATA;
272 MenuInfo.dwMenuData = (ULONG_PTR) menudata;
273 SetMenuInfo (hMenu, &MenuInfo);
274
275 return hMenu;
276}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
int nBorderWidth
Definition: shlmenu.c:50
COLORREF crBorderColor
Definition: shlmenu.c:49
HBITMAP hBorderBmp
Definition: shlmenu.c:51
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:838

◆ FileMenu_DeleteAllItems()

BOOL WINAPI FileMenu_DeleteAllItems ( HMENU  hmenu)

Definition at line 669 of file shlmenu.c.

670{
671 MENUITEMINFOW mii;
672 LPFMINFO menudata;
673
674 int i;
675
676 TRACE("%p\n", hmenu);
677
678 ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
679 mii.cbSize = sizeof(MENUITEMINFOW);
681
682 for (i = 0; i < GetMenuItemCount( hmenu ); i++)
683 { GetMenuItemInfoW(hmenu, i, TRUE, &mii );
684
686
687 if (mii.hSubMenu)
689 }
690
691 while (DeleteMenu (hmenu, 0, MF_BYPOSITION)){};
692
693 menudata = FM_GetMenuInfo(hmenu);
694
695 menudata->bInitialized = FALSE;
696
697 return TRUE;
698}
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
void WINAPI FileMenu_Destroy(HMENU hmenu)
Definition: shlmenu.c:284
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MF_BYPOSITION
Definition: winuser.h:203

Referenced by FileMenu_Destroy(), and FileMenu_ReplaceUsingPidl().

◆ FileMenu_DeleteItemByCmd()

BOOL WINAPI FileMenu_DeleteItemByCmd ( HMENU  hMenu,
UINT  uID 
)

Definition at line 704 of file shlmenu.c.

705{
706 MENUITEMINFOW mii;
707
708 TRACE("%p 0x%08x\n", hMenu, uID);
709
710 ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
711 mii.cbSize = sizeof(MENUITEMINFOW);
712 mii.fMask = MIIM_SUBMENU;
713
714 GetMenuItemInfoW(hMenu, uID, FALSE, &mii );
715 if ( mii.hSubMenu )
716 {
717 /* FIXME: Do what? */
718 }
719
720 DeleteMenu(hMenu, MF_BYCOMMAND, uID);
721 return TRUE;
722}
#define MF_BYCOMMAND
Definition: winuser.h:202

◆ FileMenu_DeleteItemByFirstID()

BOOL WINAPI FileMenu_DeleteItemByFirstID ( HMENU  hMenu,
UINT  uID 
)

Definition at line 750 of file shlmenu.c.

753{
754 TRACE("%p 0x%08x\n", hMenu, uID);
755 return FALSE;
756}

◆ FileMenu_DeleteItemByIndex()

BOOL WINAPI FileMenu_DeleteItemByIndex ( HMENU  hMenu,
UINT  uPos 
)

Definition at line 727 of file shlmenu.c.

728{
729 MENUITEMINFOW mii;
730
731 TRACE("%p 0x%08x\n", hMenu, uPos);
732
733 ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
734 mii.cbSize = sizeof(MENUITEMINFOW);
735 mii.fMask = MIIM_SUBMENU;
736
737 GetMenuItemInfoW(hMenu, uPos, TRUE, &mii );
738 if ( mii.hSubMenu )
739 {
740 /* FIXME: Do what? */
741 }
742
743 DeleteMenu(hMenu, MF_BYPOSITION, uPos);
744 return TRUE;
745}

◆ FileMenu_DeleteSeparator()

BOOL WINAPI FileMenu_DeleteSeparator ( HMENU  hMenu)

Definition at line 761 of file shlmenu.c.

762{
763 TRACE("%p\n", hMenu);
764 return FALSE;
765}

◆ FileMenu_Destroy()

void WINAPI FileMenu_Destroy ( HMENU  hmenu)

Definition at line 284 of file shlmenu.c.

285{
286 LPFMINFO menudata;
287
288 TRACE("%p\n", hmenu);
289
291
292 menudata = FM_GetMenuInfo(hmenu);
293
294 SHFree( menudata->pidl);
295 HeapFree(GetProcessHeap(), 0, menudata);
296
298}
BOOL WINAPI FileMenu_DeleteAllItems(HMENU hmenu)
Definition: shlmenu.c:669
LPITEMIDLIST pidl
Definition: shlmenu.c:54
BOOL WINAPI DestroyMenu(_In_ HMENU)

Referenced by FileMenu_DeleteAllItems().

◆ FileMenu_DrawItem()

LRESULT WINAPI FileMenu_DrawItem ( HWND  hWnd,
LPDRAWITEMSTRUCT  lpdis 
)

Definition at line 586 of file shlmenu.c.

589{
590 LPFMITEM pMyItem = (LPFMITEM)(lpdis->itemData);
591 COLORREF clrPrevText, clrPrevBkgnd;
592 int xi,yi,xt,yt;
593 HIMAGELIST hImageList;
594 RECT TextRect;
595 LPFMINFO menuinfo;
596
597 TRACE("%p %p %s\n", hWnd, lpdis, debugstr_w(pMyItem->szItemText));
598
599 if (lpdis->itemState & ODS_SELECTED)
600 {
601 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT));
602 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT));
603 }
604 else
605 {
606 clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_MENUTEXT));
607 clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_MENU));
608 }
609
610 TextRect = lpdis->rcItem;
611
612 /* add the menubitmap */
613 menuinfo = FM_GetMenuInfo(pMyItem->hMenu);
614 if (menuinfo->nBorderWidth)
615 TextRect.left += menuinfo->nBorderWidth;
616
617 TextRect.left += FM_LEFTBORDER;
618 xi = TextRect.left + FM_SPACE1;
619 yi = TextRect.top + FM_Y_SPACE/2;
620 TextRect.bottom -= FM_Y_SPACE/2;
621
622 xt = xi + FM_ICON_SIZE + FM_SPACE2;
623 yt = yi;
624
625 ExtTextOutW (lpdis->hDC, xt , yt, ETO_OPAQUE, &TextRect, pMyItem->szItemText, pMyItem->cchItemText, NULL);
626
627 Shell_GetImageLists(0, &hImageList);
628 ImageList_Draw(hImageList, pMyItem->iIconIndex, lpdis->hDC, xi, yi, ILD_NORMAL);
629
630 TRACE("-- %s\n", wine_dbgstr_rect(&TextRect));
631
632 SetTextColor(lpdis->hDC, clrPrevText);
633 SetBkColor(lpdis->hDC, clrPrevBkgnd);
634
635 return TRUE;
636}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
HWND hWnd
Definition: settings.c:17
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:683
#define ILD_NORMAL
Definition: commctrl.h:417
#define FM_ICON_SIZE
Definition: shlmenu.c:549
#define FM_LEFTBORDER
Definition: shlmenu.c:553
struct FMITEM * LPFMITEM
#define FM_Y_SPACE
Definition: shlmenu.c:550
#define FM_SPACE1
Definition: shlmenu.c:551
#define FM_SPACE2
Definition: shlmenu.c:552
ULONG_PTR itemData
Definition: winuser.h:3093
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD COLORREF
Definition: windef.h:300
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
DWORD WINAPI GetSysColor(_In_ int)
#define ODS_SELECTED
Definition: winuser.h:2545
#define COLOR_MENU
Definition: winuser.h:917
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927
#define COLOR_MENUTEXT
Definition: winuser.h:920

◆ FileMenu_EnableItemByCmd()

BOOL WINAPI FileMenu_EnableItemByCmd ( HMENU  hMenu,
UINT  uID,
BOOL  bEnable 
)

Definition at line 770 of file shlmenu.c.

774{
775 TRACE("%p 0x%08x 0x%08x\n", hMenu, uID,bEnable);
776 return FALSE;
777}
_In_ BOOL bEnable
Definition: winddi.h:3426

◆ FileMenu_FindSubMenuByPidl()

HMENU WINAPI FileMenu_FindSubMenuByPidl ( HMENU  hMenu,
LPCITEMIDLIST  pidl 
)

Definition at line 467 of file shlmenu.c.

470{
471 FIXME("%p %p\n",hMenu, pidl);
472 return 0;
473}
#define FIXME(fmt,...)
Definition: debug.h:114

◆ FileMenu_GetItemExtent()

DWORD WINAPI FileMenu_GetItemExtent ( HMENU  hMenu,
UINT  uPos 
)

Definition at line 785 of file shlmenu.c.

786{ RECT rect;
787
788 FIXME("%p 0x%08x\n", hMenu, uPos);
789
790 if (GetMenuItemRect(0, hMenu, uPos, &rect))
791 {
792 FIXME("%s\n", wine_dbgstr_rect(&rect));
793 return ((rect.right-rect.left)<<16) + (rect.top-rect.bottom);
794 }
795 return 0x00100010; /*FIXME*/
796}
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI GetMenuItemRect(_In_opt_ HWND, _In_ HMENU, _In_ UINT, _Out_ LPRECT)

◆ FileMenu_GetLastSelectedItemPidls()

BOOL WINAPI FileMenu_GetLastSelectedItemPidls ( UINT  uReserved,
LPCITEMIDLIST ppidlFolder,
LPCITEMIDLIST ppidlItem 
)

Definition at line 540 of file shlmenu.c.

544{
545 FIXME("0x%08x %p %p\n",uReserved, ppidlFolder, ppidlItem);
546 return FALSE;
547}

◆ FileMenu_HandleMenuChar()

LRESULT WINAPI FileMenu_HandleMenuChar ( HMENU  hMenu,
WPARAM  wParam 
)

Definition at line 655 of file shlmenu.c.

658{
659 FIXME("%p 0x%08lx\n",hMenu,wParam);
660 return 0;
661}
WPARAM wParam
Definition: combotst.c:138

◆ FileMenu_InitMenuPopup()

BOOL WINAPI FileMenu_InitMenuPopup ( HMENU  hmenu)

Definition at line 646 of file shlmenu.c.

647{
649 return TRUE;
650}

◆ FileMenu_InsertUsingPidl()

int WINAPI FileMenu_InsertUsingPidl ( HMENU  hmenu,
UINT  uID,
LPCITEMIDLIST  pidl,
UINT  uFlags,
UINT  uEnumFlags,
LPFNFMCALLBACK  lpfnCallback 
)

Definition at line 414 of file shlmenu.c.

421{
422 TRACE("%p 0x%08x %p 0x%08x 0x%08x %p\n",
423 hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
424
425 pdump (pidl);
426
428
429 FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
430
431 return FM_InitMenuPopup(hmenu, NULL);
432}
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:311
static LPFMINFO FM_SetMenuParameter(HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
Definition: shlmenu.c:100

Referenced by FileMenu_AddFilesForPidl().

◆ FileMenu_Invalidate()

void WINAPI FileMenu_Invalidate ( HMENU  hMenu)

Definition at line 459 of file shlmenu.c.

460{
461 FIXME("%p\n",hMenu);
462}

◆ FileMenu_MeasureItem()

LRESULT WINAPI FileMenu_MeasureItem ( HWND  hWnd,
LPMEASUREITEMSTRUCT  lpmis 
)

Definition at line 558 of file shlmenu.c.

561{
562 LPFMITEM pMyItem = (LPFMITEM)(lpmis->itemData);
563 HDC hdc = GetDC(hWnd);
564 SIZE size;
565 LPFMINFO menuinfo;
566
567 TRACE("%p %p %s\n", hWnd, lpmis, debugstr_w(pMyItem->szItemText));
568
569 GetTextExtentPoint32W(hdc, pMyItem->szItemText, pMyItem->cchItemText, &size);
570
572 lpmis->itemHeight = (size.cy > (FM_ICON_SIZE + FM_Y_SPACE)) ? size.cy : (FM_ICON_SIZE + FM_Y_SPACE);
573
574 /* add the menubitmap */
575 menuinfo = FM_GetMenuInfo(pMyItem->hMenu);
576 if (menuinfo->nBorderWidth)
577 lpmis->itemWidth += menuinfo->nBorderWidth;
578
579 TRACE("-- 0x%04x 0x%04x\n", lpmis->itemWidth, lpmis->itemHeight);
580 ReleaseDC (hWnd, hdc);
581 return 0;
582}
GLsizeiptr size
Definition: glext.h:5919
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define FM_RIGHTBORDER
Definition: shlmenu.c:554
ULONG_PTR itemData
Definition: winuser.h:3646
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

◆ FileMenu_ReplaceUsingPidl()

int WINAPI FileMenu_ReplaceUsingPidl ( HMENU  hmenu,
UINT  uID,
LPCITEMIDLIST  pidl,
UINT  uEnumFlags,
LPFNFMCALLBACK  lpfnCallback 
)

Definition at line 439 of file shlmenu.c.

445{
446 TRACE("%p 0x%08x %p 0x%08x %p\n",
447 hmenu, uID, pidl, uEnumFlags, lpfnCallback);
448
450
451 FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback);
452
453 return FM_InitMenuPopup(hmenu, NULL);
454}

◆ FileMenu_TrackPopupMenuEx()

BOOL WINAPI FileMenu_TrackPopupMenuEx ( HMENU  hMenu,
UINT  uFlags,
int  x,
int  y,
HWND  hWnd,
LPTPMPARAMS  lptpm 
)

Definition at line 524 of file shlmenu.c.

531{
532 TRACE("%p 0x%08x 0x%x 0x%x %p %p\n",
533 hMenu, uFlags, x, y, hWnd, lptpm);
534 return TrackPopupMenuEx(hMenu, uFlags, x, y, hWnd, lptpm);
535}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)

◆ FM_GetMenuInfo()

static LPFMINFO FM_GetMenuInfo ( HMENU  hmenu)
static

Definition at line 74 of file shlmenu.c.

75{
77 LPFMINFO menudata;
78
79 MenuInfo.cbSize = sizeof(MENUINFO);
80 MenuInfo.fMask = MIM_MENUDATA;
81
82 if (! GetMenuInfo(hmenu, &MenuInfo))
83 return NULL;
84
85 menudata = (LPFMINFO)MenuInfo.dwMenuData;
86
87 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))
88 {
89 ERR("menudata corrupt: %p %u\n", menudata, MenuInfo.cbSize);
90 return 0;
91 }
92
93 return menudata;
94
95}

Referenced by FileMenu_AppendFilesForPidl(), FileMenu_DeleteAllItems(), FileMenu_Destroy(), FileMenu_DrawItem(), FileMenu_MeasureItem(), and FM_SetMenuParameter().

◆ FM_InitMenuPopup()

static int FM_InitMenuPopup ( HMENU  hmenu,
LPCITEMIDLIST  pAlternatePidl 
)
static

Definition at line 129 of file shlmenu.c.

130{ IShellFolder *lpsf, *lpsf2;
131 ULONG ulItemAttr = SFGAO_FOLDER;
132 UINT uID, uEnumFlags;
133 LPFNFMCALLBACK lpfnCallback;
134 LPCITEMIDLIST pidl;
135 WCHAR sTemp[MAX_PATH];
136 int NumberOfItems = 0, iIcon;
138 LPFMINFO menudata;
139
140 TRACE("%p %p\n", hmenu, pAlternatePidl);
141
142 MenuInfo.cbSize = sizeof(MENUINFO);
143 MenuInfo.fMask = MIM_MENUDATA;
144
145 if (! GetMenuInfo(hmenu, &MenuInfo))
146 return FALSE;
147
148 menudata = (LPFMINFO)MenuInfo.dwMenuData;
149
150 if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))
151 {
152 ERR("menudata corrupt: %p %u\n", menudata, MenuInfo.cbSize);
153 return 0;
154 }
155
156 if (menudata->bInitialized)
157 return 0;
158
159 pidl = (pAlternatePidl? pAlternatePidl: menudata->pidl);
160 if (!pidl)
161 return 0;
162
163 uID = menudata->uID;
164 uEnumFlags = menudata->uEnumFlags;
165 lpfnCallback = menudata->lpfnCallback;
166 menudata->bInitialized = FALSE;
167
169
170 if (SUCCEEDED (SHGetDesktopFolder(&lpsf)))
171 {
172 if (SUCCEEDED(IShellFolder_BindToObject(lpsf, pidl,0,&IID_IShellFolder,(LPVOID *)&lpsf2)))
173 {
174 IEnumIDList *lpe = NULL;
175
176 if (SUCCEEDED (IShellFolder_EnumObjects(lpsf2, 0, uEnumFlags, &lpe )))
177 {
178
179 LPITEMIDLIST pidlTemp = NULL;
180 ULONG ulFetched;
181
182 while ((!bAbortInit) && (S_OK == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)))
183 {
184 if (SUCCEEDED (IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulItemAttr)))
185 {
186 ILGetDisplayNameExW(NULL, pidlTemp, sTemp, ILGDN_FORPARSING);
187 if (! (PidlToSicIndex(lpsf, pidlTemp, FALSE, 0, &iIcon)))
188 iIcon = FM_BLANK_ICON;
189 if ( SFGAO_FOLDER & ulItemAttr)
190 {
191 LPFMINFO lpFmMi;
193 HMENU hMenuPopup = CreatePopupMenu();
194
195 lpFmMi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
196
197 lpFmMi->pidl = ILCombine(pidl, pidlTemp);
198 lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
199
200 MenuInfo.cbSize = sizeof(MENUINFO);
201 MenuInfo.fMask = MIM_MENUDATA;
202 MenuInfo.dwMenuData = (ULONG_PTR) lpFmMi;
203 SetMenuInfo (hMenuPopup, &MenuInfo);
204
205 FileMenu_AppendItemW (hmenu, sTemp, uID, iIcon, hMenuPopup, FM_DEFAULT_HEIGHT);
206 }
207 else
208 {
209 LPWSTR pExt = PathFindExtensionW(sTemp);
210 if (pExt)
211 *pExt = 0;
212 FileMenu_AppendItemW (hmenu, sTemp, uID, iIcon, 0, FM_DEFAULT_HEIGHT);
213 }
214 }
215
216 if (lpfnCallback)
217 {
218 TRACE("enter callback\n");
219 lpfnCallback ( pidl, pidlTemp);
220 TRACE("leave callback\n");
221 }
222
223 NumberOfItems++;
224 }
225 IEnumIDList_Release (lpe);
226 }
227 IShellFolder_Release(lpsf2);
228 }
229 IShellFolder_Release(lpsf);
230 }
231
232 if ( GetMenuItemCount (hmenu) == 0 )
233 {
235 NumberOfItems++;
236 }
237
238 menudata->bInitialized = TRUE;
240
241 return NumberOfItems;
242}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define MAX_PATH
Definition: compat.h:34
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:709
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define L(x)
Definition: ntvdm.h:50
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
Definition: pidl.c:100
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
UINT uID
Definition: shlmenu.c:55
LPFNFMCALLBACK lpfnCallback
Definition: shlmenu.c:58
UINT uEnumFlags
Definition: shlmenu.c:57
uint32_t ULONG
Definition: typedefs.h:59
#define FM_BLANK_ICON
Definition: undocshell.h:284
void(CALLBACK * LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlFile)
Definition: undocshell.h:300
#define ILGDN_FORPARSING
Definition: undocshell.h:70

Referenced by FileMenu_AppendFilesForPidl(), FileMenu_InitMenuPopup(), FileMenu_InsertUsingPidl(), and FileMenu_ReplaceUsingPidl().

◆ FM_SetMenuParameter()

static LPFMINFO FM_SetMenuParameter ( HMENU  hmenu,
UINT  uID,
LPCITEMIDLIST  pidl,
UINT  uFlags,
UINT  uEnumFlags,
LPFNFMCALLBACK  lpfnCallback 
)
static

Definition at line 100 of file shlmenu.c.

107{
108 LPFMINFO menudata;
109
110 TRACE("\n");
111
112 menudata = FM_GetMenuInfo(hmenu);
113
114 SHFree(menudata->pidl);
115
116 menudata->uID = uID;
117 menudata->pidl = ILClone(pidl);
118 menudata->uFlags = uFlags;
119 menudata->uEnumFlags = uEnumFlags;
120 menudata->lpfnCallback = lpfnCallback;
121
122 return menudata;
123}
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:237
UINT uFlags
Definition: shlmenu.c:56

Referenced by FileMenu_InsertUsingPidl(), and FileMenu_ReplaceUsingPidl().

◆ Shell_MergeMenus()

UINT WINAPI Shell_MergeMenus ( HMENU  hmDst,
HMENU  hmSrc,
UINT  uInsert,
UINT  uIDAdjust,
UINT  uIDAdjustMax,
ULONG  uFlags 
)

Definition at line 856 of file shlmenu.c.

857{ int nItem;
858 HMENU hmSubMenu;
859 BOOL bAlreadySeparated;
860 MENUITEMINFOW miiSrc;
861 WCHAR szName[256];
862 UINT uTemp, uIDMax = uIDAdjust;
863
864 TRACE("hmenu1=%p hmenu2=%p 0x%04x 0x%04x 0x%04x 0x%04x\n",
865 hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
866
867 if (!hmDst || !hmSrc)
868 return uIDMax;
869
870 nItem = GetMenuItemCount(hmDst);
871 if (nItem == -1)
872 return uIDMax;
873
874 if (uInsert >= (UINT)nItem) /* insert position inside menu? */
875 {
876 uInsert = (UINT)nItem; /* append on the end */
877 bAlreadySeparated = TRUE;
878 }
879 else
880 {
881 bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);
882 }
883
884 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
885 {
886 /* Add a separator between the menus */
887 InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
888 bAlreadySeparated = TRUE;
889 }
890
891
892 /* Go through the menu items and clone them*/
893 for (nItem = GetMenuItemCount(hmSrc) - 1; nItem >= 0; nItem--)
894 {
895 miiSrc.cbSize = sizeof(MENUITEMINFOW);
897
898 /* We need to reset this every time through the loop in case menus DON'T have IDs*/
899 miiSrc.fType = MFT_STRING;
900 miiSrc.dwTypeData = szName;
901 miiSrc.dwItemData = 0;
902 miiSrc.cch = sizeof(szName)/sizeof(WCHAR);
903
904 if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
905 {
906 continue;
907 }
908
909/* TRACE("found menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmSrc, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu);
910*/
911 if (miiSrc.fType & MFT_SEPARATOR)
912 {
913 /* This is a separator; don't put two of them in a row */
914 if (bAlreadySeparated)
915 continue;
916
917 bAlreadySeparated = TRUE;
918 }
919 else if (miiSrc.hSubMenu)
920 {
922 {
923 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
924
925 if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax */
926 continue;
927
928 if (uIDMax <= miiSrc.wID) /* remember the highest ID */
929 uIDMax = miiSrc.wID + 1;
930 }
931 else
932 {
933 miiSrc.fMask &= ~MIIM_ID; /* Don't set IDs for submenus that didn't have them already */
934 }
935 hmSubMenu = miiSrc.hSubMenu;
936
937 miiSrc.hSubMenu = CreatePopupMenu();
938
939 if (!miiSrc.hSubMenu) return(uIDMax);
940
941 uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags & MM_SUBMENUSHAVEIDS);
942
943 if (uIDMax <= uTemp)
944 uIDMax = uTemp;
945
946 bAlreadySeparated = FALSE;
947 }
948 else /* normal menu item */
949 {
950 miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
951
952 if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax */
953 continue;
954
955 if (uIDMax <= miiSrc.wID) /* remember the highest ID */
956 uIDMax = miiSrc.wID + 1;
957
958 bAlreadySeparated = FALSE;
959 }
960
961/* TRACE("inserting menu=0x%04x %s id=0x%04x mask=0x%08x smenu=0x%04x\n", hmDst, debugstr_a(miiSrc.dwTypeData), miiSrc.wID, miiSrc.fMask, miiSrc.hSubMenu);
962*/
963 if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
964 {
965 return(uIDMax);
966 }
967 }
968
969 /* Ensure the correct number of separators at the beginning of the
970 inserted menu items*/
971 if (uInsert == 0)
972 {
973 if (bAlreadySeparated)
974 {
975 DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
976 }
977 }
978 else
979 {
980 if (_SHIsMenuSeparator(hmDst, uInsert-1))
981 {
982 if (bAlreadySeparated)
983 {
984 DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
985 }
986 }
987 else
988 {
989 if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
990 {
991 /* Add a separator between the menus*/
992 InsertMenuW(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
993 }
994 }
995 }
996 return(uIDMax);
997}
static const WCHAR szName[]
Definition: powrprof.c:45
static BOOL _SHIsMenuSeparator(HMENU hm, int i)
Definition: shlmenu.c:833
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:856
#define MM_SUBMENUSHAVEIDS
Definition: shlobj.h:2515
#define MM_ADDSEPARATOR
Definition: shlobj.h:2514
LPWSTR dwTypeData
Definition: winuser.h:3269
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define MIIM_CHECKMARKS
Definition: winuser.h:724
BOOL WINAPI InsertMenuA(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCSTR)
#define MF_SEPARATOR
Definition: winuser.h:137
#define MFT_STRING
Definition: winuser.h:746

Referenced by CBandSiteBase::_OnContextMenu(), CDesktopFolder::CallBack(), CDrivesFolder::CallBack(), CFSFolder::CallBack(), CDefView::Exec(), CDefView::FillArrangeAsMenu(), CDefView::FillEditMenu(), CDefView::FillFileMenu(), CDefView::FillViewMenu(), CShellBrowser::InsertMenusSB(), CBandSiteMenu::QueryContextMenu(), CISFBand::QueryContextMenu(), CDefaultContextMenu::QueryContextMenu(), CDefViewBckgrndMenu::QueryContextMenu(), CTrayWindowCtxMenu::QueryContextMenu(), Shell_MergeMenus(), and test_shlmenu().

◆ SHFind_InitMenuPopup()

IContextMenu *WINAPI SHFind_InitMenuPopup ( HMENU  hMenu,
HWND  hWndParent,
UINT  w,
UINT  x 
)

Definition at line 823 of file shlmenu.c.

824{
825 FIXME("hmenu=%p hwnd=%p 0x%08x 0x%08x stub\n",
826 hMenu,hWndParent,w,x);
827 return NULL; /* this is supposed to be a pointer */
828}
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )

Variable Documentation

◆ bAbortInit

BOOL bAbortInit
static

Definition at line 68 of file shlmenu.c.

Referenced by FileMenu_AbortInitMenu(), FileMenu_InsertUsingPidl(), and FM_InitMenuPopup().