Fix build with wxUSE_UNICODE_UTF8

wxString is not implicitly convertible to const char* in that configuration.
Also, stock IDs work fine with GTK+3 despite being deprecated, so only avoid
them for GTK+4.
This commit is contained in:
Paul Cornett 2018-10-20 09:58:30 -07:00
parent 51fb57ec07
commit 35a9f134cc

View File

@ -139,7 +139,6 @@ bool wxInfoBar::Create(wxWindow *parent, wxWindowID winid)
// finish creation and connect to all the signals we're interested in // finish creation and connect to all the signals we're interested in
m_parent->DoAddChild(this); m_parent->DoAddChild(this);
PostCreation(wxDefaultSize); PostCreation(wxDefaultSize);
GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response)); GTKConnectWidget("response", G_CALLBACK(wxgtk_infobar_response));
@ -232,18 +231,13 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label)
// our best size (at least in vertical direction) // our best size (at least in vertical direction)
InvalidateBestSize(); InvalidateBestSize();
GtkWidget *button = gtk_info_bar_add_button GtkWidget* button = gtk_info_bar_add_button(GTK_INFO_BAR(m_widget),
( #ifdef __WXGTK4__
GTK_INFO_BAR(m_widget), wxGTK_CONV(label.empty() ? wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)) : label),
label.empty() ?
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)))
#else #else
wxString(wxGetStockGtkID(btnid)) label.empty() ? wxGetStockGtkID(btnid) : static_cast<const char*>(wxGTK_CONV(label)),
#endif // GTK >= 3.10 / < 3.10 #endif
: wxGTK_CONV(label), btnid);
btnid
);
wxASSERT_MSG( button, "unexpectedly failed to add button to info bar" ); wxASSERT_MSG( button, "unexpectedly failed to add button to info bar" );