Don't avoid stock items with GTK+3
They still work fine with GTK+3, we just have to avoid them with GTK+4
This commit is contained in:
@@ -179,12 +179,14 @@ wxSize wxButtonBase::GetDefaultSize()
|
||||
|
||||
GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
GtkWidget *box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
|
||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
||||
#ifdef __WXGTK4__
|
||||
wxString labelGTK = GTKConvertMnemonics(wxGetStockLabel(wxID_CANCEL));
|
||||
GtkWidget *btn = gtk_button_new_with_mnemonic(labelGTK.utf8_str());
|
||||
#else
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
||||
#endif // GTK >= 3.10 / < 3.10
|
||||
wxGCC_WARNING_RESTORE()
|
||||
#endif
|
||||
gtk_container_add(GTK_CONTAINER(box), btn);
|
||||
gtk_container_add(GTK_CONTAINER(wnd), box);
|
||||
GtkRequisition req;
|
||||
@@ -219,7 +221,8 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
if ( HasFlag(wxBU_NOTEXT) )
|
||||
return;
|
||||
|
||||
#if !defined(__WXGTK3__) || !GTK_CHECK_VERSION(3,10,0)
|
||||
#ifndef __WXGTK4__
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
|
||||
{
|
||||
const char *stock = wxGetStockGtkID(m_windowId);
|
||||
@@ -230,7 +233,8 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GTK < 3.10
|
||||
wxGCC_WARNING_RESTORE()
|
||||
#endif
|
||||
|
||||
// this call is necessary if the button had been initially created without
|
||||
// a (text) label -- then we didn't use gtk_button_new_with_mnemonic() and
|
||||
@@ -238,9 +242,11 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
gtk_button_set_use_underline(GTK_BUTTON(m_widget), TRUE);
|
||||
const wxString labelGTK = GTKConvertMnemonics(label);
|
||||
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
|
||||
#if !defined(__WXGTK3__) || !GTK_CHECK_VERSION(3,10,0)
|
||||
#ifndef __WXGTK4__
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
|
||||
#endif // GTK < 3.10
|
||||
wxGCC_WARNING_RESTORE()
|
||||
#endif
|
||||
|
||||
GTKApplyWidgetStyle( false );
|
||||
}
|
||||
|
Reference in New Issue
Block a user