ReactOS 0.4.16-dev-2204-g370eb8c
CFontBackgroundMenu Class Reference

#include <CFontBackgroundMenu.h>

Inheritance diagram for CFontBackgroundMenu:
Collaboration diagram for CFontBackgroundMenu:

Public Member Functions

 CFontBackgroundMenu ()
 
virtual ~CFontBackgroundMenu ()
 
HRESULT WINAPI Initialize (CFontExt *pFontExt, const DEFCONTEXTMENU *pdcm)
 
STDMETHODIMP QueryContextMenu (HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override
 
STDMETHODIMP InvokeCommand (LPCMINVOKECOMMANDINFO lpcmi) override
 
STDMETHODIMP GetCommandString (UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override
 
STDMETHODIMP HandleMenuMsg (UINT uMsg, WPARAM wParam, LPARAM lParam) override
 
STDMETHODIMP HandleMenuMsg2 (UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComMultiThreadModelNoCS >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 
HRESULT HandleMenuMsg2 ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam, [out] LRESULT *plResult)
 
HRESULT HandleMenuMsg ([in] UINT uMsg, [in] WPARAM wParam, [in] LPARAM lParam)
 
HRESULT QueryContextMenu ([in] HMENU hmenu, [in] UINT indexMenu, [in] UINT idCmdFirst, [in] UINT idCmdLast, [in] UINT uFlags)
 
HRESULT InvokeCommand ([in] LPCMINVOKECOMMANDINFO lpici)
 
HRESULT GetCommandString ([in] UINT_PTR idCmd, [in] UINT uType, [out] UINT *pwReserved, [out, size_is(cchMax)] LPSTR pszName, [in] UINT cchMax)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 

Private Attributes

HWND m_hwnd = nullptr
 
CFontExtm_pFontExt = nullptr
 
CComPtr< IShellFolderm_psf
 
CComPtr< IContextMenuCBm_pmcb
 
LPFNDFMCALLBACK m_pfnmcb = nullptr
 

Additional Inherited Members

- Public Types inherited from IContextMenu3
typedef IContextMenu3LPCONTEXTMENU3
 
- Public Types inherited from IContextMenu2
typedef IContextMenu2LPCONTEXTMENU2
 
- Public Types inherited from IContextMenu
typedef IContextMenuLPCONTEXTMENU
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFO CMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMINVOKECOMMANDINFOLPCMINVOKECOMMANDINFO
 
typedef struct IContextMenu::tagCMInvokeCommandInfoEx CMINVOKECOMMANDINFOEX
 
typedef struct IContextMenu::tagCMInvokeCommandInfoExLPCMINVOKECOMMANDINFOEX
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 
- Static Public Attributes inherited from IContextMenu
static const WCHAR CMDSTR_NEWFOLDERW [] = {'N','e','w','F','o','l','d','e','r',0}
 
static const WCHAR CMDSTR_VIEWLISTW [] = {'V','i','e','w','L','i','s','t',0}
 
static const WCHAR CMDSTR_VIEWDETAILSW [] = {'V','i','e','w','D','e','t','a','i','l','s',0}
 

Detailed Description

Definition at line 10 of file CFontBackgroundMenu.h.

Constructor & Destructor Documentation

◆ CFontBackgroundMenu()

CFontBackgroundMenu::CFontBackgroundMenu ( )

Definition at line 13 of file CFontBackgroundMenu.cpp.

14{
15}

◆ ~CFontBackgroundMenu()

CFontBackgroundMenu::~CFontBackgroundMenu ( )
virtual

Definition at line 17 of file CFontBackgroundMenu.cpp.

18{
19}

Member Function Documentation

◆ GetCommandString()

STDMETHODIMP CFontBackgroundMenu::GetCommandString ( UINT_PTR  idCommand,
UINT  uFlags,
UINT lpReserved,
LPSTR  lpszName,
UINT  uMaxNameLen 
)
override

Implements IContextMenu.

Definition at line 83 of file CFontBackgroundMenu.cpp.

84{
85 TRACE("%d\n", idCommand);
86 if (idCommand == 0)
87 {
88 lstrcpynA(lpszName, "properties", uMaxNameLen);
89 return S_OK;
90 }
91 return E_FAIL;
92}
#define E_FAIL
Definition: ddrawi.h:102
#define lstrcpynA
Definition: compat.h:751
#define S_OK
Definition: intsafe.h:52
#define TRACE(s)
Definition: solgame.cpp:4

◆ HandleMenuMsg()

STDMETHODIMP CFontBackgroundMenu::HandleMenuMsg ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
override

Implements IContextMenu2.

Definition at line 95 of file CFontBackgroundMenu.cpp.

96{
97 return HandleMenuMsg2(uMsg, wParam, lParam, NULL);
98}
STDMETHODIMP HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) override
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112

◆ HandleMenuMsg2()

STDMETHODIMP CFontBackgroundMenu::HandleMenuMsg2 ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT plResult 
)
override

