Set the object for the context menu event.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@50643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -336,7 +336,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
// focus handling
|
// focus handling
|
||||||
// different handling on OS X
|
// different handling on OS X
|
||||||
//
|
//
|
||||||
|
|
||||||
case kEventControlFocusPartChanged :
|
case kEventControlFocusPartChanged :
|
||||||
// the event is emulated by wxmac for systems lower than 10.5
|
// the event is emulated by wxmac for systems lower than 10.5
|
||||||
{
|
{
|
||||||
@@ -349,9 +349,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
if ( thisWindow->GetCaret() )
|
if ( thisWindow->GetCaret() )
|
||||||
thisWindow->GetCaret()->OnKillFocus();
|
thisWindow->GetCaret()->OnKillFocus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow));
|
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow));
|
||||||
|
|
||||||
// remove this as soon as posting the synthesized event works properly
|
// remove this as soon as posting the synthesized event works properly
|
||||||
static bool inKillFocusEvent = false ;
|
static bool inKillFocusEvent = false ;
|
||||||
|
|
||||||
@@ -371,12 +371,12 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow));
|
wxLogTrace(_T("Focus"), _T("focus set(%p)"), wx_static_cast(void*, thisWindow));
|
||||||
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
|
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
|
||||||
thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
|
thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
|
||||||
|
|
||||||
#if wxUSE_CARET
|
#if wxUSE_CARET
|
||||||
if ( thisWindow->GetCaret() )
|
if ( thisWindow->GetCaret() )
|
||||||
thisWindow->GetCaret()->OnSetFocus();
|
thisWindow->GetCaret()->OnSetFocus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
|
wxFocusEvent event(wxEVT_SET_FOCUS, thisWindow->GetId());
|
||||||
event.SetEventObject(thisWindow);
|
event.SetEventObject(thisWindow);
|
||||||
thisWindow->GetEventHandler()->ProcessEvent(event) ;
|
thisWindow->GetEventHandler()->ProcessEvent(event) ;
|
||||||
@@ -391,9 +391,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
{
|
{
|
||||||
// put a breakpoint here to catch focus everything events
|
// put a breakpoint here to catch focus everything events
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
||||||
|
|
||||||
ControlPartCode previousControlPart = 0;
|
ControlPartCode previousControlPart = 0;
|
||||||
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
|
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
|
||||||
|
|
||||||
@@ -405,25 +405,25 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = CallNextEventHandler(handler, event);
|
result = CallNextEventHandler(handler, event);
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() < 0x1050 )
|
if ( UMAGetSystemVersion() < 0x1050 )
|
||||||
{
|
{
|
||||||
// set back to 0 if problems arise
|
// set back to 0 if problems arise
|
||||||
#if 1
|
#if 1
|
||||||
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
ControlPartCode currentControlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
||||||
// synthesize the event focus changed event
|
// synthesize the event focus changed event
|
||||||
EventRef evRef = NULL ;
|
EventRef evRef = NULL ;
|
||||||
|
|
||||||
OSStatus err = MacCreateEvent(
|
OSStatus err = MacCreateEvent(
|
||||||
NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
|
NULL , kEventClassControl , kEventControlFocusPartChanged , TicksToEventTime( TickCount() ) ,
|
||||||
kEventAttributeUserEvent , &evRef );
|
kEventAttributeUserEvent , &evRef );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
|
|
||||||
wxMacCarbonEvent iEvent( evRef ) ;
|
wxMacCarbonEvent iEvent( evRef ) ;
|
||||||
iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef ) ;
|
iEvent.SetParameter<ControlRef>( kEventParamDirectObject , controlRef ) ;
|
||||||
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart ) ;
|
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart ) ;
|
||||||
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart ) ;
|
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart ) ;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// TODO test this first, avoid double posts etc...
|
// TODO test this first, avoid double posts etc...
|
||||||
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
|
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
|
||||||
@@ -441,7 +441,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow));
|
wxLogTrace(_T("Focus"), _T("focus lost(%p)"), wx_static_cast(void*, thisWindow));
|
||||||
|
|
||||||
static bool inKillFocusEvent = false ;
|
static bool inKillFocusEvent = false ;
|
||||||
|
|
||||||
if ( !inKillFocusEvent )
|
if ( !inKillFocusEvent )
|
||||||
@@ -1367,7 +1367,7 @@ void wxWindowMac::SetFocus()
|
|||||||
|
|
||||||
// as we cannot rely on the control features to find out whether we are in full keyboard mode,
|
// as we cannot rely on the control features to find out whether we are in full keyboard mode,
|
||||||
// we can only leave in case of an error
|
// we can only leave in case of an error
|
||||||
|
|
||||||
wxLogTrace(_T("Focus"), _T("SetFocus(%p)"), wx_static_cast(void*, this));
|
wxLogTrace(_T("Focus"), _T("SetFocus(%p)"), wx_static_cast(void*, this));
|
||||||
|
|
||||||
OSStatus err = m_peer->SetFocus( kControlFocusNextPart ) ;
|
OSStatus err = m_peer->SetFocus( kControlFocusNextPart ) ;
|
||||||
@@ -2553,14 +2553,14 @@ void wxWindowMac::MacPaintGrowBox()
|
|||||||
|
|
||||||
CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ;
|
CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ;
|
||||||
wxASSERT( cgContext ) ;
|
wxASSERT( cgContext ) ;
|
||||||
|
|
||||||
m_peer->GetRect( &rect ) ;
|
m_peer->GetRect( &rect ) ;
|
||||||
|
|
||||||
int size = m_hScrollBar ? m_hScrollBar->GetSize().y : ( m_vScrollBar ? m_vScrollBar->GetSize().x : MAC_SCROLLBAR_SIZE ) ;
|
int size = m_hScrollBar ? m_hScrollBar->GetSize().y : ( m_vScrollBar ? m_vScrollBar->GetSize().x : MAC_SCROLLBAR_SIZE ) ;
|
||||||
CGRect cgrect = CGRectMake( rect.right - size , rect.bottom - size , size , size ) ;
|
CGRect cgrect = CGRectMake( rect.right - size , rect.bottom - size , size , size ) ;
|
||||||
CGPoint cgpoint = CGPointMake( rect.right - size , rect.bottom - size ) ;
|
CGPoint cgpoint = CGPointMake( rect.right - size , rect.bottom - size ) ;
|
||||||
CGContextSaveGState( cgContext );
|
CGContextSaveGState( cgContext );
|
||||||
|
|
||||||
if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT )
|
if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT )
|
||||||
{
|
{
|
||||||
wxMacCoreGraphicsColour bkgnd( m_macBackgroundBrush ) ;
|
wxMacCoreGraphicsColour bkgnd( m_macBackgroundBrush ) ;
|
||||||
@@ -2568,7 +2568,7 @@ void wxWindowMac::MacPaintGrowBox()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGContextSetRGBFillColor( cgContext, 1.0, 1.0 , 1.0 , 1.0 );
|
CGContextSetRGBFillColor( cgContext, 1.0, 1.0 , 1.0 , 1.0 );
|
||||||
}
|
}
|
||||||
CGContextFillRect( cgContext, cgrect );
|
CGContextFillRect( cgContext, cgrect );
|
||||||
CGContextRestoreGState( cgContext );
|
CGContextRestoreGState( cgContext );
|
||||||
@@ -2833,7 +2833,7 @@ wxWindow *wxWindowBase::DoFindFocus()
|
|||||||
{
|
{
|
||||||
ControlRef control ;
|
ControlRef control ;
|
||||||
GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
|
GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
|
||||||
wxLogTrace(_T("Focus"), _T("FindFocus(windowref=%p, peer =%p, wxwindow = %p)"),
|
wxLogTrace(_T("Focus"), _T("FindFocus(windowref=%p, peer =%p, wxwindow = %p)"),
|
||||||
wx_static_cast(void*, GetUserFocusWindow()), wx_static_cast(void*, control)
|
wx_static_cast(void*, GetUserFocusWindow()), wx_static_cast(void*, control)
|
||||||
, wx_static_cast(void*, wxFindControlFromMacControl( control )));
|
, wx_static_cast(void*, wxFindControlFromMacControl( control )));
|
||||||
return (wxWindow*)wxFindControlFromMacControl( control ) ;
|
return (wxWindow*)wxFindControlFromMacControl( control ) ;
|
||||||
@@ -3546,6 +3546,7 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
|
|||||||
wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
|
wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU,
|
||||||
this->GetId(),
|
this->GetId(),
|
||||||
this->ClientToScreen(event.GetPosition()));
|
this->ClientToScreen(event.GetPosition()));
|
||||||
|
evtCtx.SetEventObject(this);
|
||||||
if ( ! GetEventHandler()->ProcessEvent(evtCtx) )
|
if ( ! GetEventHandler()->ProcessEvent(evtCtx) )
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user