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:
@@ -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()
|
wxControl::wxControl()
|
||||||
{
|
{
|
||||||
m_macControl = NULL ;
|
m_macControl = NULL ;
|
||||||
@@ -315,6 +341,11 @@ void wxControl::MacPostControlCreate()
|
|||||||
|
|
||||||
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
||||||
|
|
||||||
|
if ( wxMacSetupControlBackgroundUPP == NULL )
|
||||||
|
{
|
||||||
|
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
|
||||||
|
}
|
||||||
|
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
|
||||||
|
|
||||||
// Adjust the controls size and position
|
// Adjust the controls size and position
|
||||||
wxPoint pos(m_x, m_y);
|
wxPoint pos(m_x, m_y);
|
||||||
|
@@ -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()
|
wxControl::wxControl()
|
||||||
{
|
{
|
||||||
m_macControl = NULL ;
|
m_macControl = NULL ;
|
||||||
@@ -315,6 +341,11 @@ void wxControl::MacPostControlCreate()
|
|||||||
|
|
||||||
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
||||||
|
|
||||||
|
if ( wxMacSetupControlBackgroundUPP == NULL )
|
||||||
|
{
|
||||||
|
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
|
||||||
|
}
|
||||||
|
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
|
||||||
|
|
||||||
// Adjust the controls size and position
|
// Adjust the controls size and position
|
||||||
wxPoint pos(m_x, m_y);
|
wxPoint pos(m_x, m_y);
|
||||||
|
Reference in New Issue
Block a user