diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp index 3d6c1326a6..852630b6a7 100644 --- a/src/aui/auibar.cpp +++ b/src/aui/auibar.cpp @@ -72,7 +72,7 @@ static wxColor GetBaseColor() { #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); #else wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif @@ -208,8 +208,22 @@ void wxAuiGenericToolBarArt::DrawBackground( { wxRect rect = _rect; rect.height++; - wxColour startColour = m_baseColour.ChangeLightness(150); - wxColour endColour = m_baseColour.ChangeLightness(90); + + int startLightness = 150; + int endLightness = 90; + + + if ((m_baseColour.Red() < 75) + && (m_baseColour.Green() < 75) + && (m_baseColour.Blue() < 75)) + { + //dark mode, we cannot go very light + startLightness = 110; + endLightness = 90; + } + wxColour startColour = m_baseColour.ChangeLightness(startLightness); + wxColour endColour = m_baseColour.ChangeLightness(endLightness); + dc.GradientFillLinear(rect, startColour, endColour, wxSOUTH); } @@ -233,7 +247,11 @@ void wxAuiGenericToolBarArt::DrawLabel( const wxRect& rect) { dc.SetFont(m_font); +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); +#else dc.SetTextForeground(*wxBLACK); +#endif // we only care about the text height here since the text // will get cropped based on the width of the item @@ -343,9 +361,19 @@ void wxAuiGenericToolBarArt::DrawButton( dc.DrawBitmap(bmp, bmpX, bmpY, true); // set the item's text color based on if it is disabled +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); +#else dc.SetTextForeground(*wxBLACK); +#endif if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) + { +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT)); +#else dc.SetTextForeground(DISABLED_TEXT_COLOR); +#endif + } if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { @@ -470,9 +498,19 @@ void wxAuiGenericToolBarArt::DrawDropDownButton( dc.DrawBitmap(dropbmp, dropBmpX, dropBmpY, true); // set the item's text color based on if it is disabled +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); +#else dc.SetTextForeground(*wxBLACK); +#endif if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED) + { +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT)); +#else dc.SetTextForeground(DISABLED_TEXT_COLOR); +#endif + } if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() ) { @@ -511,7 +549,11 @@ void wxAuiGenericToolBarArt::DrawControlLabel( return; // set the label's text color +#ifdef __WXMAC__ + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); +#else dc.SetTextForeground(*wxBLACK); +#endif textX = rect.x + (rect.width/2) - (textWidth/2) + 1; textY = rect.y + rect.height - textHeight - 1; diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp index bc9e014bb3..391d322efe 100644 --- a/src/aui/dockart.cpp +++ b/src/aui/dockart.cpp @@ -152,7 +152,7 @@ wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size) wxAuiDefaultDockArt::wxAuiDefaultDockArt() { #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); #else wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif @@ -178,7 +178,11 @@ wxAuiDefaultDockArt::wxAuiDefaultDockArt() m_activeCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT); m_inactiveCaptionColour = darker1Colour; m_inactiveCaptionGradientColour = baseColour.ChangeLightness(97); +#ifdef __WXMAC__ + m_inactiveCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT); +#else m_inactiveCaptionTextColour = *wxBLACK; +#endif m_sashBrush = wxBrush(baseColour); m_backgroundBrush = wxBrush(baseColour); @@ -378,16 +382,25 @@ void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, wxUnusedVar(window); wxUnusedVar(orientation); - HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height ); - CGContextRef cgContext ; - wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl(); - cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext() ; + if ( wxPlatformInfo::Get().CheckOSVersion(10, 14) && wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW).Red() < 128 ) + { + dc.SetPen(*wxTRANSPARENT_PEN); + dc.SetBrush(m_sashBrush); + dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height); + } + else + { + HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height ); + CGContextRef cgContext ; + wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl(); + cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext() ; - HIThemeSplitterDrawInfo drawInfo ; - drawInfo.version = 0 ; - drawInfo.state = kThemeStateActive ; - drawInfo.adornment = kHIThemeSplitterAdornmentNone ; - HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ; + HIThemeSplitterDrawInfo drawInfo ; + drawInfo.version = 0 ; + drawInfo.state = kThemeStateActive ; + drawInfo.adornment = kHIThemeSplitterAdornmentNone ; + HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ; + } #elif defined(__WXGTK__) // clear out the rectangle first diff --git a/src/aui/tabart.cpp b/src/aui/tabart.cpp index 0a74494646..9ced916ff6 100644 --- a/src/aui/tabart.cpp +++ b/src/aui/tabart.cpp @@ -163,7 +163,7 @@ wxAuiGenericTabArt::wxAuiGenericTabArt() m_tabCtrlHeight = 0; #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON - wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground)); + wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); #else wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE); #endif @@ -262,9 +262,20 @@ void wxAuiGenericTabArt::DrawBackground(wxDC& dc, const wxRect& rect) { // draw background - - wxColor top_color = m_baseColour.ChangeLightness(90); - wxColor bottom_color = m_baseColour.ChangeLightness(170); + int topLightness = 90; + int bottomLightness = 170; + if ((m_baseColour.Red() < 75) + && (m_baseColour.Green() < 75) + && (m_baseColour.Blue() < 75)) + { + //dark mode, we cannot go very light + topLightness = 90; + bottomLightness = 110; + } + + + wxColor top_color = m_baseColour.ChangeLightness(topLightness); + wxColor bottom_color = m_baseColour.ChangeLightness(bottomLightness); wxRect r; if (m_flags &wxAUI_NB_BOTTOM) @@ -427,8 +438,17 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4); // this white helps fill out the gradient at the top of the tab - dc.SetPen(*wxWHITE_PEN); - dc.SetBrush(*wxWHITE_BRUSH); + wxColor gradient = *wxWHITE; + if ((m_baseColour.Red() < 75) + && (m_baseColour.Green() < 75) + && (m_baseColour.Blue() < 75)) + { + //dark mode, we go darker + gradient = m_activeColour.ChangeLightness(70); + } + + dc.SetPen(wxPen(gradient)); + dc.SetBrush(wxBrush(gradient)); dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4); // these two points help the rounded corners appear more antialiased @@ -444,7 +464,7 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, r.y -= 2; // draw gradient background - wxColor top_color = *wxWHITE; + wxColor top_color = gradient; wxColor bottom_color = m_activeColour; dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); } @@ -466,6 +486,15 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, // -- draw top gradient fill for glossy look wxColor top_color = m_baseColour; wxColor bottom_color = top_color.ChangeLightness(160); + if ((m_baseColour.Red() < 75) + && (m_baseColour.Green() < 75) + && (m_baseColour.Blue() < 75)) + { + //dark mode, we go darker + top_color = m_activeColour.ChangeLightness(70); + bottom_color = m_baseColour; + } + dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH); r.y += r.height; @@ -532,6 +561,16 @@ void wxAuiGenericTabArt::DrawTab(wxDC& dc, tab_width - (text_offset-tab_x) - close_button_width); // draw tab text +#if defined( __WXMAC__ ) + if (page.active) + { + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT)); + } + else + { + dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT)); + } +#endif dc.DrawText(draw_text, text_offset, drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1); @@ -1317,3 +1356,4 @@ void wxAuiSimpleTabArt::SetMeasuringFont(const wxFont& font) } #endif // wxUSE_AUI + \ No newline at end of file