non owned window implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52801 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -168,6 +168,8 @@ static const EventTypeSpec eventList[] =
|
|||||||
// { kEventClassControl , kEventControlBoundsChanged } ,
|
// { kEventClassControl , kEventControlBoundsChanged } ,
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
wxWindowMac* targetWindow = NULL;
|
||||||
|
|
||||||
static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
@@ -344,6 +346,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
inKillFocusEvent = true ;
|
inKillFocusEvent = true ;
|
||||||
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
|
wxFocusEvent event( wxEVT_KILL_FOCUS, thisWindow->GetId());
|
||||||
event.SetEventObject(thisWindow);
|
event.SetEventObject(thisWindow);
|
||||||
|
event.SetWindow(targetWindow);
|
||||||
thisWindow->HandleWindowEvent(event) ;
|
thisWindow->HandleWindowEvent(event) ;
|
||||||
inKillFocusEvent = false ;
|
inKillFocusEvent = false ;
|
||||||
}
|
}
|
||||||
@@ -377,7 +380,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
||||||
|
if ( controlPart != kControlFocusNoPart )
|
||||||
|
targetWindow = thisWindow;
|
||||||
|
|
||||||
ControlPartCode previousControlPart = 0;
|
ControlPartCode previousControlPart = 0;
|
||||||
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
|
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
|
||||||
|
|
||||||
@@ -1406,7 +1411,7 @@ void wxWindowMac::MacWindowToRootWindow( int *x , int *y ) const
|
|||||||
|
|
||||||
if ( !IsTopLevel() )
|
if ( !IsTopLevel() )
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
wxNonOwnedWindow* top = MacGetTopLevelWindow();
|
||||||
if (top)
|
if (top)
|
||||||
{
|
{
|
||||||
pt.x -= MacGetLeftBorderSize() ;
|
pt.x -= MacGetLeftBorderSize() ;
|
||||||
@@ -1449,7 +1454,7 @@ void wxWindowMac::MacRootWindowToWindow( int *x , int *y ) const
|
|||||||
|
|
||||||
if ( !IsTopLevel() )
|
if ( !IsTopLevel() )
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
wxNonOwnedWindow* top = MacGetTopLevelWindow();
|
||||||
if (top)
|
if (top)
|
||||||
{
|
{
|
||||||
wxMacControl::Convert( &pt , top->m_peer , m_peer ) ;
|
wxMacControl::Convert( &pt , top->m_peer , m_peer ) ;
|
||||||
@@ -1580,7 +1585,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
|
|||||||
|
|
||||||
wxWindowMac *mouseWin = 0 ;
|
wxWindowMac *mouseWin = 0 ;
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac *tlw = MacGetTopLevelWindow() ;
|
wxNonOwnedWindow *tlw = MacGetTopLevelWindow() ;
|
||||||
WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ;
|
WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ;
|
||||||
|
|
||||||
ControlPartCode part ;
|
ControlPartCode part ;
|
||||||
@@ -2562,14 +2567,14 @@ void wxWindowMac::ClearBackground()
|
|||||||
|
|
||||||
void wxWindowMac::Update()
|
void wxWindowMac::Update()
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
|
wxNonOwnedWindow* top = MacGetTopLevelWindow();
|
||||||
if (top)
|
if (top)
|
||||||
top->MacPerformUpdates() ;
|
top->MacPerformUpdates() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
wxNonOwnedWindow* wxWindowMac::MacGetTopLevelWindow() const
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* win = NULL ;
|
wxNonOwnedWindow* win = NULL ;
|
||||||
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
|
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
|
||||||
if ( window )
|
if ( window )
|
||||||
win = wxFindWinFromMacWindow( window ) ;
|
win = wxFindWinFromMacWindow( window ) ;
|
||||||
@@ -2820,7 +2825,7 @@ WXWindow wxWindowMac::MacGetTopLevelWindowRef() const
|
|||||||
#if wxUSE_POPUPWIN
|
#if wxUSE_POPUPWIN
|
||||||
wxPopupWindow* popupwin = wxDynamicCast(iter,wxPopupWindow);
|
wxPopupWindow* popupwin = wxDynamicCast(iter,wxPopupWindow);
|
||||||
if ( popupwin )
|
if ( popupwin )
|
||||||
return popupwin->MacGetPopupWindowRef();
|
return popupwin->MacGetWindowRef();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
iter = iter->GetParent() ;
|
iter = iter->GetParent() ;
|
||||||
|
Reference in New Issue
Block a user