support for arbitrary backgrounds via suppressing the ordinary control background eraser and supplying a hook for us.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2002-06-24 15:18:58 +00:00
parent ec6aa8ecd5
commit 692f921af5
2 changed files with 62 additions and 0 deletions

View File

@@ -60,6 +60,32 @@ pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCod
}
}
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
{
OSStatus status = noErr ;
switch( iMessage )
{
case kControlMsgSetUpBackground :
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
// SetThemeBackground( iDepth , iIsColor ) ;
}
else
{
status = paramErr ;
}
break ;
default :
status = paramErr ;
break ;
}
return status ;
}
wxControl::wxControl()
{
m_macControl = NULL ;
@@ -315,6 +341,11 @@ void wxControl::MacPostControlCreate()
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
if ( wxMacSetupControlBackgroundUPP == NULL )
{
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
}
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
// Adjust the controls size and position
wxPoint pos(m_x, m_y);

View File

@@ -60,6 +60,32 @@ pascal void wxMacLiveScrollbarActionProc( ControlHandle control , ControlPartCod
}
}
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
{
OSStatus status = noErr ;
switch( iMessage )
{
case kControlMsgSetUpBackground :
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
{
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
// SetThemeBackground( iDepth , iIsColor ) ;
}
else
{
status = paramErr ;
}
break ;
default :
status = paramErr ;
break ;
}
return status ;
}
wxControl::wxControl()
{
m_macControl = NULL ;
@@ -315,6 +341,11 @@ void wxControl::MacPostControlCreate()
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
if ( wxMacSetupControlBackgroundUPP == NULL )
{
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
}
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
// Adjust the controls size and position
wxPoint pos(m_x, m_y);