]> git.saurik.com Git - wxWidgets.git/commitdiff
added RequestUserAttention
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Dec 2004 10:10:14 +0000 (10:10 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Dec 2004 10:10:14 +0000 (10:10 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/mac/carbon/private.h
include/wx/mac/carbon/toplevel.h
src/mac/carbon/toplevel.cpp

index b66fcd5c31db0db88577c67fc566c792e15b96be..191fbd8cb8884bf0741596c812bdf65804013590 100644 (file)
@@ -306,6 +306,30 @@ protected :
     bool     m_release ;
 } ;
 
+//
+// helper class for allocating and deallocating Universal Proc Ptrs
+//
+
+template <typename procType, typename uppType , uppType (*newUPP)(procType) , void (*disposeUPP)(uppType) > 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<NMProcPtr,NMUPP,NewNMUPP,DisposeNMUPP> wxMacNMUPP ;
+
 #if wxUSE_GUI
 
 GWorldPtr         wxMacCreateGWorld( int width , int height , int depth ) ;
index de3c083448ec9e073ec5d76103e788c9e1891b9e..e479a11c41ef4f726473498e985a0703e980e4dc 100644 (file)
@@ -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;
index 659e5ba78e02426b01fe6e2746bee01b3ba95a63..ee145443cc0aa0c9133c99db8ea007ba40940444 100644 (file)
@@ -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
 // ---------------------------------------------------------------------------