long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
long wxApp::s_macPreferencesMenuItemId = wxID_PREFERENCES ;
long wxApp::s_macExitMenuItemId = wxID_EXIT ;
-pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
-pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
-pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
-pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
-pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , long refcon ) ;
+pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
+pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
+pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
+pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
+pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
{
{ kHICommandCut , wxID_CUT } ,
{ kHICommandCopy , wxID_COPY } ,
{
{ kHICommandCut , wxID_CUT } ,
{ kHICommandCopy , wxID_COPY } ,
if ( wxId == wxApp::s_macPreferencesMenuItemId )
macId = kHICommandPreferences ;
else if (wxId == wxApp::s_macExitMenuItemId)
if ( wxId == wxApp::s_macPreferencesMenuItemId )
macId = kHICommandPreferences ;
else if (wxId == wxApp::s_macExitMenuItemId)
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
GetMenuItemRefCon( command.menu.menuRef , command.menu.menuItemIndex , &refCon ) ;
itemMenu = wxFindMenuFromMacMenu( command.menu.menuRef ) ;
// Try the menu's event handler
{
wxEvtHandler *handler = itemMenu->GetEventHandler();
if ( handler )
processed = handler->ProcessEvent(event);
}
// Try the menu's event handler
{
wxEvtHandler *handler = itemMenu->GetEventHandler();
if ( handler )
processed = handler->ProcessEvent(event);
}
// Mac OS X passes a process serial number command line argument when
// the application is launched from the Finder. This argument must be
// removed from the command line arguments before being handled by the
// Mac OS X passes a process serial number command line argument when
// the application is launched from the Finder. This argument must be
// removed from the command line arguments before being handled by the
event_posted_context.perform = macPostedEventCallback;
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
event_posted_context.perform = macPostedEventCallback;
m_macEventPosted = CFRunLoopSourceCreate(NULL,0,&event_posted_context);
CFRunLoopAddSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
- CFRelease(m_macEventPosted);
- m_macEventPosted = NULL;
+ {
+ CFRunLoopRemoveSource(CFRunLoopGetCurrent(), m_macEventPosted, kCFRunLoopCommonModes);
+ m_macEventPosted = NULL;
+ }
err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
rec->what = keyDown ;
err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
rec->what = keyDown ;
err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
UInt32 buttons = GetCurrentButtonState();
ms.SetLeftDown( (buttons & 0x01) != 0 );
ms.SetMiddleDown( (buttons & 0x04) != 0 );
ms.SetRightDown( (buttons & 0x02) != 0 );
UInt32 buttons = GetCurrentButtonState();
ms.SetLeftDown( (buttons & 0x01) != 0 );
ms.SetMiddleDown( (buttons & 0x04) != 0 );
ms.SetRightDown( (buttons & 0x02) != 0 );
UInt32 modifiers = GetCurrentKeyModifiers();
ms.SetControlDown(modifiers & controlKey);
ms.SetShiftDown(modifiers & shiftKey);
UInt32 modifiers = GetCurrentKeyModifiers();
ms.SetControlDown(modifiers & controlKey);
ms.SetShiftDown(modifiers & shiftKey);
wxKeyEvent event(wxEVT_KEY_DOWN) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
wxKeyEvent event(wxEVT_KEY_DOWN) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
wxKeyEvent event( wxEVT_KEY_UP ) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
wxKeyEvent event( wxEVT_KEY_UP ) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
handled = focus->GetEventHandler()->ProcessEvent( event ) ;
wxKeyEvent event(wxEVT_CHAR) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
long keyval = event.m_keyCode ;
wxKeyEvent event(wxEVT_CHAR) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
long keyval = event.m_keyCode ;
- wxButton *def = wxDynamicCast(focus->GetDefaultItem(), wxButton);
- if ( def && def->IsEnabled() )
+ wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(focus), wxTopLevelWindow);
+ if ( tlw && tlw->GetDefaultItem() )
- wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
- event.SetEventObject(def);
- def->Command(event);
+ wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
+ if ( def && def->IsEnabled() )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+ event.SetEventObject(def);
+ def->Command(event);
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
{
short keycode, keychar ;
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
{
short keycode, keychar ;