- wxWX2MBbuf buf = text.mbc_str();
- const char *txt = buf;
- size_t txtlen = strlen(buf);
-#else
- const char *txt = text;
- size_t txtlen = text.length();
-#endif
-
- if ( m_windowStyle & wxTE_MULTILINE )
- {
- /* this moves the cursor pos to behind the inserted text */
- gint len = GTK_EDITABLE(m_text)->current_pos;
-
- // if we have any special style, use it
- if ( !m_defaultStyle.IsDefault() )
- {
- GdkFont *font = m_defaultStyle.HasFont()
- ? m_defaultStyle.GetFont().GetInternalFont()
- : NULL;
-
- GdkColor *colFg = m_defaultStyle.HasTextColour()
- ? m_defaultStyle.GetTextColour().GetColor()
- : NULL;
-
- GdkColor *colBg = m_defaultStyle.HasBackgroundColour()
- ? m_defaultStyle.GetBackgroundColour().GetColor()
- : NULL;
-
- gtk_text_insert( GTK_TEXT(m_text), font, colFg, colBg, txt, txtlen );
- }
- else // no style
- {
- gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len );
- }
-
- /* bring editable's cursor uptodate. bug in GTK. */
- GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
- }
- else // single line
- {
- /* this moves the cursor pos to behind the inserted text */
- gint len = GTK_EDITABLE(m_text)->current_pos;
- gtk_editable_insert_text( GTK_EDITABLE(m_text), txt, txtlen, &len );
-
- /* bring editable's cursor uptodate. bug in GTK. */
- GTK_EDITABLE(m_text)->current_pos += text.Len();
-
- /* bring entry's cursor uptodate. bug in GTK. */
- gtk_entry_set_position( GTK_ENTRY(m_text), GTK_EDITABLE(m_text)->current_pos );
- }
-}
-
-void wxTextCtrl::AppendText( const wxString &text )
-{
- wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
-
- if ( text.empty() )
- return;
-
-#if wxUSE_UNICODE
- wxWX2MBbuf buf = text.mbc_str();
- const char *txt = buf;
- size_t txtlen = strlen(buf);