Skip to content

Commit

Permalink
RecentFilesCtrl: Use blurred background on macOS
Browse files Browse the repository at this point in the history
Use source list styling on macOS for the recent files list, as Xcode
does.
  • Loading branch information
vslavik committed Jan 4, 2021
1 parent 850a331 commit 8766339
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/recent_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,22 +538,28 @@ RecentFilesCtrl::RecentFilesCtrl(wxWindow *parent)
: wxDataViewListCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER | wxBORDER_NONE),
m_data(new data)
{
#if wxCHECK_VERSION(3,1,1)
SetRowHeight(PX(46));
#endif

#ifdef __WXOSX__
NSScrollView *scrollView = (NSScrollView*)GetHandle();
scrollView.automaticallyAdjustsContentInsets = NO;

NSTableView *tableView = (NSTableView*)[scrollView documentView];
tableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList;
[tableView setIntercellSpacing:NSMakeSize(0.0, 0.0)];
const int icon_column_width = PX(32 + 12);
#else
#else // !__WXOSX__
ColorScheme::SetupWindowColors(this, [=]
{
SetBackgroundColour(ColorScheme::Get(Color::SidebarBackground));
});

m_data->icons_cache = RecentFiles::Get().m_impl->GetIconsCache();
const int icon_column_width = wxSystemSettings::GetMetric(wxSYS_ICON_X) + PX(12);
#endif

#if wxCHECK_VERSION(3,1,1)
SetRowHeight(PX(46));
#endif

AppendBitmapColumn("", 0, wxDATAVIEW_CELL_INERT, icon_column_width);
auto renderer = new MultilineTextRenderer();
auto column = new wxDataViewColumn(_("File"), renderer, 1, -1, wxALIGN_NOT, wxDATAVIEW_COL_RESIZABLE);
Expand Down
4 changes: 0 additions & 4 deletions src/welcomescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ WelcomeWindow::WelcomeWindow()
#ifndef __WXGTK__
auto recentFiles = new RecentFilesCtrl(this);
recentFiles->SetMinSize(wxSize(PX(320), -1));
ColorScheme::SetupWindowColors(this, [=]
{
recentFiles->SetBackgroundColour(ColorScheme::Get(Color::SidebarBackground));
});
topsizer->Add(recentFiles, wxSizerFlags().Expand());
#endif

Expand Down

0 comments on commit 8766339

Please sign in to comment.