short windowPart = ::FindWindow(screenMouseLocation, &window);
wxWindow* currentMouseWindow = NULL ;
-
+ ControlRef control = NULL ;
+
if ( window )
{
QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ;
else if ( (IsWindowActive(window) && windowPart == inContent) )
{
ControlPartCode part ;
- ControlRef control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ;
+ control = wxMacFindControlUnderMouse( windowMouseLocation , window , &part ) ;
+ // if there is no control below the mouse position, send the event to the toplevel window itself
if ( control == 0 )
currentMouseWindow = (wxWindow*) data ;
else
+ {
currentMouseWindow = wxFindControlFromMacControl( control ) ;
+ if ( currentMouseWindow == NULL && cEvent.GetKind() == kEventMouseMoved )
+ {
+ // for wxToolBar to function we have to send certaint events to it
+ // instead of its children (wxToolBarTools)
+ ControlRef parent ;
+ GetSuperControl(control, &parent );
+ wxWindow *wxParent = wxFindControlFromMacControl( parent ) ;
+ if ( wxParent && wxParent->IsKindOf( CLASSINFO( wxToolBar ) ) )
+ currentMouseWindow = wxParent ;
+ }
+ }
}
}
-
+
wxMouseEvent wxevent(wxEVT_LEFT_DOWN);
SetupMouseEvent( wxevent , cEvent ) ;
(FindControlUnderMouse(windowMouseLocation , window , &dummyPart) !=
wxMacFindControlUnderMouse( windowMouseLocation , window , &dummyPart ) ) )
{
- EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
- Point clickLocation = windowMouseLocation ;
-#if TARGET_API_MAC_OSX
- currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ;
-#endif
- HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation ,
- modifiers , (ControlActionUPP ) -1 ) ;
+ if ( currentMouseWindow->MacIsReallyEnabled() )
+ {
+ EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
+ Point clickLocation = windowMouseLocation ;
+ #if TARGET_API_MAC_OSX
+ currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ;
+ #endif
+ HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation ,
+ modifiers , (ControlActionUPP ) -1 ) ;
+ }
result = noErr ;
}
}
// update cursor ?
}
} // else if ( currentMouseWindow )
+ else
+ {
+ // don't mess with controls we don't know about
+ // for some reason returning eventNotHandledErr does not lead to the correct behaviour
+ // so we try sending them the correct control directly
+ wxTopLevelWindowMac* toplevelWindow = (wxTopLevelWindowMac*) data ;
+ if ( cEvent.GetKind() == kEventMouseDown && toplevelWindow && control )
+ {
+ EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
+ Point clickLocation = windowMouseLocation ;
+#if TARGET_API_MAC_OSX
+ HIPoint hiPoint ;
+ hiPoint.x = clickLocation.h ;
+ hiPoint.y = clickLocation.v ;
+ HIViewConvertPoint( &hiPoint , (ControlRef) toplevelWindow->GetHandle() , control ) ;
+ clickLocation.h = (int)hiPoint.x ;
+ clickLocation.v = (int)hiPoint.y ;
+#endif
+ HandleControlClick( control , clickLocation ,
+ modifiers , (ControlActionUPP ) -1 ) ;
+ result = noErr ;
+ }
+ }
return result ;
}
wxTopLevelWindowMac *wxTopLevelWindowMac::s_macDeactivateWindow = NULL;
+typedef struct
+{
+ wxPoint m_position ;
+ wxSize m_size ;
+} FullScreenData ;
+
void wxTopLevelWindowMac::Init()
{
m_iconized =
m_macUsesCompositing = FALSE;
#endif
m_macEventHandler = NULL ;
+ m_macFullScreenData = NULL ;
}
class wxMacDeferredWindowDeleter : public wxObject
SetName(name);
m_windowId = id == -1 ? NewControlId() : id;
+ wxWindow::SetTitle( title ) ;
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
if ( wxModelessWindows.Find(this) )
wxModelessWindows.DeleteObject(this);
+
+ FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
+ delete data ;
+ m_macFullScreenData = NULL ;
}
return TRUE ;
}
+bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
+{
+ if ( show )
+ {
+ FullScreenData *data = (FullScreenData *)m_macFullScreenData ;
+ delete data ;
+ data = new FullScreenData() ;
+
+ m_macFullScreenData = data ;
+ data->m_position = GetPosition() ;
+ data->m_size = GetSize() ;
+
+ if ( style & wxFULLSCREEN_NOMENUBAR )
+ {
+ HideMenuBar() ;
+ }
+ int left , top , right , bottom ;
+ wxRect client = wxGetClientDisplayRect() ;
+
+ int x, y, w, h ;
+
+ x = client.x ;
+ y = client.y ;
+ w = client.width ;
+ h = client.height ;
+
+ MacGetContentAreaInset( left , top , right , bottom ) ;
+
+ if ( style & wxFULLSCREEN_NOCAPTION )
+ {
+ y -= top ;
+ h += top ;
+ }
+ if ( style & wxFULLSCREEN_NOBORDER )
+ {
+ x -= left ;
+ w += left + right ;
+ h += bottom ;
+ }
+ if ( style & wxFULLSCREEN_NOTOOLBAR )
+ {
+ // TODO
+ }
+ if ( style & wxFULLSCREEN_NOSTATUSBAR )
+ {
+ // TODO
+ }
+ SetSize( x , y , w, h ) ;
+ }
+ else
+ {
+ ShowMenuBar() ;
+ FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
+ SetPosition( data->m_position ) ;
+ SetSize( data->m_size ) ;
+ delete data ;
+ m_macFullScreenData = NULL ;
+ }
+ return FALSE;
+}
+
+bool wxTopLevelWindowMac::IsFullScreen() const
+{
+ return m_macFullScreenData != NULL ;
+}
+
// we are still using coordinates of the content view, todo switch to structure bounds
void wxTopLevelWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )