ReactOS  0.4.15-dev-439-g292f67a
CMenuDeskBar Class Reference

#include <CMenuDeskBar.h>

Inheritance diagram for CMenuDeskBar:
Collaboration diagram for CMenuDeskBar:

Public Member Functions

 CMenuDeskBar ()
 
virtual ~CMenuDeskBar ()
 
virtual HRESULT STDMETHODCALLTYPE Popup (POINTL *ppt, RECTL *prcExclude, MP_POPUPFLAGS dwFlags)
 
virtual HRESULT STDMETHODCALLTYPE OnSelect (DWORD dwSelectType)
 
virtual HRESULT STDMETHODCALLTYPE SetSubMenu (IMenuPopup *pmp, BOOL fSet)
 
virtual HRESULT STDMETHODCALLTYPE GetWindow (HWND *phwnd)
 
virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp (BOOL fEnterMode)
 
virtual HRESULT STDMETHODCALLTYPE SetSite (IUnknown *pUnkSite)
 
virtual HRESULT STDMETHODCALLTYPE GetSite (REFIID riid, PVOID *ppvSite)
 
virtual HRESULT STDMETHODCALLTYPE SetIconSize (DWORD iIcon)
 
virtual HRESULT STDMETHODCALLTYPE GetIconSize (DWORD *piIcon)
 
virtual HRESULT STDMETHODCALLTYPE SetBitmap (HBITMAP hBitmap)
 
virtual HRESULT STDMETHODCALLTYPE GetBitmap (HBITMAP *phBitmap)
 
virtual HRESULT STDMETHODCALLTYPE Initialize (THIS)
 
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 QueryService (REFGUID guidService, REFIID riid, void **ppvObject)
 
virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS (LPUNKNOWN lpUnknown, BOOL bFocus)
 
virtual HRESULT STDMETHODCALLTYPE UIActivateIO (BOOL bActivating, LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE HasFocusIO (THIS)
 
virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO (LPMSG lpMsg)
 
virtual HRESULT STDMETHODCALLTYPE SetClient (IUnknown *punkClient)
 
virtual HRESULT STDMETHODCALLTYPE GetClient (IUnknown **ppunkClient)
 
virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB (LPRECT prc)
 
- 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)
 
- Public Member Functions inherited from IDeskBar
HRESULT OnPosRectChangeDB ([in] RECT *prc)
 

Private Member Functions

virtual void OnFinalMessage (HWND hWnd)
 
