X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e8759560f8c3d47d51abca114d3ef475c6b13529..bd044e27b3c7f9b6d56e75b9e1b789be3545cd5e:/src/osx/carbon/renderer.cpp diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp index c693596282..c8d11afd5d 100644 --- a/src/osx/carbon/renderer.cpp +++ b/src/osx/carbon/renderer.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: src/mac/carbon/renderer.cpp +// Name: src/osx/carbon/renderer.cpp // Purpose: implementation of wxRendererNative for Mac // Author: Vadim Zeitlin // Modified by: @@ -27,8 +27,22 @@ #include "wx/renderer.h" #include "wx/graphics.h" +#include "wx/dcgraph.h" #include "wx/osx/private.h" +#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP + #include "wx/image.h" + #include "wx/mstream.h" +#endif // wxHAS_DRAW_TITLE_BAR_BITMAP + +// check if we're currently in a paint event +inline bool wxInPaintEvent(wxWindow* win, wxDC& dc) +{ + wxUnusedVar(dc); + return ( win->MacGetCGContextRef() != NULL ); +} + + class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative { @@ -81,6 +95,22 @@ public: virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0); + virtual void DrawChoice(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + + virtual void DrawComboBox(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + + virtual void DrawTextCtrl(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + + virtual void DrawRadioBitmap(wxWindow* win, wxDC& dc, const wxRect& rect, int flags=0); + +#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP + virtual void DrawTitleBarBitmap(wxWindow *win, + wxDC& dc, + const wxRect& rect, + wxTitleBarButton button, + int flags = 0); +#endif // wxHAS_DRAW_TITLE_BAR_BITMAP + private: void DrawMacThemeButton(wxWindow *win, wxDC& dc, @@ -121,7 +151,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win, dc.SetBrush( *wxTRANSPARENT_BRUSH ); HIRect headerRect = CGRectMake( x, y, w, h ); - if ( !dc.IsKindOf( CLASSINFO( wxPaintDC ) ) ) + if ( !wxInPaintEvent(win, dc) ) { win->Refresh( &rect ); } @@ -204,7 +234,7 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win, dc.SetBrush( *wxTRANSPARENT_BRUSH ); HIRect headerRect = CGRectMake( x, y, w, h ); - if ( !dc.IsKindOf( CLASSINFO( wxPaintDC ) ) ) + if ( !wxInPaintEvent(win, dc) ) { win->Refresh( &rect ); } @@ -250,7 +280,7 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win, // under compositing we should only draw when called by the OS, otherwise just issue a redraw command // strange redraw errors occur if we don't do this - if ( !dc.IsKindOf( CLASSINFO( wxPaintDC ) ) ) + if ( !wxInPaintEvent(win, dc) ) { wxRect rect( (int) splitterRect.origin.x, (int) splitterRect.origin.y, (int) splitterRect.size.width, (int) splitterRect.size.height ); @@ -307,7 +337,7 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win, dc.SetBrush( *wxTRANSPARENT_BRUSH ); HIRect headerRect = CGRectMake( x, y, w, h ); - if ( !dc.IsKindOf( CLASSINFO( wxPaintDC ) ) ) + if ( !wxInPaintEvent(win, dc) ) { win->Refresh( &rect ); } @@ -328,6 +358,8 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win, if (flags & wxCONTROL_UNDETERMINED) drawInfo.value = kThemeButtonMixed; drawInfo.adornment = adornment; + if (flags & wxCONTROL_FOCUSED) + drawInfo.adornment |= kThemeAdornmentFocus; HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect ); } @@ -342,8 +374,20 @@ wxRendererMac::DrawCheckBox(wxWindow *win, if (flags & wxCONTROL_CHECKED) flags |= wxCONTROL_SELECTED; + int kind; + + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) + kind = kThemeCheckBoxSmall; + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) + kind = kThemeCheckBoxMini; + else + kind = kThemeCheckBox; + + DrawMacThemeButton(win, dc, rect, flags, - kThemeCheckBox, kThemeAdornmentNone); + kind, kThemeAdornmentNone); } wxSize wxRendererMac::GetCheckBoxSize(wxWindow* WXUNUSED(win)) @@ -416,6 +460,7 @@ wxRendererMac::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int fl CGRect cgrect = CGRectMake( rect.x , rect.y , rect.width, rect.height ) ; HIThemeFrameDrawInfo info ; + memset( &info, 0 , sizeof(info) ) ; info.version = 0 ; @@ -428,3 +473,323 @@ wxRendererMac::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int fl HIThemeDrawFocusRect( &cgrect , true , cgContext , kHIThemeOrientationNormal ) ; } + +void wxRendererMac::DrawChoice(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags) +{ + int kind; + + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) + kind = kThemePopupButtonSmall; + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) + kind = kThemePopupButtonMini; + else + kind = kThemePopupButton; + + DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone); +} + + +void wxRendererMac::DrawComboBox(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags) +{ + int kind; + + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) + kind = kThemeComboBoxSmall; + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) + kind = kThemeComboBoxMini; + else + kind = kThemeComboBox; + + DrawMacThemeButton(win, dc, rect, flags, kind, kThemeAdornmentNone); +} + +void wxRendererMac::DrawRadioBitmap(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags) +{ + int kind; + + if (win->GetWindowVariant() == wxWINDOW_VARIANT_SMALL || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_SMALL)) + kind = kThemeRadioButtonSmall; + else if (win->GetWindowVariant() == wxWINDOW_VARIANT_MINI || + (win->GetParent() && win->GetParent()->GetWindowVariant() == wxWINDOW_VARIANT_MINI)) + kind = kThemeRadioButtonMini; + else + kind = kThemeRadioButton; + + if (flags & wxCONTROL_CHECKED) + flags |= wxCONTROL_SELECTED; + + DrawMacThemeButton(win, dc, rect, flags, + kind, kThemeAdornmentNone); +} + +void wxRendererMac::DrawTextCtrl(wxWindow* win, wxDC& dc, + const wxRect& rect, int flags) +{ + const wxCoord x = rect.x; + const wxCoord y = rect.y; + const wxCoord w = rect.width; + const wxCoord h = rect.height; + + dc.SetBrush( *wxWHITE_BRUSH ); + dc.SetPen( *wxTRANSPARENT_PEN ); + dc.DrawRectangle(rect); + + dc.SetBrush( *wxTRANSPARENT_BRUSH ); + + HIRect hiRect = CGRectMake( x, y, w, h ); + if ( !wxInPaintEvent(win, dc) ) + { + win->Refresh( &rect ); + } + else + { + CGContextRef cgContext; + + cgContext = (CGContextRef) static_cast(dc.GetImpl())->GetGraphicsContext()->GetNativeContext(); + + { + HIThemeFrameDrawInfo drawInfo; + + memset( &drawInfo, 0, sizeof(drawInfo) ); + drawInfo.version = 0; + drawInfo.kind = kHIThemeFrameTextFieldSquare; + drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive; + if (flags & wxCONTROL_FOCUSED) + drawInfo.isFocused = true; + + HIThemeDrawFrame( &hiRect, &drawInfo, cgContext, kHIThemeOrientationNormal); + } + } +} + +#ifdef wxHAS_DRAW_TITLE_BAR_BITMAP + +void wxRendererMac::DrawTitleBarBitmap(wxWindow *win, + wxDC& dc, + const wxRect& rect, + wxTitleBarButton button, + int flags) +{ + // the files below were converted from the originals in art/osx/close*.png + // using misc/scripts/png2c.py script -- we must use PNG and not XPM for + // them because they use transparency and don't look right without it + + /* close.png - 400 bytes */ + static const unsigned char close_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, + 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, + 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, + 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, + 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, + 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x00, + 0xef, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0xa5, + 0xd2, 0x31, 0x4a, 0x03, 0x41, 0x18, 0xc5, 0xf1, + 0xdf, 0xc6, 0x55, 0x02, 0xb2, 0x18, 0xb0, 0x33, + 0x8d, 0xd8, 0x6e, 0x8a, 0x14, 0xa6, 0xb2, 0xc9, + 0x21, 0x72, 0x0b, 0xdb, 0x5c, 0x45, 0x98, 0x3b, + 0x24, 0xc7, 0x99, 0x6d, 0x2d, 0x04, 0xd3, 0x09, + 0x42, 0x48, 0x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93, 0xbe, + 0x72, 0x55, 0x71, 0xf9, 0xeb, 0x92, 0xbf, 0x03, + 0x70, 0x33, 0x76, 0x58, 0xe5, 0x41, 0xfb, 0x6d, + 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, 0x58, 0x74, + 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, 0x6f, 0x77, + 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, 0x73, 0x74, + 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, 0xda, 0x33, + 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, 0x00, 0xa3, + 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, 0x00, 0x00, + 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 + }; + + /* close_current.png - 421 bytes */ + static const unsigned char close_current_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, + 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, + 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, + 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, + 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, + 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01, + 0x04, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d, + 0xd2, 0xbd, 0x4a, 0x43, 0x31, 0x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, 0x92, 0xa5, 0x53, 0x17, 0x6b, 0x3f, 0xce, + 0x06, 0x3e, 0x71, 0x88, 0xed, 0xd1, 0x68, 0x34, + 0x0b, 0x21, 0x4c, 0x7a, 0xbd, 0xde, 0x7d, 0xd9, + 0x7a, 0x38, 0x1c, 0x3e, 0x86, 0x10, 0x26, 0xfd, + 0x7e, 0xff, 0xa9, 0x01, 0xc2, 0x4b, 0x21, 0xa7, + 0x00, 0xd0, 0xfa, 0xe3, 0x6a, 0x1f, 0x78, 0xc0, + 0xb4, 0x90, 0x33, 0xcf, 0x44, 0xec, 0x66, 0x42, + 0x56, 0xe9, 0x0d, 0xcf, 0x32, 0x72, 0xd5, 0xd2, + 0xe4, 0xbf, 0x21, 0xff, 0x02, 0x4d, 0xb5, 0x74, + 0x79, 0x60, 0x9f, 0x78, 0x78, 0x00, 0x00, 0x00, + 0x20, 0x7a, 0x54, 0x58, 0x74, 0x74, 0x69, 0x66, + 0x66, 0x3a, 0x72, 0x6f, 0x77, 0x73, 0x2d, 0x70, + 0x65, 0x72, 0x2d, 0x73, 0x74, 0x72, 0x69, 0x70, + 0x00, 0x00, 0x78, 0xda, 0x33, 0xb5, 0x30, 0x05, + 0x00, 0x01, 0x47, 0x00, 0xa3, 0x38, 0xda, 0x77, + 0x3b, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, + 0x44, 0xae, 0x42, 0x60, 0x82}; + + /* close_pressed.png - 458 bytes */ + static const unsigned char close_pressed_png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, + 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0x48, 0x2d, + 0xd1, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, + 0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, + 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, + 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x12, 0x00, + 0x00, 0x0b, 0x12, 0x01, 0xd2, 0xdd, 0x7e, 0xfc, + 0x00, 0x00, 0x00, 0x09, 0x76, 0x70, 0x41, 0x67, + 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0xb1, 0x5b, 0xf1, 0xf7, 0x00, 0x00, 0x01, + 0x29, 0x49, 0x44, 0x41, 0x54, 0x28, 0xcf, 0x9d, + 0x92, 0x31, 0x6a, 0xc3, 0x40, 0x14, 0x44, 0x9f, + 0x2c, 0xe1, 0xc2, 0x10, 0x08, 0xc4, 0xe0, 0x22, + 0x76, 0x21, 0x04, 0x29, 0x13, 0xf0, 0x05, 0x54, + 0xa5, 0x8a, 0x0f, 0xb2, 0x8d, 0x0e, 0xa0, 0x23, + 0xa8, 0x56, 0xa3, 0x03, 0xe8, 0x08, 0xba, 0x80, + 0xba, 0xb0, 0x45, 0x0a, 0x97, 0x02, 0x23, 0x58, + 0x83, 0x40, 0x60, 0x61, 0x08, 0x11, 0x04, 0x57, + 0x69, 0xf6, 0xc3, 0x46, 0x38, 0x24, 0x64, 0xca, + 0xd9, 0x19, 0xe6, 0xff, 0xfd, 0xe3, 0xf1, 0x1d, + 0x2b, 0x20, 0x02, 0x36, 0xc0, 0xd2, 0x72, 0x27, + 0xe0, 0x08, 0x1c, 0x80, 0x5e, 0x84, 0x9e, 0x63, + 0x7a, 0x04, 0xb6, 0xc0, 0x1d, 0xd7, 0x31, 0x00, + 0x6f, 0xc0, 0x1e, 0xc0, 0x77, 0x4c, 0x31, 0x70, + 0xc3, 0xcf, 0x58, 0xd8, 0x49, 0x3e, 0x81, 0x7e, + 0x66, 0xc7, 0xdb, 0x02, 0x73, 0x80, 0xdd, 0x6e, + 0xb7, 0x9a, 0x3a, 0x1c, 0x6e, 0x6e, 0xb5, 0x2b, + 0x1f, 0x78, 0x02, 0x1e, 0x44, 0x90, 0x65, 0xd9, + 0x8b, 0xef, 0xfb, 0xef, 0x5a, 0xeb, 0x33, 0x40, + 0x92, 0x24, 0x51, 0x9a, 0xa6, 0xcf, 0xc6, 0x98, + 0xae, 0x69, 0x9a, 0xd1, 0x26, 0x8f, 0x81, 0x8d, + 0x07, 0xa0, 0xaa, 0xaa, 0x3e, 0x0c, 0xc3, 0x5a, + 0x29, 0x15, 0x0b, 0xa7, 0x94, 0x8a, 0x8b, 0xa2, + 0xa8, 0xab, 0xaa, 0xea, 0x9d, 0x21, 0x36, 0x81, + 0xf3, 0x7b, 0x00, 0xe4, 0x79, 0x7e, 0x10, 0x03, + 0x40, 0x51, 0x14, 0xb5, 0x70, 0x0e, 0x96, 0x33, + 0xfe, 0x89, 0xc0, 0xde, 0x69, 0x2d, 0x44, 0x92, + 0x24, 0x91, 0x8c, 0xe7, 0x26, 0x4f, 0x52, 0x4f, + 0x81, 0x3d, 0xee, 0x5a, 0x3e, 0x47, 0x4c, 0xae, + 0x50, 0x29, 0x15, 0xb7, 0x6d, 0xfb, 0xe1, 0xec, + 0x79, 0xf4, 0x81, 0x0b, 0x70, 0x0f, 0x2c, 0x9a, + 0xa6, 0x19, 0x8d, 0x31, 0x5d, 0x59, 0x96, 0x47, + 0x31, 0x69, 0xad, 0xcf, 0xc6, 0x98, 0xce, 0x31, + 0x0d, 0x80, 0x96, 0xe6, 0x48, 0x01, 0xe6, 0xbf, + 0xac, 0x76, 0x01, 0x6a, 0x60, 0x2f, 0xcd, 0xe9, + 0x6d, 0x23, 0x6e, 0xed, 0x9d, 0xae, 0x61, 0x00, + 0x5e, 0xb1, 0x95, 0xf3, 0x26, 0x8f, 0x7f, 0x2e, + 0xf9, 0x17, 0x50, 0x59, 0x74, 0x13, 0x34, 0x41, + 0x04, 0x5a, 0x00, 0x00, 0x00, 0x20, 0x7a, 0x54, + 0x58, 0x74, 0x74, 0x69, 0x66, 0x66, 0x3a, 0x72, + 0x6f, 0x77, 0x73, 0x2d, 0x70, 0x65, 0x72, 0x2d, + 0x73, 0x74, 0x72, 0x69, 0x70, 0x00, 0x00, 0x78, + 0xda, 0x33, 0xb5, 0x30, 0x05, 0x00, 0x01, 0x47, + 0x00, 0xa3, 0x38, 0xda, 0x77, 0x3b, 0x00, 0x00, + 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82}; + + // currently we only support the close bitmap here + if ( button != wxTITLEBAR_BUTTON_CLOSE ) + { + m_rendererNative.DrawTitleBarBitmap(win, dc, rect, button, flags); + return; + } + + // choose the correct image depending on flags + const void *data; + size_t len; + + if ( flags & wxCONTROL_PRESSED ) + { + data = close_pressed_png; + len = WXSIZEOF(close_pressed_png); + } + else if ( flags & wxCONTROL_CURRENT ) + { + data = close_current_png; + len = WXSIZEOF(close_current_png); + } + else + { + data = close_png; + len = WXSIZEOF(close_png); + } + + // load it + wxMemoryInputStream mis(data, len); + wxImage image(mis, wxBITMAP_TYPE_PNG); + wxBitmap bmp(image); + wxASSERT_MSG( bmp.IsOk(), "failed to load embedded PNG image?" ); + + // and draw it centering it in the provided rectangle: we don't scale the + // image because this is really not going to look good for such a small + // (14*14) bitmap + dc.DrawBitmap(bmp, wxRect(bmp.GetSize()).CenterIn(rect).GetPosition()); +} + +#endif // wxHAS_DRAW_TITLE_BAR_BITMAP