+ if (multi_line)
+ {
+ gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
+ (GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(GTK_TEXT(m_text)), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_text_focus_in_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(GTK_TEXT(m_text)), "focus_out_event",
+ GTK_SIGNAL_FUNC(gtk_text_focus_out_callback), (gpointer)this );
+ }
+ else
+ {
+ gtk_signal_connect( GTK_OBJECT(m_text), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_text_focus_in_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(m_text), "focus_out_event",
+ GTK_SIGNAL_FUNC(gtk_text_focus_out_callback), (gpointer)this );
+ }
+
+ if (!value.IsEmpty())
+ {
+ gint tmp = 0;
+
+#if GTK_MINOR_VERSION == 0
+ // if we don't realize it, GTK 1.0.6 dies with a SIGSEGV in
+ // gtk_editable_insert_text()
+ gtk_widget_realize(m_text);
+#endif // GTK 1.0
+
+#if wxUSE_UNICODE
+ wxWX2MBbuf val = value.mbc_str();
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), val, strlen(val), &tmp );
+#else // !Unicode
+ gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
+#endif // Unicode/!Unicode
+
+ if (multi_line)
+ {
+ /* bring editable's cursor uptodate. bug in GTK. */
+
+ GTK_EDITABLE(m_text)->current_pos = gtk_text_get_point( GTK_TEXT(m_text) );
+ }
+ }
+
+ if (style & wxTE_PASSWORD)
+ {
+ if (!multi_line)
+ gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE );
+ }
+
+ if (style & wxTE_READONLY)
+ {
+ if (!multi_line)
+ gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
+ }
+ else
+ {
+ if (multi_line)
+ gtk_text_set_editable( GTK_TEXT(m_text), 1 );
+ }
+
+ /* we want to be notified about text changes */
+ gtk_signal_connect( GTK_OBJECT(m_text), "changed",
+ GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
+
+ /* we don't set a valid background colour, because the window
+ manager should use a default one */
+ m_backgroundColour = wxColour();
+
+ wxColour colFg = parent->GetForegroundColour();
+ SetForegroundColour( colFg );
+
+ m_cursor = wxCursor( wxCURSOR_IBEAM );
+
+ // FIXME: is the bg colour correct here?
+ wxTextAttr attrDef( colFg,
+ wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW),
+ parent->GetFont() );
+ SetDefaultStyle( attrDef );