void wxWindowMac::Init()
{
- // generic
- InitBase();
-
- m_isBeingDeleted = FALSE;
m_backgroundTransparent = FALSE;
// as all windows are created with WS_VISIBLE style...
m_hScrollBar = NULL ;
m_vScrollBar = NULL ;
-
- m_label = wxEmptyString;
}
// Destructor
MacCreateScrollBars( style ) ;
}
#endif
+
+ wxWindowCreateEvent event(this);
+ GetEventHandler()->AddPendingEvent(event);
+
return TRUE;
}
oldRgn = NewRgn() ;
newRgn = NewRgn() ;
diffRgn = NewRgn() ;
+
+ // invalidate the differences between the old and the new area
+
SetRectRgn(oldRgn , oldPos.x , oldPos.y , oldPos.x + m_width , oldPos.y + m_height ) ;
SetRectRgn(newRgn , newPos.x , newPos.y , newPos.x + actualWidth , newPos.y + actualHeight ) ;
DiffRgn( newRgn , oldRgn , diffRgn ) ;
InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ;
DiffRgn( oldRgn , newRgn , diffRgn ) ;
InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ;
+
+ // we also must invalidate the border areas, someone might optimize this one day to invalidate only the really
+ // changing pixels...
+
+ if ( MacGetLeftBorderSize() != 0 || MacGetRightBorderSize() != 0 ||
+ MacGetTopBorderSize() != 0 || MacGetBottomBorderSize() != 0 )
+ {
+ RgnHandle innerOldRgn, innerNewRgn ;
+ innerOldRgn = NewRgn() ;
+ innerNewRgn = NewRgn() ;
+
+ SetRectRgn(innerOldRgn , oldPos.x + MacGetLeftBorderSize() , oldPos.y + MacGetTopBorderSize() ,
+ oldPos.x + m_width - MacGetRightBorderSize() , oldPos.y + m_height - MacGetBottomBorderSize() ) ;
+ DiffRgn( oldRgn , innerOldRgn , diffRgn ) ;
+ InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ;
+
+ SetRectRgn(innerNewRgn , newPos.x + MacGetLeftBorderSize() , newPos.y + MacGetTopBorderSize() ,
+ newPos.x + actualWidth - MacGetRightBorderSize() , newPos.y + actualHeight - MacGetBottomBorderSize() ) ;
+ DiffRgn( newRgn , innerNewRgn , diffRgn ) ;
+ InvalWindowRgn( (WindowRef) MacGetRootWindow() , diffRgn ) ;
+
+ DisposeRgn( innerOldRgn ) ;
+ DisposeRgn( innerNewRgn ) ;
+ }
+
DisposeRgn(oldRgn) ;
DisposeRgn(newRgn) ;
DisposeRgn(diffRgn) ;
bool wxWindowMac::MacIsReallyShown() const
{
- if ( m_isShown && (m_parent != NULL) ) {
+ if ( m_isShown && (m_parent != NULL && !IsTopLevel() ) ) {
return m_parent->MacIsReallyShown();
}
return m_isShown;
{
if( IsTopLevel() )
return ;
+
+ int major,minor;
+ wxGetOsVersion( &major, &minor );
RGBColor white = { 0xFFFF, 0xFFFF , 0xFFFF } ;
- RGBColor black = { 0x0000, 0x0000 , 0x0000 } ;
RGBColor face = { 0xDDDD, 0xDDDD , 0xDDDD } ;
- RGBColor shadow = { 0x4444, 0x4444 , 0x4444 } ;
+
+ RGBColor darkShadow = { 0x0000, 0x0000 , 0x0000 } ;
+ RGBColor lightShadow = { 0x4444, 0x4444 , 0x4444 } ;
+ // OS X has lighter border edges than classic:
+ if (major >= 10)
+ {
+ darkShadow.red = 0x8E8E;
+ darkShadow.green = 0x8E8E;
+ darkShadow.blue = 0x8E8E;
+ lightShadow.red = 0xBDBD;
+ lightShadow.green = 0xBDBD;
+ lightShadow.blue = 0xBDBD;
+ }
+
PenNormal() ;
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
- Rect rect = { top , left , m_height + top , m_width + left } ;
- SInt32 border = 0 ;
- /*
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
- InsetRect( &rect , border , border );
- DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
- */
+ Rect rect = { top , left , m_height + top , m_width + left } ;
+ SInt32 border = 0 ;
+ /*
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+ InsetRect( &rect , border , border );
+ DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+ */
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
#else
LineTo( left + m_width - 3 , top + m_height - 3 );
LineTo( left + m_width - 3 , top + 2 );
- RGBForeColor( sunken ? &face : &black );
+ RGBForeColor( sunken ? &face : &darkShadow );
MoveTo( left + 0 , top + m_height - 1 );
LineTo( left + m_width - 1 , top + m_height - 1 );
LineTo( left + m_width - 1 , top + 0 );
- RGBForeColor( sunken ? &shadow : &white );
+ RGBForeColor( sunken ? &lightShadow : &white );
MoveTo( left + 1 , top + m_height - 3 );
LineTo( left + 1, top + 1 );
LineTo( left + m_width - 3 , top + 1 );
- RGBForeColor( sunken ? &white : &shadow );
+ RGBForeColor( sunken ? &white : &lightShadow );
MoveTo( left + 1 , top + m_height - 2 );
LineTo( left + m_width - 2 , top + m_height - 2 );
LineTo( left + m_width - 2 , top + 1 );
- RGBForeColor( sunken ? &black : &face );
+ RGBForeColor( sunken ? &darkShadow : &face );
MoveTo( left + 2 , top + m_height - 4 );
LineTo( left + 2 , top + 2 );
LineTo( left + m_width - 4 , top + 2 );
}
else if (HasFlag(wxSIMPLE_BORDER))
{
- Rect rect = { top , left , m_height + top , m_width + left } ;
- RGBForeColor( &black ) ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
+ RGBForeColor( &darkShadow ) ;
FrameRect( &rect ) ;
}
}
child->GetPosition( &x, &y );
int w,h;
child->GetSize( &w, &h );
- child->SetSize( x+dx, y+dy, w, h );
+ if (rect)
+ {
+ wxRect rc(x,y,w,h);
+ if (rect->Intersects(rc))
+ child->SetSize( x+dx, y+dy, w, h );
+ }
+ else
+ {
+ child->SetSize( x+dx, y+dy, w, h );
+ }
}
Update() ;
}
bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
-{
+{
if ((event.m_x < m_x) || (event.m_y < m_y) ||
(event.m_x > (m_x + m_width)) || (event.m_y > (m_y + m_height)))
return FALSE;
RgnHandle tempRgn = NewRgn() ;
RgnHandle tempStaticBoxRgn = NewRgn() ;
- 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 ) ) )
+ if ( MacIsReallyShown() )
{
- int borderTop = 14 ;
- int borderOther = 4 ;
+ SetRectRgn( visRgn , 0 , 0 , m_width , m_height ) ;
- SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
- DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
- }
+ //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 ;
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ borderTop += 2 ;
- if ( !IsTopLevel() )
- {
- wxWindow* parent = GetParent() ;
- while( parent )
+ SetRectRgn( tempStaticBoxRgn , borderOther , borderTop , m_width - borderOther , m_height - borderOther ) ;
+ DiffRgn( visRgn , tempStaticBoxRgn , visRgn ) ;
+ }
+
+ if ( !IsTopLevel() )
{
- wxSize size = parent->GetSize() ;
- int x , y ;
- x = y = 0 ;
- parent->MacWindowToRootWindow( &x, &y ) ;
- MacRootWindowToWindow( &x , &y ) ;
-
- SetRectRgn( tempRgn ,
- x + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
- x + size.x - parent->MacGetRightBorderSize(),
- y + size.y - parent->MacGetBottomBorderSize()) ;
-
- SectRgn( visRgn , tempRgn , visRgn ) ;
- if ( parent->IsTopLevel() )
- break ;
- parent = parent->GetParent() ;
+ 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 + parent->MacGetLeftBorderSize() , y + parent->MacGetTopBorderSize() ,
+ x + size.x - parent->MacGetRightBorderSize(),
+ y + size.y - parent->MacGetBottomBorderSize()) ;
+
+ SectRgn( visRgn , tempRgn , visRgn ) ;
+ if ( parent->IsTopLevel() )
+ break ;
+ parent = parent->GetParent() ;
+ }
}
- }
- if ( respectChildrenAndSiblings )
- {
- if ( GetWindowStyle() & wxCLIP_CHILDREN )
+ if ( respectChildrenAndSiblings )
{
- for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
+ if ( GetWindowStyle() & wxCLIP_CHILDREN )
{
- wxWindowMac *child = node->GetData();
-
- if ( !child->IsTopLevel() && child->IsShown() )
+ for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
- SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
- if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
- {
- int borderTop = 14 ;
- int borderOther = 4 ;
+ wxWindowMac *child = node->GetData();
- SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
- DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+ if ( !child->IsTopLevel() && child->IsShown() )
+ {
+ SetRectRgn( tempRgn , child->m_x , child->m_y , child->m_x + child->m_width , child->m_y + child->m_height ) ;
+ if ( child->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+ {
+ int borderTop = 14 ;
+ int borderOther = 4 ;
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ borderTop += 2 ;
+
+ SetRectRgn( tempStaticBoxRgn , child->m_x + borderOther , child->m_y + borderTop , child->m_x + child->m_width - borderOther , child->m_y + child->m_height - borderOther ) ;
+ DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+ }
+ DiffRgn( visRgn , tempRgn , visRgn ) ;
}
- DiffRgn( visRgn , tempRgn , visRgn ) ;
}
}
- }
- if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
- {
- bool thisWindowThrough = false ;
- for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
+ if ( (GetWindowStyle() & wxCLIP_SIBLINGS) && GetParent() )
{
- wxWindowMac *sibling = node->GetData();
- if ( sibling == this )
- {
- thisWindowThrough = true ;
- continue ;
- }
- if( !thisWindowThrough )
+ bool thisWindowThrough = false ;
+ for (wxWindowListNode *node = GetParent()->GetChildren().GetFirst(); node; node = node->GetNext())
{
- continue ;
- }
-
- if ( !sibling->IsTopLevel() && sibling->IsShown() )
- {
- 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 ) ;
- if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+ wxWindowMac *sibling = node->GetData();
+ if ( sibling == this )
+ {
+ thisWindowThrough = true ;
+ continue ;
+ }
+ if( !thisWindowThrough )
{
- int borderTop = 14 ;
- int borderOther = 4 ;
+ continue ;
+ }
- SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
- DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+ if ( !sibling->IsTopLevel() && sibling->IsShown() )
+ {
+ 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 ) ;
+ if ( sibling->IsKindOf( CLASSINFO( wxStaticBox ) ) )
+ {
+ int borderTop = 14 ;
+ int borderOther = 4 ;
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ borderTop += 2 ;
+
+ SetRectRgn( tempStaticBoxRgn , sibling->m_x - m_x + borderOther , sibling->m_y - m_y + borderTop , sibling->m_x + sibling->m_width - m_x - borderOther , sibling->m_y + sibling->m_height - m_y - borderOther ) ;
+ DiffRgn( tempRgn , tempStaticBoxRgn , tempRgn ) ;
+ }
+ DiffRgn( visRgn , tempRgn , visRgn ) ;
}
- DiffRgn( visRgn , tempRgn , visRgn ) ;
}
}
}