X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e181eae04877c1369a3ad01160f889ddc48971b..787f0fc4f3eb08f1065d86e44ace8d7453e1b1b3:/src/mac/carbon/toplevel.cpp diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 6f7d252499..778bd56588 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -390,59 +390,6 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent ) } } -ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, const Point& location , ControlRef superControl , ControlPartCode *outPart ) -{ - if ( superControl ) - { - UInt16 childrenCount = 0 ; - ControlHandle sibling ; - Rect r ; - OSStatus err = CountSubControls( superControl , &childrenCount ) ; - if ( err == errControlIsNotEmbedder ) - return NULL ; - - wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ; - - for ( UInt16 i = childrenCount ; i >=1 ; --i ) - { - err = GetIndexedSubControl( superControl , i , & sibling ) ; - if ( err == errControlIsNotEmbedder ) - return NULL ; - - wxASSERT_MSG( err == noErr , wxT("Unexpected error when accessing subcontrols") ) ; - if ( IsControlVisible( sibling ) ) - { - UMAGetControlBoundsInWindowCoords( sibling , &r ) ; - if ( MacPtInRect( location , &r ) ) - { - ControlHandle child = wxMacFindSubControl( toplevelWindow , location , sibling , outPart ) ; - if ( child ) - { - return child ; - } - else - { - Point testLocation = location ; - - if ( toplevelWindow ) - { - testLocation.h -= r.left ; - testLocation.v -= r.top ; - } - - *outPart = TestControl( sibling , testLocation ) ; - - return sibling ; - } - } - } - } - } - - return NULL ; -} - - #define NEW_CAPTURE_HANDLING 1 pascal OSStatus @@ -603,31 +550,6 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler), if (currentMouseWindow->CanAcceptFocus() && wxWindow::FindFocus()!=currentMouseWindow) currentMouseWindow->SetFocus(); } - - // if built-in find control is finding the wrong control (ie static box instead of overlaid - // button, we cannot let the standard handler do its job, but must handle manually - - if ( cEvent.GetKind() == kEventMouseDown ) - { - if ( currentMouseWindow->MacIsReallyEnabled() ) - { - EventModifiers modifiers = cEvent.GetParameter(kEventParamKeyModifiers, typeUInt32) ; - Point clickLocation = windowMouseLocation ; - - currentMouseWindow->MacRootWindowToWindow( &clickLocation.h , &clickLocation.v ) ; - - HandleControlClick( (ControlRef) currentMouseWindow->GetHandle() , clickLocation , - modifiers , (ControlActionUPP ) -1 ) ; - - if ((currentMouseWindowParent != NULL) && - (currentMouseWindowParent->GetChildren().Find(currentMouseWindow) == NULL)) - { - currentMouseWindow = NULL; - } - } - - result = noErr ; - } } if ( cEvent.GetKind() == kEventMouseUp && wxApp::s_captureWindow ) @@ -938,7 +860,7 @@ wxMacDeferredWindowDeleter::wxMacDeferredWindowDeleter( WindowRef windowRef ) wxMacDeferredWindowDeleter::~wxMacDeferredWindowDeleter() { - UMADisposeWindow( (WindowRef) m_macWindow ) ; + DisposeWindow( (WindowRef) m_macWindow ) ; } bool wxTopLevelWindowMac::Create(wxWindow *parent, @@ -961,7 +883,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent, DoMacCreateRealWindow( parent, title, pos , size , style , name ) ; - SetBackgroundColour(wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive))); + SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE )); if (GetExtraStyle() & wxFRAME_EX_METAL) MacSetMetalAppearance(true); @@ -1068,11 +990,16 @@ bool wxTopLevelWindowMac::SetBackgroundColour(const wxColour& col ) if ( !wxTopLevelWindowBase::SetBackgroundColour(col) && m_hasBgCol ) return false ; - if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ) + if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) || col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) ) + { SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ; - else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) ) + SetBackgroundStyle(wxBG_STYLE_CUSTOM); + } + else if ( col == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) || col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) ) + { SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ; - // TODO BETTER THEME SUPPORT + SetBackgroundStyle(wxBG_STYLE_CUSTOM); + } return true; } @@ -1277,7 +1204,7 @@ void wxTopLevelWindowMac::DoMacCreateRealWindow( SetWindowBounds( (WindowRef) m_macWindow , kWindowStructureRgn , &theBoundsRect ) ; wxAssociateWinWithMacWindow( (WindowRef) m_macWindow , this ) ; - UMASetWTitle( (WindowRef) m_macWindow , title , m_font.GetEncoding() ) ; + SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxMacCFStringHolder( title , m_font.GetEncoding() ) ); m_peer = new wxMacControl(this , true /*isRootControl*/) ; // There is a bug in 10.2.X for ::GetRootControl returning the window view instead of @@ -1374,7 +1301,7 @@ void wxTopLevelWindowMac::MacActivate( long timestamp , bool WXUNUSED(inIsActiva void wxTopLevelWindowMac::SetTitle(const wxString& title) { wxWindow::SetLabel( title ) ; - UMASetWTitle( (WindowRef)m_macWindow , title , m_font.GetEncoding() ) ; + SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxMacCFStringHolder( title , m_font.GetEncoding() ) ) ; } wxString wxTopLevelWindowMac::GetTitle() const