ReactOS  0.4.14-dev-317-g96040ec
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 550 of file shlmenu.c.

◆ FM_LEFTBORDER

#define FM_LEFTBORDER   2

Definition at line 554 of file shlmenu.c.

◆ FM_RIGHTBORDER

#define FM_RIGHTBORDER   8

Definition at line 555 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 552 of file shlmenu.c.

◆ FM_SPACE2

#define FM_SPACE2   2

Definition at line 553 of file shlmenu.c.

◆ FM_Y_SPACE

#define FM_Y_SPACE   4

Definition at line 551 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 834 of file shlmenu.c.

835 {
836  MENUITEMINFOW mii;
837 
838  mii.cbSize = sizeof(MENUITEMINFOW);
839  mii.fMask = MIIM_TYPE;
840  mii.cch = 0; /* WARNING: We MUST initialize it to 0*/
841  if (!GetMenuItemInfoW(hm, i, TRUE, &mii))
842  {
843  return(FALSE);
844  }
845 
846  if (mii.fType & MFT_SEPARATOR)
847  {
848  return(TRUE);
849  }
850 
851  return(FALSE);
852 }
#define TRUE
Definition: types.h:120
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
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define MFT_SEPARATOR
Definition: winuser.h:739
#define MIIM_TYPE
Definition: winuser.h:720
struct tagMENUITEMINFOW MENUITEMINFOW

Referenced by Shell_MergeMenus().

◆ FileMenu_AbortInitMenu()

void WINAPI FileMenu_AbortInitMenu ( void  )

Definition at line 803 of file shlmenu.c.

804 { TRACE("\n");
805  bAbortInit = TRUE;
806 }
#define TRUE
Definition: types.h:120
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 505 of file shlmenu.c.

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

◆ FileMenu_AppendFilesForPidl()

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

Definition at line 479 of file shlmenu.c.

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

◆ FileMenu_AppendItemAW()

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

Definition at line 382 of file shlmenu.c.

389 {
390  BOOL ret;
391 
392  if (!lpText) return FALSE;
393 
394  if (SHELL_OsIsUnicode() || lpText == FM_SEPARATOR)
395  ret = FileMenu_AppendItemW(hMenu, lpText, uID, icon, hMenuPopup, nItemHeight);
396  else
397  {
398  DWORD len = MultiByteToWideChar( CP_ACP, 0, lpText, -1, NULL, 0 );
399  LPWSTR lpszText = HeapAlloc ( GetProcessHeap(), 0, len*sizeof(WCHAR) );
400  if (!lpszText) return FALSE;
401  MultiByteToWideChar( CP_ACP, 0, lpText, -1, lpszText, len );
402  ret = FileMenu_AppendItemW(hMenu, lpszText, uID, icon, hMenuPopup, nItemHeight);
403  HeapFree( GetProcessHeap(), 0, lpszText );
404  }
405 
406  return ret;
407 }
#define CP_ACP
Definition: compat.h:99
static __inline BOOL SHELL_OsIsUnicode(void)
Definition: shell32_main.h:130
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL FileMenu_AppendItemW(HMENU hMenu, LPCWSTR lpText, UINT uID, int icon, HMENU hMenuPopup, int nItemHeight)
Definition: shlmenu.c:305
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FM_SEPARATOR
Definition: shlmenu.c:39
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ FileMenu_AppendItemW()

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

Definition at line 305 of file shlmenu.c.

