drawing methods cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -387,13 +387,9 @@ void wxControl::MacAdjustControlRect()
|
|||||||
m_height += 2 * m_macVerticalBorder;
|
m_height += 2 * m_macVerticalBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacDrawingHelper helper ( wxFindWinFromMacWindow( MacGetRootWindow() ) ) ;
|
|
||||||
if ( helper.Ok() )
|
|
||||||
{
|
|
||||||
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ControlHandle wxControl::MacGetContainerForEmbedding()
|
ControlHandle wxControl::MacGetContainerForEmbedding()
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
@@ -415,9 +411,6 @@ void wxControl::MacSuperChangedPosition()
|
|||||||
GetParent()->MacWindowToRootWindow( & mac_x , & mac_y ) ;
|
GetParent()->MacWindowToRootWindow( & mac_x , & mac_y ) ;
|
||||||
|
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
WindowRef rootwindow = MacGetRootWindow() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow ) ;
|
|
||||||
|
|
||||||
if ( mac_x + m_macHorizontalBorder != former_mac_x ||
|
if ( mac_x + m_macHorizontalBorder != former_mac_x ||
|
||||||
mac_y + m_macVerticalBorder != former_mac_y )
|
mac_y + m_macVerticalBorder != former_mac_y )
|
||||||
@@ -637,40 +630,38 @@ void wxControl::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
|
|
||||||
void wxControl::MacRedrawControl()
|
void wxControl::MacRedrawControl()
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl && MacGetRootWindow() )
|
||||||
{
|
{
|
||||||
WindowRef window = MacGetRootWindow() ;
|
wxClientDC dc(this) ;
|
||||||
if ( window )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
// the controls sometimes draw outside their boundaries, this
|
||||||
if ( win )
|
// should be resolved differently but is not trivial (e.g. drop shadows)
|
||||||
{
|
// since adding them to the border would yield in enormous gaps between
|
||||||
wxMacDrawingHelper help( win ) ;
|
// the controls
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
Rect r = { 0 , 0 , 32000 , 32000 } ;
|
||||||
|
ClipRect( &r ) ;
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
UMADrawControl( m_macControl ) ;
|
UMADrawControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxControl::OnPaint(wxPaintEvent& event)
|
void wxControl::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
{
|
{
|
||||||
WindowRef window = MacGetRootWindow() ;
|
wxPaintDC dc(this) ;
|
||||||
if ( window )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
// the controls sometimes draw outside their boundaries, this
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
// should be resolved differently but is not trivial (e.g. drop shadows)
|
||||||
if ( win )
|
// since adding them to the border would yield in enormous gaps between
|
||||||
{
|
// the controls
|
||||||
wxMacDrawingHelper help( win ) ;
|
Rect r = { 0 , 0 , 32000 , 32000 } ;
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
ClipRect( &r ) ;
|
||||||
|
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
UMADrawControl( m_macControl ) ;
|
UMADrawControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
|
@@ -47,14 +47,15 @@ wxWindowDC::wxWindowDC()
|
|||||||
|
|
||||||
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
// this time it is really the full window
|
int x , y ;
|
||||||
Rect clipRect ;
|
x = y = 0 ;
|
||||||
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
the_canvas->MacWindowToRootWindow( &x , &y ) ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
|
m_macLocalOrigin.h = x ;
|
||||||
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
m_macLocalOrigin.v = y ;
|
||||||
|
CopyRgn( the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
@@ -81,21 +82,23 @@ wxClientDC::wxClientDC()
|
|||||||
|
|
||||||
wxClientDC::wxClientDC(wxWindow *window)
|
wxClientDC::wxClientDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
Rect clipRect ;
|
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
|
wxSize size = window->GetClientSize() ;
|
||||||
window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
int x , y ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
|
x = origin.x ;
|
||||||
|
y = origin.y ;
|
||||||
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
|
m_macLocalOrigin.h = x ;
|
||||||
|
m_macLocalOrigin.v = y ;
|
||||||
|
SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
wxSize size = window->GetSize() ;
|
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
@@ -117,30 +120,27 @@ wxPaintDC::wxPaintDC()
|
|||||||
|
|
||||||
wxPaintDC::wxPaintDC(wxWindow *window)
|
wxPaintDC::wxPaintDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
Rect clipRect ;
|
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
|
wxSize size = window->GetClientSize() ;
|
||||||
window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
int x , y ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
|
x = origin.x ;
|
||||||
|
y = origin.y ;
|
||||||
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
|
m_macLocalOrigin.h = x ;
|
||||||
|
m_macLocalOrigin.v = y ;
|
||||||
|
SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_ok = TRUE ;
|
|
||||||
/*
|
|
||||||
wxCoord x , y ,w , h ;
|
|
||||||
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
|
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
wxSize size = window->GetSize() ;
|
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
SetClippingRegion( x , y , w , h ) ;
|
m_ok = TRUE ;
|
||||||
*/
|
|
||||||
SetBackground(window->MacGetBackgroundBrush());
|
SetBackground(window->MacGetBackgroundBrush());
|
||||||
SetFont( window->GetFont() ) ;
|
SetFont( window->GetFont() ) ;
|
||||||
}
|
}
|
||||||
|
@@ -162,6 +162,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
||||||
}
|
}
|
||||||
listDef.u.userProc = macListDefUPP ;
|
listDef.u.userProc = macListDefUPP ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
Size asize;
|
Size asize;
|
||||||
|
|
||||||
@@ -176,6 +177,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
SetControlVisibility(m_macControl, false, false);
|
SetControlVisibility(m_macControl, false, false);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
long result ;
|
long result ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false ,
|
m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false ,
|
||||||
@@ -197,7 +199,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
Point pt = (**m_macList).cellSize ;
|
Point pt = (**m_macList).cellSize ;
|
||||||
pt.v = 14 ;
|
pt.v = 14 ;
|
||||||
LCellSize( pt , m_macList ) ;
|
LCellSize( pt , m_macList ) ;
|
||||||
|
|
||||||
LAddColumn( 1 , 0 , m_macList ) ;
|
LAddColumn( 1 , 0 , m_macList ) ;
|
||||||
#endif
|
#endif
|
||||||
OptionBits options = 0;
|
OptionBits options = 0;
|
||||||
@@ -585,12 +586,8 @@ void wxListBox::SetupColours()
|
|||||||
|
|
||||||
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
||||||
{
|
{
|
||||||
// Set up port
|
wxControl::Refresh( eraseBack , rect ) ;
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
// MacRedrawControl() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow );
|
|
||||||
|
|
||||||
UMADrawControl(m_macControl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
|
@@ -179,39 +179,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
else
|
else
|
||||||
value = st ;
|
value = st ;
|
||||||
::SetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
|
::SetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetRootWindow() , 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 ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
@@ -254,39 +222,7 @@ void wxTextCtrl::Paste()
|
|||||||
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
||||||
TEFromScrap() ;
|
TEFromScrap() ;
|
||||||
TEPaste( teH ) ;
|
TEPaste( teH ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( 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 ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1885,39 +1821,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
TXNSetData( (**tpvars).fTXNRec, kTXNTextData, (const char*)value, value.Length(),
|
TXNSetData( (**tpvars).fTXNRec, kTXNTextData, (const char*)value, value.Length(),
|
||||||
kTXNStartOffset, kTXNEndOffset);
|
kTXNStartOffset, kTXNEndOffset);
|
||||||
}
|
}
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 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 ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
@@ -1976,38 +1880,7 @@ void wxTextCtrl::Paste()
|
|||||||
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
||||||
TEFromScrap() ;
|
TEFromScrap() ;
|
||||||
TEPaste( teH ) ;
|
TEPaste( teH ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->MacGetWindowData() )
|
|
||||||
{
|
|
||||||
::SetThemeWindowBackground( 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 ) ;
|
|
||||||
::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -168,13 +168,19 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
Point localOrigin ;
|
Point localOrigin ;
|
||||||
Rect clipRect ;
|
Rect clipRect ;
|
||||||
WindowRef window ;
|
WindowRef window = MacGetRootWindow() ;
|
||||||
wxWindow *win ;
|
wxWindow *win ;
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
int lx , ly ;
|
||||||
|
lx = ly = 0 ;
|
||||||
|
MacWindowToRootWindow( &lx , &ly ) ;
|
||||||
|
localOrigin.v = ly ;
|
||||||
|
localOrigin.h = lx ;
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
||||||
m_y + m_height + localOrigin.v , m_x + m_width + localOrigin.h} ;
|
|
||||||
|
Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
|
||||||
|
m_height + localOrigin.v , m_width + localOrigin.h} ;
|
||||||
ControlFontStyleRec controlstyle ;
|
ControlFontStyleRec controlstyle ;
|
||||||
|
|
||||||
controlstyle.flags = kControlUseFontMask ;
|
controlstyle.flags = kControlUseFontMask ;
|
||||||
@@ -378,11 +384,16 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
Rect clipRect ;
|
Rect clipRect ;
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
wxWindow *win ;
|
wxWindow *win ;
|
||||||
|
int lx , ly ;
|
||||||
|
lx = ly = 0 ;
|
||||||
|
MacWindowToRootWindow( &lx , &ly ) ;
|
||||||
|
localOrigin.v = ly ;
|
||||||
|
localOrigin.h = lx ;
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
|
||||||
m_y + m_height + localOrigin.v , m_x + m_width + localOrigin.h} ;
|
m_height + localOrigin.v , m_width + localOrigin.h} ;
|
||||||
ControlFontStyleRec controlstyle ;
|
ControlFontStyleRec controlstyle ;
|
||||||
|
|
||||||
controlstyle.flags = kControlUseFontMask ;
|
controlstyle.flags = kControlUseFontMask ;
|
||||||
@@ -400,9 +411,6 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
int toolcount = 0 ;
|
int toolcount = 0 ;
|
||||||
{
|
{
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
WindowRef rootwindow = MacGetRootWindow() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
::SetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow ) ;
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||||
@@ -453,13 +461,6 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::SetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||||
@@ -578,39 +579,11 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
|
|||||||
|
|
||||||
void wxToolBar::OnPaint(wxPaintEvent& event)
|
void wxToolBar::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
Point localOrigin ;
|
wxPaintDC dc(this) ;
|
||||||
Rect clipRect ;
|
wxMacPortSetter helper(&dc) ;
|
||||||
WindowRef window ;
|
|
||||||
wxWindow *win ;
|
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
|
||||||
if ( window && win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( 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() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
|
||||||
m_y + localOrigin.v + m_height , m_x + localOrigin.h + m_width } ;
|
|
||||||
|
|
||||||
|
Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
|
||||||
|
dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
|
||||||
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
{
|
{
|
||||||
int index = 0 ;
|
int index = 0 ;
|
||||||
@@ -622,8 +595,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouse( wxMouseEvent &event )
|
void wxToolBar::OnMouse( wxMouseEvent &event )
|
||||||
|
@@ -556,32 +556,17 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
if ( doMove || doResize )
|
if ( doMove || doResize )
|
||||||
{
|
{
|
||||||
// erase former position
|
// erase former position
|
||||||
wxMacDrawingHelper focus( this ) ;
|
|
||||||
if ( focus.Ok() )
|
Refresh() ;
|
||||||
{
|
|
||||||
Rect clientrect = { 0 , 0 , m_height , m_width } ;
|
|
||||||
focus.LocalToWindow( &clientrect ) ;
|
|
||||||
// ClipRect( &clientrect ) ;
|
|
||||||
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_x = actualX ;
|
m_x = actualX ;
|
||||||
m_y = actualY ;
|
m_y = actualY ;
|
||||||
m_width = actualWidth ;
|
m_width = actualWidth ;
|
||||||
m_height = actualHeight ;
|
m_height = actualHeight ;
|
||||||
|
|
||||||
// erase new position
|
// erase new position
|
||||||
|
|
||||||
{
|
Refresh() ;
|
||||||
wxMacDrawingHelper focus( this ) ;
|
|
||||||
if ( focus.Ok() )
|
|
||||||
{
|
|
||||||
Rect clientrect = { 0 , 0 , m_height , m_width } ;
|
|
||||||
focus.LocalToWindow( &clientrect ) ;
|
|
||||||
// ClipRect( &clientrect ) ;
|
|
||||||
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( doMove )
|
if ( doMove )
|
||||||
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
||||||
|
|
||||||
@@ -948,11 +933,10 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
|
|||||||
|
|
||||||
void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
|
void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
|
||||||
{
|
{
|
||||||
wxMacDrawingHelper focus( this ) ;
|
wxWindowDC dc(this) ;
|
||||||
if ( focus.Ok() )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
|
||||||
MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
|
MacPaintBorders( dc.m_macLocalOrigin.h , dc.m_macLocalOrigin.v) ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxWindowMac::GetScrollPos(int orient) const
|
int wxWindowMac::GetScrollPos(int orient) const
|
||||||
@@ -1123,20 +1107,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
|
|||||||
// Does a physical scroll
|
// Does a physical scroll
|
||||||
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
||||||
{
|
{
|
||||||
wxMacDrawingHelper focus( this , true ) ;
|
wxClientDC dc(this) ;
|
||||||
if ( focus.Ok() )
|
wxMacPortSetter helper(&dc) ;
|
||||||
|
|
||||||
{
|
{
|
||||||
int width , height ;
|
int width , height ;
|
||||||
GetClientSize( &width , &height ) ;
|
GetClientSize( &width , &height ) ;
|
||||||
|
|
||||||
Rect scrollrect = { 0 , 0 , height , width } ;
|
Rect scrollrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , dc.YLOG2DEVMAC(height) , dc.XLOG2DEVMAC(width) } ;
|
||||||
focus.LocalToWindow( &scrollrect ) ;
|
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
ClipRect( &scrollrect ) ;
|
ClipRect( &scrollrect ) ;
|
||||||
if ( rect )
|
if ( rect )
|
||||||
{
|
{
|
||||||
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
|
Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
|
||||||
focus.LocalToWindow( &r ) ;
|
dc.XLOG2DEVMAC(rect->x + rect->width) } ;
|
||||||
SectRect( &scrollrect , &r , &scrollrect ) ;
|
SectRect( &scrollrect , &r , &scrollrect ) ;
|
||||||
}
|
}
|
||||||
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
|
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
|
||||||
@@ -1444,30 +1428,50 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
|||||||
const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
||||||
{
|
{
|
||||||
RgnHandle visRgn = NewRgn() ;
|
RgnHandle visRgn = NewRgn() ;
|
||||||
|
RgnHandle tempRgn = NewRgn() ;
|
||||||
|
|
||||||
SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
|
SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
|
||||||
|
|
||||||
|
//TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
|
||||||
|
if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
|
||||||
|
{
|
||||||
|
int borderTop = 14 ;
|
||||||
|
int borderOther = 4 ;
|
||||||
|
|
||||||
|
SetRectRgn( tempRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
|
||||||
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* parent = GetParent() ;
|
||||||
|
while( parent )
|
||||||
|
{
|
||||||
|
wxSize size = parent->GetSize() ;
|
||||||
|
int x , y ;
|
||||||
|
x = y = 0 ;
|
||||||
|
parent->MacWindowToRootWindow( &x, &y ) ;
|
||||||
|
MacRootWindowToWindow( &x , &y ) ;
|
||||||
|
SetRectRgn( tempRgn , x , y , x + size.x , y + size.y ) ;
|
||||||
|
SectRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
|
if ( parent->IsTopLevel() )
|
||||||
|
break ;
|
||||||
|
parent = parent->GetParent() ;
|
||||||
|
}
|
||||||
if ( GetWindowStyle() & wxCLIP_CHILDREN )
|
if ( GetWindowStyle() & wxCLIP_CHILDREN )
|
||||||
{
|
{
|
||||||
// subtract all children from updatergn
|
|
||||||
|
|
||||||
RgnHandle childarea = NewRgn() ;
|
|
||||||
for (wxNode *node = GetChildren().First(); node; node = node->Next())
|
for (wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||||
{
|
{
|
||||||
wxWindowMac *child = (wxWindowMac*)node->Data();
|
wxWindowMac *child = (wxWindowMac*)node->Data();
|
||||||
|
|
||||||
if ( !child->IsTopLevel() && child->IsShown() )
|
if ( !child->IsTopLevel() && child->IsShown() )
|
||||||
{
|
{
|
||||||
SetRectRgn( childarea , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
|
SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
|
||||||
DiffRgn( visRgn , childarea , visRgn ) ;
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisposeRgn( childarea ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
|
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
|
||||||
{
|
{
|
||||||
RgnHandle siblingarea = NewRgn() ;
|
|
||||||
bool thisWindowThrough = false ;
|
bool thisWindowThrough = false ;
|
||||||
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
|
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
|
||||||
{
|
{
|
||||||
@@ -1484,14 +1488,14 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
|||||||
|
|
||||||
if ( !sibling->IsTopLevel() && sibling->IsShown() )
|
if ( !sibling->IsTopLevel() && sibling->IsShown() )
|
||||||
{
|
{
|
||||||
SetRectRgn( siblingarea , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ;
|
SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ;
|
||||||
DiffRgn( visRgn , siblingarea , visRgn ) ;
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisposeRgn( siblingarea ) ;
|
|
||||||
}
|
}
|
||||||
m_macVisibleRegion = visRgn ;
|
m_macVisibleRegion = visRgn ;
|
||||||
DisposeRgn( visRgn ) ;
|
DisposeRgn( visRgn ) ;
|
||||||
|
DisposeRgn( tempRgn ) ;
|
||||||
return m_macVisibleRegion ;
|
return m_macVisibleRegion ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1726,65 +1730,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
|
|
||||||
{
|
|
||||||
if ( window == NULL )
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
GrafPtr currPort;
|
|
||||||
GrafPtr port ;
|
|
||||||
::GetPort(&currPort);
|
|
||||||
port = UMAGetWindowPort( window) ;
|
|
||||||
if (currPort != port )
|
|
||||||
::SetPort(port);
|
|
||||||
Rect cr = clipRect ;
|
|
||||||
OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
|
|
||||||
::ClipRect(&cr);
|
|
||||||
|
|
||||||
::PenNormal() ;
|
|
||||||
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
|
|
||||||
::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
|
|
||||||
Pattern whiteColor ;
|
|
||||||
|
|
||||||
::BackPat( GetQDGlobalsWhite( &whiteColor) ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
|
|
||||||
{
|
|
||||||
wxASSERT( GetParent() != NULL ) ;
|
|
||||||
GetParent()->MacGetPortParams( localOrigin , clipRect , window, rootwin) ;
|
|
||||||
localOrigin->h += m_x;
|
|
||||||
localOrigin->v += m_y;
|
|
||||||
OffsetRect(clipRect, -m_x, -m_y);
|
|
||||||
|
|
||||||
Rect myClip;
|
|
||||||
myClip.left = 0;
|
|
||||||
myClip.top = 0;
|
|
||||||
myClip.right = m_width;
|
|
||||||
myClip.bottom = m_height;
|
|
||||||
SectRect(clipRect, &myClip, clipRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
|
|
||||||
{
|
|
||||||
MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
|
|
||||||
|
|
||||||
int width , height ;
|
|
||||||
GetClientSize( &width , &height ) ;
|
|
||||||
wxPoint client ;
|
|
||||||
client = GetClientAreaOrigin( ) ;
|
|
||||||
|
|
||||||
localOrigin->h += client.x;
|
|
||||||
localOrigin->v += client.y;
|
|
||||||
OffsetRect(clipRect, -client.x, -client.y);
|
|
||||||
|
|
||||||
Rect myClip = { 0 , 0 , height , width } ;
|
|
||||||
SectRect(clipRect, &myClip, clipRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
long wxWindowMac::MacGetLeftBorderSize( ) const
|
long wxWindowMac::MacGetLeftBorderSize( ) const
|
||||||
{
|
{
|
||||||
if( IsTopLevel() )
|
if( IsTopLevel() )
|
||||||
@@ -1840,46 +1785,6 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
|
|||||||
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
|
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
|
|
||||||
{
|
|
||||||
m_ok = false ;
|
|
||||||
Rect clipRect ;
|
|
||||||
WindowRef window ;
|
|
||||||
wxWindowMac *rootwin ;
|
|
||||||
m_currentPort = NULL ;
|
|
||||||
|
|
||||||
GetPort( &m_formerPort ) ;
|
|
||||||
if ( theWindow )
|
|
||||||
{
|
|
||||||
if ( clientArea )
|
|
||||||
theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
|
|
||||||
else
|
|
||||||
theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
|
|
||||||
m_currentPort = UMAGetWindowPort( window ) ;
|
|
||||||
if ( m_formerPort != m_currentPort )
|
|
||||||
SetPort( m_currentPort ) ;
|
|
||||||
GetPenState( &m_savedPenState ) ;
|
|
||||||
theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
|
|
||||||
m_ok = true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacDrawingHelper::~wxMacDrawingHelper()
|
|
||||||
{
|
|
||||||
if ( m_ok )
|
|
||||||
{
|
|
||||||
SetPort( m_currentPort ) ;
|
|
||||||
SetPenState( &m_savedPenState ) ;
|
|
||||||
Rect portRect ;
|
|
||||||
GetPortBounds( m_currentPort , &portRect ) ;
|
|
||||||
ClipRect( &portRect ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_formerPort != m_currentPort )
|
|
||||||
SetPort( m_formerPort ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the wxWindowMac at the current mouse position, returning the mouse
|
// Find the wxWindowMac at the current mouse position, returning the mouse
|
||||||
// position.
|
// position.
|
||||||
wxWindowMac* wxFindWindowAtPointer(wxPoint& pt)
|
wxWindowMac* wxFindWindowAtPointer(wxPoint& pt)
|
||||||
|
@@ -387,13 +387,9 @@ void wxControl::MacAdjustControlRect()
|
|||||||
m_height += 2 * m_macVerticalBorder;
|
m_height += 2 * m_macVerticalBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMacDrawingHelper helper ( wxFindWinFromMacWindow( MacGetRootWindow() ) ) ;
|
|
||||||
if ( helper.Ok() )
|
|
||||||
{
|
|
||||||
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
UMASizeControl( m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ControlHandle wxControl::MacGetContainerForEmbedding()
|
ControlHandle wxControl::MacGetContainerForEmbedding()
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
@@ -415,9 +411,6 @@ void wxControl::MacSuperChangedPosition()
|
|||||||
GetParent()->MacWindowToRootWindow( & mac_x , & mac_y ) ;
|
GetParent()->MacWindowToRootWindow( & mac_x , & mac_y ) ;
|
||||||
|
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
WindowRef rootwindow = MacGetRootWindow() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow ) ;
|
|
||||||
|
|
||||||
if ( mac_x + m_macHorizontalBorder != former_mac_x ||
|
if ( mac_x + m_macHorizontalBorder != former_mac_x ||
|
||||||
mac_y + m_macVerticalBorder != former_mac_y )
|
mac_y + m_macVerticalBorder != former_mac_y )
|
||||||
@@ -637,40 +630,38 @@ void wxControl::Refresh(bool eraseBack, const wxRect *rect)
|
|||||||
|
|
||||||
void wxControl::MacRedrawControl()
|
void wxControl::MacRedrawControl()
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl && MacGetRootWindow() )
|
||||||
{
|
{
|
||||||
WindowRef window = MacGetRootWindow() ;
|
wxClientDC dc(this) ;
|
||||||
if ( window )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
// the controls sometimes draw outside their boundaries, this
|
||||||
if ( win )
|
// should be resolved differently but is not trivial (e.g. drop shadows)
|
||||||
{
|
// since adding them to the border would yield in enormous gaps between
|
||||||
wxMacDrawingHelper help( win ) ;
|
// the controls
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
Rect r = { 0 , 0 , 32000 , 32000 } ;
|
||||||
|
ClipRect( &r ) ;
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
UMADrawControl( m_macControl ) ;
|
UMADrawControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxControl::OnPaint(wxPaintEvent& event)
|
void wxControl::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_macControl )
|
if ( m_macControl )
|
||||||
{
|
{
|
||||||
WindowRef window = MacGetRootWindow() ;
|
wxPaintDC dc(this) ;
|
||||||
if ( window )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
// the controls sometimes draw outside their boundaries, this
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
// should be resolved differently but is not trivial (e.g. drop shadows)
|
||||||
if ( win )
|
// since adding them to the border would yield in enormous gaps between
|
||||||
{
|
// the controls
|
||||||
wxMacDrawingHelper help( win ) ;
|
Rect r = { 0 , 0 , 32000 , 32000 } ;
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
ClipRect( &r ) ;
|
||||||
|
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
|
||||||
UMADrawControl( m_macControl ) ;
|
UMADrawControl( m_macControl ) ;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
|
@@ -47,14 +47,15 @@ wxWindowDC::wxWindowDC()
|
|||||||
|
|
||||||
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
// this time it is really the full window
|
int x , y ;
|
||||||
Rect clipRect ;
|
x = y = 0 ;
|
||||||
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
the_canvas->MacWindowToRootWindow( &x , &y ) ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
|
m_macLocalOrigin.h = x ;
|
||||||
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
m_macLocalOrigin.v = y ;
|
||||||
|
CopyRgn( the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
@@ -81,21 +82,23 @@ wxClientDC::wxClientDC()
|
|||||||
|
|
||||||
wxClientDC::wxClientDC(wxWindow *window)
|
wxClientDC::wxClientDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
Rect clipRect ;
|
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
|
wxSize size = window->GetClientSize() ;
|
||||||
window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
int x , y ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
|
x = origin.x ;
|
||||||
|
y = origin.y ;
|
||||||
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
|
m_macLocalOrigin.h = x ;
|
||||||
|
m_macLocalOrigin.v = y ;
|
||||||
|
SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
wxSize size = window->GetSize() ;
|
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
@@ -117,30 +120,27 @@ wxPaintDC::wxPaintDC()
|
|||||||
|
|
||||||
wxPaintDC::wxPaintDC(wxWindow *window)
|
wxPaintDC::wxPaintDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
WindowRef windowref ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
wxWindowMac* rootwindow ;
|
WindowRef windowref = rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
Rect clipRect ;
|
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
|
wxSize size = window->GetClientSize() ;
|
||||||
window->MacGetPortClientParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
|
int x , y ;
|
||||||
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
|
x = origin.x ;
|
||||||
|
y = origin.y ;
|
||||||
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
|
m_macLocalOrigin.h = x ;
|
||||||
|
m_macLocalOrigin.v = y ;
|
||||||
|
SetRectRgn( m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
|
||||||
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_ok = TRUE ;
|
|
||||||
/*
|
|
||||||
wxCoord x , y ,w , h ;
|
|
||||||
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
|
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
wxSize size = window->GetSize() ;
|
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
SetClippingRegion( x , y , w , h ) ;
|
m_ok = TRUE ;
|
||||||
*/
|
|
||||||
SetBackground(window->MacGetBackgroundBrush());
|
SetBackground(window->MacGetBackgroundBrush());
|
||||||
SetFont( window->GetFont() ) ;
|
SetFont( window->GetFont() ) ;
|
||||||
}
|
}
|
||||||
|
@@ -162,6 +162,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
||||||
}
|
}
|
||||||
listDef.u.userProc = macListDefUPP ;
|
listDef.u.userProc = macListDefUPP ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
Size asize;
|
Size asize;
|
||||||
|
|
||||||
@@ -176,6 +177,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
SetControlVisibility(m_macControl, false, false);
|
SetControlVisibility(m_macControl, false, false);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
long result ;
|
long result ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false ,
|
m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false ,
|
||||||
@@ -197,7 +199,6 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
Point pt = (**m_macList).cellSize ;
|
Point pt = (**m_macList).cellSize ;
|
||||||
pt.v = 14 ;
|
pt.v = 14 ;
|
||||||
LCellSize( pt , m_macList ) ;
|
LCellSize( pt , m_macList ) ;
|
||||||
|
|
||||||
LAddColumn( 1 , 0 , m_macList ) ;
|
LAddColumn( 1 , 0 , m_macList ) ;
|
||||||
#endif
|
#endif
|
||||||
OptionBits options = 0;
|
OptionBits options = 0;
|
||||||
@@ -585,12 +586,8 @@ void wxListBox::SetupColours()
|
|||||||
|
|
||||||
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
||||||
{
|
{
|
||||||
// Set up port
|
wxControl::Refresh( eraseBack , rect ) ;
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
// MacRedrawControl() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow );
|
|
||||||
|
|
||||||
UMADrawControl(m_macControl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
|
@@ -179,39 +179,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
else
|
else
|
||||||
value = st ;
|
value = st ;
|
||||||
::SetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
|
::SetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetRootWindow() , 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 ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
@@ -254,39 +222,7 @@ void wxTextCtrl::Paste()
|
|||||||
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
||||||
TEFromScrap() ;
|
TEFromScrap() ;
|
||||||
TEPaste( teH ) ;
|
TEPaste( teH ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( 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 ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1885,39 +1821,7 @@ void wxTextCtrl::SetValue(const wxString& st)
|
|||||||
TXNSetData( (**tpvars).fTXNRec, kTXNTextData, (const char*)value, value.Length(),
|
TXNSetData( (**tpvars).fTXNRec, kTXNTextData, (const char*)value, value.Length(),
|
||||||
kTXNStartOffset, kTXNEndOffset);
|
kTXNStartOffset, kTXNEndOffset);
|
||||||
}
|
}
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 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 ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
@@ -1976,38 +1880,7 @@ void wxTextCtrl::Paste()
|
|||||||
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
::GetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
|
||||||
TEFromScrap() ;
|
TEFromScrap() ;
|
||||||
TEPaste( teH ) ;
|
TEPaste( teH ) ;
|
||||||
WindowRef window = MacGetRootWindow() ;
|
MacRedrawControl() ;
|
||||||
if ( window )
|
|
||||||
{
|
|
||||||
wxWindow* win = wxFindWinFromMacWindow( window ) ;
|
|
||||||
if ( win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->MacGetWindowData() )
|
|
||||||
{
|
|
||||||
::SetThemeWindowBackground( 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 ) ;
|
|
||||||
::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -168,13 +168,19 @@ bool wxToolBar::Realize()
|
|||||||
|
|
||||||
Point localOrigin ;
|
Point localOrigin ;
|
||||||
Rect clipRect ;
|
Rect clipRect ;
|
||||||
WindowRef window ;
|
WindowRef window = MacGetRootWindow() ;
|
||||||
wxWindow *win ;
|
wxWindow *win ;
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
int lx , ly ;
|
||||||
|
lx = ly = 0 ;
|
||||||
|
MacWindowToRootWindow( &lx , &ly ) ;
|
||||||
|
localOrigin.v = ly ;
|
||||||
|
localOrigin.h = lx ;
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
||||||
m_y + m_height + localOrigin.v , m_x + m_width + localOrigin.h} ;
|
|
||||||
|
Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
|
||||||
|
m_height + localOrigin.v , m_width + localOrigin.h} ;
|
||||||
ControlFontStyleRec controlstyle ;
|
ControlFontStyleRec controlstyle ;
|
||||||
|
|
||||||
controlstyle.flags = kControlUseFontMask ;
|
controlstyle.flags = kControlUseFontMask ;
|
||||||
@@ -378,11 +384,16 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
Rect clipRect ;
|
Rect clipRect ;
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
wxWindow *win ;
|
wxWindow *win ;
|
||||||
|
int lx , ly ;
|
||||||
|
lx = ly = 0 ;
|
||||||
|
MacWindowToRootWindow( &lx , &ly ) ;
|
||||||
|
localOrigin.v = ly ;
|
||||||
|
localOrigin.h = lx ;
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
// GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
Rect toolbarrect = { localOrigin.v ,localOrigin.h ,
|
||||||
m_y + m_height + localOrigin.v , m_x + m_width + localOrigin.h} ;
|
m_height + localOrigin.v , m_width + localOrigin.h} ;
|
||||||
ControlFontStyleRec controlstyle ;
|
ControlFontStyleRec controlstyle ;
|
||||||
|
|
||||||
controlstyle.flags = kControlUseFontMask ;
|
controlstyle.flags = kControlUseFontMask ;
|
||||||
@@ -400,9 +411,6 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
int toolcount = 0 ;
|
int toolcount = 0 ;
|
||||||
{
|
{
|
||||||
WindowRef rootwindow = MacGetRootWindow() ;
|
WindowRef rootwindow = MacGetRootWindow() ;
|
||||||
wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
|
|
||||||
::SetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
|
|
||||||
wxMacDrawingHelper focus( wxrootwindow ) ;
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
wxToolBarTool *tool = (wxToolBarTool *)node->Data();
|
||||||
@@ -453,13 +461,6 @@ void wxToolBar::MacSuperChangedPosition()
|
|||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::SetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
|
||||||
@@ -578,39 +579,11 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
|
|||||||
|
|
||||||
void wxToolBar::OnPaint(wxPaintEvent& event)
|
void wxToolBar::OnPaint(wxPaintEvent& event)
|
||||||
{
|
{
|
||||||
Point localOrigin ;
|
wxPaintDC dc(this) ;
|
||||||
Rect clipRect ;
|
wxMacPortSetter helper(&dc) ;
|
||||||
WindowRef window ;
|
|
||||||
wxWindow *win ;
|
|
||||||
|
|
||||||
GetParent()->MacGetPortParams( &localOrigin , &clipRect , &window , &win ) ;
|
|
||||||
if ( window && win )
|
|
||||||
{
|
|
||||||
wxMacDrawingHelper help( win ) ;
|
|
||||||
// the mac control manager always assumes to have the origin at 0,0
|
|
||||||
bool hasTabBehind = false ;
|
|
||||||
wxWindow* parent = GetParent() ;
|
|
||||||
while ( parent )
|
|
||||||
{
|
|
||||||
if( parent->IsTopLevel() )
|
|
||||||
{
|
|
||||||
// ::SetThemeWindowBackground( 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() ;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rect toolbarrect = { m_y + localOrigin.v , m_x + localOrigin.h ,
|
|
||||||
m_y + localOrigin.v + m_height , m_x + localOrigin.h + m_width } ;
|
|
||||||
|
|
||||||
|
Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
|
||||||
|
dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ;
|
||||||
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
{
|
{
|
||||||
int index = 0 ;
|
int index = 0 ;
|
||||||
@@ -622,8 +595,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::OnMouse( wxMouseEvent &event )
|
void wxToolBar::OnMouse( wxMouseEvent &event )
|
||||||
|
@@ -556,32 +556,17 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
if ( doMove || doResize )
|
if ( doMove || doResize )
|
||||||
{
|
{
|
||||||
// erase former position
|
// erase former position
|
||||||
wxMacDrawingHelper focus( this ) ;
|
|
||||||
if ( focus.Ok() )
|
Refresh() ;
|
||||||
{
|
|
||||||
Rect clientrect = { 0 , 0 , m_height , m_width } ;
|
|
||||||
focus.LocalToWindow( &clientrect ) ;
|
|
||||||
// ClipRect( &clientrect ) ;
|
|
||||||
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_x = actualX ;
|
m_x = actualX ;
|
||||||
m_y = actualY ;
|
m_y = actualY ;
|
||||||
m_width = actualWidth ;
|
m_width = actualWidth ;
|
||||||
m_height = actualHeight ;
|
m_height = actualHeight ;
|
||||||
|
|
||||||
// erase new position
|
// erase new position
|
||||||
|
|
||||||
{
|
Refresh() ;
|
||||||
wxMacDrawingHelper focus( this ) ;
|
|
||||||
if ( focus.Ok() )
|
|
||||||
{
|
|
||||||
Rect clientrect = { 0 , 0 , m_height , m_width } ;
|
|
||||||
focus.LocalToWindow( &clientrect ) ;
|
|
||||||
// ClipRect( &clientrect ) ;
|
|
||||||
InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( doMove )
|
if ( doMove )
|
||||||
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
|
||||||
|
|
||||||
@@ -948,11 +933,10 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
|
|||||||
|
|
||||||
void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
|
void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
|
||||||
{
|
{
|
||||||
wxMacDrawingHelper focus( this ) ;
|
wxWindowDC dc(this) ;
|
||||||
if ( focus.Ok() )
|
wxMacPortSetter helper(&dc) ;
|
||||||
{
|
|
||||||
MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
|
MacPaintBorders( dc.m_macLocalOrigin.h , dc.m_macLocalOrigin.v) ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxWindowMac::GetScrollPos(int orient) const
|
int wxWindowMac::GetScrollPos(int orient) const
|
||||||
@@ -1123,20 +1107,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
|
|||||||
// Does a physical scroll
|
// Does a physical scroll
|
||||||
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
|
||||||
{
|
{
|
||||||
wxMacDrawingHelper focus( this , true ) ;
|
wxClientDC dc(this) ;
|
||||||
if ( focus.Ok() )
|
wxMacPortSetter helper(&dc) ;
|
||||||
|
|
||||||
{
|
{
|
||||||
int width , height ;
|
int width , height ;
|
||||||
GetClientSize( &width , &height ) ;
|
GetClientSize( &width , &height ) ;
|
||||||
|
|
||||||
Rect scrollrect = { 0 , 0 , height , width } ;
|
Rect scrollrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , dc.YLOG2DEVMAC(height) , dc.XLOG2DEVMAC(width) } ;
|
||||||
focus.LocalToWindow( &scrollrect ) ;
|
|
||||||
RgnHandle updateRgn = NewRgn() ;
|
RgnHandle updateRgn = NewRgn() ;
|
||||||
ClipRect( &scrollrect ) ;
|
ClipRect( &scrollrect ) ;
|
||||||
if ( rect )
|
if ( rect )
|
||||||
{
|
{
|
||||||
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
|
Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
|
||||||
focus.LocalToWindow( &r ) ;
|
dc.XLOG2DEVMAC(rect->x + rect->width) } ;
|
||||||
SectRect( &scrollrect , &r , &scrollrect ) ;
|
SectRect( &scrollrect , &r , &scrollrect ) ;
|
||||||
}
|
}
|
||||||
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
|
ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
|
||||||
@@ -1444,30 +1428,50 @@ wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
|||||||
const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
||||||
{
|
{
|
||||||
RgnHandle visRgn = NewRgn() ;
|
RgnHandle visRgn = NewRgn() ;
|
||||||
|
RgnHandle tempRgn = NewRgn() ;
|
||||||
|
|
||||||
SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
|
SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
|
||||||
|
|
||||||
|
//TODO : as soon as the new scheme has proven to work correctly, move this to wxStaticBox
|
||||||
|
if ( IsKindOf( CLASSINFO( wxStaticBox ) ) )
|
||||||
|
{
|
||||||
|
int borderTop = 14 ;
|
||||||
|
int borderOther = 4 ;
|
||||||
|
|
||||||
|
SetRectRgn( tempRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
|
||||||
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxWindow* parent = GetParent() ;
|
||||||
|
while( parent )
|
||||||
|
{
|
||||||
|
wxSize size = parent->GetSize() ;
|
||||||
|
int x , y ;
|
||||||
|
x = y = 0 ;
|
||||||
|
parent->MacWindowToRootWindow( &x, &y ) ;
|
||||||
|
MacRootWindowToWindow( &x , &y ) ;
|
||||||
|
SetRectRgn( tempRgn , x , y , x + size.x , y + size.y ) ;
|
||||||
|
SectRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
|
if ( parent->IsTopLevel() )
|
||||||
|
break ;
|
||||||
|
parent = parent->GetParent() ;
|
||||||
|
}
|
||||||
if ( GetWindowStyle() & wxCLIP_CHILDREN )
|
if ( GetWindowStyle() & wxCLIP_CHILDREN )
|
||||||
{
|
{
|
||||||
// subtract all children from updatergn
|
|
||||||
|
|
||||||
RgnHandle childarea = NewRgn() ;
|
|
||||||
for (wxNode *node = GetChildren().First(); node; node = node->Next())
|
for (wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||||
{
|
{
|
||||||
wxWindowMac *child = (wxWindowMac*)node->Data();
|
wxWindowMac *child = (wxWindowMac*)node->Data();
|
||||||
|
|
||||||
if ( !child->IsTopLevel() && child->IsShown() )
|
if ( !child->IsTopLevel() && child->IsShown() )
|
||||||
{
|
{
|
||||||
SetRectRgn( childarea , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
|
SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
|
||||||
DiffRgn( visRgn , childarea , visRgn ) ;
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisposeRgn( childarea ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
|
if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
|
||||||
{
|
{
|
||||||
RgnHandle siblingarea = NewRgn() ;
|
|
||||||
bool thisWindowThrough = false ;
|
bool thisWindowThrough = false ;
|
||||||
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
|
for (wxNode *node = GetParent()->GetChildren().First(); node; node = node->Next())
|
||||||
{
|
{
|
||||||
@@ -1484,14 +1488,14 @@ const wxRegion& wxWindowMac::MacGetVisibleRegion()
|
|||||||
|
|
||||||
if ( !sibling->IsTopLevel() && sibling->IsShown() )
|
if ( !sibling->IsTopLevel() && sibling->IsShown() )
|
||||||
{
|
{
|
||||||
SetRectRgn( siblingarea , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ;
|
SetRectRgn( tempRgn , sibling->m_x - m_x , sibling->m_y - m_y , sibling->m_x + sibling->m_width - m_x , sibling->m_y + sibling->m_height - m_y ) ;
|
||||||
DiffRgn( visRgn , siblingarea , visRgn ) ;
|
DiffRgn( visRgn , tempRgn , visRgn ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DisposeRgn( siblingarea ) ;
|
|
||||||
}
|
}
|
||||||
m_macVisibleRegion = visRgn ;
|
m_macVisibleRegion = visRgn ;
|
||||||
DisposeRgn( visRgn ) ;
|
DisposeRgn( visRgn ) ;
|
||||||
|
DisposeRgn( tempRgn ) ;
|
||||||
return m_macVisibleRegion ;
|
return m_macVisibleRegion ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1726,65 +1730,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
|
|
||||||
{
|
|
||||||
if ( window == NULL )
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
GrafPtr currPort;
|
|
||||||
GrafPtr port ;
|
|
||||||
::GetPort(&currPort);
|
|
||||||
port = UMAGetWindowPort( window) ;
|
|
||||||
if (currPort != port )
|
|
||||||
::SetPort(port);
|
|
||||||
Rect cr = clipRect ;
|
|
||||||
OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
|
|
||||||
::ClipRect(&cr);
|
|
||||||
|
|
||||||
::PenNormal() ;
|
|
||||||
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
|
|
||||||
::RGBForeColor(& win->GetForegroundColour().GetPixel() ) ;
|
|
||||||
Pattern whiteColor ;
|
|
||||||
|
|
||||||
::BackPat( GetQDGlobalsWhite( &whiteColor) ) ;
|
|
||||||
// ::SetThemeWindowBackground( win->m_macWindowData->m_macWindow , win->m_macWindowData->m_macWindowBackgroundTheme , false ) ;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
|
|
||||||
{
|
|
||||||
wxASSERT( GetParent() != NULL ) ;
|
|
||||||
GetParent()->MacGetPortParams( localOrigin , clipRect , window, rootwin) ;
|
|
||||||
localOrigin->h += m_x;
|
|
||||||
localOrigin->v += m_y;
|
|
||||||
OffsetRect(clipRect, -m_x, -m_y);
|
|
||||||
|
|
||||||
Rect myClip;
|
|
||||||
myClip.left = 0;
|
|
||||||
myClip.top = 0;
|
|
||||||
myClip.right = m_width;
|
|
||||||
myClip.bottom = m_height;
|
|
||||||
SectRect(clipRect, &myClip, clipRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
|
|
||||||
{
|
|
||||||
MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
|
|
||||||
|
|
||||||
int width , height ;
|
|
||||||
GetClientSize( &width , &height ) ;
|
|
||||||
wxPoint client ;
|
|
||||||
client = GetClientAreaOrigin( ) ;
|
|
||||||
|
|
||||||
localOrigin->h += client.x;
|
|
||||||
localOrigin->v += client.y;
|
|
||||||
OffsetRect(clipRect, -client.x, -client.y);
|
|
||||||
|
|
||||||
Rect myClip = { 0 , 0 , height , width } ;
|
|
||||||
SectRect(clipRect, &myClip, clipRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
long wxWindowMac::MacGetLeftBorderSize( ) const
|
long wxWindowMac::MacGetLeftBorderSize( ) const
|
||||||
{
|
{
|
||||||
if( IsTopLevel() )
|
if( IsTopLevel() )
|
||||||
@@ -1840,46 +1785,6 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
|
|||||||
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
|
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
|
|
||||||
{
|
|
||||||
m_ok = false ;
|
|
||||||
Rect clipRect ;
|
|
||||||
WindowRef window ;
|
|
||||||
wxWindowMac *rootwin ;
|
|
||||||
m_currentPort = NULL ;
|
|
||||||
|
|
||||||
GetPort( &m_formerPort ) ;
|
|
||||||
if ( theWindow )
|
|
||||||
{
|
|
||||||
if ( clientArea )
|
|
||||||
theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
|
|
||||||
else
|
|
||||||
theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
|
|
||||||
m_currentPort = UMAGetWindowPort( window ) ;
|
|
||||||
if ( m_formerPort != m_currentPort )
|
|
||||||
SetPort( m_currentPort ) ;
|
|
||||||
GetPenState( &m_savedPenState ) ;
|
|
||||||
theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
|
|
||||||
m_ok = true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMacDrawingHelper::~wxMacDrawingHelper()
|
|
||||||
{
|
|
||||||
if ( m_ok )
|
|
||||||
{
|
|
||||||
SetPort( m_currentPort ) ;
|
|
||||||
SetPenState( &m_savedPenState ) ;
|
|
||||||
Rect portRect ;
|
|
||||||
GetPortBounds( m_currentPort , &portRect ) ;
|
|
||||||
ClipRect( &portRect ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_formerPort != m_currentPort )
|
|
||||||
SetPort( m_formerPort ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find the wxWindowMac at the current mouse position, returning the mouse
|
// Find the wxWindowMac at the current mouse position, returning the mouse
|
||||||
// position.
|
// position.
|
||||||
wxWindowMac* wxFindWindowAtPointer(wxPoint& pt)
|
wxWindowMac* wxFindWindowAtPointer(wxPoint& pt)
|
||||||
|
Reference in New Issue
Block a user