LRESULT _OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnSize (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnNotify (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnActivate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnMouseActivate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnAppActivate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnWinIniChange (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnNcPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT _OnClose (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
HRESULT _AdjustForTheme (BOOL bFlatStyle)
 
BOOL _IsSubMenuParent (HWND hwnd)
 
HRESULT _CloseBar ()
 

Private Attributes

CComPtr< IUnknownm_Site
 
CComPtr< IUnknownm_Client
 
CComPtr< IMenuPopupm_SubMenuParent
 
CComPtr< IMenuPopupm_SubMenuChild
 
HWND m_ClientWindow
 
DWORD m_IconSize
 
HBITMAP m_Banner
 
BOOL m_Shown
 
DWORD m_ShowFlags
 
BOOL m_didAddRef
 

Additional Inherited Members

- 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 IUnknown
typedef IUnknownLPUNKNOWN
 
- Public Types inherited from IServiceProvider
typedef IServiceProviderLPSERVICEPROVIDER
 
- Public Types inherited from IMenuPopup
enum  tagMENUPOPUPSELECT {
  MPOS_EXECUTE = 0, MPOS_FULLCANCEL, MPOS_CANCELLEVEL, MPOS_SELECTLEFT,
  MPOS_SELECTRIGHT, MPOS_CHILDTRACKING
}
 
enum  tagMENUPOPUPPOPUPFLAGS {
  MPPF_SETFOCUS = 0x00000001, MPPF_INITIALSELECT = 0x00000002, MPPF_NOANIMATE = 0x00000004, MPPF_KEYBOARD = 0x00000010,
  MPPF_REPOSITION = 0x00000020, MPPF_FORCEZORDER = 0x00000040, MPPF_FINALSELECT = 0x00000080, MPPF_TOP = 0x20000000,
  MPPF_LEFT = 0x40000000, MPPF_RIGHT = 0x60000000, MPPF_BOTTOM = 0x80000000, MPPF_POS_MASK = 0xE0000000,
  MPPF_ALIGN_LEFT = 0x02000000, MPPF_ALIGN_RIGHT = 0x04000000
}
 
typedef int MP_POPUPFLAGS
 
- Public Types inherited from IOleWindow
typedef IOleWindowLPOLEWINDOW
 
- Public Types inherited from IObjectWithSite
typedef IObjectWithSiteLPOBJECTWITHSITE
 
- 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 27 of file CMenuDeskBar.h.

Constructor & Destructor Documentation

◆ CMenuDeskBar()

CMenuDeskBar::CMenuDeskBar ( )

Definition at line 48 of file CMenuDeskBar.cpp.

48  :
49  m_Client(NULL),
51  m_IconSize(0),
52  m_Banner(NULL),
53  m_Shown(FALSE),
54  m_ShowFlags(0),
56 {
57 }
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
smooth NULL
Definition: ftsmooth.c:416
HWND m_ClientWindow
Definition: CMenuDeskBar.h:46
DWORD m_ShowFlags
Definition: CMenuDeskBar.h:52
BOOL m_didAddRef
Definition: CMenuDeskBar.h:54
DWORD m_IconSize
Definition: CMenuDeskBar.h:48
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ ~CMenuDeskBar()

CMenuDeskBar::~CMenuDeskBar ( )
virtual

Definition at line 59 of file CMenuDeskBar.cpp.

60 {
61 }

Member Function Documentation

◆ _AdjustForTheme()

HRESULT CMenuDeskBar::_AdjustForTheme ( BOOL  bFlatStyle)
private

Definition at line 842 of file CMenuDeskBar.cpp.

843 {
846  SHSetWindowBits(m_hWnd, GWL_STYLE, mask, style);
847  return S_OK;
848 }
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG WINAPI SHSetWindowBits(HWND hwnd, INT offset, UINT mask, UINT flags)
Definition: ordinal.c:1123
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
#define S_OK
Definition: intsafe.h:59
#define WS_BORDER
Definition: pedump.c:625
Arabic default style
Definition: afstyles.h:93

Referenced by Exec().

◆ _CloseBar()

HRESULT CMenuDeskBar::_CloseBar ( )
private

Definition at line 618 of file CMenuDeskBar.cpp.

619 {
620  CComPtr<IDeskBarClient> dbc;
621  HRESULT hr;
622 
623  // Ensure that our data isn't destroyed while we are working
624  CComPtr<IDeskBar> safeThis = this;
625 
626  m_Shown = false;
627 
628  if (m_SubMenuParent)
629  {
630  m_SubMenuParent->SetSubMenu(this, FALSE);
631  }
632 
633  if (m_SubMenuChild)
634  {
635  hr = m_SubMenuChild->OnSelect(MPOS_CANCELLEVEL);
636  if (FAILED_UNEXPECTEDLY(hr))
637  return hr;
638  }
639 
640  hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
641  if (FAILED_UNEXPECTEDLY(hr))
642  return hr;
643 
644  hr = dbc->UIActivateDBC(FALSE);
645  if (FAILED_UNEXPECTEDLY(hr))
646  return hr;
647 
649 
650  return UIActivateIO(FALSE, NULL);
651 }
CComPtr< IMenuPopup > m_SubMenuChild
Definition: CMenuDeskBar.h:44
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
#define SWP_HIDEWINDOW
Definition: winuser.h:1226
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IMenuPopup > m_SubMenuParent
Definition: CMenuDeskBar.h:43
LONG HRESULT
Definition: typedefs.h:78
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg)
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

Referenced by OnSelect(), and SetSite().

◆ _IsSubMenuParent()

BOOL CMenuDeskBar::_IsSubMenuParent ( HWND  hwnd)
private

Definition at line 653 of file CMenuDeskBar.cpp.

654 {
655  CComPtr<IMenuPopup> popup = m_SubMenuParent;
656 
657  while (popup)
658  {
659  HRESULT hr;
660  HWND parent;
661 
662  hr = IUnknown_GetWindow(popup, &parent);
663  if (FAILED_UNEXPECTEDLY(hr))
664  return FALSE;
665  if (hwnd == parent)
666  return TRUE;
667 
668  hr = IUnknown_GetSite(popup, IID_PPV_ARG(IMenuPopup, &popup));
669  if (FAILED(hr))
670  return FALSE;
671  }
672 
673  return FALSE;
674 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite)
Definition: ordinal.c:2593
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
CComPtr< IMenuPopup > m_SubMenuParent
Definition: CMenuDeskBar.h:43
r parent
Definition: btrfs.c:2944
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71

Referenced by _OnActivate().

◆ _OnActivate()

LRESULT CMenuDeskBar::_OnActivate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 759 of file CMenuDeskBar.cpp.

760 {
761  // BUG in ReactOS: WM_ACTIVATE/WA_INACTIVE makes no sense with lParam==hWnd
762  if (LOWORD(wParam) != 0 || reinterpret_cast<HWND>(lParam) == m_hWnd)
763  {
764  return 0;
765  }
766 
767  // HACK! I just want it to work !!!
768  CComPtr<IDeskBar> db;
769  HRESULT hr = IUnknown_QueryService(m_Client, SID_SMenuBandChild, IID_PPV_ARG(IDeskBar, &db));
770  if (FAILED_UNEXPECTEDLY(hr))
771  return 0;
772 
773  CComPtr<IUnknown> punk;
774 
775  hr = db->GetClient(&punk);
776  if (FAILED_UNEXPECTEDLY(hr))
777  return 0;
778 
779  if (!punk && m_Shown)
780  {
781  if (!_IsSubMenuParent(reinterpret_cast<HWND>(lParam)))
782  {
784  }
785  }
786 
787  return 0;
788 }
BOOL _IsSubMenuParent(HWND hwnd)
HRESULT hr
Definition: shlfolder.c:183
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
WPARAM wParam
Definition: combotst.c:138
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType)
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ _OnAppActivate()

LRESULT CMenuDeskBar::_OnAppActivate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 795 of file CMenuDeskBar.cpp.

796 {
797 #if 0
798  if (wParam == 0 && m_Shown)
799  {
801  }
802 #endif
803  return 0;
804 }
WPARAM wParam
Definition: combotst.c:138
virtual HRESULT STDMETHODCALLTYPE OnSelect(DWORD dwSelectType)

◆ _OnClose()

LRESULT CMenuDeskBar::_OnClose ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 836 of file CMenuDeskBar.cpp.

837 {
838  /* Prevent the CMenuDeskBar from destroying on being sent a WM_CLOSE */
839  return 0;
840 }

◆ _OnCreate()

LRESULT CMenuDeskBar::_OnCreate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 63 of file CMenuDeskBar.cpp.

64 {
65  if (!m_didAddRef)
66  {
67  this->AddRef();
68  m_didAddRef = TRUE;
69  }
70 
71  bHandled = FALSE;
72  return 0;
73 }
#define TRUE
Definition: types.h:120
ULONG AddRef()
BOOL m_didAddRef
Definition: CMenuDeskBar.h:54

◆ _OnMouseActivate()

LRESULT CMenuDeskBar::_OnMouseActivate ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 790 of file CMenuDeskBar.cpp.

791 {
792  return MA_NOACTIVATE;
793 }
#define MA_NOACTIVATE
Definition: winuser.h:2478

◆ _OnNcPaint()

LRESULT CMenuDeskBar::_OnNcPaint ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 814 of file CMenuDeskBar.cpp.

815 {
816  /* If it is a flat style menu we need to handle WM_NCPAINT
817  * and paint the border with the right colour */
818  if ((GetStyle() & WS_BORDER) == 0)
819  {
820  /* This isn't a flat style menu. */
821  bHandled = FALSE;
822  return 0;
823  }
824 
825  HDC hdc;
826  RECT rcWindow;
827 
828  hdc = GetWindowDC();
829  GetWindowRect(&rcWindow);
830  OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top);
832  ReleaseDC(hdc);
833  return 0;
834 }
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: main.c:9
#define WS_BORDER
Definition: pedump.c:625
#define COLOR_BTNSHADOW
Definition: winuser.h:920
HDC WINAPI GetWindowDC(_In_opt_ HWND)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
int WINAPI FrameRect(_In_ HDC, _In_ LPCRECT, _In_ HBRUSH)

◆ _OnNotify()

LRESULT CMenuDeskBar::_OnNotify ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 697 of file CMenuDeskBar.cpp.

698 {
699  if (!m_Client)
700  return 0;
701 
702  CComPtr<IWinEventHandler> winEventHandler;
703  HRESULT hr = m_Client->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler));
704  if (FAILED_UNEXPECTEDLY(hr))
705  return 0;
706 
707  if (winEventHandler)
708  {
709  LRESULT result;
710  hr = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result);
711  if (FAILED_UNEXPECTEDLY(hr))
712  return 0;
713  return result;
714  }
715 
716  return 0;
717 }
HRESULT hr
Definition: shlfolder.c:183
UINT uMsg
Definition: menu.cpp:213
#define IID_PPV_ARG(Itype, ppType)
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LONG_PTR LRESULT
Definition: windef.h:209
GLuint64EXT * result
Definition: glext.h:11304
LPARAM lParam
Definition: combotst.c:139
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