312 {
313  MENUITEMINFOW mii;
314  LPFMITEM myItem;
315  LPFMINFO menudata;
317 
318 
319  TRACE("%p %s 0x%08x 0x%08x %p 0x%08x\n",
320  hMenu, (lpText!=FM_SEPARATOR) ? debugstr_w(lpText) : NULL,
321  uID, icon, hMenuPopup, nItemHeight);
322 
323  ZeroMemory (&mii, sizeof(MENUITEMINFOW));
324 
325  mii.cbSize = sizeof(MENUITEMINFOW);
326 
327  if (lpText != FM_SEPARATOR)
328  {
329  int len = strlenW (lpText);
330  myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR));
331  strcpyW (myItem->szItemText, lpText);
332  myItem->cchItemText = len;
333  myItem->iIconIndex = icon;
334  myItem->hMenu = hMenu;
335  mii.fMask = MIIM_DATA;
336  mii.dwItemData = (ULONG_PTR) myItem;
337  }
338 
339  if ( hMenuPopup )
340  { /* sub menu */
341  mii.fMask |= MIIM_TYPE | MIIM_SUBMENU;
342  mii.fType = MFT_OWNERDRAW;
343  mii.hSubMenu = hMenuPopup;
344  }
345  else if (lpText == FM_SEPARATOR )
346  { mii.fMask |= MIIM_ID | MIIM_TYPE;
347  mii.fType = MFT_SEPARATOR;
348  }
349  else
350  { /* normal item */
351  mii.fMask |= MIIM_ID | MIIM_TYPE | MIIM_STATE;
353  mii.fType = MFT_OWNERDRAW;
354  }
355  mii.wID = uID;
356 
357  InsertMenuItemW (hMenu, (UINT)-1, TRUE, &mii);
358 
359  /* set bFixedItems to true */
360  MenuInfo.cbSize = sizeof(MENUINFO);
361  MenuInfo.fMask = MIM_MENUDATA;
362 
363  if (! GetMenuInfo(hMenu, &MenuInfo))
364  return FALSE;
365 
366  menudata = (LPFMINFO)MenuInfo.dwMenuData;
367  if ((menudata == 0) || (MenuInfo.cbSize != sizeof(MENUINFO)))
368  {
369  ERR("menudata corrupt: %p %u\n", menudata, MenuInfo.cbSize);
370  return FALSE;
371  }
372 
373  menudata->bFixedItems = TRUE;
374  SetMenuInfo(hMenu, &MenuInfo);
375 
376  return TRUE;
377 
378 }
struct tagMENUINFO MENUINFO
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ZeroMemory
Definition: winbase.h:1642
#define MFS_DEFAULT
Definition: winuser.h:743
#define MIIM_SUBMENU
Definition: winuser.h:718
#define MFS_ENABLED
Definition: winuser.h:745
#define MIIM_STATE
Definition: winuser.h:716
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
int iIconIndex
Definition: shlmenu.c:63
#define MIIM_ID
Definition: winuser.h:717
#define TRACE(s)
Definition: solgame.cpp:4
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MFT_SEPARATOR
Definition: winuser.h:739
#define FM_SEPARATOR
Definition: shlmenu.c:39
Definition: shlmenu.c:44
WCHAR szItemText[1]
Definition: shlmenu.c:65
#define MIIM_TYPE
Definition: winuser.h:720
GLenum GLsizei len
Definition: glext.h:6722
menu info structure
Definition: window.h:275
#define ERR(fmt,...)
Definition: debug.h:109
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
BOOL WINAPI SetMenuInfo(_In_ HMENU, _In_ LPCMENUINFO)
BOOL WINAPI GetMenuInfo(_In_ HMENU, _Inout_ LPMENUINFO)
Definition: shlmenu.c:61
int cchItemText
Definition: shlmenu.c:62
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
unsigned int UINT
Definition: ndis.h:50
struct FMINFO * LPFMINFO
BOOL bFixedItems
Definition: shlmenu.c:47
#define ULONG_PTR
Definition: config.h:101
#define MFT_OWNERDRAW
Definition: winuser.h:736
#define MIIM_DATA
Definition: winuser.h:721
ULONG_PTR dwItemData
Definition: winuser.h:3242
LPVOID WINAPI SHAlloc(SIZE_T len)
Definition: shellole.c:309
struct tagMENUITEMINFOW MENUITEMINFOW
HMENU hMenu
Definition: shlmenu.c:64

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 251 of file shlmenu.c.

