X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71aba8333cc915afff9e740c944f7fa7247abacb..0f314c30b8c4ffbd7d87146f72be7a061d506235:/src/gtk1/textctrl.cpp?ds=sidebyside diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index fda2c96595..79726b054c 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -347,8 +347,7 @@ bool wxTextCtrl::Create( wxWindow *parent, m_focusWidget = m_text; PostCreation(); - - SetFont( parent->GetFont() ); + InheritAttributes(); wxSize size_best( DoGetBestSize() ); wxSize new_size( size ); @@ -604,6 +603,13 @@ void wxTextCtrl::WriteText( const wxString &text ) gtk_editable_delete_selection( GTK_EDITABLE(m_text) ); wxGtkTextInsert(m_text, m_defaultStyle, text.c_str(), text.Len()); + // we called wxGtkTextInsert with correct font, no need to do anything + // in UpdateFontIfNeeded() any longer + if ( !text.empty() ) + { + m_updateFont = FALSE; + } + // Bring editable's cursor back uptodate. SET_EDITABLE_POS(m_text, gtk_text_get_point( GTK_TEXT(m_text) )); #endif // GTK 1.x/2.0 @@ -667,10 +673,21 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const return buf; } else -#endif { return wxEmptyString; } +#else + GtkTextBuffer *text_buffer; + text_buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_text)); + GtkTextIter line; + gtk_text_buffer_get_iter_at_line(text_buffer,&line,lineNo); + GtkTextIter end; + gtk_text_buffer_get_end_iter(text_buffer,&end ); + gchar *text = gtk_text_buffer_get_text(text_buffer,&line,&end,TRUE); + wxString result(wxGTK_CONV_BACK(text)); + g_free(text); + return result.BeforeFirst(wxT('\n')); +#endif } else { @@ -905,6 +922,11 @@ void wxTextCtrl::OnParentEnable( bool enable ) } } +void wxTextCtrl::MarkDirty() +{ + m_modified = TRUE; +} + void wxTextCtrl::DiscardEdits() { m_modified = FALSE;