Add support for Mac dock icon bouncing. I used a cross-platform enum so that we can (ideally) craft a cross-platform API for 3.0.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2316,6 +2316,17 @@ enum wxUpdateUI
|
||||
wxUPDATE_UI_FROMIDLE = 0x0002 /* Invoked from On(Internal)Idle */
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* Notification Event flags - used for dock icon bouncing, etc. */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
||||
enum wxNotificationOptions
|
||||
{
|
||||
wxNOTIFY_NONE = 0x0000,
|
||||
wxNOTIFY_ONCE = 0x0001,
|
||||
wxNOTIFY_REPEAT = 0x0002
|
||||
};
|
||||
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
/* miscellaneous */
|
||||
/* ---------------------------------------------------------------------------- */
|
||||
|
@@ -75,6 +75,8 @@ public:
|
||||
void MacSetCurrentEvent( WXEVENTREF event , WXEVENTHANDLERCALLREF handler )
|
||||
{ m_macCurrentEvent = event ; m_macCurrentEventHandlerCallRef = handler ; }
|
||||
|
||||
void MacRequestUserAttention(wxNotificationOptions options);
|
||||
|
||||
// adding a CFType object to be released only at the end of the current event cycle (increases the
|
||||
// refcount of the object passed), needed in case we are in the middle of an event concering an object
|
||||
// we want to delete and cannot do it immediately
|
||||
@@ -101,6 +103,7 @@ public:
|
||||
static long s_macPreferencesMenuItemId ;
|
||||
static long s_macExitMenuItemId ;
|
||||
static wxString s_macHelpMenuTitleName ;
|
||||
static void* s_macNotificationRecord ;
|
||||
|
||||
WXEVENTREF MacGetCurrentEvent() { return m_macCurrentEvent ; }
|
||||
void MacHandleOneEvent( WXEVENTREF ev ) ;
|
||||
|
@@ -98,6 +98,8 @@ wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
|
||||
|
||||
bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin
|
||||
|
||||
void* wxApp::s_macNotificationRecord = NULL;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Core Apple Event Support
|
||||
//----------------------------------------------------------------------
|
||||
@@ -300,7 +302,18 @@ void wxApp::MacPrintFile(const wxString & fileName )
|
||||
#endif //docview
|
||||
}
|
||||
|
||||
void wxApp::MacRequestUserAttention(wxNotificationOptions options)
|
||||
{
|
||||
NMRec nmRec = {0};
|
||||
nmRec.qType = nmType;
|
||||
nmRec.nmMark = 1;
|
||||
NMInstall(&nmRec);
|
||||
|
||||
if (options == wxNOTIFY_ONCE)
|
||||
NMRemove (&nmRec);
|
||||
else // save the reference and remove it on app activation
|
||||
wxApp::s_macNotificationRecord = &nmRec;
|
||||
}
|
||||
|
||||
void wxApp::MacNewFile()
|
||||
{
|
||||
@@ -613,8 +626,17 @@ static pascal OSStatus wxMacAppApplicationEventHandler( EventHandlerCallRef hand
|
||||
switch ( GetEventKind( event ) )
|
||||
{
|
||||
case kEventAppActivated :
|
||||
if ( wxTheApp )
|
||||
if ( wxTheApp ) {
|
||||
wxTheApp->SetActive( true , NULL ) ;
|
||||
// If MacRequestUserAttention is set to repeat, then we need
|
||||
// to shut down the notification upon app activation. This
|
||||
// should happen automatically, but let's add the handler
|
||||
// just in case.
|
||||
if (wxApp::s_macNotificationRecord) {
|
||||
NMRemove((NMRec*)wxApp::s_macNotificationRecord);
|
||||
wxApp::s_macNotificationRecord = NULL;
|
||||
}
|
||||
}
|
||||
result = noErr ;
|
||||
break ;
|
||||
|
||||
|
Reference in New Issue
Block a user