reactos/dll/win32/shell32/shellmenu/CMenuSite.h
Joachim Henze 93ccb203ef [0.4.10][SHELL32] Backport format+logging-trivia, ARRAYSIZE/_countof
Picks various trivial improvements from newer branches, does not fix specific JIRA-tickets and also doesn't
*entirely* cover a specific PR, therefore none of those are mentioned here.
Main motivation is to reduce large scale white-noise diff between the branches, to make
future commits diffs (with some fixes that actually matter) smaller in size and therefore easier to review.

Specifically:
- large-scale formatting & logging improvements, including but not limited to 0.4.15-dev-7653-g 6f91b6c0fe
- strip trailing whitespace
- also typos like 'unkown', missing \n as it was
  part of 0.4.15-dev-6323-g 3854a5d8e9 and
  0.4.15-dev-4492-g 03422451b3
  (I left out the MOUSE_MOVE-one from that, because I consider the missing \n there intentional)
- ports back many usages of ARRAYSIZE/_countof as it was added as part of some commits from Hermes, e.g.:
  *partial* pick of 0.4.13-dev-622-g 8a30801516 and
  *partial* pick of 0.4.15-dev-3642-g 83be315abf (I left out the literals here for now, ...
    I *might* pick them later on their own, but not now. I first want to verify their isolated impact on all compilers generated file-sizes.
    Some of those changes would even increase the binary size, especially those where the same literal is used multiple times,
    because string-pooling is currently not enabled for all toolchains and configurations.)
- COpenWithMenu.cpp: strip double-semicolon
- COpenWithMenu.cpp && folder_options.cpp: add \n to some dbg-prints without increasing their length
- CFSDropTarget.cpp: add \n to some dbg-prints, strip some good-path-traces that are no longer present in master in return to avoid size increase, fix indentation
- CShellLink.cpp: add \n to some dbg-prints without increasing their length
- iconcache.cpp: fix wrong indentation
- shlfileop.cpp: partially pick 0.4.15-dev-7388-g d689cfe158 just the stripping of #ifdef __REACTOS__ but NOT the actual fix! (the ifdefs were only present in 0.4.14)
- 0.4.10 and lower: shellpath.c Strip some TRACEs with wrong format-strings, strip unused string my_DocumentsW

binary size of shell32.dll has tendency to shrink slightly, which is caused solely by the logging changes:

master          RosBEWin2.2.2 GCC8.4.0 dbg x86               10.538.496 (0.4.15-dev-7640-gbdcfc6b)
releases/0.4.14 RosBEWin2.2.2 GCC8.4.0 dbg x86  9.317.888 ->  9.316.684
releases/0.4.14 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.345.024 ->  9.345.024
releases/0.4.13 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.201.152 ->  9.200.640
releases/0.4.12 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.146.880 ->  9.146.880
releases/0.4.11 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.077.760 ->  9.077.248
releases/0.4.10 RosBEWin2.1.6 GCC4.7.2 dbg x86  9.074.176 ->  9.072.128
releases/0.4. 9 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.825.856 ->  8.824.832
releases/0.4. 8 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.740.864 ->  8.738.816
releases/0.4. 7 RosBEWin2.1.6 GCC4.7.2 dbg x86  8.668.160 ->  8.666.624
2024-02-25 01:50:03 +01:00

109 lines
4.6 KiB
C++

/*
* Shell Menu Site
*
* Copyright 2014 David Quintana
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma once
class CMenuSite :
public CComCoClass<CMenuSite, &CLSID_MenuBandSite>,
public CComObjectRootEx<CComMultiThreadModelNoCS>,
public CWindowImpl<CMenuSite, CWindow, CControlWinTraits>,
public IBandSite,
public IDeskBarClient,
public IOleCommandTarget,
public IInputObject,
public IInputObjectSite,
public IWinEventHandler,
public IServiceProvider
{
private:
CComPtr<IUnknown> m_DeskBarSite;
CComPtr<IUnknown> m_BandObject;
CComPtr<IDeskBand> m_DeskBand;
CComPtr<IWinEventHandler> m_WinEventHandler;
HWND m_hWndBand;
public:
CMenuSite();
virtual ~CMenuSite() {}
DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_MENU)
DECLARE_REGISTRY_RESOURCEID(IDR_MENUBANDSITE)
DECLARE_NOT_AGGREGATABLE(CMenuSite)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CMenuSite)
COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite)
COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient)
COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow)
COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget)
COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject)
COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite)
COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler)
COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider)
END_COM_MAP()
// IBandSite
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);
// IDeskBarClient
virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite);
virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc);
virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState);
// IOleWindow
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
// IOleCommandTarget
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);
// IInputObject
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg);
virtual HRESULT STDMETHODCALLTYPE HasFocusIO();
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg);
// IInputObjectSite
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus);
// IWinEventHandler
virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd);
virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult);
// IServiceProvider
virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject);
// Using custom message map instead
virtual BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD mapId = 0);
// UNIMPLEMENTED
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);
private:
IUnknown * ToIUnknown() { return static_cast<IDeskBarClient*>(this); }
};