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 ;
+ }
+ }
}
}
(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 ;
}
}
// 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 ( toplevelWindow && control )
+ if ( cEvent.GetKind() == kEventMouseDown && toplevelWindow && control )
{
EventModifiers modifiers = cEvent.GetParameter<EventModifiers>(kEventParamKeyModifiers, typeUInt32) ;
Point clickLocation = windowMouseLocation ;
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 )