X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ca4532668cad0441baf03cfe509d3acb84a15edd..757cc9def70e4685054f4a24238e2df111f6c9fd:/src/mac/control.cpp diff --git a/src/mac/control.cpp b/src/mac/control.cpp index e1f7d4dd47..945441b4ea 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -60,6 +60,34 @@ 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 ; @@ -119,7 +147,7 @@ wxControl::~wxControl() void wxControl::SetLabel(const wxString& title) { - m_label = title ; + m_label = wxStripMenuCodes(title) ; if ( (ControlHandle) m_macControl ) { @@ -127,9 +155,9 @@ void wxControl::SetLabel(const wxString& title) wxString label ; if( wxApp::s_macDefaultEncodingIsPC ) - label = wxMacMakeMacStringFromPC( title ) ; + label = wxMacMakeMacStringFromPC( m_label ) ; else - label = title ; + label = m_label ; #if TARGET_CARBON c2pstrcpy( (StringPtr) maclabel , label ) ; @@ -315,6 +343,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);