From: Stefan Csomor Date: Wed, 29 Dec 2004 10:10:14 +0000 (+0000) Subject: added RequestUserAttention X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3feeb1e1e0bb7b691d8fdd457e1f8035a9e9cf15 added RequestUserAttention git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/carbon/private.h b/include/wx/mac/carbon/private.h index b66fcd5c31..191fbd8cb8 100644 --- a/include/wx/mac/carbon/private.h +++ b/include/wx/mac/carbon/private.h @@ -306,6 +306,30 @@ protected : bool m_release ; } ; +// +// helper class for allocating and deallocating Universal Proc Ptrs +// + +template class wxMacUPP +{ +public : + wxMacUPP( procType proc ) + { + m_upp = NULL ; + m_upp = (*newUPP)( NULL ) ; + } + ~wxMacUPP() + { + if ( m_upp ) + disposeUPP( m_upp ) ; + } + operator uppType() { return m_upp ; } +private : + uppType m_upp ; +} ; + +typedef wxMacUPP wxMacNMUPP ; + #if wxUSE_GUI GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ; diff --git a/include/wx/mac/carbon/toplevel.h b/include/wx/mac/carbon/toplevel.h index de3c083448..e479a11c41 100644 --- a/include/wx/mac/carbon/toplevel.h +++ b/include/wx/mac/carbon/toplevel.h @@ -55,6 +55,10 @@ public: virtual wxPoint GetClientAreaOrigin() const; + // Attracts the users attention to this window if the application is + // inactive (should be called when a background event occurs) + virtual void RequestUserAttention(int flags = wxUSER_ATTENTION_INFO); + // implement base class pure virtuals virtual void Maximize(bool maximize = TRUE); virtual bool IsMaximized() const; diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 659e5ba78e..ee145443cc 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -1373,6 +1373,31 @@ wxUint32 wxTopLevelWindowMac::MacGetWindowAttributes() const return attr ; } +// Attracts the users attention to this window if the application is +// inactive (should be called when a background event occurs) + +static pascal void wxMacNMResponse( NMRecPtr ptr ) +{ + NMRemove( ptr ) ; + DisposePtr( (Ptr) ptr ) ; +} + + +void wxTopLevelWindowMac::RequestUserAttention(int flags ) +{ + NMRecPtr notificationRequest = (NMRecPtr) NewPtr( sizeof( NMRec) ) ; + static wxMacNMUPP nmupp( wxMacNMResponse ) + ; + memset( notificationRequest , 0 , sizeof(*notificationRequest) ) ; + notificationRequest->qType = nmType ; + notificationRequest->nmMark = 1 ; + notificationRequest->nmIcon = 0 ; + notificationRequest->nmSound = 0 ; + notificationRequest->nmStr = NULL ; + notificationRequest->nmResp = nmupp ; + verify_noerr( NMInstall( notificationRequest ) ) ; +} + // --------------------------------------------------------------------------- // Shape implementation // ---------------------------------------------------------------------------