From 90b22acaa8a8673e9a6749aa5e5322d2c8913a85 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 4 Mar 2001 19:10:47 +0000 Subject: [PATCH] corrected redraw problems with native controls git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9464 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 74 ++++++++++++++++++++++++++++++++++++- src/mac/carbon/window.cpp | 2 +- src/mac/textctrl.cpp | 74 ++++++++++++++++++++++++++++++++++++- src/mac/window.cpp | 2 +- 4 files changed, 146 insertions(+), 6 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 811f5d86f4..7e1450068d 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -25,6 +25,8 @@ #include "wx/button.h" #include "wx/panel.h" #include "wx/textctrl.h" +#include "wx/notebook.h" +#include "wx/tabctrl.h" #include "wx/settings.h" #include "wx/filefn.h" #include "wx/utils.h" @@ -159,7 +161,41 @@ void wxTextCtrl::SetValue(const wxString& st) else value = st ; UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ; - UMADrawControl( m_macControl ) ; + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxMacDrawingHelper help( win ) ; + // the mac control manager always assumes to have the origin at 0,0 + SetOrigin( 0 , 0 ) ; + + bool hasTabBehind = false ; + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ; + break ; + } + + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) + SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ; + break ; + } + + parent = parent->GetParent() ; + } + + UMADrawControl( m_macControl ) ; + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ; + wxDC::MacInvalidateSetup() ; + } + } } // Clipboard operations @@ -214,7 +250,41 @@ void wxTextCtrl::Paste() UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ; TEFromScrap() ; TEPaste( teH ) ; - UMADrawControl( m_macControl ) ; + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxMacDrawingHelper help( win ) ; + // the mac control manager always assumes to have the origin at 0,0 + SetOrigin( 0 , 0 ) ; + + bool hasTabBehind = false ; + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ; + break ; + } + + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) + SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ; + break ; + } + + parent = parent->GetParent() ; + } + + UMADrawControl( m_macControl ) ; + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ; + wxDC::MacInvalidateSetup() ; + } + } } } diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 40ade4f268..f3ba668abe 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -1743,7 +1743,7 @@ void wxWindow::MacMouseMoved( EventRecord *ev , short part) } void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating ) { - wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating); + wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); event.m_timeStamp = ev->when ; event.SetEventObject(this); diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 811f5d86f4..7e1450068d 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -25,6 +25,8 @@ #include "wx/button.h" #include "wx/panel.h" #include "wx/textctrl.h" +#include "wx/notebook.h" +#include "wx/tabctrl.h" #include "wx/settings.h" #include "wx/filefn.h" #include "wx/utils.h" @@ -159,7 +161,41 @@ void wxTextCtrl::SetValue(const wxString& st) else value = st ; UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ; - UMADrawControl( m_macControl ) ; + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxMacDrawingHelper help( win ) ; + // the mac control manager always assumes to have the origin at 0,0 + SetOrigin( 0 , 0 ) ; + + bool hasTabBehind = false ; + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ; + break ; + } + + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) + SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ; + break ; + } + + parent = parent->GetParent() ; + } + + UMADrawControl( m_macControl ) ; + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ; + wxDC::MacInvalidateSetup() ; + } + } } // Clipboard operations @@ -214,7 +250,41 @@ void wxTextCtrl::Paste() UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ; TEFromScrap() ; TEPaste( teH ) ; - UMADrawControl( m_macControl ) ; + WindowRef window = GetMacRootWindow() ; + if ( window ) + { + wxWindow* win = wxFindWinFromMacWindow( window ) ; + if ( win ) + { + wxMacDrawingHelper help( win ) ; + // the mac control manager always assumes to have the origin at 0,0 + SetOrigin( 0 , 0 ) ; + + bool hasTabBehind = false ; + wxWindow* parent = GetParent() ; + while ( parent ) + { + if( parent->MacGetWindowData() ) + { + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ; + break ; + } + + if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) + { + if ( ((wxControl*)parent)->GetMacControl() ) + SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ; + break ; + } + + parent = parent->GetParent() ; + } + + UMADrawControl( m_macControl ) ; + UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ; + wxDC::MacInvalidateSetup() ; + } + } } } diff --git a/src/mac/window.cpp b/src/mac/window.cpp index 40ade4f268..f3ba668abe 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -1743,7 +1743,7 @@ void wxWindow::MacMouseMoved( EventRecord *ev , short part) } void wxWindow::MacActivate( EventRecord *ev , bool inIsActivating ) { - wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating); + wxActivateEvent event(wxEVT_ACTIVATE, inIsActivating , m_windowId); event.m_timeStamp = ev->when ; event.SetEventObject(this); -- 2.45.2