Implements IContextMenu3.

Definition at line 101 of file CFontBackgroundMenu.cpp.

102{
103 if (uMsg == WM_INITMENUPOPUP)
104 {
105 HMENU hMenu = (HMENU)wParam;
107 return S_OK;
108 }
109 return E_NOTIMPL;
110}
#define E_NOTIMPL
Definition: ddrawi.h:99
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define FCIDM_SHVIEW_INSERTLINK
Definition: shresdef.h:875
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define WM_INITMENUPOPUP
Definition: winuser.h:1774

Referenced by HandleMenuMsg().

◆ Initialize()

HRESULT WINAPI CFontBackgroundMenu::Initialize ( CFontExt pFontExt,
const DEFCONTEXTMENU pdcm 
)

Definition at line 21 of file CFontBackgroundMenu.cpp.

22{
23 m_pFontExt = pFontExt;
24 m_psf = pdcm->psf;
25 m_pmcb = pdcm->pcmcb;
26 m_hwnd = pdcm->hwnd;
27 return S_OK;
28}
CComPtr< IContextMenuCB > m_pmcb
CComPtr< IShellFolder > m_psf
IContextMenuCB * pcmcb
Definition: shlobj.h:2556
IShellFolder * psf
Definition: shlobj.h:2558

◆ InvokeCommand()

STDMETHODIMP CFontBackgroundMenu::InvokeCommand ( LPCMINVOKECOMMANDINFO  lpcmi)
override

Implements IContextMenu.

Definition at line 40 of file CFontBackgroundMenu.cpp.

