Added wxWakeUpIdle() for MSW and empty stubs for Motif, OS2, and Mac
Pending events are now deleted after being processed git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5f2936dacb
commit
9779893b90
@ -310,10 +310,8 @@ extern void WXDLLEXPORT wxExit();
|
|||||||
// Yield to other apps/messages
|
// Yield to other apps/messages
|
||||||
extern bool WXDLLEXPORT wxYield();
|
extern bool WXDLLEXPORT wxYield();
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
// Yield to other apps/messages
|
// Yield to other apps/messages
|
||||||
extern void WXDLLEXPORT wxWakeUpIdle();
|
extern void WXDLLEXPORT wxWakeUpIdle();
|
||||||
#endif
|
|
||||||
|
|
||||||
// Post a message to the given eventhandler which will be processed during the
|
// Post a message to the given eventhandler which will be processed during the
|
||||||
// next event loop iteration
|
// next event loop iteration
|
||||||
|
@ -609,15 +609,7 @@ void wxEvtHandler::AddPendingEvent(wxEvent& event)
|
|||||||
|
|
||||||
wxLEAVE_CRIT_SECT(wxPendingEventsLocker);
|
wxLEAVE_CRIT_SECT(wxPendingEventsLocker);
|
||||||
|
|
||||||
// TODO: Wake up idle handler for the other platforms.
|
|
||||||
#ifdef __WXGTK__
|
|
||||||
wxWakeUpIdle();
|
wxWakeUpIdle();
|
||||||
#elif wxUSE_GUI // this works for wxMSW, but may be for others too?
|
|
||||||
// might also send a dummy message to the top level window, this would
|
|
||||||
// probably be cleaner?
|
|
||||||
wxIdleEvent eventIdle;
|
|
||||||
wxTheApp->OnIdle(eventIdle);
|
|
||||||
#endif // platform
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxEvtHandler::ProcessPendingEvents()
|
void wxEvtHandler::ProcessPendingEvents()
|
||||||
@ -631,6 +623,7 @@ void wxEvtHandler::ProcessPendingEvents()
|
|||||||
{
|
{
|
||||||
event = (wxEvent *)node->Data();
|
event = (wxEvent *)node->Data();
|
||||||
ProcessEvent(*event);
|
ProcessEvent(*event);
|
||||||
|
delete event;
|
||||||
delete node;
|
delete node;
|
||||||
node = m_pendingEvents->First();
|
node = m_pendingEvents->First();
|
||||||
}
|
}
|
||||||
|
230
src/mac/app.cpp
230
src/mac/app.cpp
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
#include <profiler.h>
|
#include <profiler.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "apprsrc.h"
|
#include "apprsrc.h"
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ OSErr AEHandleQuit( AppleEvent *event , AppleEvent *reply , long refcon )
|
|||||||
return wxTheApp->MacHandleAEQuit( event , reply) ;
|
return wxTheApp->MacHandleAEQuit( event , reply) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
@ -111,17 +111,17 @@ OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
|||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEOApp(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEOApp(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
wxWindow* win = GetTopWindow() ;
|
wxWindow* win = GetTopWindow() ;
|
||||||
if ( win )
|
if ( win )
|
||||||
@ -160,7 +160,7 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringMac[ c - StringANSI] ;
|
*to = StringMac[ c - StringANSI] ;
|
||||||
}
|
}
|
||||||
++to ;
|
++to ;
|
||||||
++from ;
|
++from ;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringMac[ c - StringANSI] ;
|
*to = StringMac[ c - StringANSI] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*to = *from ;
|
*to = *from ;
|
||||||
@ -195,7 +195,7 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringANSI[ c - StringMac] ;
|
*to = StringANSI[ c - StringMac] ;
|
||||||
}
|
}
|
||||||
++to ;
|
++to ;
|
||||||
++from ;
|
++from ;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringANSI[ c - StringMac] ;
|
*to = StringANSI[ c - StringMac] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*to = *from ;
|
*to = *from ;
|
||||||
@ -219,19 +219,19 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPC( char * p )
|
void wxMacConvertFromPC( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPCForControls( char * p )
|
void wxMacConvertFromPCForControls( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
for ( int i = 0 ; i < strlen ( ptr ) ; i++ )
|
for ( int i = 0 ; i < strlen ( ptr ) ; i++ )
|
||||||
{
|
{
|
||||||
@ -242,22 +242,22 @@ void wxMacConvertFromPCForControls( char * p )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPC( unsigned char *p )
|
void wxMacConvertFromPC( unsigned char *p )
|
||||||
{
|
{
|
||||||
char *ptr = (char*) p + 1 ;
|
char *ptr = (char*) p + 1 ;
|
||||||
int len = p[0] ;
|
int len = p[0] ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char *wxBuffer ;
|
extern char *wxBuffer ;
|
||||||
|
|
||||||
wxString wxMacMakeMacStringFromPC( const char * p )
|
wxString wxMacMakeMacStringFromPC( const char * p )
|
||||||
{
|
{
|
||||||
const char *ptr = p ;
|
const char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
char *buf = wxBuffer ;
|
char *buf = wxBuffer ;
|
||||||
|
|
||||||
if ( len >= BUFSIZ + 512 )
|
if ( len >= BUFSIZ + 512 )
|
||||||
{
|
{
|
||||||
buf = new char [len+1] ;
|
buf = new char [len+1] ;
|
||||||
@ -272,28 +272,28 @@ wxString wxMacMakeMacStringFromPC( const char * p )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxMacConvertToPC( char * p )
|
void wxMacConvertToPC( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertToPC( ptr , ptr , len ) ;
|
wxMacConvertToPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertToPC( unsigned char *p )
|
void wxMacConvertToPC( unsigned char *p )
|
||||||
{
|
{
|
||||||
char *ptr = (char*) p + 1 ;
|
char *ptr = (char*) p + 1 ;
|
||||||
int len = p[0] ;
|
int len = p[0] ;
|
||||||
|
|
||||||
wxMacConvertToPC( ptr , ptr , len ) ;
|
wxMacConvertToPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMacMakePCStringFromMac( const char * p )
|
wxString wxMacMakePCStringFromMac( const char * p )
|
||||||
{
|
{
|
||||||
const char *ptr = p ;
|
const char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
char *buf = wxBuffer ;
|
char *buf = wxBuffer ;
|
||||||
|
|
||||||
if ( len >= BUFSIZ + 512 )
|
if ( len >= BUFSIZ + 512 )
|
||||||
{
|
{
|
||||||
buf = new char [len+1] ;
|
buf = new char [len+1] ;
|
||||||
@ -301,7 +301,7 @@ wxString wxMacMakePCStringFromMac( const char * p )
|
|||||||
|
|
||||||
wxMacConvertToPC( ptr , buf , len ) ;
|
wxMacConvertToPC( ptr , buf , len ) ;
|
||||||
buf[len] = 0 ;
|
buf[len] = 0 ;
|
||||||
|
|
||||||
wxString result( buf ) ;
|
wxString result( buf ) ;
|
||||||
if ( buf != wxBuffer )
|
if ( buf != wxBuffer )
|
||||||
delete buf ;
|
delete buf ;
|
||||||
@ -313,9 +313,9 @@ wxString wxMacMakePCStringFromMac( const char * p )
|
|||||||
bool wxApp::Initialize()
|
bool wxApp::Initialize()
|
||||||
{
|
{
|
||||||
int error = 0 ;
|
int error = 0 ;
|
||||||
|
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
|
|
||||||
UMAInitToolbox( 4 ) ;
|
UMAInitToolbox( 4 ) ;
|
||||||
UMAShowWatchCursor() ;
|
UMAShowWatchCursor() ;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ bool wxApp::Initialize()
|
|||||||
GUSISetup(GUSIwithInternetSockets);
|
GUSISetup(GUSIwithInternetSockets);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// test the minimal configuration necessary
|
// test the minimal configuration necessary
|
||||||
|
|
||||||
long theSystem ;
|
long theSystem ;
|
||||||
@ -344,7 +344,7 @@ bool wxApp::Initialize()
|
|||||||
else if (Gestalt(gestaltSystemVersion, &theSystem) != noErr )
|
else if (Gestalt(gestaltSystemVersion, &theSystem) != noErr )
|
||||||
{
|
{
|
||||||
error = kMacSTROldSystem ;
|
error = kMacSTROldSystem ;
|
||||||
}
|
}
|
||||||
else if ( theSystem < 0x0750 )
|
else if ( theSystem < 0x0750 )
|
||||||
{
|
{
|
||||||
error = kMacSTROldSystem ;
|
error = kMacSTROldSystem ;
|
||||||
@ -366,9 +366,9 @@ bool wxApp::Initialize()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// if we encountered any problems so far, give the error code and exit immediately
|
// if we encountered any problems so far, give the error code and exit immediately
|
||||||
|
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
short itemHit;
|
short itemHit;
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
@ -377,16 +377,16 @@ bool wxApp::Initialize()
|
|||||||
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
|
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
|
||||||
itemHit = Alert(128, nil);
|
itemHit = Alert(128, nil);
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
|
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// now avoid exceptions thrown for new (bad_alloc)
|
// now avoid exceptions thrown for new (bad_alloc)
|
||||||
|
|
||||||
std::__throws_bad_alloc = FALSE ;
|
std::__throws_bad_alloc = FALSE ;
|
||||||
|
|
||||||
s_macCursorRgn = ::NewRgn() ;
|
s_macCursorRgn = ::NewRgn() ;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@ -403,7 +403,7 @@ bool wxApp::Initialize()
|
|||||||
wxDebugContext::SetStream(oStr, sBuf);
|
wxDebugContext::SetStream(oStr, sBuf);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxClassInfo::InitializeClasses();
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
||||||
@ -426,7 +426,7 @@ bool wxApp::Initialize()
|
|||||||
wxWinMacControlList = new wxList(wxKEY_INTEGER);
|
wxWinMacControlList = new wxList(wxKEY_INTEGER);
|
||||||
|
|
||||||
UMAShowArrowCursor() ;
|
UMAShowArrowCursor() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,11 +470,11 @@ void wxApp::CleanUp()
|
|||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
ProfilerDump( "\papp.prof" ) ;
|
ProfilerDump( "\papp.prof" ) ;
|
||||||
ProfilerTerm() ;
|
ProfilerTerm() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete wxTheApp;
|
delete wxTheApp;
|
||||||
wxTheApp = NULL;
|
wxTheApp = NULL;
|
||||||
|
|
||||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||||
// At this point we want to check if there are any memory
|
// At this point we want to check if there are any memory
|
||||||
// blocks that aren't part of the wxDebugContext itself,
|
// blocks that aren't part of the wxDebugContext itself,
|
||||||
@ -488,7 +488,7 @@ void wxApp::CleanUp()
|
|||||||
}
|
}
|
||||||
// wxDebugContext::SetStream(NULL, NULL);
|
// wxDebugContext::SetStream(NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// do it as the very last thing because everything else can log messages
|
// do it as the very last thing because everything else can log messages
|
||||||
wxLog::DontCreateOnDemand();
|
wxLog::DontCreateOnDemand();
|
||||||
// do it as the very last thing because everything else can log messages
|
// do it as the very last thing because everything else can log messages
|
||||||
@ -513,11 +513,11 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
|
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
|
wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!wxTheApp)
|
if (!wxTheApp)
|
||||||
{
|
{
|
||||||
printf( "wxWindows error: wxTheApp == NULL\n" );
|
printf( "wxWindows error: wxTheApp == NULL\n" );
|
||||||
return 0;
|
return 0;
|
||||||
@ -532,18 +532,18 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
|
|
||||||
// GUI-specific initialization, such as creating an app context.
|
// GUI-specific initialization, such as creating an app context.
|
||||||
wxTheApp->OnInitGui();
|
wxTheApp->OnInitGui();
|
||||||
|
|
||||||
// we could try to get the open apple events here to adjust argc and argv better
|
// we could try to get the open apple events here to adjust argc and argv better
|
||||||
|
|
||||||
|
|
||||||
// Here frames insert themselves automatically
|
// Here frames insert themselves automatically
|
||||||
// into wxTopLevelWindows by getting created
|
// into wxTopLevelWindows by getting created
|
||||||
// in OnInit().
|
// in OnInit().
|
||||||
|
|
||||||
if (!wxTheApp->OnInit()) return 0;
|
if (!wxTheApp->OnInit()) return 0;
|
||||||
|
|
||||||
int retValue = 0;
|
int retValue = 0;
|
||||||
|
|
||||||
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
|
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
|
||||||
|
|
||||||
if (wxTheApp->GetTopWindow())
|
if (wxTheApp->GetTopWindow())
|
||||||
@ -551,11 +551,11 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
delete wxTheApp->GetTopWindow();
|
delete wxTheApp->GetTopWindow();
|
||||||
wxTheApp->SetTopWindow(NULL);
|
wxTheApp->SetTopWindow(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTheApp->DeletePendingObjects();
|
wxTheApp->DeletePendingObjects();
|
||||||
|
|
||||||
wxTheApp->OnExit();
|
wxTheApp->OnExit();
|
||||||
|
|
||||||
wxApp::CleanUp();
|
wxApp::CleanUp();
|
||||||
|
|
||||||
return retValue;
|
return retValue;
|
||||||
@ -656,6 +656,12 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
inOnIdle = FALSE;
|
inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
// **** please implement me! ****
|
||||||
|
// Wake up the idle handler processor, even if it is in another thread...
|
||||||
|
}
|
||||||
|
|
||||||
// Send idle event to all top-level windows
|
// Send idle event to all top-level windows
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
{
|
{
|
||||||
@ -702,7 +708,7 @@ void wxApp::DeletePendingObjects()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxObject *obj = (wxObject *)node->Data();
|
wxObject *obj = (wxObject *)node->Data();
|
||||||
|
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
||||||
if (wxPendingDelete.Member(obj))
|
if (wxPendingDelete.Member(obj))
|
||||||
@ -743,27 +749,27 @@ bool wxYield()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// platform specifics
|
// platform specifics
|
||||||
|
|
||||||
void wxApp::MacSuspend( bool convertClipboard )
|
void wxApp::MacSuspend( bool convertClipboard )
|
||||||
{
|
{
|
||||||
s_lastMouseDown = 0 ;
|
s_lastMouseDown = 0 ;
|
||||||
if( convertClipboard )
|
if( convertClipboard )
|
||||||
{
|
{
|
||||||
MacConvertPrivateToPublicScrap() ;
|
MacConvertPrivateToPublicScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMAHideFloatingWindows() ;
|
UMAHideFloatingWindows() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacResume( bool convertClipboard )
|
void wxApp::MacResume( bool convertClipboard )
|
||||||
{
|
{
|
||||||
s_lastMouseDown = 0 ;
|
s_lastMouseDown = 0 ;
|
||||||
if( convertClipboard )
|
if( convertClipboard )
|
||||||
{
|
{
|
||||||
MacConvertPublicToPrivateScrap() ;
|
MacConvertPublicToPrivateScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMAShowFloatingWindows() ;
|
UMAShowFloatingWindows() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,7 +784,7 @@ void wxApp::MacConvertPublicToPrivateScrap()
|
|||||||
::TEFromScrap() ;
|
::TEFromScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacDoOneEvent()
|
void wxApp::MacDoOneEvent()
|
||||||
{
|
{
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
@ -794,7 +800,7 @@ void wxApp::MacDoOneEvent()
|
|||||||
WindowPtr window = UMAFrontWindow() ;
|
WindowPtr window = UMAFrontWindow() ;
|
||||||
if ( window )
|
if ( window )
|
||||||
UMAIdleControls( window ) ;
|
UMAIdleControls( window ) ;
|
||||||
|
|
||||||
wxTheApp->ProcessIdle() ;
|
wxTheApp->ProcessIdle() ;
|
||||||
}
|
}
|
||||||
if ( event.what != kHighLevelEvent )
|
if ( event.what != kHighLevelEvent )
|
||||||
@ -803,16 +809,16 @@ void wxApp::MacDoOneEvent()
|
|||||||
// repeaters
|
// repeaters
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
wxMacProcessSocketEvents() ;
|
wxMacProcessSocketEvents() ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleOneEvent( EventRecord *ev )
|
void wxApp::MacHandleOneEvent( EventRecord *ev )
|
||||||
{
|
{
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
|
|
||||||
wxApp::sm_lastMessageTime = ev->when ;
|
wxApp::sm_lastMessageTime = ev->when ;
|
||||||
|
|
||||||
switch (ev->what)
|
switch (ev->what)
|
||||||
{
|
{
|
||||||
case mouseDown:
|
case mouseDown:
|
||||||
@ -830,7 +836,7 @@ void wxApp::MacHandleOneEvent( EventRecord *ev )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ev->modifiers &= ~controlKey ;
|
ev->modifiers &= ~controlKey ;
|
||||||
}
|
}
|
||||||
MacHandleMouseUpEvent( ev ) ;
|
MacHandleMouseUpEvent( ev ) ;
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
break;
|
break;
|
||||||
@ -875,14 +881,14 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
WindowAttributes frontWindowAttributes = NULL ;
|
WindowAttributes frontWindowAttributes = NULL ;
|
||||||
if ( frontWindow )
|
if ( frontWindow )
|
||||||
UMAGetWindowAttributes( frontWindow , &frontWindowAttributes ) ;
|
UMAGetWindowAttributes( frontWindow , &frontWindowAttributes ) ;
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
{
|
{
|
||||||
SysBeep ( 30 ) ;
|
SysBeep ( 30 ) ;
|
||||||
}
|
}
|
||||||
@ -914,7 +920,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
SetOrigin( 0 , 0 ) ;
|
SetOrigin( 0 , 0 ) ;
|
||||||
LocalToGlobal( &pt ) ;
|
LocalToGlobal( &pt ) ;
|
||||||
SetPort( port ) ;
|
SetPort( port ) ;
|
||||||
win->SetSize( pt.h , pt.v , -1 ,
|
win->SetSize( pt.h , pt.v , -1 ,
|
||||||
-1 , wxSIZE_USE_EXISTING);
|
-1 , wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@ -935,13 +941,13 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
int newWidth = LoWord(growResult);
|
int newWidth = LoWord(growResult);
|
||||||
int newHeight = HiWord(growResult);
|
int newHeight = HiWord(growResult);
|
||||||
int oldWidth, oldHeight;
|
int oldWidth, oldHeight;
|
||||||
|
|
||||||
win->GetSize(&oldWidth, &oldHeight);
|
win->GetSize(&oldWidth, &oldHeight);
|
||||||
if (newWidth == 0)
|
if (newWidth == 0)
|
||||||
newWidth = oldWidth;
|
newWidth = oldWidth;
|
||||||
if (newHeight == 0)
|
if (newHeight == 0)
|
||||||
newHeight = oldHeight;
|
newHeight = oldHeight;
|
||||||
|
|
||||||
if (win)
|
if (win)
|
||||||
win->SetSize( -1, -1, newWidth, newHeight, wxSIZE_USE_EXISTING);
|
win->SetSize( -1, -1, newWidth, newHeight, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
@ -954,7 +960,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
// TODO setup size event
|
// TODO setup size event
|
||||||
ZoomWindow( window , windowPart , false ) ;
|
ZoomWindow( window , windowPart , false ) ;
|
||||||
if (win)
|
if (win)
|
||||||
win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
|
win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
|
||||||
window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
|
window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@ -967,7 +973,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
case inContent :
|
case inContent :
|
||||||
if ( window != frontWindow )
|
if ( window != frontWindow )
|
||||||
{
|
{
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
{
|
{
|
||||||
SysBeep ( 30 ) ;
|
SysBeep ( 30 ) ;
|
||||||
}
|
}
|
||||||
@ -987,7 +993,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
win->MacMouseDown( ev , windowPart ) ;
|
win->MacMouseDown( ev , windowPart ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -996,9 +1002,9 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
||||||
{
|
{
|
||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
@ -1016,8 +1022,8 @@ void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
|
|
||||||
long wxMacTranslateKey(char key, char code)
|
long wxMacTranslateKey(char key, char code)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 0x01 :
|
case 0x01 :
|
||||||
key = WXK_HOME;
|
key = WXK_HOME;
|
||||||
@ -1116,7 +1122,7 @@ long wxMacTranslateKey(char key, char code)
|
|||||||
default:
|
default:
|
||||||
break ;
|
break ;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1130,8 +1136,8 @@ void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
|
|||||||
short keycode ;
|
short keycode ;
|
||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(ev->message & charCodeMask);
|
keychar = short(ev->message & charCodeMask);
|
||||||
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
||||||
|
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
if ( focus )
|
if ( focus )
|
||||||
{
|
{
|
||||||
@ -1191,7 +1197,7 @@ void wxApp::MacHandleDiskEvent( EventRecord *ev )
|
|||||||
OSErr err ;
|
OSErr err ;
|
||||||
Point point ;
|
Point point ;
|
||||||
SetPt( &point , 100 , 100 ) ;
|
SetPt( &point , 100 , 100 ) ;
|
||||||
|
|
||||||
err = DIBadMount( point , ev->message ) ;
|
err = DIBadMount( point , ev->message ) ;
|
||||||
wxASSERT( err == noErr ) ;
|
wxASSERT( err == noErr ) ;
|
||||||
}
|
}
|
||||||
@ -1210,17 +1216,17 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
{
|
{
|
||||||
WindowRef oldFrontWindow = NULL ;
|
WindowRef oldFrontWindow = NULL ;
|
||||||
WindowRef newFrontWindow = NULL ;
|
WindowRef newFrontWindow = NULL ;
|
||||||
|
|
||||||
// in case we don't take care of activating ourselves, we have to synchronize
|
// in case we don't take care of activating ourselves, we have to synchronize
|
||||||
// our idea of the active window with the process manager's - which it already activated
|
// our idea of the active window with the process manager's - which it already activated
|
||||||
|
|
||||||
if ( !doesActivate )
|
if ( !doesActivate )
|
||||||
oldFrontWindow = UMAFrontNonFloatingWindow() ;
|
oldFrontWindow = UMAFrontNonFloatingWindow() ;
|
||||||
|
|
||||||
MacResume( convertClipboard ) ;
|
MacResume( convertClipboard ) ;
|
||||||
|
|
||||||
newFrontWindow = UMAFrontNonFloatingWindow() ;
|
newFrontWindow = UMAFrontNonFloatingWindow() ;
|
||||||
|
|
||||||
if ( oldFrontWindow )
|
if ( oldFrontWindow )
|
||||||
{
|
{
|
||||||
wxWindow* win = wxFindWinFromMacWindow( oldFrontWindow ) ;
|
wxWindow* win = wxFindWinFromMacWindow( oldFrontWindow ) ;
|
||||||
@ -1235,12 +1241,12 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacSuspend( convertClipboard ) ;
|
MacSuspend( convertClipboard ) ;
|
||||||
|
|
||||||
// in case this suspending did close an active window, another one might
|
// in case this suspending did close an active window, another one might
|
||||||
// have surfaced -> lets deactivate that one
|
// have surfaced -> lets deactivate that one
|
||||||
|
|
||||||
WindowRef newActiveWindow = UMAGetActiveNonFloatingWindow() ;
|
WindowRef newActiveWindow = UMAGetActiveNonFloatingWindow() ;
|
||||||
if ( newActiveWindow )
|
if ( newActiveWindow )
|
||||||
{
|
{
|
||||||
@ -1254,30 +1260,30 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
case mouseMovedMessage :
|
case mouseMovedMessage :
|
||||||
{
|
{
|
||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
wxWindow* currentMouseWindow = NULL ;
|
wxWindow* currentMouseWindow = NULL ;
|
||||||
|
|
||||||
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , ¤tMouseWindow ) ;
|
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , ¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
|
|
||||||
bool isDown = !(ev->modifiers & btnState) ; // 1 is for up
|
bool isDown = !(ev->modifiers & btnState) ; // 1 is for up
|
||||||
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
|
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
|
||||||
|
|
||||||
event.m_leftDown = isDown && !controlDown;
|
event.m_leftDown = isDown && !controlDown;
|
||||||
event.m_middleDown = FALSE;
|
event.m_middleDown = FALSE;
|
||||||
event.m_rightDown = isDown && controlDown;
|
event.m_rightDown = isDown && controlDown;
|
||||||
event.m_shiftDown = ev->modifiers & shiftKey;
|
event.m_shiftDown = ev->modifiers & shiftKey;
|
||||||
event.m_controlDown = ev->modifiers & controlKey;
|
event.m_controlDown = ev->modifiers & controlKey;
|
||||||
event.m_altDown = ev->modifiers & optionKey;
|
event.m_altDown = ev->modifiers & optionKey;
|
||||||
event.m_metaDown = ev->modifiers & cmdKey;
|
event.m_metaDown = ev->modifiers & cmdKey;
|
||||||
event.m_x = ev->where.h;
|
event.m_x = ev->where.h;
|
||||||
event.m_y = ev->where.v;
|
event.m_y = ev->where.v;
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event ) ;
|
||||||
@ -1292,9 +1298,9 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
}
|
}
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
@ -1302,7 +1308,7 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
case inSysWindow :
|
case inSysWindow :
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if ( s_lastMouseDown == 0 )
|
if ( s_lastMouseDown == 0 )
|
||||||
ev->modifiers |= btnState ;
|
ev->modifiers |= btnState ;
|
||||||
|
|
||||||
@ -1314,21 +1320,21 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
||||||
{
|
{
|
||||||
if (macMenuId == 0)
|
if (macMenuId == 0)
|
||||||
return; // no menu item selected
|
return; // no menu item selected
|
||||||
|
|
||||||
if (macMenuId == kwxMacAppleMenuId && macMenuItemNum > 1)
|
if (macMenuId == kwxMacAppleMenuId && macMenuItemNum > 1)
|
||||||
{
|
{
|
||||||
#if ! TARGET_CARBON
|
#if ! TARGET_CARBON
|
||||||
Str255 deskAccessoryName ;
|
Str255 deskAccessoryName ;
|
||||||
GrafPtr savedPort ;
|
GrafPtr savedPort ;
|
||||||
|
|
||||||
GetMenuItemText(GetMenuHandle(kwxMacAppleMenuId), macMenuItemNum, deskAccessoryName);
|
GetMenuItemText(GetMenuHandle(kwxMacAppleMenuId), macMenuItemNum, deskAccessoryName);
|
||||||
GetPort(&savedPort);
|
GetPort(&savedPort);
|
||||||
OpenDeskAcc(deskAccessoryName);
|
OpenDeskAcc(deskAccessoryName);
|
||||||
@ -1340,8 +1346,8 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
||||||
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
||||||
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1368,4 +1374,4 @@ wxApp::macAdjustCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
#include <profiler.h>
|
#include <profiler.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "apprsrc.h"
|
#include "apprsrc.h"
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ OSErr AEHandleQuit( AppleEvent *event , AppleEvent *reply , long refcon )
|
|||||||
return wxTheApp->MacHandleAEQuit( event , reply) ;
|
return wxTheApp->MacHandleAEQuit( event , reply) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
ProcessSerialNumber PSN ;
|
ProcessSerialNumber PSN ;
|
||||||
PSN.highLongOfPSN = 0 ;
|
PSN.highLongOfPSN = 0 ;
|
||||||
@ -111,17 +111,17 @@ OSErr wxApp::MacHandleAEODoc(AppleEvent *event , AppleEvent *reply)
|
|||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEPDoc(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEOApp(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEOApp(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
|
OSErr wxApp::MacHandleAEQuit(AppleEvent *event , AppleEvent *reply)
|
||||||
{
|
{
|
||||||
wxWindow* win = GetTopWindow() ;
|
wxWindow* win = GetTopWindow() ;
|
||||||
if ( win )
|
if ( win )
|
||||||
@ -160,7 +160,7 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringMac[ c - StringANSI] ;
|
*to = StringMac[ c - StringANSI] ;
|
||||||
}
|
}
|
||||||
++to ;
|
++to ;
|
||||||
++from ;
|
++from ;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringMac[ c - StringANSI] ;
|
*to = StringMac[ c - StringANSI] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*to = *from ;
|
*to = *from ;
|
||||||
@ -195,7 +195,7 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringANSI[ c - StringMac] ;
|
*to = StringANSI[ c - StringMac] ;
|
||||||
}
|
}
|
||||||
++to ;
|
++to ;
|
||||||
++from ;
|
++from ;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
if ( c != NULL )
|
if ( c != NULL )
|
||||||
{
|
{
|
||||||
*to = StringANSI[ c - StringMac] ;
|
*to = StringANSI[ c - StringMac] ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*to = *from ;
|
*to = *from ;
|
||||||
@ -219,19 +219,19 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPC( char * p )
|
void wxMacConvertFromPC( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPCForControls( char * p )
|
void wxMacConvertFromPCForControls( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
for ( int i = 0 ; i < strlen ( ptr ) ; i++ )
|
for ( int i = 0 ; i < strlen ( ptr ) ; i++ )
|
||||||
{
|
{
|
||||||
@ -242,22 +242,22 @@ void wxMacConvertFromPCForControls( char * p )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertFromPC( unsigned char *p )
|
void wxMacConvertFromPC( unsigned char *p )
|
||||||
{
|
{
|
||||||
char *ptr = (char*) p + 1 ;
|
char *ptr = (char*) p + 1 ;
|
||||||
int len = p[0] ;
|
int len = p[0] ;
|
||||||
|
|
||||||
wxMacConvertFromPC( ptr , ptr , len ) ;
|
wxMacConvertFromPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char *wxBuffer ;
|
extern char *wxBuffer ;
|
||||||
|
|
||||||
wxString wxMacMakeMacStringFromPC( const char * p )
|
wxString wxMacMakeMacStringFromPC( const char * p )
|
||||||
{
|
{
|
||||||
const char *ptr = p ;
|
const char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
char *buf = wxBuffer ;
|
char *buf = wxBuffer ;
|
||||||
|
|
||||||
if ( len >= BUFSIZ + 512 )
|
if ( len >= BUFSIZ + 512 )
|
||||||
{
|
{
|
||||||
buf = new char [len+1] ;
|
buf = new char [len+1] ;
|
||||||
@ -272,28 +272,28 @@ wxString wxMacMakeMacStringFromPC( const char * p )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxMacConvertToPC( char * p )
|
void wxMacConvertToPC( char * p )
|
||||||
{
|
{
|
||||||
char *ptr = p ;
|
char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
|
|
||||||
wxMacConvertToPC( ptr , ptr , len ) ;
|
wxMacConvertToPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertToPC( unsigned char *p )
|
void wxMacConvertToPC( unsigned char *p )
|
||||||
{
|
{
|
||||||
char *ptr = (char*) p + 1 ;
|
char *ptr = (char*) p + 1 ;
|
||||||
int len = p[0] ;
|
int len = p[0] ;
|
||||||
|
|
||||||
wxMacConvertToPC( ptr , ptr , len ) ;
|
wxMacConvertToPC( ptr , ptr , len ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMacMakePCStringFromMac( const char * p )
|
wxString wxMacMakePCStringFromMac( const char * p )
|
||||||
{
|
{
|
||||||
const char *ptr = p ;
|
const char *ptr = p ;
|
||||||
int len = strlen ( p ) ;
|
int len = strlen ( p ) ;
|
||||||
char *buf = wxBuffer ;
|
char *buf = wxBuffer ;
|
||||||
|
|
||||||
if ( len >= BUFSIZ + 512 )
|
if ( len >= BUFSIZ + 512 )
|
||||||
{
|
{
|
||||||
buf = new char [len+1] ;
|
buf = new char [len+1] ;
|
||||||
@ -301,7 +301,7 @@ wxString wxMacMakePCStringFromMac( const char * p )
|
|||||||
|
|
||||||
wxMacConvertToPC( ptr , buf , len ) ;
|
wxMacConvertToPC( ptr , buf , len ) ;
|
||||||
buf[len] = 0 ;
|
buf[len] = 0 ;
|
||||||
|
|
||||||
wxString result( buf ) ;
|
wxString result( buf ) ;
|
||||||
if ( buf != wxBuffer )
|
if ( buf != wxBuffer )
|
||||||
delete buf ;
|
delete buf ;
|
||||||
@ -313,9 +313,9 @@ wxString wxMacMakePCStringFromMac( const char * p )
|
|||||||
bool wxApp::Initialize()
|
bool wxApp::Initialize()
|
||||||
{
|
{
|
||||||
int error = 0 ;
|
int error = 0 ;
|
||||||
|
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
|
|
||||||
UMAInitToolbox( 4 ) ;
|
UMAInitToolbox( 4 ) ;
|
||||||
UMAShowWatchCursor() ;
|
UMAShowWatchCursor() ;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ bool wxApp::Initialize()
|
|||||||
GUSISetup(GUSIwithInternetSockets);
|
GUSISetup(GUSIwithInternetSockets);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// test the minimal configuration necessary
|
// test the minimal configuration necessary
|
||||||
|
|
||||||
long theSystem ;
|
long theSystem ;
|
||||||
@ -344,7 +344,7 @@ bool wxApp::Initialize()
|
|||||||
else if (Gestalt(gestaltSystemVersion, &theSystem) != noErr )
|
else if (Gestalt(gestaltSystemVersion, &theSystem) != noErr )
|
||||||
{
|
{
|
||||||
error = kMacSTROldSystem ;
|
error = kMacSTROldSystem ;
|
||||||
}
|
}
|
||||||
else if ( theSystem < 0x0750 )
|
else if ( theSystem < 0x0750 )
|
||||||
{
|
{
|
||||||
error = kMacSTROldSystem ;
|
error = kMacSTROldSystem ;
|
||||||
@ -366,9 +366,9 @@ bool wxApp::Initialize()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// if we encountered any problems so far, give the error code and exit immediately
|
// if we encountered any problems so far, give the error code and exit immediately
|
||||||
|
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
short itemHit;
|
short itemHit;
|
||||||
Str255 message;
|
Str255 message;
|
||||||
|
|
||||||
@ -377,16 +377,16 @@ bool wxApp::Initialize()
|
|||||||
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
|
ParamText("\pFatal Error", message, (ConstStr255Param)"\p", (ConstStr255Param)"\p");
|
||||||
itemHit = Alert(128, nil);
|
itemHit = Alert(128, nil);
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
|
ProfilerInit( collectDetailed, bestTimeBase , 20000 , 30 ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// now avoid exceptions thrown for new (bad_alloc)
|
// now avoid exceptions thrown for new (bad_alloc)
|
||||||
|
|
||||||
std::__throws_bad_alloc = FALSE ;
|
std::__throws_bad_alloc = FALSE ;
|
||||||
|
|
||||||
s_macCursorRgn = ::NewRgn() ;
|
s_macCursorRgn = ::NewRgn() ;
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
@ -403,7 +403,7 @@ bool wxApp::Initialize()
|
|||||||
wxDebugContext::SetStream(oStr, sBuf);
|
wxDebugContext::SetStream(oStr, sBuf);
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxClassInfo::InitializeClasses();
|
wxClassInfo::InitializeClasses();
|
||||||
|
|
||||||
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
|
||||||
@ -426,7 +426,7 @@ bool wxApp::Initialize()
|
|||||||
wxWinMacControlList = new wxList(wxKEY_INTEGER);
|
wxWinMacControlList = new wxList(wxKEY_INTEGER);
|
||||||
|
|
||||||
UMAShowArrowCursor() ;
|
UMAShowArrowCursor() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,11 +470,11 @@ void wxApp::CleanUp()
|
|||||||
#if __option(profile)
|
#if __option(profile)
|
||||||
ProfilerDump( "\papp.prof" ) ;
|
ProfilerDump( "\papp.prof" ) ;
|
||||||
ProfilerTerm() ;
|
ProfilerTerm() ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
delete wxTheApp;
|
delete wxTheApp;
|
||||||
wxTheApp = NULL;
|
wxTheApp = NULL;
|
||||||
|
|
||||||
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
|
||||||
// At this point we want to check if there are any memory
|
// At this point we want to check if there are any memory
|
||||||
// blocks that aren't part of the wxDebugContext itself,
|
// blocks that aren't part of the wxDebugContext itself,
|
||||||
@ -488,7 +488,7 @@ void wxApp::CleanUp()
|
|||||||
}
|
}
|
||||||
// wxDebugContext::SetStream(NULL, NULL);
|
// wxDebugContext::SetStream(NULL, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// do it as the very last thing because everything else can log messages
|
// do it as the very last thing because everything else can log messages
|
||||||
wxLog::DontCreateOnDemand();
|
wxLog::DontCreateOnDemand();
|
||||||
// do it as the very last thing because everything else can log messages
|
// do it as the very last thing because everything else can log messages
|
||||||
@ -513,11 +513,11 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
|
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
|
wxTheApp = (wxApp*) (* wxApp::GetInitializerFunction()) ();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!wxTheApp)
|
if (!wxTheApp)
|
||||||
{
|
{
|
||||||
printf( "wxWindows error: wxTheApp == NULL\n" );
|
printf( "wxWindows error: wxTheApp == NULL\n" );
|
||||||
return 0;
|
return 0;
|
||||||
@ -532,18 +532,18 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
|
|
||||||
// GUI-specific initialization, such as creating an app context.
|
// GUI-specific initialization, such as creating an app context.
|
||||||
wxTheApp->OnInitGui();
|
wxTheApp->OnInitGui();
|
||||||
|
|
||||||
// we could try to get the open apple events here to adjust argc and argv better
|
// we could try to get the open apple events here to adjust argc and argv better
|
||||||
|
|
||||||
|
|
||||||
// Here frames insert themselves automatically
|
// Here frames insert themselves automatically
|
||||||
// into wxTopLevelWindows by getting created
|
// into wxTopLevelWindows by getting created
|
||||||
// in OnInit().
|
// in OnInit().
|
||||||
|
|
||||||
if (!wxTheApp->OnInit()) return 0;
|
if (!wxTheApp->OnInit()) return 0;
|
||||||
|
|
||||||
int retValue = 0;
|
int retValue = 0;
|
||||||
|
|
||||||
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
|
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
|
||||||
|
|
||||||
if (wxTheApp->GetTopWindow())
|
if (wxTheApp->GetTopWindow())
|
||||||
@ -551,11 +551,11 @@ int wxEntry( int argc, char *argv[] )
|
|||||||
delete wxTheApp->GetTopWindow();
|
delete wxTheApp->GetTopWindow();
|
||||||
wxTheApp->SetTopWindow(NULL);
|
wxTheApp->SetTopWindow(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTheApp->DeletePendingObjects();
|
wxTheApp->DeletePendingObjects();
|
||||||
|
|
||||||
wxTheApp->OnExit();
|
wxTheApp->OnExit();
|
||||||
|
|
||||||
wxApp::CleanUp();
|
wxApp::CleanUp();
|
||||||
|
|
||||||
return retValue;
|
return retValue;
|
||||||
@ -656,6 +656,12 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
inOnIdle = FALSE;
|
inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
// **** please implement me! ****
|
||||||
|
// Wake up the idle handler processor, even if it is in another thread...
|
||||||
|
}
|
||||||
|
|
||||||
// Send idle event to all top-level windows
|
// Send idle event to all top-level windows
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
{
|
{
|
||||||
@ -702,7 +708,7 @@ void wxApp::DeletePendingObjects()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxObject *obj = (wxObject *)node->Data();
|
wxObject *obj = (wxObject *)node->Data();
|
||||||
|
|
||||||
delete obj;
|
delete obj;
|
||||||
|
|
||||||
if (wxPendingDelete.Member(obj))
|
if (wxPendingDelete.Member(obj))
|
||||||
@ -743,27 +749,27 @@ bool wxYield()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// platform specifics
|
// platform specifics
|
||||||
|
|
||||||
void wxApp::MacSuspend( bool convertClipboard )
|
void wxApp::MacSuspend( bool convertClipboard )
|
||||||
{
|
{
|
||||||
s_lastMouseDown = 0 ;
|
s_lastMouseDown = 0 ;
|
||||||
if( convertClipboard )
|
if( convertClipboard )
|
||||||
{
|
{
|
||||||
MacConvertPrivateToPublicScrap() ;
|
MacConvertPrivateToPublicScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMAHideFloatingWindows() ;
|
UMAHideFloatingWindows() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacResume( bool convertClipboard )
|
void wxApp::MacResume( bool convertClipboard )
|
||||||
{
|
{
|
||||||
s_lastMouseDown = 0 ;
|
s_lastMouseDown = 0 ;
|
||||||
if( convertClipboard )
|
if( convertClipboard )
|
||||||
{
|
{
|
||||||
MacConvertPublicToPrivateScrap() ;
|
MacConvertPublicToPrivateScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
UMAShowFloatingWindows() ;
|
UMAShowFloatingWindows() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -778,7 +784,7 @@ void wxApp::MacConvertPublicToPrivateScrap()
|
|||||||
::TEFromScrap() ;
|
::TEFromScrap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacDoOneEvent()
|
void wxApp::MacDoOneEvent()
|
||||||
{
|
{
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
@ -794,7 +800,7 @@ void wxApp::MacDoOneEvent()
|
|||||||
WindowPtr window = UMAFrontWindow() ;
|
WindowPtr window = UMAFrontWindow() ;
|
||||||
if ( window )
|
if ( window )
|
||||||
UMAIdleControls( window ) ;
|
UMAIdleControls( window ) ;
|
||||||
|
|
||||||
wxTheApp->ProcessIdle() ;
|
wxTheApp->ProcessIdle() ;
|
||||||
}
|
}
|
||||||
if ( event.what != kHighLevelEvent )
|
if ( event.what != kHighLevelEvent )
|
||||||
@ -803,16 +809,16 @@ void wxApp::MacDoOneEvent()
|
|||||||
// repeaters
|
// repeaters
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
wxMacProcessSocketEvents() ;
|
wxMacProcessSocketEvents() ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleOneEvent( EventRecord *ev )
|
void wxApp::MacHandleOneEvent( EventRecord *ev )
|
||||||
{
|
{
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
|
|
||||||
wxApp::sm_lastMessageTime = ev->when ;
|
wxApp::sm_lastMessageTime = ev->when ;
|
||||||
|
|
||||||
switch (ev->what)
|
switch (ev->what)
|
||||||
{
|
{
|
||||||
case mouseDown:
|
case mouseDown:
|
||||||
@ -830,7 +836,7 @@ void wxApp::MacHandleOneEvent( EventRecord *ev )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ev->modifiers &= ~controlKey ;
|
ev->modifiers &= ~controlKey ;
|
||||||
}
|
}
|
||||||
MacHandleMouseUpEvent( ev ) ;
|
MacHandleMouseUpEvent( ev ) ;
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
break;
|
break;
|
||||||
@ -875,14 +881,14 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
WindowAttributes frontWindowAttributes = NULL ;
|
WindowAttributes frontWindowAttributes = NULL ;
|
||||||
if ( frontWindow )
|
if ( frontWindow )
|
||||||
UMAGetWindowAttributes( frontWindow , &frontWindowAttributes ) ;
|
UMAGetWindowAttributes( frontWindow , &frontWindowAttributes ) ;
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
{
|
{
|
||||||
SysBeep ( 30 ) ;
|
SysBeep ( 30 ) ;
|
||||||
}
|
}
|
||||||
@ -914,7 +920,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
SetOrigin( 0 , 0 ) ;
|
SetOrigin( 0 , 0 ) ;
|
||||||
LocalToGlobal( &pt ) ;
|
LocalToGlobal( &pt ) ;
|
||||||
SetPort( port ) ;
|
SetPort( port ) ;
|
||||||
win->SetSize( pt.h , pt.v , -1 ,
|
win->SetSize( pt.h , pt.v , -1 ,
|
||||||
-1 , wxSIZE_USE_EXISTING);
|
-1 , wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@ -935,13 +941,13 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
int newWidth = LoWord(growResult);
|
int newWidth = LoWord(growResult);
|
||||||
int newHeight = HiWord(growResult);
|
int newHeight = HiWord(growResult);
|
||||||
int oldWidth, oldHeight;
|
int oldWidth, oldHeight;
|
||||||
|
|
||||||
win->GetSize(&oldWidth, &oldHeight);
|
win->GetSize(&oldWidth, &oldHeight);
|
||||||
if (newWidth == 0)
|
if (newWidth == 0)
|
||||||
newWidth = oldWidth;
|
newWidth = oldWidth;
|
||||||
if (newHeight == 0)
|
if (newHeight == 0)
|
||||||
newHeight = oldHeight;
|
newHeight = oldHeight;
|
||||||
|
|
||||||
if (win)
|
if (win)
|
||||||
win->SetSize( -1, -1, newWidth, newHeight, wxSIZE_USE_EXISTING);
|
win->SetSize( -1, -1, newWidth, newHeight, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
@ -954,7 +960,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
// TODO setup size event
|
// TODO setup size event
|
||||||
ZoomWindow( window , windowPart , false ) ;
|
ZoomWindow( window , windowPart , false ) ;
|
||||||
if (win)
|
if (win)
|
||||||
win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
|
win->SetSize( -1, -1, window->portRect.right-window->portRect.left ,
|
||||||
window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
|
window->portRect.bottom-window->portRect.top, wxSIZE_USE_EXISTING);
|
||||||
}
|
}
|
||||||
s_lastMouseDown = 0;
|
s_lastMouseDown = 0;
|
||||||
@ -967,7 +973,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
case inContent :
|
case inContent :
|
||||||
if ( window != frontWindow )
|
if ( window != frontWindow )
|
||||||
{
|
{
|
||||||
if ( s_macIsInModalLoop )
|
if ( s_macIsInModalLoop )
|
||||||
{
|
{
|
||||||
SysBeep ( 30 ) ;
|
SysBeep ( 30 ) ;
|
||||||
}
|
}
|
||||||
@ -987,7 +993,7 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
win->MacMouseDown( ev , windowPart ) ;
|
win->MacMouseDown( ev , windowPart ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -996,9 +1002,9 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
|
|||||||
void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
||||||
{
|
{
|
||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
@ -1016,8 +1022,8 @@ void wxApp::MacHandleMouseUpEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
|
|
||||||
long wxMacTranslateKey(char key, char code)
|
long wxMacTranslateKey(char key, char code)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 0x01 :
|
case 0x01 :
|
||||||
key = WXK_HOME;
|
key = WXK_HOME;
|
||||||
@ -1116,7 +1122,7 @@ long wxMacTranslateKey(char key, char code)
|
|||||||
default:
|
default:
|
||||||
break ;
|
break ;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1130,8 +1136,8 @@ void wxApp::MacHandleKeyDownEvent( EventRecord *ev )
|
|||||||
short keycode ;
|
short keycode ;
|
||||||
short keychar ;
|
short keychar ;
|
||||||
keychar = short(ev->message & charCodeMask);
|
keychar = short(ev->message & charCodeMask);
|
||||||
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
keycode = short(ev->message & keyCodeMask) >> 8 ;
|
||||||
|
|
||||||
wxWindow* focus = wxWindow::FindFocus() ;
|
wxWindow* focus = wxWindow::FindFocus() ;
|
||||||
if ( focus )
|
if ( focus )
|
||||||
{
|
{
|
||||||
@ -1191,7 +1197,7 @@ void wxApp::MacHandleDiskEvent( EventRecord *ev )
|
|||||||
OSErr err ;
|
OSErr err ;
|
||||||
Point point ;
|
Point point ;
|
||||||
SetPt( &point , 100 , 100 ) ;
|
SetPt( &point , 100 , 100 ) ;
|
||||||
|
|
||||||
err = DIBadMount( point , ev->message ) ;
|
err = DIBadMount( point , ev->message ) ;
|
||||||
wxASSERT( err == noErr ) ;
|
wxASSERT( err == noErr ) ;
|
||||||
}
|
}
|
||||||
@ -1210,17 +1216,17 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
{
|
{
|
||||||
WindowRef oldFrontWindow = NULL ;
|
WindowRef oldFrontWindow = NULL ;
|
||||||
WindowRef newFrontWindow = NULL ;
|
WindowRef newFrontWindow = NULL ;
|
||||||
|
|
||||||
// in case we don't take care of activating ourselves, we have to synchronize
|
// in case we don't take care of activating ourselves, we have to synchronize
|
||||||
// our idea of the active window with the process manager's - which it already activated
|
// our idea of the active window with the process manager's - which it already activated
|
||||||
|
|
||||||
if ( !doesActivate )
|
if ( !doesActivate )
|
||||||
oldFrontWindow = UMAFrontNonFloatingWindow() ;
|
oldFrontWindow = UMAFrontNonFloatingWindow() ;
|
||||||
|
|
||||||
MacResume( convertClipboard ) ;
|
MacResume( convertClipboard ) ;
|
||||||
|
|
||||||
newFrontWindow = UMAFrontNonFloatingWindow() ;
|
newFrontWindow = UMAFrontNonFloatingWindow() ;
|
||||||
|
|
||||||
if ( oldFrontWindow )
|
if ( oldFrontWindow )
|
||||||
{
|
{
|
||||||
wxWindow* win = wxFindWinFromMacWindow( oldFrontWindow ) ;
|
wxWindow* win = wxFindWinFromMacWindow( oldFrontWindow ) ;
|
||||||
@ -1235,12 +1241,12 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacSuspend( convertClipboard ) ;
|
MacSuspend( convertClipboard ) ;
|
||||||
|
|
||||||
// in case this suspending did close an active window, another one might
|
// in case this suspending did close an active window, another one might
|
||||||
// have surfaced -> lets deactivate that one
|
// have surfaced -> lets deactivate that one
|
||||||
|
|
||||||
WindowRef newActiveWindow = UMAGetActiveNonFloatingWindow() ;
|
WindowRef newActiveWindow = UMAGetActiveNonFloatingWindow() ;
|
||||||
if ( newActiveWindow )
|
if ( newActiveWindow )
|
||||||
{
|
{
|
||||||
@ -1254,30 +1260,30 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
case mouseMovedMessage :
|
case mouseMovedMessage :
|
||||||
{
|
{
|
||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
wxWindow* currentMouseWindow = NULL ;
|
wxWindow* currentMouseWindow = NULL ;
|
||||||
|
|
||||||
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , ¤tMouseWindow ) ;
|
MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) , ¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
|
|
||||||
bool isDown = !(ev->modifiers & btnState) ; // 1 is for up
|
bool isDown = !(ev->modifiers & btnState) ; // 1 is for up
|
||||||
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
|
bool controlDown = ev->modifiers & controlKey ; // for simulating right mouse
|
||||||
|
|
||||||
event.m_leftDown = isDown && !controlDown;
|
event.m_leftDown = isDown && !controlDown;
|
||||||
event.m_middleDown = FALSE;
|
event.m_middleDown = FALSE;
|
||||||
event.m_rightDown = isDown && controlDown;
|
event.m_rightDown = isDown && controlDown;
|
||||||
event.m_shiftDown = ev->modifiers & shiftKey;
|
event.m_shiftDown = ev->modifiers & shiftKey;
|
||||||
event.m_controlDown = ev->modifiers & controlKey;
|
event.m_controlDown = ev->modifiers & controlKey;
|
||||||
event.m_altDown = ev->modifiers & optionKey;
|
event.m_altDown = ev->modifiers & optionKey;
|
||||||
event.m_metaDown = ev->modifiers & cmdKey;
|
event.m_metaDown = ev->modifiers & cmdKey;
|
||||||
event.m_x = ev->where.h;
|
event.m_x = ev->where.h;
|
||||||
event.m_y = ev->where.v;
|
event.m_y = ev->where.v;
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event ) ;
|
||||||
@ -1292,9 +1298,9 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
}
|
}
|
||||||
|
|
||||||
short windowPart = ::FindWindow(ev->where, &window);
|
short windowPart = ::FindWindow(ev->where, &window);
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
case inMenuBar :
|
case inMenuBar :
|
||||||
@ -1302,7 +1308,7 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
case inSysWindow :
|
case inSysWindow :
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if ( s_lastMouseDown == 0 )
|
if ( s_lastMouseDown == 0 )
|
||||||
ev->modifiers |= btnState ;
|
ev->modifiers |= btnState ;
|
||||||
|
|
||||||
@ -1314,21 +1320,21 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
||||||
{
|
{
|
||||||
if (macMenuId == 0)
|
if (macMenuId == 0)
|
||||||
return; // no menu item selected
|
return; // no menu item selected
|
||||||
|
|
||||||
if (macMenuId == kwxMacAppleMenuId && macMenuItemNum > 1)
|
if (macMenuId == kwxMacAppleMenuId && macMenuItemNum > 1)
|
||||||
{
|
{
|
||||||
#if ! TARGET_CARBON
|
#if ! TARGET_CARBON
|
||||||
Str255 deskAccessoryName ;
|
Str255 deskAccessoryName ;
|
||||||
GrafPtr savedPort ;
|
GrafPtr savedPort ;
|
||||||
|
|
||||||
GetMenuItemText(GetMenuHandle(kwxMacAppleMenuId), macMenuItemNum, deskAccessoryName);
|
GetMenuItemText(GetMenuHandle(kwxMacAppleMenuId), macMenuItemNum, deskAccessoryName);
|
||||||
GetPort(&savedPort);
|
GetPort(&savedPort);
|
||||||
OpenDeskAcc(deskAccessoryName);
|
OpenDeskAcc(deskAccessoryName);
|
||||||
@ -1340,8 +1346,8 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
wxWindow* frontwindow = wxFindWinFromMacWindow( ::FrontWindow() ) ;
|
||||||
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
if ( frontwindow && wxMenuBar::MacGetInstalledMenuBar() )
|
||||||
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
wxMenuBar::MacGetInstalledMenuBar()->MacMenuSelect( frontwindow->GetEventHandler() , 0 , macMenuId , macMenuItemNum ) ;
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1368,4 +1374,4 @@ wxApp::macAdjustCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -346,7 +346,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if 1
|
#if 1
|
||||||
// It seemed before that this hack was redundant and
|
// It seemed before that this hack was redundant and
|
||||||
// key down events were being generated by wxCanvasInputEvent.
|
// key down events were being generated by wxCanvasInputEvent.
|
||||||
// But no longer - why ???
|
// But no longer - why ???
|
||||||
//
|
//
|
||||||
@ -355,7 +355,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
// We intercepted and processed the key down event
|
// We intercepted and processed the key down event
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XtDispatchEvent(event);
|
XtDispatchEvent(event);
|
||||||
@ -483,6 +483,13 @@ void wxApp::OnIdle(wxIdleEvent& event)
|
|||||||
inOnIdle = FALSE;
|
inOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
// **** please implement me! ****
|
||||||
|
// Wake up the idle handler processor, even if it is in another thread...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send idle event to all top-level windows
|
// Send idle event to all top-level windows
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
{
|
{
|
||||||
|
@ -1168,6 +1168,24 @@ bool wxYield()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// wxWakeUpIdle
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
// Send the top window a dummy message so idle handler processing will
|
||||||
|
// start up again. Doing it this way ensures that the idle handler
|
||||||
|
// wakes up in the right thread.
|
||||||
|
wxWindow *topWindow = wxTheApp->GetTopWindow();
|
||||||
|
if ( topWindow ) {
|
||||||
|
HWND hWnd = (HWND)topWindow->GetHWND();
|
||||||
|
::PostMessage(hWnd, WM_NULL, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxIcon
|
wxIcon
|
||||||
wxApp::GetStdIcon(int which) const
|
wxApp::GetStdIcon(int which) const
|
||||||
{
|
{
|
||||||
|
@ -767,6 +767,12 @@ void wxApp::OnIdle(
|
|||||||
sbInOnIdle = FALSE;
|
sbInOnIdle = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxWakeUpIdle()
|
||||||
|
{
|
||||||
|
// **** please implement me! ****
|
||||||
|
// Wake up the idle handler processor, even if it is in another thread...
|
||||||
|
}
|
||||||
|
|
||||||
// Send idle event to all top-level windows
|
// Send idle event to all top-level windows
|
||||||
bool wxApp::SendIdleEvents()
|
bool wxApp::SendIdleEvents()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user