-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mac: Support Dark Mode in Advanced View #5267
Changes from 3 commits
4969e38
6c14fec
3f0753a
e2a130f
ceb01f5
02c8887
862a1b4
3a5f3cc
b025bb8
c439b67
6a0ea0c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1980,6 +1980,55 @@ void CAdvancedFrame::OnSelectAll(wxCommandEvent& WXUNUSED(event)) { | |
} | ||
|
||
|
||
// On the Mac, we must destroy and recreate each wxListCtrl | ||
// to properly transition between dark mode and regular mode | ||
void CAdvancedFrame::OnDarkModeChanged( wxSysColourChangedEvent& WXUNUSED(event) ) { | ||
CBOINCBaseView* theView = NULL;; | ||
CBOINCListCtrl* theListCtrl = NULL; | ||
long bottomItem; | ||
wxTimerEvent timerEvent; | ||
int currentPage = _GetCurrentViewPage(); | ||
|
||
StopTimers(); | ||
SaveState(); | ||
// Get the list copntrol's current scroll position | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spell check: "control's" |
||
if ((currentPage == VW_PROJ) || (currentPage == VW_TASK) || (currentPage == VW_XFER)) { | ||
theView = (CBOINCBaseView*)(m_pNotebook->GetPage(m_pNotebook->GetSelection())); | ||
theListCtrl = theView->GetListCtrl(); | ||
bottomItem = theListCtrl->GetTopItem() + theListCtrl->GetCountPerPage() - 1; | ||
} | ||
RepopulateNotebook(); | ||
RestoreState(); | ||
|
||
// The last tab label ("Disk") is ellipsed here unless the window is resized | ||
// TODO: figure out how to replace this hack with a proper fix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a blank comment line after this line. |
||
int x, y; | ||
GetSize(&x, &y); | ||
SetSize(x+1, y); | ||
SetSize(x, y); | ||
|
||
// Scroll the recreated list control to the same row as before | ||
if ((currentPage == VW_PROJ) || (currentPage == VW_TASK) || (currentPage == VW_XFER)) { | ||
theView = (CBOINCBaseView*)(m_pNotebook->GetPage(m_pNotebook->GetSelection())); | ||
theView->FireOnListRender(timerEvent); | ||
theListCtrl = theView->GetListCtrl(); | ||
if (theListCtrl->GetCountPerPage() < theListCtrl->GetItemCount()) { | ||
theListCtrl->EnsureVisible(bottomItem); | ||
} | ||
} | ||
// TODO: figure out how to preserve notices tab (currentPage == VW_NOTIF) scrolled position | ||
|
||
StartTimers(); | ||
|
||
CDlgEventLog* eventLog = wxGetApp().GetEventLog(); | ||
if (eventLog) { | ||
wxGetApp().OnEventLogClose(); | ||
delete eventLog; // eventLog->Destroy() creates a race condition if used here. | ||
wxGetApp().DisplayEventLog(); | ||
} | ||
} | ||
|
||
|
||
void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) { | ||
wxMenuBar* pMenuBar = GetMenuBar(); | ||
wxASSERT(pMenuBar); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,9 @@ bool CNoticeListCtrl::Create( wxWindow* parent ) { | |
#endif | ||
////@end CNoticeListCtrl creation | ||
|
||
wxSystemAppearance appearance = wxSystemSettings::GetAppearance(); | ||
m_isDarkMode = appearance.IsDark(); | ||
|
||
wxBoxSizer *topsizer; | ||
topsizer = new wxBoxSizer(wxVERTICAL); | ||
|
||
|
@@ -101,7 +104,18 @@ bool CNoticeListCtrl::Create( wxWindow* parent ) { | |
SetSizer(topsizer); | ||
|
||
m_itemCount = 0; | ||
m_noticesBody = wxT("<html><head></head><body></body></html>"); | ||
if (m_isDarkMode){ | ||
m_noticesBody = wxT("<html><style>body{background-color:black;color:white;}</style><head></head><body></body></html>"); | ||
} else { | ||
m_noticesBody = wxT("<html><head></head><body></body></html>"); | ||
} | ||
|
||
// In Dark Mode, paint the windoe black immediately | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spell check: window |
||
#if wxUSE_WEBVIEW | ||
m_browser->SetPage(m_noticesBody, wxEmptyString); | ||
#else | ||
m_browser->SetPage(m_noticesBody); | ||
#endif | ||
|
||
// Display the fetching notices message until we have notices | ||
// to display or have determined that there are no notices. | ||
|
@@ -139,7 +153,13 @@ void CNoticeListCtrl::SetItemCount(int newCount) { | |
wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced)); | ||
|
||
m_itemCount = newCount; | ||
m_noticesBody = wxT("<html><head></head><body><font face=helvetica>"); | ||
|
||
|
||
if (m_isDarkMode){ | ||
m_noticesBody = wxT("<html><style>body{background-color:black;color:white;}</style><head></head><body><font face=helvetica>"); | ||
} else { | ||
m_noticesBody = wxT("<html><head></head><body><font face=helvetica>"); | ||
} | ||
|
||
for (i=0; i<newCount; ++i) { | ||
if (pDoc->IsConnected()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a blank comment line after this line.