257 {
259  LPFMINFO menudata;
260 
261  HMENU hMenu = CreatePopupMenu();
262 
263  TRACE("0x%08x 0x%08x %p 0x%08x 0x%08x hMenu=%p\n",
264  crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
265 
266  menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
267  menudata->crBorderColor = crBorderColor;
268  menudata->nBorderWidth = nBorderWidth;
269  menudata->hBorderBmp = hBorderBmp;
270 
271  MenuInfo.cbSize = sizeof(MENUINFO);
272  MenuInfo.fMask = MIM_MENUDATA;
273  MenuInfo.dwMenuData = (ULONG_PTR) menudata;
274  SetMenuInfo (hMenu, &MenuInfo);
275 
276  return hMenu;
277 }
struct tagMENUINFO MENUINFO
UINT uFlags
Definition: api.c:59
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
COLORREF crBorderColor
Definition: shlmenu.c:49
Definition: shlmenu.c:44
HBITMAP hBorderBmp
Definition: shlmenu.c:51
menu info structure
Definition: window.h:275
BOOL WINAPI SetMenuInfo(_In_ HMENU, _In_ LPCMENUINFO)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define ULONG_PTR
Definition: config.h:101
int nBorderWidth
Definition: shlmenu.c:50
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

◆ FileMenu_DeleteAllItems()

BOOL WINAPI FileMenu_DeleteAllItems ( HMENU  hmenu)

Definition at line 670 of file shlmenu.c.

671 {
672  MENUITEMINFOW mii;
673  LPFMINFO menudata;
674 
675  int i;
676 
677  TRACE("%p\n", hmenu);
678 
679  ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
680  mii.cbSize = sizeof(MENUITEMINFOW);
682 
683  for (i = 0; i < GetMenuItemCount( hmenu ); i++)
684  { GetMenuItemInfoW(hmenu, i, TRUE, &mii );
685 
686  SHFree((LPFMINFO)mii.dwItemData);
687 
688  if (mii.hSubMenu)
690  }
691 
692  while (DeleteMenu (hmenu, 0, MF_BYPOSITION)){};
693 
694  menudata = FM_GetMenuInfo(hmenu);
695 
696  menudata->bInitialized = FALSE;
697 
698  return TRUE;
699 }
#define TRUE
Definition: types.h:120
static HMENU hmenu
Definition: win.c:66
#define ZeroMemory
Definition: winbase.h:1642
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 MIIM_SUBMENU
Definition: winuser.h:718
void WINAPI FileMenu_Destroy(HMENU hmenu)
Definition: shlmenu.c:285
#define MF_BYPOSITION
Definition: winuser.h:203
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL bInitialized
Definition: shlmenu.c:46
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
Definition: shlmenu.c:44
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
#define MIIM_DATA
Definition: winuser.h:721
ULONG_PTR dwItemData
Definition: winuser.h:3242
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74
struct tagMENUITEMINFOW MENUITEMINFOW

Referenced by FileMenu_Destroy(), and FileMenu_ReplaceUsingPidl().

◆ FileMenu_DeleteItemByCmd()

BOOL WINAPI FileMenu_DeleteItemByCmd ( HMENU  hMenu,
UINT  uID 
)

Definition at line 705 of file shlmenu.c.

706 {
707  MENUITEMINFOW mii;
708 
709  TRACE("%p 0x%08x\n", hMenu, uID);
710 
711  ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
712  mii.cbSize = sizeof(MENUITEMINFOW);
713  mii.fMask = MIIM_SUBMENU;
714 
715  GetMenuItemInfoW(hMenu, uID, FALSE, &mii );
716  if ( mii.hSubMenu )
717  {
718  /* FIXME: Do what? */
719  }
720 
721  DeleteMenu(hMenu, MF_BYCOMMAND, uID);
722  return TRUE;
723 }
#define TRUE
Definition: types.h:120
#define MF_BYCOMMAND
Definition: winuser.h:202
#define ZeroMemory
Definition: winbase.h:1642
#define MIIM_SUBMENU
Definition: winuser.h:718
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
struct tagMENUITEMINFOW MENUITEMINFOW

◆ FileMenu_DeleteItemByFirstID()

BOOL WINAPI FileMenu_DeleteItemByFirstID ( HMENU  hMenu,
UINT  uID 
)

Definition at line 751 of file shlmenu.c.

754 {
755  TRACE("%p 0x%08x\n", hMenu, uID);
756  return FALSE;
757 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ FileMenu_DeleteItemByIndex()

BOOL WINAPI FileMenu_DeleteItemByIndex ( HMENU  hMenu,
UINT  uPos 
)

Definition at line 728 of file shlmenu.c.

729 {
730  MENUITEMINFOW mii;
731 
732  TRACE("%p 0x%08x\n", hMenu, uPos);
733 
734  ZeroMemory ( &mii, sizeof(MENUITEMINFOW));
735  mii.cbSize = sizeof(MENUITEMINFOW);
736  mii.fMask = MIIM_SUBMENU;
737 
738  GetMenuItemInfoW(hMenu, uPos, TRUE, &mii );
739  if ( mii.hSubMenu )
740  {
741  /* FIXME: Do what? */
742  }
743 
744  DeleteMenu(hMenu, MF_BYPOSITION, uPos);
745  return TRUE;
746 }
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1642
#define MIIM_SUBMENU
Definition: winuser.h:718
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
struct tagMENUITEMINFOW MENUITEMINFOW

◆ FileMenu_DeleteSeparator()

BOOL WINAPI FileMenu_DeleteSeparator ( HMENU  hMenu)

Definition at line 762 of file shlmenu.c.

763 {
764  TRACE("%p\n", hMenu);
765  return FALSE;
766 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ FileMenu_Destroy()

void WINAPI FileMenu_Destroy ( HMENU  hmenu)

Definition at line 285 of file shlmenu.c.

286 {
287  LPFMINFO menudata;
288 
289  TRACE("%p\n", hmenu);
290 
292 
293  menudata = FM_GetMenuInfo(hmenu);
294 
295  SHFree( menudata->pidl);
296  HeapFree(GetProcessHeap(), 0, menudata);
297 
298  DestroyMenu (hmenu);
299 }
static HMENU hmenu
Definition: win.c:66
LPITEMIDLIST pidl
Definition: shlmenu.c:54
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
BOOL WINAPI FileMenu_DeleteAllItems(HMENU hmenu)
Definition: shlmenu.c:670
Definition: shlmenu.c:44
BOOL WINAPI DestroyMenu(_In_ HMENU)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by FileMenu_DeleteAllItems().

◆ FileMenu_DrawItem()

LRESULT WINAPI FileMenu_DrawItem ( HWND  hWnd,
LPDRAWITEMSTRUCT  lpdis 
)

Definition at line 587 of file shlmenu.c.

590 {
591  LPFMITEM pMyItem = (LPFMITEM)(lpdis->itemData);
592  COLORREF clrPrevText, clrPrevBkgnd;
593  int xi,yi,xt,yt;
594  HIMAGELIST hImageList;
595  RECT TextRect;
596  LPFMINFO menuinfo;
597 
598  TRACE("%p %p %s\n", hWnd, lpdis, debugstr_w(pMyItem->szItemText));
599 
600  if (lpdis->itemState & ODS_SELECTED)
601  {
602  clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHTTEXT));
603  clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_HIGHLIGHT));
604  }
605  else
606  {
607  clrPrevText = SetTextColor(lpdis->hDC, GetSysColor (COLOR_MENUTEXT));
608  clrPrevBkgnd = SetBkColor(lpdis->hDC, GetSysColor (COLOR_MENU));
609  }
610 
611  TextRect = lpdis->rcItem;
612 
613  /* add the menubitmap */
614  menuinfo = FM_GetMenuInfo(pMyItem->hMenu);
615  if (menuinfo->nBorderWidth)
616  TextRect.left += menuinfo->nBorderWidth;
617 
618  TextRect.left += FM_LEFTBORDER;
619  xi = TextRect.left + FM_SPACE1;
620  yi = TextRect.top + FM_Y_SPACE/2;
621  TextRect.bottom -= FM_Y_SPACE/2;
622 
623  xt = xi + FM_ICON_SIZE + FM_SPACE2;
624  yt = yi;
625 
626  ExtTextOutW (lpdis->hDC, xt , yt, ETO_OPAQUE, &TextRect, pMyItem->szItemText, pMyItem->cchItemText, NULL);
627 
628  Shell_GetImageLists(0, &hImageList);
629  ImageList_Draw(hImageList, pMyItem->iIconIndex, lpdis->hDC, xi, yi, ILD_NORMAL);
630 
631  TRACE("-- %s\n", wine_dbgstr_rect(&TextRect));
632 
633  SetTextColor(lpdis->hDC, clrPrevText);
634  SetBkColor(lpdis->hDC, clrPrevBkgnd);
635 
636  return TRUE;
637 }
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 TRUE
Definition: types.h:120
#define COLOR_HIGHLIGHT
Definition: winuser.h:916
struct FMITEM * LPFMITEM
HWND hWnd
Definition: settings.c:17
LONG top
Definition: windef.h:292
ULONG_PTR itemData
Definition: winuser.h:3067
#define FM_SPACE2
Definition: shlmenu.c:553
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
LONG left
Definition: windef.h:291
DWORD WINAPI GetSysColor(_In_ int)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define ETO_OPAQUE
Definition: wingdi.h:646
#define FM_LEFTBORDER
Definition: shlmenu.c:554
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_MENU
Definition: winuser.h:907
int iIconIndex
Definition: shlmenu.c:63
#define FM_Y_SPACE
Definition: shlmenu.c:551
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:917
#define TRACE(s)
Definition: solgame.cpp:4
DWORD COLORREF
Definition: windef.h:285
const char * wine_dbgstr_rect(const RECT *rect)
#define COLOR_MENUTEXT
Definition: winuser.h:910
#define FM_ICON_SIZE
Definition: shlmenu.c:550
Definition: shlmenu.c:44
WCHAR szItemText[1]
Definition: shlmenu.c:65
#define FM_SPACE1
Definition: shlmenu.c:552
BOOL WINAPI Shell_GetImageLists(HIMAGELIST *lpBigList, HIMAGELIST *lpSmallList)
Definition: iconcache.cpp:706
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
Definition: shlmenu.c:61
int cchItemText
Definition: shlmenu.c:62
#define ODS_SELECTED
Definition: winuser.h:2520
LONG bottom
Definition: windef.h:294
int nBorderWidth
Definition: shlmenu.c:50
#define ILD_NORMAL
Definition: commctrl.h:413
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74
HMENU hMenu
Definition: shlmenu.c:64

