// Carbon Events
// ---------------------------------------------------------------------------
-#if TARGET_API_MAC_OSX
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3
-enum
-{
- kEventControlVisibilityChanged = 157
-};
-#endif
-
-#endif
-
static const EventTypeSpec eventList[] =
{
{ kEventClassCommand, kEventProcessCommand } ,
#endif
{
-#if wxMAC_USE_CORE_GRAPHICS
bool created = false ;
CGContextRef cgContext = NULL ;
OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
CGContextClearRect( cgContext, bounds );
}
-
-#endif
if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
result = noErr ;
-#if wxMAC_USE_CORE_GRAPHICS
thisWindow->MacSetCGContextRef( NULL ) ;
}
if ( created )
CGContextRelease( cgContext ) ;
-#endif
}
if ( allocatedRgn )
Boolean focusEverything = false ;
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
-#ifdef __WXMAC_OSX__
if ( cEvent.GetParameter<Boolean>(kEventParamControlFocusEverything , &focusEverything ) == noErr )
{
}
-#endif
if ( thisWindow->MacIsUserPane() )
result = noErr ;
m_peer = NULL ;
m_frozenness = 0 ;
m_macAlpha = 255 ;
-
-#if wxMAC_USE_CORE_GRAPHICS
m_cgContextRef = NULL ;
-#endif
// as all windows are created with WS_VISIBLE style...
m_isShown = true;
m_hScrollBarAlwaysShown = false;
m_vScrollBarAlwaysShown = false;
- m_macBackgroundBrush = wxNullBrush ;
-
m_macIsUserPane = true;
m_clipChildren = false ;
m_cachedClippedRectValid = false ;
break ;
case wxWINDOW_VARIANT_MINI :
- if (UMAGetSystemVersion() >= 0x1030 )
- {
- // not always defined in the headers
- size = 3 ;
- themeFont = 109 ;
- }
- else
- {
- size = kControlSizeSmall;
- themeFont = kThemeSmallSystemFont ;
- }
+ // not always defined in the headers
+ size = 3 ;
+ themeFont = 109 ;
break ;
case wxWINDOW_VARIANT_LARGE :
if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
return false ;
- wxBrush brush ;
- wxColour newCol(GetBackgroundColour());
-
- if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) )
- brush.MacSetTheme( kThemeBrushDocumentWindowBackground ) ;
- else if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) )
- brush.MacSetTheme( kThemeBrushDialogBackgroundActive ) ;
- else
- brush.SetColour( newCol ) ;
-
- MacSetBackgroundBrush( brush ) ;
- MacUpdateControlFont() ;
+ m_peer->SetBackgroundColour( col ) ;
return true ;
}
-void wxWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
-{
- m_macBackgroundBrush = brush ;
- m_peer->SetBackground( brush ) ;
-}
-
bool wxWindowMac::MacCanFocus() const
{
// TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so
GetMouse( &pt ) ;
#endif
- control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ;
+ control = FindControlUnderMouse( pt , window , &part ) ;
if ( control )
mouseWin = wxFindControlFromMacControl( control ) ;
RectRgn( updateOuter, &rect ) ;
DiffRgn( updateOuter, updateInner , updateOuter ) ;
-#ifdef __WXMAC_OSX__
GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
-#else
- WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
- if ( tlw )
- InvalWindowRgn( tlw , updateOuter ) ;
-#endif
DisposeRgn( updateOuter ) ;
DisposeRgn( updateInner ) ;
return ;
#if TARGET_API_MAC_OSX
- if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT
- || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
+ if ( !m_backgroundColour.Ok() || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
{
event.Skip() ;
}
if ( IsTopLevel() )
return ;
-#if wxMAC_USE_CORE_GRAPHICS
if ( MacHasScrollBarCorner() )
{
Rect rect ;
CGPoint cgpoint = CGPointMake( rect.right - size , rect.bottom - size ) ;
CGContextSaveGState( cgContext );
- if ( m_macBackgroundBrush.Ok() && m_macBackgroundBrush.GetStyle() != wxTRANSPARENT )
+ if ( m_backgroundColour.Ok() )
{
- wxMacCoreGraphicsColour bkgnd( m_macBackgroundBrush ) ;
- bkgnd.Apply( cgContext );
+ CGContextSetFillColorWithColor( cgContext, m_backgroundColour.GetCGColor() );
}
else
{
CGContextFillRect( cgContext, cgrect );
CGContextRestoreGState( cgContext );
}
-#endif
}
void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(rightOrigin) )
m_peer->GetRect( &rect ) ;
InsetRect( &rect, -1 , -1 ) ;
-#if wxMAC_USE_CORE_GRAPHICS
{
CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left ,
rect.bottom - rect.top ) ;
}
#endif
}
- #else
- {
- wxTopLevelWindowMac* top = MacGetTopLevelWindow();
- if ( top )
- {
- wxPoint pt(0, 0) ;
- wxMacControl::Convert( &pt , GetParent()->m_peer , top->m_peer ) ;
- OffsetRect( &rect , pt.x , pt.y ) ;
- }
-
- if ( HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
- DrawThemeEditTextFrame( &rect, IsEnabled() ? kThemeStateActive : kThemeStateInactive ) ;
- else if ( HasFlag(wxSIMPLE_BORDER) )
- DrawThemeListBoxFrame( &rect, IsEnabled() ? kThemeStateActive : kThemeStateInactive ) ;
-
- if ( hasFocus )
- DrawThemeFocusRect( &rect , true ) ;
- // TODO REMOVE
- /*
- if ( hasBothScrollbars ) // hasBothScrollbars is not declared
- {
- // GetThemeStandaloneGrowBoxBounds
- // DrawThemeStandaloneNoGrowBox
- }
- */
- }
-#endif
}
void wxWindowMac::RemoveChild( wxWindowBase *child )
m_peer->SetNeedsDisplay() ;
#else
// this would be the preferred version for fast drawing controls
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- if ( UMAGetSystemVersion() >= 0x1030 )
- HIViewRender(m_peer->GetControlRef()) ;
- else
-#endif
- Update() ;
+ HIViewRender(m_peer->GetControlRef()) ;
#endif
}
if ( MacGetTopLevelWindow() && m_peer->NeedsFocusRect() )
{
-#if wxMAC_USE_CORE_GRAPHICS
GetParent()->Refresh() ;
-#else
wxMacWindowStateSaver sv( this ) ;
Rect rect ;
// we have to invalidate things, we cannot simple redraw
MacInvalidateBorders() ;
}
-#endif
}
event.Skip();
eventNc.SetEventObject( child );
if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
{
-#if wxMAC_USE_CORE_GRAPHICS
child->MacPaintBorders(0, 0) ;
-#else
- {
- wxWindowDC dc(this) ;
- dc.SetClippingRegion(wxRegion(updatergn));
- wxMacPortSetter helper(&dc) ;
- child->MacPaintBorders(0, 0) ;
- }
-#endif
}
}
}
bool wxWindowMac::SetTransparent(wxByte alpha)
{
-#if wxMAC_USE_CORE_GRAPHICS
SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
if ( alpha != m_macAlpha )
Refresh() ;
}
return true ;
-#else
- return false ;
-#endif
}
bool wxWindowMac::CanSetTransparent()
{
-#if wxMAC_USE_CORE_GRAPHICS
return true ;
-#else
- return false ;
-#endif
}
wxByte wxWindowMac::GetTransparent() const