Referenced by _OnWinIniChange().

◆ _OnPaint()

LRESULT CMenuDeskBar::_OnPaint ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 719 of file CMenuDeskBar.cpp.

720 {
721  bHandled = FALSE;
722 
723  if (m_Banner && !m_IconSize)
724  {
725  BITMAP bm;
726  PAINTSTRUCT ps;
727  HDC hdc = BeginPaint(&ps);
728 
731 
732  ::GetObject(m_Banner, sizeof(bm), &bm);
733 
734  RECT rc;
735  if (!GetClientRect(&rc))
736  WARN("GetClientRect failed\n");
737 
738  const int bx = bm.bmWidth;
739  const int by = bm.bmHeight;
740  const int cy = rc.bottom;
741 
742  TRACE("Painting banner: %d by %d\n", bm.bmWidth, bm.bmHeight);
743 
744  if (!::StretchBlt(hdc, 0, 0, bx, cy - by, hdcMem, 0, 0, bx, 1, SRCCOPY))
745  WARN("StretchBlt failed\n");
746 
747  if (!::BitBlt(hdc, 0, cy - by, bx, by, hdcMem, 0, 0, SRCCOPY))
748  WARN("BitBlt failed\n");
749 
750  ::SelectObject(hdcMem, hbmOld);
752 
753  EndPaint(&ps);
754  }
755 
756  return TRUE;
757 }
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
static HDC
Definition: imagelist.c:92
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_ PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
#define TRACE(s)
Definition: solgame.cpp:4
#define GetObject
Definition: wingdi.h:4467
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
GLbyte by
Definition: glext.h:8766
LONG bottom
Definition: windef.h:309
DWORD m_IconSize
Definition: CMenuDeskBar.h:48
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104

◆ _OnSize()

LRESULT CMenuDeskBar::_OnSize ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 676 of file CMenuDeskBar.cpp.

