From 692f921af50867cfc5d6fb7ce0af1debf070b1cf Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 24 Jun 2002 15:18:58 +0000 Subject: [PATCH] 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 --- src/mac/carbon/control.cpp | 31 +++++++++++++++++++++++++++++++ src/mac/control.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index e1f7d4dd47..b56dee0d18 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -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); diff --git a/src/mac/control.cpp b/src/mac/control.cpp index e1f7d4dd47..b56dee0d18 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -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); -- 2.49.0