41{
42 INT idCmd = IS_INTRESOURCE(lpcmi->lpVerb) ? LOWORD(lpcmi->lpVerb) : -1;
43 TRACE("%d\n", idCmd);
44
45 if (idCmd == 0 || (idCmd == -1 && !lstrcmpiA(lpcmi->lpVerb, "properties")))
46 {
47 // Open "Fonts" properties
48 LPITEMIDLIST pidl = NULL;
50 if (FAILED_UNEXPECTEDLY(hr) || !pidl)
51 return E_FAIL;
52
53 SHELLEXECUTEINFOW sei = {
54 sizeof(sei), SEE_MASK_INVOKEIDLIST | SEE_MASK_ASYNCOK, NULL, L"properties",
55 NULL, NULL, NULL, SW_SHOWNORMAL, NULL, const_cast<LPITEMIDLIST>(pidl)
56 };
57 BOOL bOK = ShellExecuteExW(&sei);
58 if (pidl)
59 CoTaskMemFree(pidl);
60 return bOK ? S_OK : E_FAIL;
61 }
62
63 if (idCmd == FCIDM_SHVIEW_INSERT || (idCmd == -1 && !lstrcmpiA(lpcmi->lpVerb, "paste")))
64 {
65 CComPtr<IDataObject> pDataObj;
66 HRESULT hr = OleGetClipboard(&pDataObj);
67 if (FAILED_UNEXPECTEDLY(hr) || !CheckDataObject(pDataObj))
68 {
69 // Show error message
72 text.LoadStringW(IDS_INSTALL_FAILED);
74 return E_FAIL;
75 }
76
77 return SHSimulateDrop(m_pFontExt, pDataObj, 0, NULL, NULL);
78 }
79
80 return S_OK;
81}
#define IDS_INSTALL_FAILED
Definition: resource.h:9
#define IDS_REACTOS_FONTS_FOLDER
Definition: resource.h:7
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4227
#define IS_INTRESOURCE(x)
Definition: loader.c:613
const WCHAR * text
Definition: package.c:1794
HRESULT WINAPI OleGetClipboard(IDataObject **obj)
Definition: clipboard.c:2249
HRESULT WINAPI SHGetSpecialFolderLocation(HWND hwndOwner, INT nFolder, LPITEMIDLIST *ppidl)
Definition: shellpath.c:3384
BOOL WINAPI SHSimulateDrop(IDropTarget *pDrop, IDataObject *pDataObj, DWORD grfKeyState, PPOINTL lpPt, DWORD *pdwEffect)
Definition: ordinal.c:1828
#define FAILED_UNEXPECTEDLY
Definition: utils.cpp:30
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL CheckDataObject(IDataObject *pDataObj)
Definition: fontext.cpp:308
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define LOWORD(l)
Definition: pedump.c:82
static char title[]
Definition: ps.c:92
#define SEE_MASK_ASYNCOK
Definition: shellapi.h:43
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2723
HRESULT hr
Definition: shlfolder.c:183
#define CSIDL_FONTS
Definition: shlobj.h:2198
#define FCIDM_SHVIEW_INSERT
Definition: shresdef.h:873
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
int32_t INT
Definition: typedefs.h:58
#define SW_SHOWNORMAL
Definition: winuser.h:781
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:798

◆ QueryContextMenu()

STDMETHODIMP CFontBackgroundMenu::QueryContextMenu ( HMENU  hMenu,
UINT  indexMenu,
UINT  idCmdFirst,
UINT  idCmdLast,
UINT  uFlags 
)
override

Implements IContextMenu.

Definition at line 31 of file CFontBackgroundMenu.cpp.

32{
33 TRACE("%d\n", idCmdFirst);
35 INT idCmd = idCmdFirst;
36 AppendMenuW(hMenu, MF_STRING, idCmd++, strProp);
37 return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmd - idCmdFirst);
38}
#define IDS_PROPERTIES
Definition: resource.h:108
#define MAKE_HRESULT(sev, fac, code)
Definition: dmerror.h:29
#define SEVERITY_SUCCESS
Definition: winerror.h:177
#define MF_STRING
Definition: winuser.h:138
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)

Member Data Documentation

◆ m_hwnd

HWND CFontBackgroundMenu::m_hwnd = nullptr
private

Definition at line 14 of file CFontBackgroundMenu.h.

Referenced by Initialize(), and InvokeCommand().

◆ m_pfnmcb

LPFNDFMCALLBACK CFontBackgroundMenu::m_pfnmcb = nullptr
private

Definition at line 18 of file CFontBackgroundMenu.h.

◆ m_pFontExt

CFontExt* CFontBackgroundMenu::m_pFontExt = nullptr
private

Definition at line 15 of file CFontBackgroundMenu.h.

Referenced by Initialize(), and InvokeCommand().

◆ m_pmcb

CComPtr<IContextMenuCB> CFontBackgroundMenu::m_pmcb
private

Definition at line 17 of file CFontBackgroundMenu.h.

Referenced by Initialize().

◆ m_psf

CComPtr<IShellFolder> CFontBackgroundMenu::m_psf
private

Definition at line 16 of file CFontBackgroundMenu.h.

Referenced by Initialize().


The documentation for this class was generated from the following files: