X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d1263a3992c1ccf03c98d99bbfce9849196caf6f..65669e3152f9d6d3bb77c31d4211a356fe089d56:/src/gtk/textctrl.cpp diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 340ab8038f..e30c23e4da 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -685,8 +685,9 @@ bool wxTextCtrl::Create( wxWindow *parent, if (style & wxNO_BORDER) g_object_set (m_text, "has-frame", FALSE, NULL); - + } + g_object_ref(m_widget); m_parent->DoAddChild( this ); @@ -959,15 +960,18 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) { if ( !(flags & SetValue_SendEvent) ) EnableTextChangedEvents(false); - + gtk_text_buffer_set_text( m_buffer, "", 0 ); - + if ( !(flags & SetValue_SendEvent) ) EnableTextChangedEvents(true); - + return; } +#if wxUSE_UNICODE + const wxCharBuffer buffer(value.utf8_str()); +#else wxFontEncoding enc = m_defaultStyle.HasFont() ? m_defaultStyle.GetFont().GetEncoding() : wxFONTENCODING_SYSTEM; @@ -982,6 +986,7 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) wxLogWarning(_("Failed to set text in the text control.")); return; } +#endif if ( !(flags & SetValue_SendEvent) ) { @@ -1002,9 +1007,6 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags ) { EnableTextChangedEvents(true); } - - // This was added after discussion on the list - SetInsertionPoint(0); } void wxTextCtrl::WriteText( const wxString &text ) @@ -1020,6 +1022,9 @@ void wxTextCtrl::WriteText( const wxString &text ) return; } +#if wxUSE_UNICODE + const wxCharBuffer buffer(text.utf8_str()); +#else // check if we have a specific style for the current position wxFontEncoding enc = wxFONTENCODING_SYSTEM; wxTextAttr style; @@ -1040,6 +1045,7 @@ void wxTextCtrl::WriteText( const wxString &text ) wxLogWarning(_("Failed to insert text in the control.")); return; } +#endif // First remove the selection if there is one // TODO: Is there an easier GTK specific way to do this?