Ticket #18146: wxWidgets-dark.patch

File wxWidgets-dark.patch, 9.8 KB (added by dkulp, 3 years ago)
  • src/aui/auibar.cpp

    diff --git a/src/aui/auibar.cpp b/src/aui/auibar.cpp
    index 2c5155a94b..77586a2793 100644
    a b wxBitmap wxAuiBitmapFromBits(const unsigned char bits[], int w, int h, 
    7070
    7171static wxColor GetBaseColor()
    7272{
    73 
    74 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
    75     wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
    76 #else
    7773    wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
    78 #endif
    7974
    8075    // the baseColour is too pale to use as our base colour,
    8176    // so darken it a bit --
  • src/aui/dockart.cpp

    diff --git a/src/aui/dockart.cpp b/src/aui/dockart.cpp
    index 0d4e2b7167..838f2d1114 100644
    a b wxString wxAuiChopText(wxDC& dc, const wxString& text, int max_size) 
    156156
    157157wxAuiDefaultDockArt::wxAuiDefaultDockArt()
    158158{
    159 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
    160     wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
    161 #else
    162159    wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
    163 #endif
    164160
    165161    // the baseColour is too pale to use as our base colour,
    166162    // so darken it a bit --
    wxAuiDefaultDockArt::wxAuiDefaultDockArt() 
    183179    m_activeCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
    184180    m_inactiveCaptionColour = darker1Colour;
    185181    m_inactiveCaptionGradientColour = baseColour.ChangeLightness(97);
    186     m_inactiveCaptionTextColour = *wxBLACK;
     182    m_inactiveCaptionTextColour = wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT);
    187183
    188184    m_sashBrush = wxBrush(baseColour);
    189185    m_backgroundBrush = wxBrush(baseColour);
    wxFont wxAuiDefaultDockArt::GetFont(int id) 
    379375
    380376void wxAuiDefaultDockArt::DrawSash(wxDC& dc, wxWindow *window, int orientation, const wxRect& rect)
    381377{
    382 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
    383     wxUnusedVar(window);
    384     wxUnusedVar(orientation);
    385 
    386     HIRect splitterRect = CGRectMake( rect.x , rect.y , rect.width , rect.height );
    387     CGContextRef cgContext ;
    388     wxGCDCImpl *impl = (wxGCDCImpl*) dc.GetImpl();
    389     cgContext = (CGContextRef) impl->GetGraphicsContext()->GetNativeContext() ;
    390 
    391     HIThemeSplitterDrawInfo drawInfo ;
    392     drawInfo.version = 0 ;
    393     drawInfo.state = kThemeStateActive ;
    394     drawInfo.adornment = kHIThemeSplitterAdornmentNone ;
    395     HIThemeDrawPaneSplitter( &splitterRect , &drawInfo , cgContext , kHIThemeOrientationNormal ) ;
    396 
    397 #elif defined(__WXGTK__)
     378#if defined(__WXGTK__)
    398379    // clear out the rectangle first
    399380    dc.SetPen(*wxTRANSPARENT_PEN);
    400381    dc.SetBrush(m_sashBrush);
    void wxAuiDefaultDockArt::DrawBorder(wxDC& dc, wxWindow* window, const wxRect& _ 
    489470    {
    490471        for (i = 0; i < border_width; ++i)
    491472        {
    492             dc.SetPen(*wxWHITE_PEN);
     473            dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT)));
    493474            dc.DrawLine(rect.x, rect.y, rect.x+rect.width, rect.y);
    494475            dc.DrawLine(rect.x, rect.y, rect.x, rect.y+rect.height);
    495             dc.SetPen(m_borderPen);
     476            dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)));
    496477            dc.DrawLine(rect.x, rect.y+rect.height-1,
    497478                        rect.x+rect.width, rect.y+rect.height-1);
    498479            dc.DrawLine(rect.x+rect.width-1, rect.y,
  • src/aui/tabart.cpp

    diff --git a/src/aui/tabart.cpp b/src/aui/tabart.cpp
    index 0a74494646..f7ac24c345 100644
    a b wxAuiGenericTabArt::wxAuiGenericTabArt() 
    162162    m_fixedTabWidth = 100;
    163163    m_tabCtrlHeight = 0;
    164164
    165 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
    166     wxColor baseColour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
    167 #else
    168165    wxColor baseColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
    169 #endif
    170166
    171167    // the baseColour is too pale to use as our base colour,
    172168    // so darken it a bit --
    void wxAuiGenericTabArt::DrawBackground(wxDC& dc, 
    262258                                        const wxRect& rect)
    263259{
    264260    // draw background
    265 
    266     wxColor top_color       = m_baseColour.ChangeLightness(90);
    267     wxColor bottom_color   = m_baseColour.ChangeLightness(170);
     261    int topLightness = 90;
     262    int bottomLightness = 170;
     263    if ((m_baseColour.Red()) +
     264        (m_baseColour.Green()) +
     265        (m_baseColour.Blue()) < 128)
     266    {
     267        //dark mode, we cannot go very light
     268        topLightness = 90;
     269        bottomLightness = 110;
     270    }
     271   
     272   
     273    wxColor top_color       = m_baseColour.ChangeLightness(topLightness);
     274    wxColor bottom_color   = m_baseColour.ChangeLightness(bottomLightness);
    268275    wxRect r;
    269276
    270277   if (m_flags &wxAUI_NB_BOTTOM)
    void wxAuiGenericTabArt::DrawTab(wxDC& dc, 
    415422    int drawn_tab_yoff = border_points[1].y;
    416423    int drawn_tab_height = border_points[0].y - border_points[1].y;
    417424
    418 
     425   
    419426    if (page.active)
    420427    {
    421428        // draw active tab
    void wxAuiGenericTabArt::DrawTab(wxDC& dc, 
    427434        dc.DrawRectangle(r.x+1, r.y+1, r.width-1, r.height-4);
    428435
    429436        // this white helps fill out the gradient at the top of the tab
    430         dc.SetPen(*wxWHITE_PEN);
    431         dc.SetBrush(*wxWHITE_BRUSH);
     437        wxColor gradient = *wxWHITE;
     438        if ((m_baseColour.Red()) +
     439            (m_baseColour.Green()) +
     440            (m_baseColour.Blue()) < 128)
     441        {
     442            //dark mode, we go darker
     443            gradient = m_activeColour.ChangeLightness(70);
     444        }
     445       
     446        dc.SetPen(wxPen(gradient));
     447        dc.SetBrush(wxBrush(gradient));
    432448        dc.DrawRectangle(r.x+2, r.y+1, r.width-3, r.height-4);
    433449
    434450        // these two points help the rounded corners appear more antialiased
    void wxAuiGenericTabArt::DrawTab(wxDC& dc, 
    444460        r.y -= 2;
    445461
    446462        // draw gradient background
    447         wxColor top_color = *wxWHITE;
     463        wxColor top_color = gradient;
    448464        wxColor bottom_color = m_activeColour;
    449465        dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);
    450466    }
    void wxAuiGenericTabArt::DrawTab(wxDC& dc, 
    466482        // -- draw top gradient fill for glossy look
    467483        wxColor top_color = m_baseColour;
    468484        wxColor bottom_color = top_color.ChangeLightness(160);
     485        if ((m_baseColour.Red()) +
     486            (m_baseColour.Green()) +
     487            (m_baseColour.Blue()) < 128)
     488        {
     489            //dark mode, we go darker
     490            top_color = m_activeColour.ChangeLightness(70);
     491            bottom_color = m_baseColour;
     492        }
     493       
    469494        dc.GradientFillLinear(r, bottom_color, top_color, wxNORTH);
    470495
    471496        r.y += r.height;
    void wxAuiGenericTabArt::DrawTab(wxDC& dc, 
    532557                          tab_width - (text_offset-tab_x) - close_button_width);
    533558
    534559    // draw tab text
     560    if (page.active)
     561    {
     562        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_CAPTIONTEXT));
     563    }
     564    else
     565    {
     566        dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_INACTIVECAPTIONTEXT));
     567    }
    535568    dc.DrawText(draw_text,
    536569                text_offset,
    537570                drawn_tab_yoff + (drawn_tab_height)/2 - (texty/2) - 1);
  • src/osx/carbon/renderer.cpp

    diff --git a/src/osx/carbon/renderer.cpp b/src/osx/carbon/renderer.cpp
    index f7cd333d38..f104054ad3 100644
    a b int wxRendererMac::DrawHeaderButton( wxWindow *win, 
    172172    wxHeaderSortIconType sortArrow,
    173173    wxHeaderButtonParams* params )
    174174{
     175    if ( wxPlatformInfo::Get().CheckOSVersion(10, 14) ) {
     176        return wxRendererNative::GetGeneric().DrawHeaderButton(win, dc,  rect, flags, sortArrow, params);
     177    }
     178   
    175179    const wxCoord x = rect.x;
    176180    const wxCoord y = rect.y;
    177181    const wxCoord w = rect.width;
    void wxRendererMac::DrawSplitterSash( wxWindow *win, 
    373377            CGContextFillRect(cgContext,splitterRect);
    374378        }
    375379
    376         if ( win->HasFlag(wxSP_3DSASH) )
     380        if ( win->HasFlag(wxSP_3DSASH) && !wxPlatformInfo::Get().CheckOSVersion(10, 14) )
    377381        {
    378382            HIThemeSplitterDrawInfo drawInfo;
    379383            drawInfo.version = 0;
  • src/osx/cocoa/settings.mm

    diff --git a/src/osx/cocoa/settings.mm b/src/osx/cocoa/settings.mm
    index d59f9f7c0e..355b5f1d14 100644
    a b static int wxOSXGetUserDefault(NSString* key, int defaultValue) 
    110110        sysColor = [NSColor controlShadowColor];
    111111        break;
    112112    case wxSYS_COLOUR_3DLIGHT:
    113         sysColor = [NSColor controlHighlightColor];
     113        sysColor = [NSColor highlightColor];
    114114        break;
    115115    case wxSYS_COLOUR_HIGHLIGHTTEXT:
    116116        sysColor = [NSColor selectedTextColor];
  • src/ribbon/art_aui.cpp

    diff --git a/src/ribbon/art_aui.cpp b/src/ribbon/art_aui.cpp
    index 7df2bfa702..4eb3144ba1 100644
    a b  
    3737wxRibbonAUIArtProvider::wxRibbonAUIArtProvider()
    3838    : wxRibbonMSWArtProvider(false)
    3939{
    40 #if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
    41     wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
    42 #else
    4340    wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
    44 #endif
    4541
    4642    SetColourScheme(base_colour,
    4743        wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT),
  • src/stc/stc.cpp

    diff --git a/src/stc/stc.cpp b/src/stc/stc.cpp
    index 620e0b9197..b4602db8da 100644
    a b bool wxStyledTextCtrl::Create(wxWindow *parent, 
    224224    // STC doesn't support RTL languages at all
    225225    SetLayoutDirection(wxLayout_LeftToRight);
    226226
    227     // Rely on native double buffering by default, except under Mac where it
    228     // doesn't work for some reason, see #18085.
    229 #if wxALWAYS_NATIVE_DOUBLE_BUFFER && !defined(__WXMAC__)
     227    // Rely on native double buffering by default.
     228#if wxALWAYS_NATIVE_DOUBLE_BUFFER
    230229    SetBufferedDraw(false);
    231230#else
    232231    SetBufferedDraw(true);