677 {
678  if (m_Client)
679  {
680  RECT rc;
681 
682  GetClientRect(&rc);
683 
684  if (m_Banner != NULL)
685  {
686  BITMAP bm;
687  ::GetObject(m_Banner, sizeof(bm), &bm);
688  rc.left += bm.bmWidth;
689  }
690 
691  ::SetWindowPos(m_ClientWindow, NULL, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, 0);
692  }
693 
694  return 0;
695 }
LONG top
Definition: windef.h:307
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
smooth NULL
Definition: ftsmooth.c:416
#define GetObject
Definition: wingdi.h:4467
HWND m_ClientWindow
Definition: CMenuDeskBar.h:46
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
Definition: bl.h:1331
LONG bottom
Definition: windef.h:309
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

Referenced by Popup(), SetBitmap(), and SetIconSize().

◆ _OnWinIniChange()

LRESULT CMenuDeskBar::_OnWinIniChange ( UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 806 of file CMenuDeskBar.cpp.

807 {
808  if (wParam == SPI_SETFLATMENU)
809  return _OnNotify(uMsg, wParam, lParam, bHandled);
810 
811  return 0;
812 }
UINT uMsg
Definition: menu.cpp:213
WPARAM wParam
Definition: combotst.c:138
LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
LPARAM lParam
Definition: combotst.c:139

◆ ContextSensitiveHelp()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::ContextSensitiveHelp ( BOOL  fEnterMode)
virtual

Implements IOleWindow.

Definition at line 97 of file CMenuDeskBar.cpp.

98 {
99  return E_NOTIMPL;
100 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Exec()

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

Implements IOleCommandTarget.

Definition at line 113 of file CMenuDeskBar.cpp.

115 {
116  if (IsEqualIID(*pguidCmdGroup, CGID_MenuDeskBar))
117  {
118  switch (nCmdID)
119  {
120  case 2: // refresh
121  return S_OK;
122  case 3: // load complete
123  return S_OK;
124  case 4: // set font metrics
125  return _AdjustForTheme(nCmdexecopt);
126  }
127  }
128  if (IsEqualIID(*pguidCmdGroup, CGID_Explorer))
129  {
130  }
131  else if (IsEqualIID(*pguidCmdGroup, IID_IDeskBarClient))
132  {
133  switch (nCmdID)
134  {
135  case 0:
136  // hide current band
137  break;
138  case 2:
139  break;
140  case 3:
141  break;
142  }
143  }
144  return E_NOTIMPL;
145 }
HRESULT _AdjustForTheme(BOOL bFlatStyle)
#define S_OK
Definition: intsafe.h:59
#define E_NOTIMPL
Definition: ddrawi.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ GetBitmap()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetBitmap ( HBITMAP phBitmap)
virtual

Definition at line 562 of file CMenuDeskBar.cpp.

563 {
564  if (phBitmap)
565  *phBitmap = m_Banner;
566  return S_OK;
567 }
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
#define S_OK
Definition: intsafe.h:59

◆ GetClient()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetClient ( IUnknown **  ppunkClient)
virtual

Implements IDeskBar.

Definition at line 234 of file CMenuDeskBar.cpp.

235 {
236  if (ppunkClient == NULL)
237  return E_POINTER;
238 
239  if (!m_Client)
240  return E_FAIL;
241 
242  return m_Client->QueryInterface(IID_PPV_ARG(IUnknown, ppunkClient));
243 }
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
#define E_POINTER
Definition: winerror.h:2365
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ GetIconSize()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetIconSize ( DWORD piIcon)
virtual

Definition at line 545 of file CMenuDeskBar.cpp.

546 {
547  if (piIcon)
548  *piIcon = m_IconSize;
549  return S_OK;
550 }
#define S_OK
Definition: intsafe.h:59
DWORD m_IconSize
Definition: CMenuDeskBar.h:48

◆ GetSite()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetSite ( REFIID  riid,
PVOID ppvSite 
)
virtual

Implements IObjectWithSite.

Definition at line 277 of file CMenuDeskBar.cpp.

278 {
279  if (m_Site == NULL)
280  return E_FAIL;
281 
282  return m_Site->QueryInterface(riid, ppvSite);
283 }
REFIID riid
Definition: precomp.h:44
#define E_FAIL
Definition: ddrawi.h:102
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IUnknown > m_Site
Definition: CMenuDeskBar.h:41

◆ GetWindow()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::GetWindow ( HWND phwnd)
virtual

Implements IOleWindow.

Definition at line 89 of file CMenuDeskBar.cpp.

90 {
91  if (lphwnd == NULL)
92  return E_POINTER;
93  *lphwnd = m_hWnd;
94  return S_OK;
95 }
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ HasFocusIO()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::HasFocusIO ( THIS  )
virtual

Definition at line 184 of file CMenuDeskBar.cpp.

185 {
187 }
HRESULT WINAPI IUnknown_HasFocusIO(IUnknown *lpUnknown)
Definition: ordinal.c:4182
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ Initialize()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize ( THIS  )
virtual

Definition at line 84 of file CMenuDeskBar.cpp.

85 {
86  return S_OK;
87 }
#define S_OK
Definition: intsafe.h:59

◆ OnFinalMessage()

void CMenuDeskBar::OnFinalMessage ( HWND  hWnd)
privatevirtual

Definition at line 75 of file CMenuDeskBar.cpp.

76 {
77  if (m_didAddRef)
78  {
79  this->Release();
81  }
82 }
ULONG Release()
BOOL m_didAddRef
Definition: CMenuDeskBar.h:54

◆ OnFocusChangeIS()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnFocusChangeIS ( LPUNKNOWN  lpUnknown,
BOOL  bFocus 
)
virtual

Definition at line 102 of file CMenuDeskBar.cpp.

103 {
104  return IUnknown_OnFocusChangeIS(m_Client, punkObj, fSetFocus);
105 }
HRESULT WINAPI IUnknown_OnFocusChangeIS(LPUNKNOWN lpUnknown, LPUNKNOWN pFocusObject, BOOL bFocus)
Definition: ordinal.c:4652
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ OnPosRectChangeDB()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnPosRectChangeDB ( LPRECT  prc)
virtual

Definition at line 245 of file CMenuDeskBar.cpp.

246 {
247  if (prc == NULL)
248  return E_POINTER;
249 
250  return S_OK;
251 }
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
_Out_ LPRECT prc
Definition: ntgdi.h:1658

◆ OnSelect()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnSelect ( DWORD  dwSelectType)
virtual

Implements IMenuPopup.

Definition at line 590 of file CMenuDeskBar.cpp.

591 {
592  CComPtr<IDeskBar> safeThis = this;
593  CComPtr<IMenuPopup> oldParent = m_SubMenuParent;
594 
595  TRACE("OnSelect dwSelectType=%d\n", this, dwSelectType);
596  switch (dwSelectType)
597  {
598  case MPOS_EXECUTE:
599  case MPOS_FULLCANCEL:
600  case MPOS_CANCELLEVEL:
601 
602  _CloseBar();
603 
604  if (dwSelectType == MPOS_CANCELLEVEL)
605  return S_OK;
606 
607  case MPOS_SELECTLEFT:
608  case MPOS_SELECTRIGHT:
609  case MPOS_CHILDTRACKING:
610  if (oldParent)
611  return oldParent->OnSelect(dwSelectType);
612  break;
613  }
614 
615  return S_OK;
616 }
HRESULT _CloseBar()
#define TRACE(s)
Definition: solgame.cpp:4
CComPtr< IMenuPopup > m_SubMenuParent
Definition: CMenuDeskBar.h:43
#define S_OK
Definition: intsafe.h:59

Referenced by _OnActivate(), and _OnAppActivate().

◆ Popup()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::Popup ( POINTL ppt,
RECTL prcExclude,
MP_POPUPFLAGS  dwFlags 
)
virtual

Implements IMenuPopup.

Definition at line 316 of file CMenuDeskBar.cpp.

317 {
318  HRESULT hr;
319  CComPtr<IOleCommandTarget> oct;
320  CComPtr<IInputObject> io;
321  CComPtr<IDeskBand> band;
322  CComPtr<IDeskBarClient> dbc;
323 
324  if (m_hWnd == NULL)
325  return E_FAIL;
326 
328  if (FAILED_UNEXPECTEDLY(hr))
329  return hr;
330 
331  hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &dbc));
332  if (FAILED_UNEXPECTEDLY(hr))
333  return hr;
334 
335  // Windows calls this, but it appears to be unimplemented?
336  hr = dbc->SetModeDBC(1);
337  // Allow it to fail with E_NOTIMPL.
338 
339  // No clue about the arg, using anything != 0
340  hr = dbc->UIActivateDBC(TRUE);
341  if (FAILED_UNEXPECTEDLY(hr))
342  return hr;
343 
344  RECT rc = { 0 };
345  hr = dbc->GetSize(0, &rc);
346  if (FAILED_UNEXPECTEDLY(hr))
347  return hr;
348 
349  // Unknown meaning
350  const int CMD = 19;
351  const int CMD_EXEC_OPT = 0;
352 
353  hr = IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand, CMD, CMD_EXEC_OPT, NULL, NULL);
354  if (FAILED_UNEXPECTEDLY(hr))
355  return hr;
356 
358  ::OffsetRect(&rc, -rc.left, -rc.top);
359 
360  if (m_Banner != NULL)
361  {
362  BITMAP bm;
363  ::GetObject(m_Banner, sizeof(bm), &bm);
364  rc.right += bm.bmWidth;
365  }
366 
367  RECT rcWorkArea;
368  ::GetWindowRect(GetDesktopWindow(), &rcWorkArea);
369  int cxWorkArea = rcWorkArea.right - rcWorkArea.left;
370  int cyWorkArea = rcWorkArea.bottom - rcWorkArea.top;
371 
372  int x = ppt->x;
373  int y = ppt->y;
374  int cx = rc.right - rc.left;
375  int cy = rc.bottom - rc.top;
376 
377  // TODO: Make alignLeft default to TRUE in LTR systems or whenever necessary.
378  BOOL alignLeft = FALSE;
379  BOOL alignTop = FALSE;
380  BOOL preferVertical = FALSE;
381  switch (dwFlags & MPPF_POS_MASK)
382  {
383  case MPPF_TOP:
384  alignTop = TRUE;
385  preferVertical = TRUE;
386  break;
387  case MPPF_LEFT:
388  alignLeft = TRUE;
389  break;
390  case MPPF_BOTTOM:
391  alignTop = FALSE;
392  preferVertical = TRUE;
393  break;
394  case MPPF_RIGHT:
395  alignLeft = FALSE;
396  break;
397  }
398 
399  // Try the selected alignment and verify that it doesn't escape the work area.
400  if (alignLeft)
401  {
402  x = ppt->x - cx;
403  }
404  else
405  {
406  x = ppt->x;
407  }
408 
409  if (alignTop)
410  {
411  y = ppt->y - cy;
412  }
413  else
414  {
415  y = ppt->y;
416  }
417 
418  if (prcExclude)
419  AdjustForExcludeArea(alignLeft, alignTop, preferVertical, &x, &y, cx, cy, *prcExclude);
420 
421  // Verify that it doesn't escape the work area, and flip.
422  if (alignLeft)
423  {
424  if (x < rcWorkArea.left && (ppt->x+cx) <= rcWorkArea.right)
425  {
426  alignLeft = FALSE;
427  if (prcExclude)
428  x = prcExclude->right - ((x + cx) - prcExclude->left);
429  else
430  x = ppt->x;
431  }
432  }
433  else
434  {
435  if ((ppt->x + cx) > rcWorkArea.right && x >= rcWorkArea.left)
436  {
437  alignLeft = TRUE;
438  if (prcExclude)
439  x = prcExclude->left - cx + (prcExclude->right - x);
440  else
441  x = ppt->x - cx;
442  }
443  }
444 
445  BOOL flipV = FALSE;
446  if (alignTop)
447  {
448  if (y < rcWorkArea.top && (ppt->y + cy) <= rcWorkArea.bottom)
449  {
450  alignTop = FALSE;
451  if (prcExclude)
452  y = prcExclude->bottom - ((y + cy) - prcExclude->top);
453  else
454  y = ppt->y;
455 
456  flipV = true;
457  }
458  }
459  else
460  {
461  if ((ppt->y + cy) > rcWorkArea.bottom && y >= rcWorkArea.top)
462  {
463  alignTop = TRUE;
464  if (prcExclude)
465  y = prcExclude->top - cy + (prcExclude->bottom - y);
466  else
467  y = ppt->y - cy;
468 
469  flipV = true;
470  }
471  }
472 
473  if (prcExclude)
474  AdjustForExcludeArea(alignLeft, alignTop, preferVertical, &x, &y, cx, cy, *prcExclude);
475 
476  if (x < rcWorkArea.left)
477  x = rcWorkArea.left;
478 
479  if (cx > cxWorkArea)
480  cx = cxWorkArea;
481 
482  if (x + cx > rcWorkArea.right)
483  x = rcWorkArea.right - cx;
484 
485  if (y < rcWorkArea.top)
486  y = rcWorkArea.top;
487 
488  if (cy > cyWorkArea)
489  cy = cyWorkArea;
490 
491  if (y + cy > rcWorkArea.bottom)
492  y = rcWorkArea.bottom - cy;
493 
495 
496  this->SetWindowPos(HWND_TOPMOST, x, y, cx, cy, flags);
497 
498  if (flipV)
499  {
502  else if (dwFlags & MPPF_FINALSELECT)
504  }
505 
507  m_Shown = true;
508 
509  // HACK: The bar needs to be notified of the size AFTER it is shown.
510  // Quick & dirty way of getting it done.
511  BOOL bHandled;
512  _OnSize(WM_SIZE, 0, 0, bHandled);
513 
515 
517  {
518  const int CMD_SELECT = 5;
519  int CMD_SELECT_OPTS = dwFlags & MPPF_INITIALSELECT ? 0 : -2;
520  IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand, CMD_SELECT, CMD_SELECT_OPTS, NULL, NULL);
521  }
522 
523  return S_OK;
524 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
LONG top
Definition: windef.h:307
long bottom
Definition: polytest.cpp:53
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
#define HWND_TOPMOST
Definition: winuser.h:1194
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut)
Definition: ordinal.c:1546
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#define IID_PPV_ARG(Itype, ppType)
#define E_FAIL
Definition: ddrawi.h:102
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
LONG y
Definition: windef.h:330
long right
Definition: polytest.cpp:53
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
unsigned int BOOL
Definition: ntddk_ex.h:94
long top
Definition: polytest.cpp:53
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:581
smooth NULL
Definition: ftsmooth.c:416
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:656
long left
Definition: polytest.cpp:53
#define WM_SIZE
Definition: winuser.h:1593
LONG HRESULT
Definition: typedefs.h:78
#define SWP_NOACTIVATE
Definition: winuser.h:1227
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
LONG x
Definition: windef.h:329
#define GetObject
Definition: wingdi.h:4467
GLbitfield flags
Definition: glext.h:7161
#define GetWindowLong
Definition: winuser.h:5771
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define GWL_STYLE
Definition: winuser.h:846
#define CMD
Definition: stat64.c:23
#define S_OK
Definition: intsafe.h:59
LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
Definition: bl.h:1331
static void AdjustForExcludeArea(BOOL alignLeft, BOOL alignTop, BOOL preferVertical, PINT px, PINT py, INT cx, INT cy, RECTL rcExclude)
DWORD m_ShowFlags
Definition: CMenuDeskBar.h:52
ios_base &_STLP_CALL oct(ios_base &__s)
Definition: _ios_base.h:327
virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL bActivating, LPMSG lpMsg)
#define SWP_SHOWWINDOW
Definition: winuser.h:1233
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_opt_ int * cx
Definition: commctrl.h:581
LONG bottom
Definition: windef.h:309
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ QueryService()

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

Implements IServiceProvider.

Definition at line 147 of file CMenuDeskBar.cpp.

148 {
149  HRESULT hr;
150 
151  if (IsEqualGUID(guidService, SID_SMenuPopup) ||
152  IsEqualGUID(guidService, SID_SMenuBandParent) ||
153  IsEqualGUID(guidService, SID_STopLevelBrowser))
154  {
155  hr = this->QueryInterface(riid, ppvObject);
156  if (SUCCEEDED(hr))
157  return hr;
158  }
159 
160  if (IsEqualGUID(guidService, SID_SMenuBandBottom) ||
161  IsEqualGUID(guidService, SID_SMenuBandBottomSelected) ||
162  IsEqualGUID(guidService, SID_SMenuBandChild))
163  {
164  if (m_Client == NULL)
165  return E_NOINTERFACE;
166 
167  hr = IUnknown_QueryService(m_Client, guidService, riid, ppvObject);
168  if (SUCCEEDED(hr))
169  return hr;
170  }
171 
172 
173  if (m_Site == NULL)
174  return E_NOINTERFACE;
175 
176  return IUnknown_QueryService(m_Site, guidService, riid, ppvObject);
177 }
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
REFIID LPVOID * ppvObject
Definition: precomp.h:44
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
CComPtr< IUnknown > m_Site
Definition: CMenuDeskBar.h:41
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ QueryStatus()

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

Implements IOleCommandTarget.

Definition at line 107 of file CMenuDeskBar.cpp.

109 {
110  return E_NOTIMPL;
111 }
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetBitmap()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetBitmap ( HBITMAP  hBitmap)
virtual

Definition at line 552 of file CMenuDeskBar.cpp.

553 {
554  m_Banner = hBitmap;
555 
556  BOOL bHandled;
557  _OnSize(WM_SIZE, 0, 0, bHandled);
558 
559  return S_OK;
560 }
HBITMAP m_Banner
Definition: CMenuDeskBar.h:49
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_SIZE
Definition: winuser.h:1593
#define S_OK
Definition: intsafe.h:59
LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
static HBITMAP hBitmap
Definition: timezone.c:26

◆ SetClient()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetClient ( IUnknown punkClient)
virtual

Implements IDeskBar.

Definition at line 194 of file CMenuDeskBar.cpp.

195 {
196  CComPtr<IDeskBarClient> pDeskBandClient;
197  HRESULT hr;
198 
199  if (m_Client)
200  {
201  hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDeskBandClient));
202  if (FAILED_UNEXPECTEDLY(hr))
203  return hr;
204 
205  pDeskBandClient->SetDeskBarSite(NULL);
206 
207  pDeskBandClient = NULL;
208  m_Client = NULL;
209  }
210 
211  if (punkClient == NULL)
212  return S_OK;
213 
214  if (m_hWnd == NULL)
215  {
216  Create(NULL);
217  }
218 
219  hr = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &m_Client));
220  if (FAILED_UNEXPECTEDLY(hr))
221  return hr;
222 
223  hr = m_Client->QueryInterface(IID_PPV_ARG(IDeskBarClient, &pDeskBandClient));
224  if (FAILED_UNEXPECTEDLY(hr))
225  return hr;
226 
227  hr = pDeskBandClient->SetDeskBarSite(static_cast<IDeskBar*>(this));
228  if (FAILED_UNEXPECTEDLY(hr))
229  return hr;
230 
232 }
HRESULT hr
Definition: shlfolder.c:183
_In_ BOOLEAN Create
Definition: pstypes.h:519
#define IID_PPV_ARG(Itype, ppType)
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
Definition: ordinal.c:1329
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
HWND m_ClientWindow
Definition: CMenuDeskBar.h:46
#define S_OK
Definition: intsafe.h:59
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

