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:
@@ -72,50 +72,21 @@ public:
|
|||||||
IFACEMETHODIMP Invoke(IToastNotification *sender, IToastFailedEventArgs *e);
|
IFACEMETHODIMP Invoke(IToastNotification *sender, IToastFailedEventArgs *e);
|
||||||
|
|
||||||
// IUnknown
|
// IUnknown
|
||||||
IFACEMETHODIMP_(ULONG) AddRef()
|
DECLARE_IUNKNOWN_METHODS;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxAutoULong m_cRef;
|
|
||||||
|
|
||||||
wxToastNotifMsgImpl* m_impl;
|
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
|
class wxToastNotifMsgImpl : public wxNotificationMessageImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Reference in New Issue
Block a user