X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f02a4ffa5feb5332c0cb41d625b7634677fbc6f4..53a410d1b242fce6ef061c7e6d24f54f8e38664d:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 8fe730574b..686346c3cc 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: mac/toplevel.cpp +// Name: src/mac/carbon/toplevel.cpp // Purpose: implements wxTopLevelWindow for Mac // Author: Stefan Csomor // Modified by: @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "toplevel.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -398,7 +394,7 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) } } -ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, Point location , ControlRef superControl , ControlPartCode *outPart ) +ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, const Point& location , ControlRef superControl , ControlPartCode *outPart ) { if ( superControl ) { @@ -445,7 +441,7 @@ ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, Point locat return NULL ; } -ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , Point location , WindowRef window , ControlPartCode *outPart ) +ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , const Point& location , WindowRef window , ControlPartCode *outPart ) { #if TARGET_API_MAC_OSX if ( UMAGetSystemVersion() >= 0x1030 && ( toplevelWindow == 0 || toplevelWindow->MacUsesCompositing() ) ) @@ -483,7 +479,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev windowPart = inContent ; } #endif - + if ( window ) { QDGlobalToLocalPoint( UMAGetWindowPort(window ) , &windowMouseLocation ) ; @@ -535,7 +531,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev eventleave.SetEventType( wxEVT_LEAVE_WINDOW ); g_MacLastWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y ); eventleave.SetEventObject( g_MacLastWindow ) ; - + wxevent.SetId( g_MacLastWindow->GetId() ) ; #if wxUSE_TOOLTIPS wxToolTip::RelayEvent( g_MacLastWindow , eventleave); #endif // wxUSE_TOOLTIPS @@ -547,6 +543,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev evententer.SetEventType( wxEVT_ENTER_WINDOW ); currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y ); evententer.SetEventObject( currentMouseWindow ) ; + wxevent.SetId( currentMouseWindow->GetId() ) ; #if wxUSE_TOOLTIPS wxToolTip::RelayEvent( currentMouseWindow , evententer); #endif // wxUSE_TOOLTIPS @@ -571,6 +568,7 @@ pascal OSStatus wxMacTopLevelMouseEventHandler( EventHandlerCallRef handler , Ev currentMouseWindow->ScreenToClient( &wxevent.m_x , &wxevent.m_y ) ; wxevent.SetEventObject( currentMouseWindow ) ; + wxevent.SetId( currentMouseWindow->GetId() ) ; // make tooltips current @@ -923,7 +921,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent, SetName(name); m_windowId = id == -1 ? NewControlId() : id; - wxWindow::SetTitle( title ) ; + wxWindow::SetLabel( title ) ; MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ; @@ -1210,6 +1208,16 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title, // the root control level handleer MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ; +#if TARGET_API_MAC_OSX + if ( m_macUsesCompositing && m_macWindow != NULL ) + { + if ( GetExtraStyle() & wxFRAME_EX_METAL ) + MacSetMetalAppearance( true ) ; + } +#endif + + + // the frame window event handler InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ; MacInstallTopLevelWindowEventHandler() ; @@ -1270,10 +1278,15 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool inIsActivating ) void wxTopLevelWindowMac::SetTitle(const wxString& title) { - wxWindow::SetTitle( title ) ; + wxWindow::SetLabel( title ) ; UMASetWTitle( (WindowRef)m_macWindow , title , m_font.GetEncoding() ) ; } +wxString wxTopLevelWindowMac::GetTitle() const +{ + return wxWindow::GetLabel(); +} + bool wxTopLevelWindowMac::Show(bool show) { if ( !wxTopLevelWindowBase::Show(show) ) @@ -1282,7 +1295,10 @@ bool wxTopLevelWindowMac::Show(bool show) if (show) { #if wxUSE_SYSTEM_OPTIONS //code contributed by Ryan Wilcox December 18, 2003 - if ( (wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) && ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1) ) + bool plainTransition = UMAGetSystemVersion() >= 0x1000 ; + if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) + plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ; + if ( plainTransition ) { ::ShowWindow( (WindowRef)m_macWindow ); } @@ -1300,7 +1316,10 @@ bool wxTopLevelWindowMac::Show(bool show) else { #if wxUSE_SYSTEM_OPTIONS - if ( (wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) && ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1) ) + bool plainTransition = UMAGetSystemVersion() >= 0x1000 ; + if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) ) + plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ; + if ( plainTransition ) { ::HideWindow((WindowRef) m_macWindow ); } @@ -1382,6 +1401,23 @@ bool wxTopLevelWindowMac::IsFullScreen() const return m_macFullScreenData != NULL ; } +void wxTopLevelWindowMac::SetExtraStyle(long exStyle) +{ + if ( GetExtraStyle() == exStyle ) + return ; + + wxTopLevelWindowBase::SetExtraStyle( exStyle ) ; +#if TARGET_API_MAC_OSX + if ( m_macUsesCompositing && m_macWindow != NULL ) + { + bool metal = GetExtraStyle() & wxFRAME_EX_METAL ; + if ( MacGetMetalAppearance() != metal ) + MacSetMetalAppearance( metal ) ; + } +#endif +} + + // 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 ) @@ -1707,4 +1743,3 @@ static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16 } // --------------------------------------------------------------------------- -