Referenced by SetSite().

◆ SetIconSize()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetIconSize ( DWORD  iIcon)
virtual

Definition at line 526 of file CMenuDeskBar.cpp.

527 {
528  HRESULT hr;
529  m_IconSize = iIcon;
530 
531  // Unknown meaning (set flags? set icon size?)
532  const int CMD = 16;
533  const int CMD_EXEC_OPT = iIcon ? 0 : 2; // seems to work
534 
535  hr = IUnknown_QueryServiceExec(m_Client, SID_SMenuBandChild, &CLSID_MenuBand, CMD, CMD_EXEC_OPT, NULL, NULL);
536  if (FAILED_UNEXPECTEDLY(hr))
537  return hr;
538 
539  BOOL bHandled;
540  _OnSize(WM_SIZE, 0, 0, bHandled);
541 
542  return hr;
543 }
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, const GUID *group, DWORD cmdId, DWORD cmdOpt, VARIANT *pIn, VARIANT *pOut)
Definition: ordinal.c:1546
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define WM_SIZE
Definition: winuser.h:1593
LONG HRESULT
Definition: typedefs.h:78
#define FAILED_UNEXPECTEDLY(hr)
Definition: shellutils.h:71
#define CMD
Definition: stat64.c:23
LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
DWORD m_IconSize
Definition: CMenuDeskBar.h:48
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ SetSite()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSite ( IUnknown pUnkSite)
virtual