◆ FileMenu_EnableItemByCmd()

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

Definition at line 771 of file shlmenu.c.

775 {
776  TRACE("%p 0x%08x 0x%08x\n", hMenu, uID,bEnable);
777  return FALSE;
778 }
#define TRACE(s)
Definition: solgame.cpp:4
_In_ BOOL bEnable
Definition: winddi.h:3426

◆ FileMenu_FindSubMenuByPidl()

HMENU WINAPI FileMenu_FindSubMenuByPidl ( HMENU  hMenu,
LPCITEMIDLIST  pidl 
)

Definition at line 468 of file shlmenu.c.

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

◆ FileMenu_GetItemExtent()

DWORD WINAPI FileMenu_GetItemExtent ( HMENU  hMenu,
UINT  uPos 
)

Definition at line 786 of file shlmenu.c.

787 { RECT rect;
788 
789  FIXME("%p 0x%08x\n", hMenu, uPos);
790 
791  if (GetMenuItemRect(0, hMenu, uPos, &rect))
792  {
793  FIXME("%s\n", wine_dbgstr_rect(&rect));
794  return ((rect.right-rect.left)<<16) + (rect.top-rect.bottom);
795  }
796  return 0x00100010; /*FIXME*/
797 }
& rect
Definition: startmenu.cpp:1413
#define FIXME(fmt,...)
Definition: debug.h:110
const char * wine_dbgstr_rect(const RECT *rect)
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 541 of file shlmenu.c.

545 {
546  FIXME("0x%08x %p %p\n",uReserved, ppidlFolder, ppidlItem);
547  return FALSE;
548 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ FileMenu_HandleMenuChar()

LRESULT WINAPI FileMenu_HandleMenuChar ( HMENU  hMenu,
WPARAM  wParam 
)

Definition at line 656 of file shlmenu.c.

659 {
660  FIXME("%p 0x%08lx\n",hMenu,wParam);
661  return 0;
662 }
WPARAM wParam
Definition: combotst.c:138
#define FIXME(fmt,...)
Definition: debug.h:110

◆ FileMenu_InitMenuPopup()

BOOL WINAPI FileMenu_InitMenuPopup ( HMENU  hmenu)

Definition at line 647 of file shlmenu.c.

648 {
650  return TRUE;
651 }
#define TRUE
Definition: types.h:120
static HMENU hmenu
Definition: win.c:66
smooth NULL
Definition: ftsmooth.c:416
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
Definition: shlmenu.c:129

◆ FileMenu_InsertUsingPidl()

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

Definition at line 415 of file shlmenu.c.

422 {
423  TRACE("%p 0x%08x %p 0x%08x 0x%08x %p\n",
424  hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
425 
426  pdump (pidl);
427 
428  bAbortInit = FALSE;
429 
430  FM_SetMenuParameter(hmenu, uID, pidl, uFlags, uEnumFlags, lpfnCallback);
431 
432  return FM_InitMenuPopup(hmenu, NULL);
433 }
static LPFMINFO FM_SetMenuParameter(HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
Definition: shlmenu.c:100
static HMENU hmenu
Definition: win.c:66
UINT uFlags
Definition: api.c:59
smooth NULL
Definition: ftsmooth.c:416
static BOOL bAbortInit
Definition: shlmenu.c:68
#define TRACE(s)
Definition: solgame.cpp:4
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
Definition: shlmenu.c:129
void pdump(LPCITEMIDLIST pidl)
Definition: debughlp.cpp:248

Referenced by FileMenu_AddFilesForPidl().

◆ FileMenu_Invalidate()

void WINAPI FileMenu_Invalidate ( HMENU  hMenu)

Definition at line 460 of file shlmenu.c.

461 {
462  FIXME("%p\n",hMenu);
463 }
#define FIXME(fmt,...)
Definition: debug.h:110

◆ FileMenu_MeasureItem()

LRESULT WINAPI FileMenu_MeasureItem ( HWND  hWnd,
LPMEASUREITEMSTRUCT  lpmis 
)

Definition at line 559 of file shlmenu.c.

562 {
563  LPFMITEM pMyItem = (LPFMITEM)(lpmis->itemData);
564  HDC hdc = GetDC(hWnd);
565  SIZE size;
566  LPFMINFO menuinfo;
567 
568  TRACE("%p %p %s\n", hWnd, lpmis, debugstr_w(pMyItem->szItemText));
569 
570  GetTextExtentPoint32W(hdc, pMyItem->szItemText, pMyItem->cchItemText, &size);
571 
573  lpmis->itemHeight = (size.cy > (FM_ICON_SIZE + FM_Y_SPACE)) ? size.cy : (FM_ICON_SIZE + FM_Y_SPACE);
574 
575  /* add the menubitmap */
576  menuinfo = FM_GetMenuInfo(pMyItem->hMenu);
577  if (menuinfo->nBorderWidth)
578  lpmis->itemWidth += menuinfo->nBorderWidth;
579 
580  TRACE("-- 0x%04x 0x%04x\n", lpmis->itemWidth, lpmis->itemHeight);
581  ReleaseDC (hWnd, hdc);
582  return 0;
583 }
struct FMITEM * LPFMITEM
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
#define FM_SPACE2
Definition: shlmenu.c:553
#define FM_LEFTBORDER
Definition: shlmenu.c:554
#define debugstr_w
Definition: kernel32.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define FM_Y_SPACE
Definition: shlmenu.c:551
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define FM_RIGHTBORDER
Definition: shlmenu.c:555
#define FM_ICON_SIZE
Definition: shlmenu.c:550
Definition: shlmenu.c:44
HDC hdc
Definition: main.c:9
WCHAR szItemText[1]
Definition: shlmenu.c:65
ULONG_PTR itemData
Definition: winuser.h:3620
#define FM_SPACE1
Definition: shlmenu.c:552
Definition: shlmenu.c:61
int cchItemText
Definition: shlmenu.c:62
int nBorderWidth
Definition: shlmenu.c:50
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74
HMENU hMenu
Definition: shlmenu.c:64
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

◆ FileMenu_ReplaceUsingPidl()

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

Definition at line 440 of file shlmenu.c.

446 {
447  TRACE("%p 0x%08x %p 0x%08x %p\n",
448  hmenu, uID, pidl, uEnumFlags, lpfnCallback);
449 
451 
452  FM_SetMenuParameter(hmenu, uID, pidl, 0, uEnumFlags, lpfnCallback);
453 
454  return FM_InitMenuPopup(hmenu, NULL);
455 }
static LPFMINFO FM_SetMenuParameter(HMENU hmenu, UINT uID, LPCITEMIDLIST pidl, UINT uFlags, UINT uEnumFlags, LPFNFMCALLBACK lpfnCallback)
Definition: shlmenu.c:100
static HMENU hmenu
Definition: win.c:66
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI FileMenu_DeleteAllItems(HMENU hmenu)
Definition: shlmenu.c:670
static int FM_InitMenuPopup(HMENU hmenu, LPCITEMIDLIST pAlternatePidl)
Definition: shlmenu.c:129

◆ FileMenu_TrackPopupMenuEx()

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

Definition at line 525 of file shlmenu.c.

532 {
533  TRACE("%p 0x%08x 0x%x 0x%x %p %p\n",
534  hMenu, uFlags, x, y, hWnd, lptpm);
535  return TrackPopupMenuEx(hMenu, uFlags, x, y, hWnd, lptpm);
536 }
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
UINT uFlags
Definition: api.c:59
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ 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 }
struct tagMENUINFO MENUINFO
static HMENU hmenu
Definition: win.c:66
smooth NULL
Definition: ftsmooth.c:416
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: shlmenu.c:44
menu info structure
Definition: window.h:275
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI GetMenuInfo(_In_ HMENU, _Inout_ LPMENUINFO)
struct FMINFO * LPFMINFO

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  {
234  static const WCHAR szEmpty[] = { '(','e','m','p','t','y',')',0 };
236  NumberOfItems++;
237  }
238 
239  menudata->bInitialized = TRUE;
241 
242  return NumberOfItems;
243 }
struct tagMENUINFO MENUINFO
#define TRUE
Definition: types.h:120
UINT uEnumFlags
Definition: shlmenu.c:57
static HMENU hmenu
Definition: win.c:66
LPFNFMCALLBACK lpfnCallback
Definition: shlmenu.c:58
#define FM_DEFAULT_HEIGHT
Definition: undocshell.h:248
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:699
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
Definition: shtypes.idl:42
#define ILGDN_FORPARSING
Definition: undocshell.h:68
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL bInitialized
Definition: shlmenu.c:46
void(CALLBACK * LPFNFMCALLBACK)(LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlFile)
Definition: undocshell.h:263
smooth NULL
Definition: ftsmooth.c:416
BOOL ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR path, DWORD type)
Definition: pidl.c:91
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:442
LPITEMIDLIST pidl
Definition: shlmenu.c:54
static BOOL bAbortInit
Definition: shlmenu.c:68
static const WCHAR szEmpty[]
Definition: provider.c:50
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL FileMenu_AppendItemW(HMENU hMenu, LPCWSTR lpText, UINT uID, int icon, HMENU hMenuPopup, int nItemHeight)
Definition: shlmenu.c:305
#define MAX_PATH
Definition: compat.h:26
Definition: shlmenu.c:44
#define FM_BLANK_ICON
Definition: undocshell.h:247
menu info structure
Definition: window.h:275
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI SetMenuInfo(_In_ HMENU, _In_ LPCMENUINFO)
BOOL WINAPI GetMenuInfo(_In_ HMENU, _Inout_ LPMENUINFO)
UINT uID
Definition: shlmenu.c:55
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
struct FMINFO * LPFMINFO
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
BOOL PidlToSicIndex(IShellFolder *sh, LPCITEMIDLIST pidl, BOOL bBigIcon, UINT uFlags, int *pIndex)
Definition: iconcache.cpp:732
WCHAR * LPWSTR
Definition: xmlstorage.h:184
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 }
UINT uEnumFlags
Definition: shlmenu.c:57
static HMENU hmenu
Definition: win.c:66
LPFNFMCALLBACK lpfnCallback
Definition: shlmenu.c:58
UINT uFlags
Definition: api.c:59
LPITEMIDLIST pidl
Definition: shlmenu.c:54
#define TRACE(s)
Definition: solgame.cpp:4
UINT uFlags
Definition: shlmenu.c:56
Definition: shlmenu.c:44
LPITEMIDLIST WINAPI ILClone(LPCITEMIDLIST pidl)
Definition: pidl.c:228
UINT uID
Definition: shlmenu.c:55
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331
static LPFMINFO FM_GetMenuInfo(HMENU hmenu)
Definition: shlmenu.c:74

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 857 of file shlmenu.c.

