Remove all wxGTK_CONV macros except for wxGTK_CONV_FN
Use wxString::utf8_str() and FromUTF8() directly, there is no need for the macros abstracting the difference between ANSI and Unicode builds any longer.
This commit is contained in:
parent
813fcbaf10
commit
81807382b7
43 changed files with 122 additions and 175 deletions
|
|
@ -30,16 +30,6 @@
|
|||
// and use it only to test for pango versions >= 1.16.0
|
||||
extern const gchar *wx_pango_version_check(int major, int minor, int micro);
|
||||
|
||||
#define wxGTK_CONV(s) (s).utf8_str()
|
||||
#define wxGTK_CONV_ENC(s, enc) wxGTK_CONV((s))
|
||||
#define wxGTK_CONV_FONT(s, font) wxGTK_CONV((s))
|
||||
#define wxGTK_CONV_SYS(s) wxGTK_CONV((s))
|
||||
|
||||
#define wxGTK_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
|
||||
#define wxGTK_CONV_BACK_ENC(s, enc) wxGTK_CONV_BACK(s)
|
||||
#define wxGTK_CONV_BACK_FONT(s, font) wxGTK_CONV_BACK(s)
|
||||
#define wxGTK_CONV_BACK_SYS(s) wxGTK_CONV_BACK(s)
|
||||
|
||||
// Define a macro for converting wxString to char* in appropriate encoding for
|
||||
// the file names.
|
||||
#ifdef G_OS_WIN32
|
||||
|
|
|
|||
|
|
@ -35,13 +35,6 @@ class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
|
|||
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
|
||||
class WXDLLIMPEXP_FWD_CORE wxWindow;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Some Unicode <-> UTF8 macros stolen from GTK
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define wxGTK_CONV(s) wxConvUTF8.cWX2MB(s)
|
||||
#define wxGTK_CONV_BACK(s) wxConvUTF8.cMB2WX(s)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// we maintain a hash table which contains the mapping from Widget to wxWindow
|
||||
// corresponding to the window for this widget
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ gboolean statusbar_query_tooltip(GtkWidget* WXUNUSED(widget),
|
|||
if (str.empty())
|
||||
return FALSE;
|
||||
|
||||
gtk_tooltip_set_text(tooltip, wxGTK_CONV_SYS(str));
|
||||
gtk_tooltip_set_text(tooltip, str.utf8_str());
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
// existence the pointer persists in wxString which uses it either
|
||||
// for internal representation (in wxUSE_UNICODE_UTF8 case) or as
|
||||
// cached m_convertedToChar (in wxUSE_UNICODE_WCHAR case)
|
||||
m_strings[n] = wxGTK_CONV_SYS(a[n]);
|
||||
m_strings[n] = a[n].utf8_str();
|
||||
}
|
||||
|
||||
// array must be null-terminated
|
||||
|
|
@ -102,7 +102,7 @@ static gboolean activate_link(GtkAboutDialog*, const char* link, void* dontIgnor
|
|||
{
|
||||
if (dontIgnore)
|
||||
{
|
||||
wxLaunchDefaultBrowser(wxGTK_CONV_BACK_SYS(link));
|
||||
wxLaunchDefaultBrowser(wxString::FromUTF8(link));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -112,7 +112,7 @@ static gboolean activate_link(GtkAboutDialog*, const char* link, void* dontIgnor
|
|||
extern "C" {
|
||||
static void wxGtkAboutDialogOnLink(GtkAboutDialog*, const char* link, void*)
|
||||
{
|
||||
wxLaunchDefaultBrowser(wxGTK_CONV_BACK_SYS(link));
|
||||
wxLaunchDefaultBrowser(wxString::FromUTF8(link));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -124,21 +124,21 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
|||
gs_aboutDialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
|
||||
|
||||
GtkAboutDialog * const dlg = gs_aboutDialog;
|
||||
gtk_about_dialog_set_program_name(dlg, wxGTK_CONV_SYS(info.GetName()));
|
||||
gtk_about_dialog_set_program_name(dlg, info.GetName().utf8_str());
|
||||
if ( info.HasVersion() )
|
||||
gtk_about_dialog_set_version(dlg, wxGTK_CONV_SYS(info.GetVersion()));
|
||||
gtk_about_dialog_set_version(dlg, info.GetVersion().utf8_str());
|
||||
else
|
||||
gtk_about_dialog_set_version(dlg, nullptr);
|
||||
if ( info.HasCopyright() )
|
||||
gtk_about_dialog_set_copyright(dlg, wxGTK_CONV_SYS(info.GetCopyrightToDisplay()));
|
||||
gtk_about_dialog_set_copyright(dlg, info.GetCopyrightToDisplay().utf8_str());
|
||||
else
|
||||
gtk_about_dialog_set_copyright(dlg, nullptr);
|
||||
if ( info.HasDescription() )
|
||||
gtk_about_dialog_set_comments(dlg, wxGTK_CONV_SYS(info.GetDescription()));
|
||||
gtk_about_dialog_set_comments(dlg, info.GetDescription().utf8_str());
|
||||
else
|
||||
gtk_about_dialog_set_comments(dlg, nullptr);
|
||||
if ( info.HasLicence() )
|
||||
gtk_about_dialog_set_license(dlg, wxGTK_CONV_SYS(info.GetLicence()));
|
||||
gtk_about_dialog_set_license(dlg, info.GetLicence().utf8_str());
|
||||
else
|
||||
gtk_about_dialog_set_license(dlg, nullptr);
|
||||
|
||||
|
|
@ -157,11 +157,11 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
|||
gtk_about_dialog_set_url_hook(wxGtkAboutDialogOnLink, nullptr, nullptr);
|
||||
#endif
|
||||
|
||||
gtk_about_dialog_set_website(dlg, wxGTK_CONV_SYS(info.GetWebSiteURL()));
|
||||
gtk_about_dialog_set_website(dlg, info.GetWebSiteURL().utf8_str());
|
||||
gtk_about_dialog_set_website_label
|
||||
(
|
||||
dlg,
|
||||
wxGTK_CONV_SYS(info.GetWebSiteDescription())
|
||||
info.GetWebSiteDescription().utf8_str()
|
||||
);
|
||||
}
|
||||
else
|
||||
|
|
@ -214,7 +214,7 @@ void wxAboutBox(const wxAboutDialogInfo& info, wxWindow* parent)
|
|||
}
|
||||
|
||||
if ( !transCredits.empty() )
|
||||
gtk_about_dialog_set_translator_credits(dlg, wxGTK_CONV_SYS(transCredits));
|
||||
gtk_about_dialog_set_translator_credits(dlg, transCredits.utf8_str());
|
||||
else
|
||||
gtk_about_dialog_set_translator_credits(dlg, nullptr);
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ void wxBitmapComboBox::GTKInsertComboBoxTextItem( unsigned int n, const wxString
|
|||
gtk_list_store_insert( store, &iter, n );
|
||||
|
||||
wxGtkValue value( G_TYPE_STRING );
|
||||
g_value_set_string( value, wxGTK_CONV( text ) );
|
||||
g_value_set_string( value, text.utf8_str() );
|
||||
gtk_list_store_set_value( store, &iter, m_stringCellIndex, value );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ void wxButton::SetLabel( const wxString &lbl )
|
|||
// so "use-underline" GtkButton property remained unset
|
||||
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));
|
||||
gtk_button_set_label(GTK_BUTTON(m_widget), labelGTK.utf8_str());
|
||||
#ifndef __WXGTK4__
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
gtk_button_set_use_stock(GTK_BUTTON(m_widget), FALSE);
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ bool wxChoice::GTKHandleFocusOut()
|
|||
void wxChoice::GTKInsertComboBoxTextItem( unsigned int n, const wxString& text )
|
||||
{
|
||||
#ifdef __WXGTK3__
|
||||
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(m_widget), n, wxGTK_CONV(text));
|
||||
gtk_combo_box_text_insert_text(GTK_COMBO_BOX_TEXT(m_widget), n, text.utf8_str());
|
||||
#else
|
||||
gtk_combo_box_insert_text( GTK_COMBO_BOX( m_widget ), n, wxGTK_CONV( text ) );
|
||||
gtk_combo_box_insert_text( GTK_COMBO_BOX( m_widget ), n, text.utf8_str() );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ int wxChoice::FindString( const wxString &item, bool bCase ) const
|
|||
{
|
||||
wxGtkValue value;
|
||||
gtk_tree_model_get_value( model, &iter, m_stringCellIndex, value );
|
||||
wxString str = wxGTK_CONV_BACK( g_value_get_string( value ) );
|
||||
wxString str = wxString::FromUTF8Unchecked( g_value_get_string( value ) );
|
||||
|
||||
if (item.IsSameAs( str, bCase ) )
|
||||
return count;
|
||||
|
|
@ -277,7 +277,7 @@ void wxChoice::SetString(unsigned int n, const wxString &text)
|
|||
if (gtk_tree_model_iter_nth_child (model, &iter, nullptr, n))
|
||||
{
|
||||
wxGtkValue value(G_TYPE_STRING);
|
||||
g_value_set_string( value, wxGTK_CONV( text ) );
|
||||
g_value_set_string( value, text.utf8_str() );
|
||||
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, m_stringCellIndex, value );
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ wxString wxChoice::GetString(unsigned int n) const
|
|||
|
||||
wxGtkValue value;
|
||||
gtk_tree_model_get_value( model, &iter, m_stringCellIndex, value );
|
||||
return wxGTK_CONV_BACK( g_value_get_string( value ) );
|
||||
return wxString::FromUTF8Unchecked( g_value_get_string( value ) );
|
||||
}
|
||||
|
||||
unsigned int wxChoice::GetCount() const
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ bool wxCollapsiblePane::Create(wxWindow *parent,
|
|||
}
|
||||
|
||||
m_widget =
|
||||
gtk_expander_new_with_mnemonic(wxGTK_CONV(GTKConvertMnemonics(label)));
|
||||
gtk_expander_new_with_mnemonic(GTKConvertMnemonics(label).utf8_str());
|
||||
g_object_ref(m_widget);
|
||||
|
||||
// Connect to the "notify::expanded" signal instead of the more common
|
||||
|
|
@ -209,7 +209,7 @@ bool wxCollapsiblePane::IsCollapsed() const
|
|||
void wxCollapsiblePane::SetLabel(const wxString &str)
|
||||
{
|
||||
gtk_expander_set_label(GTK_EXPANDER(m_widget),
|
||||
wxGTK_CONV(GTKConvertMnemonics(str)));
|
||||
GTKConvertMnemonics(str).utf8_str());
|
||||
|
||||
// FIXME: we need to update our collapsed width in some way but using GetBestSize()
|
||||
// we may get the size of the control with the pane size summed up if we are expanded!
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ bool wxColourDialog::Create(wxWindow *parent, const wxColourData *data)
|
|||
gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(m_widget), m_data.GetChooseAlpha());
|
||||
#else
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
m_widget = gtk_color_selection_dialog_new(wxGTK_CONV(title));
|
||||
m_widget = gtk_color_selection_dialog_new(title.utf8_str());
|
||||
|
||||
g_object_ref(m_widget);
|
||||
|
||||
|
|
|
|||
|
|
@ -262,14 +262,14 @@ bool wxColour::FromString(const wxString& str)
|
|||
{
|
||||
#ifdef __WXGTK3__
|
||||
GdkRGBA gdkRGBA;
|
||||
if (gdk_rgba_parse(&gdkRGBA, wxGTK_CONV_SYS(str)))
|
||||
if (gdk_rgba_parse(&gdkRGBA, str.utf8_str()))
|
||||
{
|
||||
*this = wxColour(gdkRGBA);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
GdkColor colGDK;
|
||||
if ( gdk_color_parse( wxGTK_CONV_SYS( str ), &colGDK ) )
|
||||
if ( gdk_color_parse( str.utf8_str(), &colGDK ) )
|
||||
{
|
||||
*this = wxColour(colGDK);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||
else // editable combobox
|
||||
{
|
||||
// any value is accepted, even if it's not in our list
|
||||
gtk_entry_set_text( entry, wxGTK_CONV(value) );
|
||||
gtk_entry_set_text( entry, value.utf8_str() );
|
||||
}
|
||||
|
||||
GTKConnectChangedSignal();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void wxControl::GTKFixSensitivity(bool WXUNUSED_IN_GTK3(onlyIfUnderMouse))
|
|||
void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label)
|
||||
{
|
||||
const wxString labelGTK = GTKConvertMnemonics(label);
|
||||
gtk_label_set_text_with_mnemonic(w, wxGTK_CONV(labelGTK));
|
||||
gtk_label_set_text_with_mnemonic(w, labelGTK.utf8_str());
|
||||
}
|
||||
|
||||
#if wxUSE_MARKUP
|
||||
|
|
@ -152,7 +152,7 @@ void wxControl::GTKSetLabelForLabel(GtkLabel *w, const wxString& label)
|
|||
void wxControl::GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label)
|
||||
{
|
||||
const wxString labelGTK = GTKConvertMnemonicsWithMarkup(label);
|
||||
gtk_label_set_markup_with_mnemonic(w, wxGTK_CONV(labelGTK));
|
||||
gtk_label_set_markup_with_mnemonic(w, labelGTK.utf8_str());
|
||||
}
|
||||
|
||||
#endif // wxUSE_MARKUP
|
||||
|
|
@ -168,7 +168,7 @@ void wxControl::GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label
|
|||
GtkWidget* wxControl::GTKCreateFrame(const wxString& label)
|
||||
{
|
||||
const wxString labelGTK = GTKConvertMnemonics(label);
|
||||
GtkWidget* labelwidget = gtk_label_new_with_mnemonic(wxGTK_CONV(labelGTK));
|
||||
GtkWidget* labelwidget = gtk_label_new_with_mnemonic(labelGTK.utf8_str());
|
||||
gtk_widget_show(labelwidget); // without this it won't show...
|
||||
|
||||
GtkWidget* framewidget = gtk_frame_new(nullptr);
|
||||
|
|
|
|||
|
|
@ -2226,8 +2226,7 @@ static void wxGtkTextRendererEditedCallback( GtkCellRendererText *WXUNUSED(rende
|
|||
{
|
||||
wxDataViewRenderer *cell = (wxDataViewRenderer*) user_data;
|
||||
|
||||
cell->GtkOnTextEdited(arg1, wxGTK_CONV_BACK_FONT(
|
||||
arg2, cell->GetOwner()->GetOwner()->GetFont()));
|
||||
cell->GtkOnTextEdited(arg1, wxString::FromUTF8Unchecked(arg2));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2375,7 +2374,7 @@ const char* wxDataViewTextRenderer::GetTextPropertyName() const
|
|||
bool wxDataViewTextRenderer::SetTextValue(const wxString& str)
|
||||
{
|
||||
wxGtkValue gvalue( G_TYPE_STRING );
|
||||
g_value_set_string( gvalue, wxGTK_CONV_FONT( str, GetOwner()->GetOwner()->GetFont() ) );
|
||||
g_value_set_string( gvalue, str.utf8_str() );
|
||||
g_object_set_property( G_OBJECT(m_renderer), GetTextPropertyName(), gvalue );
|
||||
|
||||
return true;
|
||||
|
|
@ -2385,7 +2384,7 @@ bool wxDataViewTextRenderer::GetTextValue(wxString& str) const
|
|||
{
|
||||
wxGtkValue gvalue( G_TYPE_STRING );
|
||||
g_object_get_property( G_OBJECT(m_renderer), GetTextPropertyName(), gvalue );
|
||||
str = wxGTK_CONV_BACK_FONT( g_value_get_string( gvalue ), const_cast<wxDataViewTextRenderer*>(this)->GetOwner()->GetOwner()->GetFont() );
|
||||
str = wxString::FromUTF8Unchecked( g_value_get_string( gvalue ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2787,7 +2786,7 @@ void wxDataViewCustomRenderer::RenderText( const wxString &text,
|
|||
GtkCellRendererText * const textRenderer = GtkGetTextRenderer();
|
||||
|
||||
wxGtkValue gvalue( G_TYPE_STRING );
|
||||
g_value_set_string( gvalue, wxGTK_CONV_FONT( text, GetOwner()->GetOwner()->GetFont() ) );
|
||||
g_value_set_string( gvalue, text.utf8_str() );
|
||||
g_object_set_property( G_OBJECT(textRenderer), "text", gvalue );
|
||||
|
||||
GtkApplyAttr(textRenderer, GetAttr());
|
||||
|
|
@ -2893,7 +2892,7 @@ void wxDataViewProgressRenderer::GTKSetLabel()
|
|||
if ( m_label.empty() )
|
||||
buf = wxScopedCharBuffer::CreateNonOwned("");
|
||||
else
|
||||
buf = wxGTK_CONV_FONT(m_label, GetOwner()->GetOwner()->GetFont());
|
||||
buf = m_label.utf8_str();
|
||||
|
||||
g_value_set_string( gvalue, buf);
|
||||
g_object_set_property( G_OBJECT(m_renderer), "text", gvalue );
|
||||
|
|
@ -2983,9 +2982,7 @@ wxSize wxDataViewChoiceRenderer::GetSize() const
|
|||
bool wxDataViewChoiceRenderer::SetValue( const wxVariant &value )
|
||||
{
|
||||
wxGtkValue gvalue( G_TYPE_STRING );
|
||||
g_value_set_string(gvalue,
|
||||
wxGTK_CONV_FONT(value.GetString(),
|
||||
GetOwner()->GetOwner()->GetFont()));
|
||||
g_value_set_string(gvalue, value.GetString().utf8_str());
|
||||
g_object_set_property( G_OBJECT(m_renderer), "text", gvalue );
|
||||
|
||||
return true;
|
||||
|
|
@ -2995,8 +2992,7 @@ bool wxDataViewChoiceRenderer::GetValue( wxVariant &value ) const
|
|||
{
|
||||
wxGtkValue gvalue( G_TYPE_STRING );
|
||||
g_object_get_property( G_OBJECT(m_renderer), "text", gvalue );
|
||||
value = wxGTK_CONV_BACK_FONT(g_value_get_string(gvalue),
|
||||
GetOwner()->GetOwner()->GetFont());
|
||||
value = wxString::FromUTF8Unchecked(g_value_get_string(gvalue));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3305,14 +3301,12 @@ void wxDataViewColumn::SetOwner( wxDataViewCtrl *owner )
|
|||
|
||||
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(m_column);
|
||||
|
||||
gtk_tree_view_column_set_title( column, wxGTK_CONV_FONT(GetTitle(), GetOwner()->GetFont() ) );
|
||||
gtk_tree_view_column_set_title( column, GetTitle().utf8_str() );
|
||||
}
|
||||
|
||||
void wxDataViewColumn::SetTitle( const wxString &title )
|
||||
{
|
||||
wxDataViewCtrl *ctrl = GetOwner();
|
||||
gtk_label_set_text( GTK_LABEL(m_label), ctrl ? wxGTK_CONV_FONT(title, ctrl->GetFont())
|
||||
: wxGTK_CONV_SYS(title) );
|
||||
gtk_label_set_text( GTK_LABEL(m_label), title.utf8_str() );
|
||||
if (title.empty())
|
||||
gtk_widget_hide( m_label );
|
||||
else
|
||||
|
|
@ -3321,9 +3315,8 @@ void wxDataViewColumn::SetTitle( const wxString &title )
|
|||
|
||||
wxString wxDataViewColumn::GetTitle() const
|
||||
{
|
||||
return wxGTK_CONV_BACK_FONT(
|
||||
gtk_label_get_text( GTK_LABEL(m_label) ),
|
||||
GetOwner()->GetFont()
|
||||
return wxString::FromUTF8Unchecked(
|
||||
gtk_label_get_text( GTK_LABEL(m_label) )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1385,7 +1385,7 @@ void wxWindowDCImpl::DoDrawRotatedText(const wxString& text, int xLogical, int y
|
|||
|
||||
wxCHECK_RET( IsOk(), wxT("invalid window dc") );
|
||||
|
||||
pango_layout_set_text(m_layout, wxGTK_CONV(text), -1);
|
||||
pango_layout_set_text(m_layout, text.utf8_str(), -1);
|
||||
const bool setAttrs = m_font.GTKSetPangoAttrs(m_layout);
|
||||
|
||||
const GdkColor* bg_col = nullptr;
|
||||
|
|
|
|||
|
|
@ -89,17 +89,17 @@ bool wxDirDialog::Create(wxWindow* parent,
|
|||
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
|
||||
|
||||
m_widget = gtk_file_chooser_dialog_new(
|
||||
wxGTK_CONV(m_message),
|
||||
m_message.utf8_str(),
|
||||
gtk_parent,
|
||||
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
#ifdef __WXGTK4__
|
||||
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
||||
static_cast<const char*>(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)).utf8_str()),
|
||||
#else
|
||||
"gtk-cancel",
|
||||
#endif
|
||||
GTK_RESPONSE_CANCEL,
|
||||
#ifdef __WXGTK4__
|
||||
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)))),
|
||||
static_cast<const char*>(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)).utf8_str()),
|
||||
#else
|
||||
"gtk-open",
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void wxGtkFileChooser::SetWildcard( const wxString& wildCard )
|
|||
{
|
||||
GtkFileFilter* filter = gtk_file_filter_new();
|
||||
|
||||
gtk_file_filter_set_name( filter, wxGTK_CONV_SYS( wildDescriptions[n] ) );
|
||||
gtk_file_filter_set_name( filter, wildDescriptions[n].utf8_str() );
|
||||
|
||||
wxStringTokenizer exttok( wildFilters[n], wxT( ";" ) );
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ void wxGtkFileChooser::SetWildcard( const wxString& wildCard )
|
|||
while ( exttok.HasMoreTokens() )
|
||||
{
|
||||
wxString token = exttok.GetNextToken();
|
||||
gtk_file_filter_add_pattern( filter, wxGTK_CONV_SYS( token ) );
|
||||
gtk_file_filter_add_pattern( filter, token.utf8_str() );
|
||||
|
||||
if (n1 == 1)
|
||||
m_wildcards.Add( token ); // Only add first pattern to list, used later when saving
|
||||
|
|
@ -422,7 +422,7 @@ bool wxGtkFileCtrl::SetFilename( const wxString& name )
|
|||
{
|
||||
if ( HasFlag( wxFC_SAVE ) )
|
||||
{
|
||||
gtk_file_chooser_set_current_name( m_fcWidget, wxGTK_CONV( name ) );
|
||||
gtk_file_chooser_set_current_name( m_fcWidget, name.utf8_str() );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -235,16 +235,16 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
|
|||
}
|
||||
|
||||
m_widget = gtk_file_chooser_dialog_new(
|
||||
wxGTK_CONV(m_message),
|
||||
m_message.utf8_str(),
|
||||
gtk_parent,
|
||||
gtk_action,
|
||||
#ifdef __WXGTK4__
|
||||
static_cast<const gchar*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
|
||||
static_cast<const gchar*>(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)).utf8_str()),
|
||||
#else
|
||||
"gtk-cancel",
|
||||
#endif
|
||||
GTK_RESPONSE_CANCEL,
|
||||
static_cast<const gchar*>(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT,
|
||||
static_cast<const gchar*>(ok_btn_stock.utf8_str()), GTK_RESPONSE_ACCEPT,
|
||||
nullptr);
|
||||
|
||||
g_object_ref(m_widget);
|
||||
|
|
@ -448,7 +448,7 @@ void wxFileDialog::SetFilename(const wxString& name)
|
|||
|
||||
if (HasFdFlag(wxFD_SAVE))
|
||||
{
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), wxGTK_CONV(name));
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(m_widget), name.utf8_str());
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ wxFontRefData::wxFontRefData(const wxFontInfo& info)
|
|||
if ( info.HasFaceName() )
|
||||
{
|
||||
pango_font_description_set_family( m_nativeFontInfo.description,
|
||||
wxGTK_CONV_SYS(info.GetFaceName()) );
|
||||
info.GetFaceName().utf8_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,12 +84,12 @@ bool wxFontDialog::DoCreate(wxWindow *parent)
|
|||
g_type_ensure(PANGO_TYPE_FONT_FACE);
|
||||
#endif
|
||||
if (gtk_check_version(3,2,0) == nullptr)
|
||||
m_widget = gtk_font_chooser_dialog_new(wxGTK_CONV(message), gtk_parent);
|
||||
m_widget = gtk_font_chooser_dialog_new(message.utf8_str(), gtk_parent);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
m_widget = gtk_font_selection_dialog_new(wxGTK_CONV(message));
|
||||
m_widget = gtk_font_selection_dialog_new(message.utf8_str());
|
||||
if (gtk_parent)
|
||||
gtk_window_set_transient_for(GTK_WINDOW(m_widget), gtk_parent);
|
||||
wxGCC_WARNING_RESTORE()
|
||||
|
|
@ -114,7 +114,7 @@ bool wxFontDialog::DoCreate(wxWindow *parent)
|
|||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
const wxString& fontname = info->ToString();
|
||||
GtkFontSelectionDialog* sel = GTK_FONT_SELECTION_DIALOG(m_widget);
|
||||
gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname));
|
||||
gtk_font_selection_dialog_set_font_name(sel, fontname.utf8_str());
|
||||
wxGCC_WARNING_RESTORE()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ void wxFontButton::UpdateFont()
|
|||
const wxString& fontname = info->ToString();
|
||||
|
||||
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
|
||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
|
||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), fontname.utf8_str());
|
||||
wxGCC_WARNING_RESTORE(deprecated-declarations)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ void wxHyperlinkCtrl::SetLabel(const wxString &label)
|
|||
{
|
||||
wxControl::SetLabel(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), labelGTK.utf8_str());
|
||||
}
|
||||
else
|
||||
wxGenericHyperlinkCtrl::SetLabel(label);
|
||||
|
|
@ -190,7 +190,7 @@ void wxHyperlinkCtrl::SetLabel(const wxString &label)
|
|||
void wxHyperlinkCtrl::SetURL(const wxString &uri)
|
||||
{
|
||||
if ( UseNative() )
|
||||
gtk_link_button_set_uri(GTK_LINK_BUTTON(m_widget), wxGTK_CONV(uri));
|
||||
gtk_link_button_set_uri(GTK_LINK_BUTTON(m_widget), uri.utf8_str());
|
||||
else
|
||||
wxGenericHyperlinkCtrl::SetURL(uri);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ void wxInfoBar::ShowMessage(const wxString& msg, int flags)
|
|||
GtkMessageType type;
|
||||
if ( wxGTKImpl::ConvertMessageTypeFromWX(flags, &type) )
|
||||
gtk_info_bar_set_message_type(GTK_INFO_BAR(m_widget), type);
|
||||
gtk_label_set_text(GTK_LABEL(m_impl->m_label), wxGTK_CONV(msg));
|
||||
gtk_label_set_text(GTK_LABEL(m_impl->m_label), msg.utf8_str());
|
||||
gtk_label_set_line_wrap(GTK_LABEL(m_impl->m_label), TRUE );
|
||||
#if GTK_CHECK_VERSION(2,10,0)
|
||||
if( wx_is_at_least_gtk2( 10 ) )
|
||||
|
|
@ -234,9 +234,9 @@ GtkWidget *wxInfoBar::GTKAddButton(wxWindowID btnid, const wxString& label)
|
|||
|
||||
GtkWidget* button = gtk_info_bar_add_button(GTK_INFO_BAR(m_widget),
|
||||
#ifdef __WXGTK4__
|
||||
wxGTK_CONV(label.empty() ? wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)) : label),
|
||||
(label.empty() ? wxConvertMnemonicsToGTK(wxGetStockLabel(btnid)) : label).utf8_str(),
|
||||
#else
|
||||
label.empty() ? wxGetStockGtkID(btnid) : static_cast<const char*>(wxGTK_CONV(label)),
|
||||
label.empty() ? wxGetStockGtkID(btnid) : static_cast<const char*>(label.utf8_str()),
|
||||
#endif
|
||||
btnid);
|
||||
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
|
|||
int wxListBox::DoInsertOneItem(const wxString& item, unsigned int pos)
|
||||
{
|
||||
wxTreeEntry* entry = wx_tree_entry_new();
|
||||
wx_tree_entry_set_label(entry, wxGTK_CONV(item));
|
||||
wx_tree_entry_set_label(entry, item.utf8_str());
|
||||
wx_tree_entry_set_destroy_func(entry, (wxTreeEntryDestroy)tree_entry_destroy_cb, this);
|
||||
|
||||
#if wxUSE_CHECKLISTBOX
|
||||
|
|
@ -593,7 +593,7 @@ void wxListBox::SetString(unsigned int n, const wxString& label)
|
|||
wxTreeEntry* entry = GetEntry(m_liststore, &iter, this);
|
||||
|
||||
// update the item itself
|
||||
wx_tree_entry_set_label(entry, wxGTK_CONV(label));
|
||||
wx_tree_entry_set_label(entry, label.utf8_str());
|
||||
|
||||
// signal row changed
|
||||
GtkTreeModel* tree_model = GTK_TREE_MODEL(m_liststore);
|
||||
|
|
@ -608,7 +608,7 @@ wxString wxListBox::GetString(unsigned int n) const
|
|||
wxTreeEntry* entry = GTKGetEntry(n);
|
||||
wxCHECK_MSG( entry, wxEmptyString, wxT("wrong listbox index") );
|
||||
|
||||
return wxGTK_CONV_BACK(wx_tree_entry_get_label(entry));
|
||||
return wxString::FromUTF8Unchecked(wx_tree_entry_get_label(entry));
|
||||
}
|
||||
|
||||
unsigned int wxListBox::GetCount() const
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ void wxMDIChildFrame::SetTitle( const wxString &title )
|
|||
|
||||
GtkNotebook * const notebook = GTKGetNotebook();
|
||||
wxCHECK_RET( notebook, "no parent notebook?" );
|
||||
gtk_notebook_set_tab_label_text(notebook, m_widget, wxGTK_CONV( title ) );
|
||||
gtk_notebook_set_tab_label_text(notebook, m_widget, title.utf8_str() );
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::DoGetPosition(int *x, int *y) const
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ void wxMenuBar::GtkAppend(wxMenu* menu, const wxString& title, int pos)
|
|||
|
||||
const wxString str(wxConvertMnemonicsToGTK(title));
|
||||
// The "m_owner" is the "menu item"
|
||||
menu->m_owner = gtk_menu_item_new_with_mnemonic( wxGTK_CONV( str ) );
|
||||
menu->m_owner = gtk_menu_item_new_with_mnemonic( str.utf8_str() );
|
||||
|
||||
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
|
||||
}
|
||||
|
|
@ -533,7 +533,7 @@ void wxMenuBar::SetMenuLabel( size_t pos, const wxString& label )
|
|||
|
||||
const wxString str(wxConvertMnemonicsToGTK(label));
|
||||
if (menu->m_owner)
|
||||
gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menu->m_owner))), wxGTK_CONV(str));
|
||||
gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(menu->m_owner))), str.utf8_str());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -682,7 +682,7 @@ void wxMenuItem::SetGtkLabel()
|
|||
{
|
||||
const wxString text = wxConvertMnemonicsToGTK(m_text.BeforeFirst('\t'));
|
||||
GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(m_menuItem)));
|
||||
gtk_label_set_text_with_mnemonic(label, wxGTK_CONV_SYS(text));
|
||||
gtk_label_set_text_with_mnemonic(label, text.utf8_str());
|
||||
#if wxUSE_ACCEL
|
||||
GtkAccel gtkAccel(this);
|
||||
if ( gtkAccel.IsOk() )
|
||||
|
|
@ -1366,7 +1366,7 @@ wxString GtkAccel::GetGtkHotKey(const wxAcceleratorEntry *accel)
|
|||
if ( code < 127 )
|
||||
{
|
||||
const wxString
|
||||
name = wxGTK_CONV_BACK_SYS(gdk_keyval_name((guint)code));
|
||||
name = wxString::FromUTF8(gdk_keyval_name((guint)code));
|
||||
if ( !name.empty() )
|
||||
{
|
||||
hotkey << name;
|
||||
|
|
@ -1410,7 +1410,7 @@ void GtkAccel::Init(const wxAcceleratorEntry* entry)
|
|||
const wxString string = GetGtkHotKey(entry);
|
||||
if (!string.empty())
|
||||
{
|
||||
gtk_accelerator_parse(wxGTK_CONV_SYS(string), &m_key, &m_mods);
|
||||
gtk_accelerator_parse(string.utf8_str(), &m_key, &m_mods);
|
||||
|
||||
// Normally, we detect all the keys considered invalid by GTK in
|
||||
// GetGtkHotKey(), but just in case GTK decides to add more invalid
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||
type,
|
||||
buttons,
|
||||
"%s",
|
||||
(const char*)wxGTK_CONV(message));
|
||||
(const char*)message.utf8_str());
|
||||
|
||||
if ( needsExtMessage )
|
||||
{
|
||||
|
|
@ -171,14 +171,14 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||
(
|
||||
(GtkMessageDialog *)m_widget,
|
||||
"%s",
|
||||
(const char *)wxGTK_CONV(m_extendedMessage)
|
||||
(const char *)m_extendedMessage.utf8_str()
|
||||
);
|
||||
}
|
||||
|
||||
g_object_ref(m_widget);
|
||||
|
||||
if (m_caption != wxMessageBoxCaptionStr)
|
||||
gtk_window_set_title(GTK_WINDOW(m_widget), wxGTK_CONV(m_caption));
|
||||
gtk_window_set_title(GTK_WINDOW(m_widget), m_caption.utf8_str());
|
||||
|
||||
GtkDialog * const dlg = GTK_DIALOG(m_widget);
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||
{
|
||||
if ( m_dialogStyle & wxHELP )
|
||||
{
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetHelpLabel()),
|
||||
gtk_dialog_add_button(dlg, GetHelpLabel().utf8_str(),
|
||||
GTK_RESPONSE_HELP);
|
||||
}
|
||||
|
||||
|
|
@ -208,24 +208,24 @@ void wxMessageDialog::GTKCreateMsgDialog()
|
|||
//
|
||||
// [Help] [Alternative] [Cancel] [Affirmative]
|
||||
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetNoLabel()),
|
||||
gtk_dialog_add_button(dlg, GetNoLabel().utf8_str(),
|
||||
GTK_RESPONSE_NO);
|
||||
|
||||
if ( m_dialogStyle & wxCANCEL )
|
||||
{
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetCancelLabel()),
|
||||
gtk_dialog_add_button(dlg, GetCancelLabel().utf8_str(),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
}
|
||||
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetYesLabel()),
|
||||
gtk_dialog_add_button(dlg, GetYesLabel().utf8_str(),
|
||||
GTK_RESPONSE_YES);
|
||||
}
|
||||
else // Ok or Ok/Cancel dialog
|
||||
{
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetOKLabel()), GTK_RESPONSE_OK);
|
||||
gtk_dialog_add_button(dlg, GetOKLabel().utf8_str(), GTK_RESPONSE_OK);
|
||||
if ( m_dialogStyle & wxCANCEL )
|
||||
{
|
||||
gtk_dialog_add_button(dlg, wxGTK_CONV(GetCancelLabel()),
|
||||
gtk_dialog_add_button(dlg, GetCancelLabel().utf8_str(),
|
||||
GTK_RESPONSE_CANCEL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ wxString wxNotebook::GetPageText( size_t page ) const
|
|||
wxCHECK_MSG(page < GetPageCount(), wxEmptyString, "invalid notebook index");
|
||||
|
||||
GtkLabel* label = GTK_LABEL(GetNotebookPage(page)->m_label);
|
||||
return wxGTK_CONV_BACK(gtk_label_get_text(label));
|
||||
return wxString::FromUTF8(gtk_label_get_text(label));
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage( size_t page ) const
|
||||
|
|
@ -273,7 +273,7 @@ bool wxNotebook::SetPageText( size_t page, const wxString &text )
|
|||
wxCHECK_MSG(page < GetPageCount(), false, "invalid notebook index");
|
||||
|
||||
GtkLabel* label = GTK_LABEL(GetNotebookPage(page)->m_label);
|
||||
gtk_label_set_text(label, wxGTK_CONV(text));
|
||||
gtk_label_set_text(label, text.utf8_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -506,7 +506,7 @@ bool wxNotebook::InsertPage( size_t position,
|
|||
}
|
||||
|
||||
/* set the label text */
|
||||
pageData->m_label = gtk_label_new(wxGTK_CONV(wxStripMenuCodes(text)));
|
||||
pageData->m_label = gtk_label_new(wxStripMenuCodes(text).utf8_str());
|
||||
|
||||
if (m_windowStyle & wxBK_LEFT)
|
||||
gtk_label_set_angle(GTK_LABEL(pageData->m_label), 90);
|
||||
|
|
|
|||
|
|
@ -304,9 +304,9 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
|
|||
label += *pc;
|
||||
}
|
||||
if ( hasMnemonic )
|
||||
rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_mnemonic( radio_button_group, wxGTK_CONV( label ) ) );
|
||||
rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_mnemonic( radio_button_group, label.utf8_str() ) );
|
||||
else
|
||||
rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, wxGTK_CONV( label ) ) );
|
||||
rbtn = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, label.utf8_str() ) );
|
||||
|
||||
gtk_widget_show( GTK_WIDGET(rbtn) );
|
||||
|
||||
|
|
@ -460,9 +460,7 @@ wxString wxRadioBox::GetString(unsigned int n) const
|
|||
|
||||
GtkLabel* label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
|
||||
|
||||
wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
|
||||
|
||||
return str;
|
||||
return wxString::FromUTF8Unchecked( gtk_label_get_text(label) );
|
||||
}
|
||||
|
||||
void wxRadioBox::SetLabel( const wxString& label )
|
||||
|
|
@ -482,7 +480,7 @@ void wxRadioBox::SetString(unsigned int item, const wxString& label)
|
|||
|
||||
GtkLabel* g_label = GTK_LABEL(gtk_bin_get_child(GTK_BIN(node->GetData()->button)));
|
||||
|
||||
gtk_label_set_text( g_label, wxGTK_CONV( label ) );
|
||||
gtk_label_set_text( g_label, label.utf8_str() );
|
||||
}
|
||||
|
||||
bool wxRadioBox::Enable( bool enable )
|
||||
|
|
@ -661,7 +659,7 @@ void wxRadioBox::DoSetItemToolTip(unsigned int n, wxToolTip *tooltip)
|
|||
if ( !tooltip )
|
||||
tooltip = GetToolTip();
|
||||
if ( tooltip )
|
||||
buf = wxGTK_CONV(tooltip->GetTip());
|
||||
buf = tooltip->GetTip().utf8_str();
|
||||
|
||||
wxToolTip::GTKApply(GTK_WIDGET(m_buttonsInfo[n]->button), buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ bool wxRadioButton::Create( wxWindow *parent,
|
|||
}
|
||||
}
|
||||
|
||||
m_widget = gtk_radio_button_new_with_label( radioButtonGroup, wxGTK_CONV( label ) );
|
||||
m_widget = gtk_radio_button_new_with_label( radioButtonGroup, label.utf8_str() );
|
||||
g_object_ref(m_widget);
|
||||
|
||||
SetLabel(label);
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ wxString wxSpinCtrlGTKBase::GetTextValue() const
|
|||
{
|
||||
wxCHECK_MSG(m_widget, wxEmptyString, "invalid spin button");
|
||||
|
||||
return wxGTK_CONV_BACK(gtk_entry_get_text( GTK_ENTRY(m_widget) ));
|
||||
return wxString::FromUTF8Unchecked(gtk_entry_get_text( GTK_ENTRY(m_widget) ));
|
||||
}
|
||||
|
||||
bool wxSpinCtrlGTKBase::GetSnapToTicks() const
|
||||
|
|
@ -336,7 +336,7 @@ void wxSpinCtrlGTKBase::SetValue( const wxString& value )
|
|||
GTKSetTextOverride(value);
|
||||
|
||||
wxSpinCtrlEventDisabler disable(this);
|
||||
gtk_entry_set_text( GTK_ENTRY(m_widget), wxGTK_CONV( value ) );
|
||||
gtk_entry_set_text( GTK_ENTRY(m_widget), value.utf8_str() );
|
||||
}
|
||||
|
||||
void wxSpinCtrlGTKBase::DoSetValue( double value )
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||
|
||||
PostCreation(size);
|
||||
|
||||
gtk_entry_set_text(entry, wxGTK_CONV(value));
|
||||
gtk_entry_set_text(entry, value.utf8_str());
|
||||
|
||||
SetHint(_("Search"));
|
||||
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,7 @@ wxString wxTextCtrl::DoGetValue() const
|
|||
gtk_text_buffer_get_end_iter( m_buffer, &end );
|
||||
wxGtkString text(gtk_text_buffer_get_text(m_buffer, &start, &end, true));
|
||||
|
||||
return wxGTK_CONV_BACK(text);
|
||||
return wxString::FromUTF8Unchecked(text);
|
||||
}
|
||||
else // single line
|
||||
{
|
||||
|
|
@ -1304,7 +1304,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
|
|||
gtk_text_iter_forward_to_line_end(&end);
|
||||
|
||||
wxGtkString text(gtk_text_buffer_get_text(m_buffer, &line, &end, true));
|
||||
result = wxGTK_CONV_BACK(text);
|
||||
result = wxString::FromUTF8Unchecked(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -634,7 +634,7 @@ void wxTextEntry::WriteText(const wxString& value)
|
|||
gtk_editable_insert_text
|
||||
(
|
||||
edit,
|
||||
wxGTK_CONV_FONT(value, GetEditableWindow()->GetFont()),
|
||||
value.utf8_str(),
|
||||
-1, // text: length: compute it using strlen()
|
||||
&len // will be updated to position after the text end
|
||||
);
|
||||
|
|
@ -681,8 +681,7 @@ wxString wxTextEntry::DoGetValue() const
|
|||
{
|
||||
const wxGtkString value(gtk_editable_get_chars(GetEditable(), 0, -1));
|
||||
|
||||
return wxGTK_CONV_BACK_FONT(value,
|
||||
const_cast<wxTextEntry *>(this)->GetEditableWindow()->GetFont());
|
||||
return wxString::FromUTF8Unchecked(value);
|
||||
}
|
||||
|
||||
void wxTextEntry::Remove(long from, long to)
|
||||
|
|
@ -1115,11 +1114,7 @@ bool wxTextEntry::SetHint(const wxString& hint)
|
|||
GtkEntry *entry = GetEntry();
|
||||
if (entry && gtk_check_version(3,2,0) == nullptr)
|
||||
{
|
||||
gtk_entry_set_placeholder_text
|
||||
(
|
||||
entry,
|
||||
wxGTK_CONV_FONT(hint, GetEditableWindow()->GetFont())
|
||||
);
|
||||
gtk_entry_set_placeholder_text(entry, hint.utf8_str());
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1132,11 +1127,7 @@ wxString wxTextEntry::GetHint() const
|
|||
GtkEntry *entry = GetEntry();
|
||||
if (entry && gtk_check_version(3,2,0) == nullptr)
|
||||
{
|
||||
return wxGTK_CONV_BACK_FONT
|
||||
(
|
||||
gtk_entry_get_placeholder_text(entry),
|
||||
const_cast<wxTextEntry *>(this)->GetEditableWindow()->GetFont()
|
||||
);
|
||||
return wxString::FromUTF8(gtk_entry_get_placeholder_text(entry));
|
||||
}
|
||||
#endif
|
||||
return wxTextEntryBase::GetHint();
|
||||
|
|
|
|||
|
|
@ -124,14 +124,7 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string,
|
|||
}
|
||||
|
||||
// Set layout's text
|
||||
const wxCharBuffer dataUTF8 = wxGTK_CONV_FONT(string, GetFont());
|
||||
if ( !dataUTF8 && !string.empty() )
|
||||
{
|
||||
// hardly ideal, but what else can we do if conversion failed?
|
||||
wxLogLastError(wxT("GetTextExtent"));
|
||||
return;
|
||||
}
|
||||
pango_layout_set_text(m_layout, dataUTF8, -1);
|
||||
pango_layout_set_text(m_layout, string.utf8_str(), -1);
|
||||
|
||||
if ( m_dc )
|
||||
{
|
||||
|
|
@ -170,15 +163,7 @@ bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text,
|
|||
return wxTextMeasureBase::DoGetPartialTextExtents(text, widths, scaleX);
|
||||
|
||||
// Set layout's text
|
||||
const wxCharBuffer dataUTF8 = wxGTK_CONV_FONT(text, GetFont());
|
||||
if ( !dataUTF8 )
|
||||
{
|
||||
// hardly ideal, but what else can we do if conversion failed?
|
||||
wxLogLastError(wxT("GetPartialTextExtents"));
|
||||
return false;
|
||||
}
|
||||
|
||||
pango_layout_set_text(m_layout, dataUTF8, -1);
|
||||
pango_layout_set_text(m_layout, text.utf8_str(), -1);
|
||||
|
||||
// Calculate the position of each character based on the widths of
|
||||
// the previous characters
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ void wxToggleButton::SetLabel(const wxString& 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), labelGTK.utf8_str());
|
||||
|
||||
GTKApplyWidgetStyle( false );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -350,7 +350,7 @@ void wxToolBarTool::SetLabel(const wxString& label)
|
|||
{
|
||||
wxString newLabel = wxControl::RemoveMnemonics(label);
|
||||
gtk_tool_button_set_label(GTK_TOOL_BUTTON(m_item),
|
||||
wxGTK_CONV_SYS(newLabel));
|
||||
newLabel.utf8_str());
|
||||
// To show the label for toolbar with wxTB_HORZ_LAYOUT.
|
||||
gtk_tool_item_set_is_important(m_item, true);
|
||||
}
|
||||
|
|
@ -587,7 +587,7 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||
label = wxControl::RemoveMnemonics(tool->GetLabel());
|
||||
|
||||
gtk_tool_button_set_label(
|
||||
GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(label));
|
||||
GTK_TOOL_BUTTON(tool->m_item), label.utf8_str());
|
||||
// needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
|
||||
gtk_tool_item_set_is_important(tool->m_item, true);
|
||||
}
|
||||
|
|
@ -597,14 +597,14 @@ bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
|
|||
if (wx_is_at_least_gtk2(12))
|
||||
{
|
||||
gtk_tool_item_set_tooltip_text(tool->m_item,
|
||||
wxGTK_CONV(tool->GetShortHelp()));
|
||||
tool->GetShortHelp().utf8_str());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifndef __WXGTK3__
|
||||
gtk_tool_item_set_tooltip(tool->m_item,
|
||||
m_tooltips, wxGTK_CONV(tool->GetShortHelp()), "");
|
||||
m_tooltips, tool->GetShortHelp().utf8_str(), "");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -775,14 +775,14 @@ void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
|
|||
if (wx_is_at_least_gtk2(12))
|
||||
{
|
||||
gtk_tool_item_set_tooltip_text(tool->m_item,
|
||||
wxGTK_CONV(helpString));
|
||||
helpString.utf8_str());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifndef __WXGTK3__
|
||||
gtk_tool_item_set_tooltip(tool->m_item,
|
||||
m_tooltips, wxGTK_CONV(helpString), "");
|
||||
m_tooltips, helpString.utf8_str(), "");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@ void wxToolTip::SetTip( const wxString &tip )
|
|||
{
|
||||
m_text = tip;
|
||||
if (m_window)
|
||||
m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text));
|
||||
m_window->GTKApplyToolTip(m_text.utf8_str());
|
||||
}
|
||||
|
||||
void wxToolTip::GTKSetWindow(wxWindow* win)
|
||||
{
|
||||
wxASSERT(win);
|
||||
m_window = win;
|
||||
m_window->GTKApplyToolTip(wxGTK_CONV_SYS(m_text));
|
||||
m_window->GTKApplyToolTip(m_text.utf8_str());
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
|||
|
|
@ -721,10 +721,10 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||
|
||||
#if 0
|
||||
if (!name.empty())
|
||||
gtk_window_set_role( GTK_WINDOW(m_widget), wxGTK_CONV( name ) );
|
||||
gtk_window_set_role( GTK_WINDOW(m_widget), name.utf8_str() );
|
||||
#endif
|
||||
|
||||
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
||||
gtk_window_set_title( GTK_WINDOW(m_widget), title.utf8_str() );
|
||||
gtk_widget_set_can_focus(m_widget, false);
|
||||
|
||||
g_signal_connect (m_widget, "delete_event",
|
||||
|
|
@ -1620,7 +1620,7 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
|
|||
|
||||
m_title = title;
|
||||
|
||||
gtk_window_set_title( GTK_WINDOW(m_widget), wxGTK_CONV( title ) );
|
||||
gtk_window_set_title( GTK_WINDOW(m_widget), title.utf8_str() );
|
||||
}
|
||||
|
||||
void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
|
|||
|
||||
void wxWebViewWebKit::LoadURL(const wxString& url)
|
||||
{
|
||||
webkit_web_view_load_uri(m_web_view, wxGTK_CONV(url));
|
||||
webkit_web_view_load_uri(m_web_view, url.utf8_str());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -986,7 +986,7 @@ long wxWebViewWebKit::Find(const wxString& text, int flags)
|
|||
if(newSearch)
|
||||
{
|
||||
//Initially we mark the matches to know how many we have
|
||||
m_findCount = webkit_web_view_mark_text_matches(m_web_view, wxGTK_CONV(text), matchCase, 0);
|
||||
m_findCount = webkit_web_view_mark_text_matches(m_web_view, text.utf8_str(), matchCase, 0);
|
||||
//In this case we return early to match IE behaviour
|
||||
m_findPosition = -1;
|
||||
return m_findCount;
|
||||
|
|
@ -1007,7 +1007,7 @@ long wxWebViewWebKit::Find(const wxString& text, int flags)
|
|||
bool highlight = flags & wxWEBVIEW_FIND_HIGHLIGHT_RESULT ? true : false;
|
||||
webkit_web_view_set_highlight_text_matches(m_web_view, highlight);
|
||||
|
||||
if(!webkit_web_view_search_text(m_web_view, wxGTK_CONV(text), matchCase, forward, wrap))
|
||||
if(!webkit_web_view_search_text(m_web_view, text.utf8_str(), matchCase, forward, wrap))
|
||||
{
|
||||
m_findPosition = -1;
|
||||
ClearSelection();
|
||||
|
|
|
|||
|
|
@ -801,7 +801,7 @@ void wxWebViewWebKit::Reload(wxWebViewReloadFlags flags)
|
|||
|
||||
void wxWebViewWebKit::LoadURL(const wxString& url)
|
||||
{
|
||||
webkit_web_view_load_uri(m_web_view, wxGTK_CONV(url));
|
||||
webkit_web_view_load_uri(m_web_view, url.utf8_str());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1417,7 +1417,7 @@ long wxWebViewWebKit::Find(const wxString& text, int flags)
|
|||
//Initially we count the matches to know how many we have
|
||||
m_findCount = -1;
|
||||
webkit_find_controller_count_matches(findctrl,
|
||||
wxGTK_CONV(text),
|
||||
text.utf8_str(),
|
||||
options,
|
||||
G_MAXUINT);
|
||||
GMainContext *main_context = g_main_context_get_thread_default();
|
||||
|
|
@ -1429,7 +1429,7 @@ long wxWebViewWebKit::Find(const wxString& text, int flags)
|
|||
if(flags & wxWEBVIEW_FIND_HIGHLIGHT_RESULT)
|
||||
{
|
||||
webkit_find_controller_search(findctrl,
|
||||
wxGTK_CONV(text),
|
||||
text.utf8_str(),
|
||||
options,
|
||||
G_MAXUINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1350,7 +1350,7 @@ bool wxWindowGTK::GTKDoInsertTextFromIM(const char* str)
|
|||
event.SetEventObject(this);
|
||||
}
|
||||
|
||||
const wxString data(wxGTK_CONV_BACK_SYS(str));
|
||||
const wxString data(wxString::FromUTF8Unchecked(str));
|
||||
if( data.empty() )
|
||||
return false;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,17 +44,14 @@ PangoContext* wxGetPangoContext();
|
|||
|
||||
#ifdef __WXGTK__
|
||||
#include "wx/gtk/private.h"
|
||||
|
||||
#define wxPANGO_CONV wxGTK_CONV_SYS
|
||||
#define wxPANGO_CONV_BACK wxGTK_CONV_BACK_SYS
|
||||
#else
|
||||
#include "wx/x11/private.h"
|
||||
#include "wx/gtk/private/string.h"
|
||||
|
||||
#define wxPANGO_CONV(s) s.utf8_str()
|
||||
#define wxPANGO_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
|
||||
#endif
|
||||
|
||||
#define wxPANGO_CONV(s) s.utf8_str()
|
||||
#define wxPANGO_CONV_BACK(s) wxString::FromUTF8Unchecked(s)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNativeFontInfo
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ void wxFontRefData::InitFromNative()
|
|||
PangoFontDescription *desc = m_nativeFontInfo.description;
|
||||
|
||||
// init fields
|
||||
m_faceName = wxGTK_CONV_BACK( pango_font_description_get_family( desc ) );
|
||||
m_faceName = wxString::FromUTF8( pango_font_description_get_family( desc ) );
|
||||
|
||||
m_pointSize = static_cast<float>(pango_font_description_get_size( desc )) / PANGO_SCALE;
|
||||
|
||||
|
|
@ -378,7 +378,7 @@ bool wxFont::Create(int pointSize,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool wxFont::Create(const wxString& fontname, wxFontEncoding enc)
|
||||
bool wxFont::Create(const wxString& fontname, wxFontEncoding WXUNUSED(enc))
|
||||
{
|
||||
if( !fontname )
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue