Refactor implementation of IUnknown in wxNotificationMessage (WinRT)
Use dedicated macros to declare and define IUnknown interface in the helper
class of wxNotificationMessage implementation.
Now dependency on wxUSE_OLE is more visible, since these macros are defined
in oleutils.h (see f2e707f095
).
This commit is contained in:
parent
69e4f491b2
commit
ce7788e5ea
@ -72,50 +72,21 @@ public:
|
||||
IFACEMETHODIMP Invoke(IToastNotification *sender, IToastFailedEventArgs *e);
|
||||
|
||||
// IUnknown
|
||||
IFACEMETHODIMP_(ULONG) AddRef()
|
||||
{
|
||||
return ++m_cRef;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP_(ULONG) Release()
|
||||
{
|
||||
if ( --m_cRef == wxAutoULong(0) )
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return m_cRef;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv)
|
||||
{
|
||||
if ( IsEqualIID(riid, IID_IUnknown) )
|
||||
*ppv = static_cast<IUnknown*>(static_cast<DesktopToastActivatedEventHandler*>(this));
|
||||
else if ( IsEqualIID(riid, __uuidof(DesktopToastActivatedEventHandler)) )
|
||||
*ppv = static_cast<DesktopToastActivatedEventHandler*>(this);
|
||||
else if ( IsEqualIID(riid, __uuidof(DesktopToastDismissedEventHandler)) )
|
||||
*ppv = static_cast<DesktopToastDismissedEventHandler*>(this);
|
||||
else if ( IsEqualIID(riid, __uuidof(DesktopToastFailedEventHandler)) )
|
||||
*ppv = static_cast<DesktopToastFailedEventHandler*>(this);
|
||||
else
|
||||
*ppv = NULL;
|
||||
|
||||
if ( *ppv )
|
||||
{
|
||||
reinterpret_cast<IUnknown*>(*ppv)->AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
DECLARE_IUNKNOWN_METHODS;
|
||||
|
||||
private:
|
||||
wxAutoULong m_cRef;
|
||||
|
||||
wxToastNotifMsgImpl* m_impl;
|
||||
};
|
||||
|
||||
BEGIN_IID_TABLE(wxToastEventHandler)
|
||||
ADD_IID(Unknown)
|
||||
ADD_RAW_IID(__uuidof(DesktopToastActivatedEventHandler))
|
||||
ADD_RAW_IID(__uuidof(DesktopToastDismissedEventHandler))
|
||||
ADD_RAW_IID(__uuidof(DesktopToastFailedEventHandler))
|
||||
END_IID_TABLE;
|
||||
|
||||
IMPLEMENT_IUNKNOWN_METHODS(wxToastEventHandler)
|
||||
|
||||
class wxToastNotifMsgImpl : public wxNotificationMessageImpl
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user