ReactOS  0.4.14-dev-998-g623dd26
CMenuSite Class Reference

#include <CMenuSite.h>

Inheritance diagram for CMenuSite:
Collaboration diagram for CMenuSite:

Public Member Functions

 CMenuSite ()
 
virtual ~CMenuSite ()
 
virtual HRESULT STDMETHODCALLTYPE AddBand (IUnknown *punk)
 
virtual HRESULT STDMETHODCALLTYPE EnumBands (UINT uBand, DWORD *pdwBandID)
 
virtual HRESULT STDMETHODCALLTYPE QueryBand (DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName)
 
virtual HRESULT STDMETHODCALLTYPE GetBandObject (DWORD dwBandID, REFIID riid, VOID **ppv)
 
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite (IUnknown *punkSite)
 
virtual HRESULT STDMETHODCALLTYPE GetSize (DWORD dwWhich, LPRECT prc)
 
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC (DWORD dwState)
 
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *phwnd)
 
virtual HRESULT STDMETHODCALLTYPE QueryStatus (const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText)
 
virtual HRESULT STDMETHODCALLTYPE Exec (const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
 
virtual HRESULT STDMETHODCALLTYPE UIActivateIO (BOOL fActivate, LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE HasFocusIO ()
 
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO (LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus)
 
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner (HWND hWnd)
 
virtual HRESULT STDMETHODCALLTYPE OnWinEvent (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
 
virtual HRESULT STDMETHODCALLTYPE QueryService (REFGUID guidService, REFIID riid, void **ppvObject)
 
virtual BOOL ProcessWindowMessage (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId=0)
 
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
 
virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo (BANDSITEINFO *pbsinfo)
 
virtual HRESULT STDMETHODCALLTYPE RemoveBand (DWORD dwBandID)
 
virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo (const BANDSITEINFO *pbsinfo)
 
virtual HRESULT STDMETHODCALLTYPE SetBandState (DWORD dwBandID, DWORD dwMask, DWORD dwState)
 
virtual HRESULT STDMETHODCALLTYPE SetModeDBC (DWORD dwMode)
 
- 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 ()
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from IServiceProvider
HRESULT RemoteQueryService ([in] REFGUID guidService, [in] REFIID riid, [out, iid_is(riid)] IUnknown **ppvObject)
 

Private Member Functions

IUnknownToIUnknown ()
 

Private Attributes

CComPtr< IUnknownm_DeskBarSite
 
CComPtr< IUnknownm_BandObject
 
CComPtr< IDeskBandm_DeskBand
 
CComPtr< IWinEventHandler > m_WinEventHandler
 
HWND m_hWndBand
 

Additional Inherited Members

- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IOleCommandTarget
enum  OLECMDF {
  OLECMDF_SUPPORTED = 0x1, OLECMDF_ENABLED = 0x2, OLECMDF_LATCHED = 0x4, OLECMDF_NINCHED = 0x8,
  OLECMDF_INVISIBLE = 0x10, OLECMDF_DEFHIDEONCTXTMENU = 0x20
}
 
enum  OLECMDTEXTF { OLECMDTEXTF_NONE = 0, OLECMDTEXTF_NAME = 1, OLECMDTEXTF_STATUS = 2 }
 
enum  OLECMDEXECOPT { OLECMDEXECOPT_DODEFAULT = 0, OLECMDEXECOPT_PROMPTUSER = 1, OLECMDEXECOPT_DONTPROMPTUSER = 2, OLECMDEXECOPT_SHOWHELP = 3 }
 
enum  OLECMDID {
  OLECMDID_OPEN = 1, OLECMDID_NEW = 2, OLECMDID_SAVE = 3, OLECMDID_SAVEAS = 4,
  OLECMDID_SAVECOPYAS = 5, OLECMDID_PRINT = 6, OLECMDID_PRINTPREVIEW = 7, OLECMDID_PAGESETUP = 8,
  OLECMDID_SPELL = 9, OLECMDID_PROPERTIES = 10, OLECMDID_CUT = 11, OLECMDID_COPY = 12,
  OLECMDID_PASTE = 13, OLECMDID_PASTESPECIAL = 14, OLECMDID_UNDO = 15, OLECMDID_REDO = 16,
  OLECMDID_SELECTALL = 17, OLECMDID_CLEARSELECTION = 18, OLECMDID_ZOOM = 19, OLECMDID_GETZOOMRANGE = 20,
  OLECMDID_UPDATECOMMANDS = 21, OLECMDID_REFRESH = 22, OLECMDID_STOP = 23, OLECMDID_HIDETOOLBARS = 24,
  OLECMDID_SETPROGRESSMAX = 25, OLECMDID_SETPROGRESSPOS = 26, OLECMDID_SETPROGRESSTEXT = 27, OLECMDID_SETTITLE = 28,
  OLECMDID_SETDOWNLOADSTATE = 29, OLECMDID_STOPDOWNLOAD = 30, OLECMDID_ONTOOLBARACTIVATED = 31, OLECMDID_FIND = 32,
  OLECMDID_DELETE = 33, OLECMDID_HTTPEQUIV = 34, OLECMDID_HTTPEQUIV_DONE = 35, OLECMDID_ENABLE_INTERACTION = 36,
  OLECMDID_ONUNLOAD = 37, OLECMDID_PROPERTYBAG2 = 38, OLECMDID_PREREFRESH = 39, OLECMDID_SHOWSCRIPTERROR = 40,
  OLECMDID_SHOWMESSAGE = 41, OLECMDID_SHOWFIND = 42, OLECMDID_SHOWPAGESETUP = 43, OLECMDID_SHOWPRINT = 44,
  OLECMDID_CLOSE = 45, OLECMDID_ALLOWUILESSSAVEAS = 46, OLECMDID_DONTDOWNLOADCSS = 47, OLECMDID_UPDATEPAGESTATUS = 48,
  OLECMDID_PRINT2 = 49, OLECMDID_PRINTPREVIEW2 = 50, OLECMDID_SETPRINTTEMPLATE = 51, OLECMDID_GETPRINTTEMPLATE = 52,
  OLECMDID_PAGEACTIONBLOCKED = 55, OLECMDID_PAGEACTIONUIQUERY = 56, OLECMDID_FOCUSVIEWCONTROLS = 57, OLECMDID_FOCUSVIEWCONTROLSQUERY = 58,
  OLECMDID_SHOWPAGEACTIONMENU = 59, OLECMDID_ADDTRAVELENTRY = 60, OLECMDID_UPDATETRAVELENTRY = 61, OLECMDID_UPDATEBACKFORWARDSTATE = 62,
  OLECMDID_OPTICAL_ZOOM = 63, OLECMDID_OPTICAL_GETZOOMRANGE = 64, OLECMDID_WINDOWSTATECHANGED = 65, OLECMDID_ACTIVEXINSTALLSCOPE = 66,
  OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = 67, OLECMDID_SHOWTASKDLG = 68, OLECMDID_POPSTATEEVENT = 69, OLECMDID_VIEWPORT_MODE = 70,
  OLECMDID_LAYOUT_VIEWPORT_WIDTH = 71, OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72, OLECMDID_USER_OPTICAL_ZOOM = 73, OLECMDID_PAGEAVAILABLE = 74,
  OLECMDID_GETUSERSCALABLE = 75, OLECMDID_UPDATE_CARET = 76, OLECMDID_ENABLE_VISIBILITY = 77, OLECMDID_MEDIA_PLAYBACK = 78
}
 
typedef IOleCommandTargetLPOLECOMMANDTARGET
 
typedef enum IOleCommandTarget::OLECMDF OLECMDF
 
typedef struct IOleCommandTarget::_tagOLECMD OLECMD
 
typedef struct IOleCommandTarget::_tagOLECMDTEXT OLECMDTEXT
 
typedef enum IOleCommandTarget::OLECMDTEXTF OLECMDTEXTF
 
typedef enum IOleCommandTarget::OLECMDEXECOPT OLECMDEXECOPT
 
typedef enum IOleCommandTarget::OLECMDID OLECMDID
 
- Public Types inherited from IServiceProvider
typedef IServiceProviderLPSERVICEPROVIDER
 
- 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
 

Detailed Description

Definition at line 22 of file CMenuSite.h.

Constructor & Destructor Documentation

◆ CMenuSite()

CMenuSite::CMenuSite ( )

Definition at line 26 of file CMenuSite.cpp.

26  :
32 {
33 }
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
HWND m_hWndBand
Definition: CMenuSite.h:39
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37

◆ ~CMenuSite()

virtual CMenuSite::~CMenuSite ( )
inlinevirtual

Definition at line 43 of file CMenuSite.h.

43 {}

Member Function Documentation

◆ AddBand()

HRESULT STDMETHODCALLTYPE CMenuSite::AddBand ( IUnknown punk)
virtual

Implements IBandSite.

Definition at line 36 of file CMenuSite.cpp.

37 {
38  HRESULT hr;
39 
40  // Little helper, for readability
41 #define TO_HRESULT(x) ((HRESULT)(S_OK+(x)))
42 
43  CComPtr<IUnknown> pUnknown;
44 
46 
47  if (pUnknown == m_BandObject)
48  return TO_HRESULT(0);
49 
50  if (m_BandObject)
51  {
54  return hr;
55  }
56 
58  m_DeskBand = NULL;
60  m_hWndBand = NULL;
61 
62  if (!pUnknown)
63  return TO_HRESULT(0);
64 
67  return hr;
68 
69  hr = pUnknown->QueryInterface(IID_PPV_ARG(IWinEventHandler, &m_WinEventHandler));
71  return hr;
72 
74  if (FAILED_UNEXPECTEDLY(hr))
75  return hr;
76 
79  return hr;
80 
82 
83  return TO_HRESULT(0);
84 }
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
#define TO_HRESULT(x)
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1283
HWND m_hWndBand
Definition: CMenuSite.h:39
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1358
smooth NULL
Definition: ftsmooth.c:416
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
IUnknown * ToIUnknown()
Definition: CMenuSite.h:107
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)

◆ ContextSensitiveHelp()

HRESULT STDMETHODCALLTYPE CMenuSite::ContextSensitiveHelp ( BOOL  fEnterMode)
virtual

Definition at line 313 of file CMenuSite.cpp.

314 {
315  return E_NOTIMPL;
316 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ EnumBands()

HRESULT STDMETHODCALLTYPE CMenuSite::EnumBands ( UINT  uBand,
DWORD pdwBandID 
)
virtual

Implements IBandSite.

Definition at line 86 of file CMenuSite.cpp.

87 {
88  if (uBand != 0)
89  return E_FAIL;
90 
91  *pdwBandID = 0;
92 
93  return S_OK;
94 }
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:59

◆ Exec()

HRESULT STDMETHODCALLTYPE CMenuSite::Exec ( const GUID pguidCmdGroup,
DWORD  nCmdID,
DWORD  nCmdexecopt,
VARIANT pvaIn,
VARIANT pvaOut 
)
virtual

Implements IOleCommandTarget.

Definition at line 198 of file CMenuSite.cpp.

199 {
200  // Forward Exec calls directly to the parent deskbar
201  return IUnknown_Exec(m_DeskBarSite, *pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
202 }
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
HRESULT WINAPI IUnknown_Exec(IUnknown *lpUnknown, REFGUID pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
Definition: ordinal.c:1034

◆ GetBandObject()

HRESULT STDMETHODCALLTYPE CMenuSite::GetBandObject ( DWORD  dwBandID,
REFIID  riid,
VOID **  ppv 
)
virtual

Implements IBandSite.

Definition at line 96 of file CMenuSite.cpp.

97 {
98  if (dwBandID != 0 || m_BandObject == NULL)
99  {
100  *ppv = NULL;
101  return E_NOINTERFACE;
102  }
103 
104  return m_BandObject->QueryInterface(riid, ppv);
105 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416

◆ GetBandSiteInfo()

HRESULT STDMETHODCALLTYPE CMenuSite::GetBandSiteInfo ( BANDSITEINFO pbsinfo)
virtual

Implements IBandSite.

Definition at line 318 of file CMenuSite.cpp.

319 {
320  return E_NOTIMPL;
321 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ GetSize()

HRESULT STDMETHODCALLTYPE CMenuSite::GetSize ( DWORD  dwWhich,
LPRECT  prc 
)
virtual

Definition at line 128 of file CMenuSite.cpp.

129 {
130  memset(prc, 0, sizeof(*prc));
131 
132  if (dwWhich != 0)
133  return S_OK;
134 
135  if (m_DeskBand == NULL)
136  return S_OK;
137 
138  DESKBANDINFO info = { 0 };
139  info.dwMask = DBIM_MAXSIZE;
140 
141  m_DeskBand->GetBandInfo(0, 0, &info);
142 
143  prc->right = info.ptMaxSize.x;
144  prc->bottom = info.ptMaxSize.y;
145 
146  return S_OK;
147 }
DBIM_BKCOLOR struct tagDESKBANDINFO DESKBANDINFO
LONG right
Definition: windef.h:308
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
#define S_OK
Definition: intsafe.h:59
LONG bottom
Definition: windef.h:309
_Out_ LPRECT prc
Definition: ntgdi.h:1658
#define memset(x, y, z)
Definition: compat.h:39

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CMenuSite::GetWindow ( HWND phwnd)
virtual

Definition at line 149 of file CMenuSite.cpp.

150 {
151  if (!IsWindow())
152  return E_FAIL;
153 
154  *phwnd = m_hWnd;
155 
156  return S_OK;
157 }
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define E_FAIL
Definition: ddrawi.h:102
#define S_OK
Definition: intsafe.h:59

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CMenuSite::HasFocusIO ( )
virtual

Definition at line 348 of file CMenuSite.cpp.

349 {
350  return S_FALSE;
351 }
#define S_FALSE
Definition: winerror.h:2357

◆ IsWindowOwner()

HRESULT STDMETHODCALLTYPE CMenuSite::IsWindowOwner ( HWND  hWnd)
virtual

Definition at line 159 of file CMenuSite.cpp.

160 {
161  if (hWnd == m_hWnd)
162  return S_OK;
163 
164  if (!m_WinEventHandler)
165  return S_FALSE;
166 
167  return m_WinEventHandler->IsWindowOwner(hWnd);
168 }
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
HWND hWnd
Definition: settings.c:17
#define S_FALSE
Definition: winerror.h:2357
#define S_OK
Definition: intsafe.h:59

◆ OnFocusChangeIS()

HRESULT STDMETHODCALLTYPE CMenuSite::OnFocusChangeIS ( IUnknown punkObj,
BOOL  fSetFocus 
)
virtual

Definition at line 353 of file CMenuSite.cpp.

354 {
355  return S_OK;
356 }
#define S_OK
Definition: intsafe.h:59

◆ OnWinEvent()

HRESULT STDMETHODCALLTYPE CMenuSite::OnWinEvent ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT theResult 
)
virtual

Definition at line 170 of file CMenuSite.cpp.

171 {
172  if (!m_WinEventHandler)
173  return S_OK;
174 
175  return m_WinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, theResult);
176 }
UINT uMsg
Definition: menu.cpp:213
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
#define S_OK
Definition: intsafe.h:59
LPARAM lParam
Definition: combotst.c:139

◆ ProcessWindowMessage()

BOOL CMenuSite::ProcessWindowMessage ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
LRESULT lResult,
DWORD  mapId = 0 
)
virtual

Definition at line 272 of file CMenuSite.cpp.

273 {
274  HWND hWndTarget = NULL;
275  CComPtr<IUnknown> protectThis(this->ToIUnknown());
276 
277  switch (uMsg)
278  {
279  case WM_SIZE:
280  if (m_BandObject)
281  {
282  CComPtr<IMenuPopup> pMenuPopup;
283  if (SUCCEEDED(m_BandObject->QueryInterface(IID_PPV_ARG(IMenuPopup, &pMenuPopup))))
284  {
285  RECT Rect = { 0 };
287  pMenuPopup->OnPosRectChangeDB(&Rect);
288  }
289  }
290  hWndTarget = hWnd;
291  lResult = 1;
292  break;
293  case WM_NOTIFY:
294  hWndTarget = reinterpret_cast<LPNMHDR>(lParam)->hwndFrom;
295  break;
296  case WM_COMMAND:
297  hWndTarget = (HWND) lParam;
298  break;
299  default:
300  return FALSE;
301  }
302 
303  if (hWndTarget && m_WinEventHandler &&
304  m_WinEventHandler->IsWindowOwner(hWndTarget) == S_OK)
305  {
306  if (SUCCEEDED(m_WinEventHandler->OnWinEvent(hWndTarget, uMsg, wParam, lParam, &lResult)))
307  return TRUE;
308  }
309 
310  return FALSE;
311 }
#define TRUE
Definition: types.h:120
UINT uMsg
Definition: menu.cpp:213
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
HWND hWnd
Definition: settings.c:17
HANDLE HWND
Definition: compat.h:13
#define IID_PPV_ARG(Itype, ppType)
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
#define WM_SIZE
Definition: winuser.h:1593
#define WM_COMMAND
Definition: winuser.h:1722
IUnknown * ToIUnknown()
Definition: CMenuSite.h:107
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define S_OK
Definition: intsafe.h:59
LPARAM lParam
Definition: combotst.c:139
#define WM_NOTIFY
Definition: richedit.h:61
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryBand()

HRESULT STDMETHODCALLTYPE CMenuSite::QueryBand ( DWORD  dwBandID,
IDeskBand **  ppstb,
DWORD pdwState,
LPWSTR  pszName,
int  cchName 
)
virtual

Implements IBandSite.

Definition at line 107 of file CMenuSite.cpp.

108 {
109  if (dwBandID != 0)
110  return E_FAIL;
111 
112  if (!m_BandObject)
113  {
114  *ppstb = NULL;
115  return E_NOINTERFACE;
116  }
117 
118  HRESULT hr = m_BandObject->QueryInterface(IID_PPV_ARG(IDeskBand, ppstb));
119 
120  *pdwState = 1;
121 
122  if (cchName > 0)
123  pszName[0] = 0;
124 
125  return hr;
126 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
Definition: winbase.h:2723
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78

◆ QueryService()

HRESULT STDMETHODCALLTYPE CMenuSite::QueryService ( REFGUID  guidService,
REFIID  riid,
void **  ppvObject 
)
virtual

Implements IServiceProvider.

Definition at line 178 of file CMenuSite.cpp.

179 {
180  *ppvObject = NULL;
181 
182  if (IsEqualGUID(guidService, SID_SMenuBandBottom) ||
183  IsEqualGUID(guidService, SID_SMenuBandBottomSelected) ||
184  IsEqualGUID(guidService, SID_SMenuBandChild))
185  {
186  if (m_BandObject == NULL)
187  return E_NOINTERFACE;
188 
189  return IUnknown_QueryService(m_BandObject, guidService, riid, ppvObject);
190  }
191 
192  if (!m_DeskBarSite)
193  return E_NOINTERFACE;
194 
195  return IUnknown_QueryService(m_DeskBarSite, guidService, riid, ppvObject);
196 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1448
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
smooth NULL
Definition: ftsmooth.c:416
REFIID LPVOID * ppvObject
Definition: precomp.h:44
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ QueryStatus()

HRESULT STDMETHODCALLTYPE CMenuSite::QueryStatus ( const GUID pguidCmdGroup,
ULONG  cCmds,
OLECMD  prgCmds[],
OLECMDTEXT pCmdText 
)
virtual

Implements IOleCommandTarget.

Definition at line 204 of file CMenuSite.cpp.

205 {
206  // Forward QueryStatus calls directly to the parent deskbar
207  return IUnknown_QueryStatus(m_DeskBarSite, *pguidCmdGroup, cCmds, prgCmds, pCmdText);
208 }
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
HRESULT WINAPI IUnknown_QueryStatus(IUnknown *lpUnknown, REFGUID pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText)
Definition: ordinal.c:995

◆ RemoveBand()

HRESULT STDMETHODCALLTYPE CMenuSite::RemoveBand ( DWORD  dwBandID)
virtual

Implements IBandSite.

Definition at line 323 of file CMenuSite.cpp.

324 {
325  return E_NOTIMPL;
326 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetBandSiteInfo()

HRESULT STDMETHODCALLTYPE CMenuSite::SetBandSiteInfo ( const BANDSITEINFO pbsinfo)
virtual

Implements IBandSite.

Definition at line 328 of file CMenuSite.cpp.

329 {
330  return E_NOTIMPL;
331 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetBandState()

HRESULT STDMETHODCALLTYPE CMenuSite::SetBandState ( DWORD  dwBandID,
DWORD  dwMask,
DWORD  dwState 
)
virtual

Implements IBandSite.

Definition at line 333 of file CMenuSite.cpp.

334 {
335  return E_NOTIMPL;
336 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetDeskBarSite()

HRESULT STDMETHODCALLTYPE CMenuSite::SetDeskBarSite ( IUnknown punkSite)
virtual

Definition at line 210 of file CMenuSite.cpp.

211 {
212  HRESULT hr;
213 
214  CComPtr<IUnknown> protectThis(this->ToIUnknown());
215 
216  // Only initialize if a parent site is being assigned
217  if (punkSite)
218  {
219  HWND hWndSite;
220 
222 
223  hr = IUnknown_GetWindow(punkSite, &hWndSite);
224 
225  if (FAILED(hr) || !hWndSite)
226  return E_FAIL;
227 
228  if (!m_hWnd)
229  {
230  Create(hWndSite, NULL, L"MenuSite");
231  }
232 
233  m_DeskBarSite = punkSite;
234  }
235  else
236  {
237  // Otherwise, deinitialize.
238  if (m_DeskBand)
239  {
240  m_DeskBand->CloseDW(0);
241  }
242 
244 
245  m_BandObject = NULL;
246  m_DeskBand = NULL;
248  m_hWndBand = NULL;
249  m_hWnd = NULL;
251  }
252 
253  return S_OK;
254 }
HRESULT hr
Definition: shlfolder.c:183
_In_ BOOLEAN Create
Definition: pstypes.h:511
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
CComPtr< IWinEventHandler > m_WinEventHandler
Definition: CMenuSite.h:38
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1283
HWND m_hWndBand
Definition: CMenuSite.h:39
HRESULT WINAPI IUnknown_SetSite(IUnknown *obj, IUnknown *site)
Definition: ordinal.c:1358
CComPtr< IUnknown > m_DeskBarSite
Definition: CMenuSite.h:35
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
static const WCHAR L[]
Definition: oid.c:1250
IUnknown * ToIUnknown()
Definition: CMenuSite.h:107
#define S_OK
Definition: intsafe.h:59

◆ SetModeDBC()

HRESULT STDMETHODCALLTYPE CMenuSite::SetModeDBC ( DWORD  dwMode)
virtual

Definition at line 338 of file CMenuSite.cpp.

339 {
340  return E_NOTIMPL;
341 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ToIUnknown()

IUnknown* CMenuSite::ToIUnknown ( )
inlineprivate

Definition at line 107 of file CMenuSite.h.

107 { return static_cast<IDeskBarClient*>(this); }

Referenced by AddBand(), ProcessWindowMessage(), and SetDeskBarSite().

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CMenuSite::TranslateAcceleratorIO ( LPMSG  lpMsg)
virtual

Definition at line 343 of file CMenuSite.cpp.

344 {
345  return S_FALSE;
346 }
#define S_FALSE
Definition: winerror.h:2357

◆ UIActivateDBC()

HRESULT STDMETHODCALLTYPE CMenuSite::UIActivateDBC ( DWORD  dwState)
virtual

Definition at line 256 of file CMenuSite.cpp.

257 {
258  if (!m_DeskBand)
259  return S_OK;
260 
261  return m_DeskBand->ShowDW(dwState != 0);
262 }
CComPtr< IDeskBand > m_DeskBand
Definition: CMenuSite.h:37
#define S_OK
Definition: intsafe.h:59

◆ UIActivateIO()

HRESULT STDMETHODCALLTYPE CMenuSite::UIActivateIO ( BOOL  fActivate,
LPMSG  lpMsg 
)
virtual

Definition at line 264 of file CMenuSite.cpp.

265 {
266  if (lpMsg)
267  return E_FAIL;
268 
269  return IUnknown_UIActivateIO(m_BandObject, fActivate, lpMsg);
270 }
HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg)
Definition: ordinal.c:1580
CComPtr< IUnknown > m_BandObject
Definition: CMenuSite.h:36
#define E_FAIL
Definition: ddrawi.h:102

Member Data Documentation

◆ m_BandObject

CComPtr<IUnknown> CMenuSite::m_BandObject
private

◆ m_DeskBand

CComPtr<IDeskBand> CMenuSite::m_DeskBand
private

Definition at line 37 of file CMenuSite.h.

Referenced by AddBand(), GetSize(), SetDeskBarSite(), and UIActivateDBC().

◆ m_DeskBarSite

CComPtr<IUnknown> CMenuSite::m_DeskBarSite
private

Definition at line 35 of file CMenuSite.h.

Referenced by Exec(), QueryService(), QueryStatus(), and SetDeskBarSite().

◆ m_hWndBand

HWND CMenuSite::m_hWndBand
private

Definition at line 39 of file CMenuSite.h.

Referenced by AddBand(), and SetDeskBarSite().

◆ m_WinEventHandler

CComPtr<IWinEventHandler> CMenuSite::m_WinEventHandler
private

Definition at line 38 of file CMenuSite.h.

Referenced by AddBand(), IsWindowOwner(), OnWinEvent(), ProcessWindowMessage(), and SetDeskBarSite().


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