FIX:fixed macos overwriting title bar text colors

Change-Id: I617c27eebee47f6739532a02038359829245df27
This commit is contained in:
tao wang 2022-08-04 17:16:37 +08:00 committed by Lane.Wei
parent 1e857a6e23
commit b03a93d7fc
5 changed files with 19 additions and 3 deletions

View file

@ -745,6 +745,13 @@ void MainFrame::update_title()
return; return;
} }
void MainFrame::update_title_colour_after_set_title()
{
#ifdef __WXOSX__
set_title_colour_after_set_title();
#endif
}
void MainFrame::show_option(bool show) void MainFrame::show_option(bool show)
{ {
if (!this) { return; } if (!this) { return; }

View file

@ -226,7 +226,8 @@ public:
void update_title(); void update_title();
void show_option(bool show); void update_title_colour_after_set_title();
void show_option(bool show);
void init_tabpanel(); void init_tabpanel();
void create_preset_tabs(); void create_preset_tabs();
//BBS: GUI refactor //BBS: GUI refactor

View file

@ -5588,6 +5588,7 @@ void Plater::priv::set_project_name(const wxString& project_name)
wxGetApp().mainframe->topbar()->SetTitle(m_project_name); wxGetApp().mainframe->topbar()->SetTitle(m_project_name);
#else #else
wxGetApp().mainframe->SetTitle(m_project_name); wxGetApp().mainframe->SetTitle(m_project_name);
wxGetApp().mainframe->update_title_colour_after_set_title();
#endif #endif
} }

View file

@ -11,7 +11,7 @@ extern bool mac_dark_mode();
extern double mac_max_scaling_factor(); extern double mac_max_scaling_factor();
extern void set_miniaturizable(void * window); extern void set_miniaturizable(void * window);
void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &)); void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &));
void set_title_colour_after_set_title();
void initGestures(void * view, wxEvtHandler * handler); void initGestures(void * view, wxEvtHandler * handler);
#endif #endif

View file

@ -58,6 +58,13 @@ void set_miniaturizable(void * window)
} }
} }
void set_title_colour_after_set_title()
{
if(mainframe_text_field){
[(NSTextField*)mainframe_text_field setTextColor : NSColor.whiteColor];
}
}
void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &)) void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &))
{ {
[(WKWebView*)web evaluateJavaScript:wxCFStringRef(script).AsNSString() completionHandler: ^(id result, NSError *error) { [(WKWebView*)web evaluateJavaScript:wxCFStringRef(script).AsNSString() completionHandler: ^(id result, NSError *error) {