wxString GetValue() const;
void SetValue( const wxString &value );
void WriteText( const wxString &text );
+ void AppendText( const wxString &text );
bool LoadFile( const wxString &file );
bool SaveFile( const wxString &file );
wxString GetValue() const;
void SetValue( const wxString &value );
void WriteText( const wxString &text );
+ void AppendText( const wxString &text );
bool LoadFile( const wxString &file );
bool SaveFile( const wxString &file );
}
}
+void wxTextCtrl::AppendText( const wxString &text )
+{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ /* we'll insert at the last position */
+ gint len = gtk_text_get_length( GTK_TEXT(m_text) );
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
+ GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
+ }
+ else
+ {
+ gtk_entry_append_text( GTK_ENTRY(m_text), text );
+ }
+}
+
bool wxTextCtrl::LoadFile( const wxString &file )
{
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
- WriteText(s);
+ AppendText(s);
return *this;
}
{
static char buf[100];
sprintf(buf, "%.2f", f);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%.2f", d);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%i", i);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%ld", i);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
buf[0] = c;
buf[1] = 0;
- WriteText(buf);
+ AppendText(buf);
return *this;
}
#endif
}
}
+void wxTextCtrl::AppendText( const wxString &text )
+{
+ wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
+
+ if (m_windowStyle & wxTE_MULTILINE)
+ {
+ /* we'll insert at the last position */
+ gint len = gtk_text_get_length( GTK_TEXT(m_text) );
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), text, text.Length(), &len );
+ GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
+ }
+ else
+ {
+ gtk_entry_append_text( GTK_ENTRY(m_text), text );
+ }
+}
+
bool wxTextCtrl::LoadFile( const wxString &file )
{
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
- WriteText(s);
+ AppendText(s);
return *this;
}
{
static char buf[100];
sprintf(buf, "%.2f", f);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%.2f", d);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%i", i);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
{
static char buf[100];
sprintf(buf, "%ld", i);
- WriteText(buf);
+ AppendText(buf);
return *this;
}
buf[0] = c;
buf[1] = 0;
- WriteText(buf);
+ AppendText(buf);
return *this;
}
#endif