X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76a5e5d21ee1a6230d777ce0209b2df4c6075f0f..74698d3a22d5e611bbcd731a3ade616c66cfaca6:/src/mac/control.cpp?ds=sidebyside diff --git a/src/mac/control.cpp b/src/mac/control.cpp index 0dcfb505d0..945441b4ea 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -36,7 +36,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) BEGIN_EVENT_TABLE(wxControl, wxWindow) EVT_MOUSE_EVENTS( wxControl::OnMouseEvent ) - EVT_CHAR( wxControl::OnKeyDown ) +// EVT_CHAR( wxControl::OnKeyDown ) EVT_PAINT( wxControl::OnPaint ) END_EVENT_TABLE() #endif @@ -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 ) ; @@ -292,7 +320,7 @@ void wxControl::MacPostControlCreate() { // no font } - else if ( IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) ) + else if ( !UMAHasAquaLayout() && (IsKindOf( CLASSINFO( wxStaticBox ) ) || IsKindOf( CLASSINFO( wxRadioBox ) ) || IsKindOf( CLASSINFO( wxButton ) ) ) ) { ControlFontStyleRec controlstyle ; controlstyle.flags = kControlUseFontMask ; @@ -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); @@ -473,7 +506,7 @@ void wxControl::DoSetSize(int x, int y, return ; } - Rect oldbounds, newbounds; + Rect oldbounds; int new_x, new_y, new_width, new_height; int mac_x, mac_y;