]> git.saurik.com Git - wxWidgets.git/commitdiff
changed wxGTK_CONV* macros to use utf8_str() and FromUTF8() so that we don't do any...
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 30 May 2007 13:55:09 +0000 (13:55 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 30 May 2007 13:55:09 +0000 (13:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/private.h
src/gtk/textctrl.cpp
src/gtk/window.cpp

index d19eed94ea93e96afbd471a19c386dd265ace82b..7b83acd3f2d2dd6a49ed2755258729438cc61dc9 100644 (file)
 extern const gchar *wx_pango_version_check(int major, int minor, int micro);
 
 #if wxUSE_UNICODE
-    #define wxGTK_CONV(s) wxConvUTF8.cWX2MB((s))
+    #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) wxConvUTF8.cMB2WX((s))
+    #define wxGTK_CONV_BACK(s) wxString::FromUTF8(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)
index d21be8967f8bfaed471f5ca088b7fb74bca31ff4..03d093667cb775336b593a3052f5f998c8487373 100644 (file)
@@ -955,16 +955,12 @@ wxString wxTextCtrl::GetValue() const
         gtk_text_buffer_get_end_iter( m_buffer, &end );
         wxGtkString text(gtk_text_buffer_get_text(m_buffer, &start, &end, true));
 
-        const wxWxCharBuffer buf = wxGTK_CONV_BACK(text);
-        if ( buf )
-            tmp = buf;
+        return wxGTK_CONV_BACK(text);
     }
     else
     {
         const gchar *text = gtk_entry_get_text( GTK_ENTRY(m_text) );
-        const wxWxCharBuffer buf = wxGTK_CONV_BACK( text );
-        if ( buf )
-            tmp = buf;
+        return wxGTK_CONV_BACK(text);
     }
 
     return tmp;
index cbc1486f6bfcb4f31c2b0fe5c6ae5d7c0ec4b3e7..7b245651356fbe70816c65b41251937ab9c5c583 100644 (file)
@@ -1136,8 +1136,8 @@ gtk_wxwindow_commit_cb (GtkIMContext *context,
         event.SetEventObject( window );
     }
 
-    const wxWxCharBuffer data(wxGTK_CONV_BACK_SYS(str));
-    if( !data )
+    const wxString data(wxGTK_CONV_BACK_SYS(str));
+    if( data.empty() )
         return;
 
     bool ret = false;
@@ -1147,7 +1147,7 @@ gtk_wxwindow_commit_cb (GtkIMContext *context,
     while (parent && !parent->IsTopLevel())
         parent = parent->GetParent();
 
-    for( const wxChar* pstr = data; *pstr; pstr++ )
+    for( wxString::const_iterator pstr = data.begin(); pstr != data.end(); ++pstr )
     {
 #if wxUSE_UNICODE
         event.m_uniChar = *pstr;
@@ -1155,7 +1155,7 @@ gtk_wxwindow_commit_cb (GtkIMContext *context,
         event.m_keyCode = *pstr < 256 ? event.m_uniChar : 0;
         wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), event.m_uniChar);
 #else
-        event.m_keyCode = *pstr;
+        event.m_keyCode = (char)*pstr;
 #endif  // wxUSE_UNICODE
 
         // To conform to the docs we need to translate Ctrl-alpha