858 { int nItem;
859  HMENU hmSubMenu;
860  BOOL bAlreadySeparated;
861  MENUITEMINFOW miiSrc;
862  WCHAR szName[256];
863  UINT uTemp, uIDMax = uIDAdjust;
864 
865  TRACE("hmenu1=%p hmenu2=%p 0x%04x 0x%04x 0x%04x 0x%04x\n",
866  hmDst, hmSrc, uInsert, uIDAdjust, uIDAdjustMax, uFlags);
867 
868  if (!hmDst || !hmSrc)
869  return uIDMax;
870 
871  nItem = GetMenuItemCount(hmDst);
872  if (nItem == -1)
873  return uIDMax;
874 
875  if (uInsert >= (UINT)nItem) /* insert position inside menu? */
876  {
877  uInsert = (UINT)nItem; /* append on the end */
878  bAlreadySeparated = TRUE;
879  }
880  else
881  {
882  bAlreadySeparated = _SHIsMenuSeparator(hmDst, uInsert);
883  }
884 
885  if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
886  {
887  /* Add a separator between the menus */
888  InsertMenuA(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
889  bAlreadySeparated = TRUE;
890  }
891 
892 
893  /* Go through the menu items and clone them*/
894  for (nItem = GetMenuItemCount(hmSrc) - 1; nItem >= 0; nItem--)
895  {
896  miiSrc.cbSize = sizeof(MENUITEMINFOW);
898 
899  /* We need to reset this every time through the loop in case menus DON'T have IDs*/
900  miiSrc.fType = MFT_STRING;
901  miiSrc.dwTypeData = szName;
902  miiSrc.dwItemData = 0;
903  miiSrc.cch = sizeof(szName)/sizeof(WCHAR);
904 
905  if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
906  {
907  continue;
908  }
909 
910 /* 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);
911 */
912  if (miiSrc.fType & MFT_SEPARATOR)
913  {
914  /* This is a separator; don't put two of them in a row */
915  if (bAlreadySeparated)
916  continue;
917 
918  bAlreadySeparated = TRUE;
919  }
920  else if (miiSrc.hSubMenu)
921  {
923  {
924  miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
925 
926  if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax */
927  continue;
928 
929  if (uIDMax <= miiSrc.wID) /* remember the highest ID */
930  uIDMax = miiSrc.wID + 1;
931  }
932  else
933  {
934  miiSrc.fMask &= ~MIIM_ID; /* Don't set IDs for submenus that didn't have them already */
935  }
936  hmSubMenu = miiSrc.hSubMenu;
937 
938  miiSrc.hSubMenu = CreatePopupMenu();
939 
940  if (!miiSrc.hSubMenu) return(uIDMax);
941 
942  uTemp = Shell_MergeMenus(miiSrc.hSubMenu, hmSubMenu, 0, uIDAdjust, uIDAdjustMax, uFlags & MM_SUBMENUSHAVEIDS);
943 
944  if (uIDMax <= uTemp)
945  uIDMax = uTemp;
946 
947  bAlreadySeparated = FALSE;
948  }
949  else /* normal menu item */
950  {
951  miiSrc.wID += uIDAdjust; /* add uIDAdjust to the ID */
952 
953  if (miiSrc.wID > uIDAdjustMax) /* skip IDs higher than uIDAdjustMax */
954  continue;
955 
956  if (uIDMax <= miiSrc.wID) /* remember the highest ID */
957  uIDMax = miiSrc.wID + 1;
958 
959  bAlreadySeparated = FALSE;
960  }
961 
962 /* 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);
963 */
964  if (!InsertMenuItemW(hmDst, uInsert, TRUE, &miiSrc))
965  {
966  return(uIDMax);
967  }
968  }
969 
970  /* Ensure the correct number of separators at the beginning of the
971  inserted menu items*/
972  if (uInsert == 0)
973  {
974  if (bAlreadySeparated)
975  {
976  DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
977  }
978  }
979  else
980  {
981  if (_SHIsMenuSeparator(hmDst, uInsert-1))
982  {
983  if (bAlreadySeparated)
984  {
985  DeleteMenu(hmDst, uInsert, MF_BYPOSITION);
986  }
987  }
988  else
989  {
990  if ((uFlags & MM_ADDSEPARATOR) && !bAlreadySeparated)
991  {
992  /* Add a separator between the menus*/
993  InsertMenuW(hmDst, uInsert, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
994  }
995  }
996  }
997  return(uIDMax);
998 }
#define MFT_STRING
Definition: winuser.h:741
#define TRUE
Definition: types.h:120
UINT WINAPI Shell_MergeMenus(HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAdjust, UINT uIDAdjustMax, ULONG uFlags)
Definition: shlmenu.c:857
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
LPWSTR dwTypeData
Definition: winuser.h:3243
UINT uFlags
Definition: api.c:59
static BOOL _SHIsMenuSeparator(HMENU hm, int i)
Definition: shlmenu.c:834
#define MIIM_SUBMENU
Definition: winuser.h:718
#define MIIM_STATE
Definition: winuser.h:716
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MF_BYPOSITION
Definition: winuser.h:203
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
smooth NULL
Definition: ftsmooth.c:416
#define MF_SEPARATOR
Definition: winuser.h:137
#define MIIM_ID
Definition: winuser.h:717
BOOL WINAPI InsertMenuA(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCSTR)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MM_ADDSEPARATOR
Definition: shlobj.h:2319
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MFT_SEPARATOR
Definition: winuser.h:739
#define MIIM_TYPE
Definition: winuser.h:720
#define MIIM_CHECKMARKS
Definition: winuser.h:719
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
unsigned int UINT
Definition: ndis.h:50
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
#define MM_SUBMENUSHAVEIDS
Definition: shlobj.h:2320
static const WCHAR szName[]
Definition: msipriv.h:1194
#define MIIM_DATA
Definition: winuser.h:721
ULONG_PTR dwItemData
Definition: winuser.h:3242
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
struct tagMENUITEMINFOW MENUITEMINFOW

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

◆ SHFind_InitMenuPopup()

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

Definition at line 824 of file shlmenu.c.

825 {
826  FIXME("hmenu=%p hwnd=%p 0x%08x 0x%08x stub\n",
827  hMenu,hWndParent,w,x);
828  return NULL; /* this is supposed to be a pointer */
829 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

◆ 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().