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 *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
GtkWidget *box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
|
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));
|
wxString labelGTK = GTKConvertMnemonics(wxGetStockLabel(wxID_CANCEL));
|
||||||
GtkWidget *btn = gtk_button_new_with_mnemonic(labelGTK.utf8_str());
|
GtkWidget *btn = gtk_button_new_with_mnemonic(labelGTK.utf8_str());
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
|
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(box), btn);
|
||||||
gtk_container_add(GTK_CONTAINER(wnd), box);
|
gtk_container_add(GTK_CONTAINER(wnd), box);
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
@@ -219,7 +221,8 @@ void wxButton::SetLabel( const wxString &lbl )
|
|||||||
if ( HasFlag(wxBU_NOTEXT) )
|
if ( HasFlag(wxBU_NOTEXT) )
|
||||||
return;
|
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))
|
if (wxIsStockID(m_windowId) && wxIsStockLabel(m_windowId, label))
|
||||||
{
|
{
|
||||||
const char *stock = wxGetStockGtkID(m_windowId);
|
const char *stock = wxGetStockGtkID(m_windowId);
|
||||||
@@ -230,7 +233,8 @@ void wxButton::SetLabel( const wxString &lbl )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // GTK < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
|
|
||||||
// this call is necessary if the button had been initially created without
|
// 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
|
// 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);
|
gtk_button_set_use_underline(GTK_BUTTON(m_widget), TRUE);
|
||||||
const wxString labelGTK = GTKConvertMnemonics(label);
|
const wxString labelGTK = GTKConvertMnemonics(label);
|
||||||
gtk_button_set_label(GTK_BUTTON(m_widget), wxGTK_CONV(labelGTK));
|
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);
|
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
|
||||||
#endif // GTK < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
|
|
||||||
GTKApplyWidgetStyle( false );
|
GTKApplyWidgetStyle( false );
|
||||||
}
|
}
|
||||||
|
@@ -85,23 +85,29 @@ bool wxDirDialog::Create(wxWindow* parent,
|
|||||||
if (parent)
|
if (parent)
|
||||||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
||||||
|
|
||||||
|
#ifndef __WXGTK4__
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
|
#endif
|
||||||
m_widget = gtk_file_chooser_dialog_new(
|
m_widget = gtk_file_chooser_dialog_new(
|
||||||
wxGTK_CONV(m_message),
|
wxGTK_CONV(m_message),
|
||||||
gtk_parent,
|
gtk_parent,
|
||||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
||||||
#else
|
#else
|
||||||
GTK_STOCK_CANCEL,
|
GTK_STOCK_CANCEL,
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
GTK_RESPONSE_CANCEL,
|
GTK_RESPONSE_CANCEL,
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)))),
|
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)))),
|
||||||
#else
|
#else
|
||||||
GTK_STOCK_OPEN,
|
GTK_STOCK_OPEN,
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
GTK_RESPONSE_ACCEPT,
|
GTK_RESPONSE_ACCEPT,
|
||||||
NULL);
|
NULL);
|
||||||
|
#ifndef __WXGTK4__
|
||||||
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
g_object_ref(m_widget);
|
g_object_ref(m_widget);
|
||||||
|
|
||||||
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
|
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
|
||||||
|
@@ -213,38 +213,44 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
|
|||||||
if (parent)
|
if (parent)
|
||||||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
||||||
|
|
||||||
|
#ifndef __WXGTK4__
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
|
#endif
|
||||||
wxString ok_btn_stock;
|
wxString ok_btn_stock;
|
||||||
if ( style & wxFD_SAVE )
|
if ( style & wxFD_SAVE )
|
||||||
{
|
{
|
||||||
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
gtk_action = GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_SAVE));
|
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_SAVE));
|
||||||
#else
|
#else
|
||||||
ok_btn_stock = GTK_STOCK_SAVE;
|
ok_btn_stock = GTK_STOCK_SAVE;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
gtk_action = GTK_FILE_CHOOSER_ACTION_OPEN;
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN));
|
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN));
|
||||||
#else
|
#else
|
||||||
ok_btn_stock = GTK_STOCK_OPEN;
|
ok_btn_stock = GTK_STOCK_OPEN;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
m_widget = gtk_file_chooser_dialog_new(
|
m_widget = gtk_file_chooser_dialog_new(
|
||||||
wxGTK_CONV(m_message),
|
wxGTK_CONV(m_message),
|
||||||
gtk_parent,
|
gtk_parent,
|
||||||
gtk_action,
|
gtk_action,
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
static_cast<const gchar*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
static_cast<const gchar*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
||||||
#else
|
#else
|
||||||
GTK_STOCK_CANCEL,
|
GTK_STOCK_CANCEL,
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
GTK_RESPONSE_CANCEL,
|
GTK_RESPONSE_CANCEL,
|
||||||
static_cast<const gchar*>(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT,
|
static_cast<const gchar*>(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT,
|
||||||
NULL);
|
NULL);
|
||||||
|
#ifndef __WXGTK4__
|
||||||
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
g_object_ref(m_widget);
|
g_object_ref(m_widget);
|
||||||
GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
|
|
||||||
|
@@ -49,47 +49,57 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
|||||||
|
|
||||||
wxString wxMessageDialog::GetDefaultYesLabel() const
|
wxString wxMessageDialog::GetDefaultYesLabel() const
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_YES));
|
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_YES));
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
return GTK_STOCK_YES;
|
return GTK_STOCK_YES;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMessageDialog::GetDefaultNoLabel() const
|
wxString wxMessageDialog::GetDefaultNoLabel() const
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_NO));
|
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_NO));
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
return GTK_STOCK_NO;
|
return GTK_STOCK_NO;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMessageDialog::GetDefaultOKLabel() const
|
wxString wxMessageDialog::GetDefaultOKLabel() const
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OK));
|
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OK));
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
return GTK_STOCK_OK;
|
return GTK_STOCK_OK;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMessageDialog::GetDefaultCancelLabel() const
|
wxString wxMessageDialog::GetDefaultCancelLabel() const
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL));
|
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL));
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
return GTK_STOCK_CANCEL;
|
return GTK_STOCK_CANCEL;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMessageDialog::GetDefaultHelpLabel() const
|
wxString wxMessageDialog::GetDefaultHelpLabel() const
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_HELP));
|
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_HELP));
|
||||||
#else
|
#else
|
||||||
|
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||||
return GTK_STOCK_HELP;
|
return GTK_STOCK_HELP;
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
wxGCC_WARNING_RESTORE()
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& label)
|
void wxMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& label)
|
||||||
@@ -102,11 +112,11 @@ void wxMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& label)
|
|||||||
}
|
}
|
||||||
else // stock label
|
else // stock label
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK3__) && GTK_CHECK_VERSION(3,10,0)
|
#ifdef __WXGTK4__
|
||||||
var = wxConvertMnemonicsToGTK(wxGetStockLabel(stockId));
|
var = wxConvertMnemonicsToGTK(wxGetStockLabel(stockId));
|
||||||
#else
|
#else
|
||||||
var = wxGetStockGtkID(stockId);
|
var = wxGetStockGtkID(stockId);
|
||||||
#endif // GTK >= 3.10 / < 3.10
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user