Don't use stock items in wxButton
Stock items are deprecated since GTK+ 3.10 so corresponding labels should be used instead of them.
This commit is contained in:
@@ -171,7 +171,12 @@ 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)
|
||||
wxString labelGTK = GTKConvertMnemonics(wxGetStockLabel(wxID_CANCEL));
|
||||
GtkWidget *btn = gtk_button_new_with_mnemonic(wxGTK_CONV(labelGTK));
|
||||
#else
|
||||
GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
||||
#endif // GTK >= 3.10 / < 3.10
|
||||
gtk_container_add(GTK_CONTAINER(box), btn);
|
||||
gtk_container_add(GTK_CONTAINER(wnd), box);
|
||||
GtkRequisition req;
|
||||
@@ -206,6 +211,7 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
if ( HasFlag(wxBU_NOTEXT) )
|
||||
return;
|
||||
|
||||
#if !defined(__WXGTK3__) || !GTK_CHECK_VERSION(3,10,0)
|
||||
if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
|
||||
{
|
||||
const char *stock = wxGetStockGtkID(m_windowId);
|
||||
@@ -216,6 +222,7 @@ void wxButton::SetLabel( const wxString &lbl )
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GTK < 3.10
|
||||
|
||||
// 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
|
||||
@@ -223,7 +230,9 @@ 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)
|
||||
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
|
||||
#endif // GTK < 3.10
|
||||
|
||||
GTKApplyWidgetStyle( false );
|
||||
}
|
||||
|
Reference in New Issue
Block a user