Implements IObjectWithSite.

Definition at line 253 of file CMenuDeskBar.cpp.

254 {
255  // Windows closes the bar if this is called when the bar is shown
256 
257  if (m_Shown)
258  _CloseBar();
259 
261 
262  m_Site = pUnkSite;
263 
264  if (m_Site)
265  {
267  }
268  else
269  {
270  SetClient(NULL);
271  DestroyWindow();
272  }
273 
274  return S_OK;
275 }
virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient)
HRESULT _CloseBar()
#define IID_PPV_ARG(Itype, ppType)
BOOL WINAPI DestroyWindow(_In_ HWND)
HRESULT WINAPI IUnknown_QueryService(IUnknown *, REFGUID, REFIID, LPVOID *)
Definition: ordinal.c:1494
smooth NULL
Definition: ftsmooth.c:416
CComPtr< IMenuPopup > m_SubMenuParent
Definition: CMenuDeskBar.h:43
#define S_OK
Definition: intsafe.h:59
CComPtr< IUnknown > m_Site
Definition: CMenuDeskBar.h:41

◆ SetSubMenu()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::SetSubMenu ( IMenuPopup pmp,
BOOL  fSet 
)
virtual

Implements IMenuPopup.

Definition at line 569 of file CMenuDeskBar.cpp.

570 {
571  // Called by the MenuBand to assign itself as the logical child of the DeskBar
572 
573  if (fSet)
574  {
575  m_SubMenuChild = pmp;
576  }
577  else
578  {
579  if (m_SubMenuChild)
580  {
581  if (pmp == m_SubMenuChild)
582  {
584  }
585  }
586  }
587  return S_OK;
588 }
CComPtr< IMenuPopup > m_SubMenuChild
Definition: CMenuDeskBar.h:44
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

◆ TranslateAcceleratorIO()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::TranslateAcceleratorIO ( LPMSG  lpMsg)
virtual

Definition at line 189 of file CMenuDeskBar.cpp.

190 {
192 }
HRESULT WINAPI IUnknown_TranslateAcceleratorIO(IUnknown *lpUnknown, LPMSG lpMsg)
Definition: ordinal.c:4150
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

◆ UIActivateIO()

HRESULT STDMETHODCALLTYPE CMenuDeskBar::UIActivateIO ( BOOL  bActivating,
LPMSG  lpMsg 
)
virtual

Definition at line 179 of file CMenuDeskBar.cpp.

180 {
181  return IUnknown_UIActivateIO(m_Client, fActivate, lpMsg);
182 }
HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg)
Definition: ordinal.c:1626
CComPtr< IUnknown > m_Client
Definition: CMenuDeskBar.h:42

Referenced by _CloseBar(), and Popup().

Member Data Documentation

◆ m_Banner

HBITMAP CMenuDeskBar::m_Banner
private

Definition at line 49 of file CMenuDeskBar.h.

Referenced by _OnPaint(), _OnSize(), GetBitmap(), Popup(), and SetBitmap().

◆ m_Client

◆ m_ClientWindow

HWND CMenuDeskBar::m_ClientWindow
private

Definition at line 46 of file CMenuDeskBar.h.

Referenced by _OnSize(), and SetClient().

◆ m_didAddRef

BOOL CMenuDeskBar::m_didAddRef
private

Definition at line 54 of file CMenuDeskBar.h.

Referenced by _OnCreate(), and OnFinalMessage().

◆ m_IconSize

DWORD CMenuDeskBar::m_IconSize
private

Definition at line 48 of file CMenuDeskBar.h.

Referenced by _OnPaint(), GetIconSize(), and SetIconSize().

◆ m_ShowFlags

DWORD CMenuDeskBar::m_ShowFlags
private

Definition at line 52 of file CMenuDeskBar.h.

Referenced by Popup().

◆ m_Shown

BOOL CMenuDeskBar::m_Shown
private

Definition at line 51 of file CMenuDeskBar.h.

Referenced by _CloseBar(), _OnActivate(), _OnAppActivate(), Popup(), and SetSite().

◆ m_Site

CComPtr<IUnknown> CMenuDeskBar::m_Site
private

Definition at line 41 of file CMenuDeskBar.h.

Referenced by GetSite(), QueryService(), and SetSite().

◆ m_SubMenuChild

CComPtr<IMenuPopup> CMenuDeskBar::m_SubMenuChild
private

Definition at line 44 of file CMenuDeskBar.h.

Referenced by _CloseBar(), and SetSubMenu().

◆ m_SubMenuParent

CComPtr<IMenuPopup> CMenuDeskBar::m_SubMenuParent
private

Definition at line 43 of file CMenuDeskBar.h.

Referenced by _CloseBar(), _IsSubMenuParent(), OnSelect(), and SetSite().


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