// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
+extern bool g_blockEventsOnDrag;
+extern wxCursor g_globalCursor;
//-----------------------------------------------------------------------------
// "changed"
m_needParent = TRUE;
m_acceptsFocus = TRUE;
- PreCreation( parent, id, pos, size, style, name );
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, validator, name ))
+ {
+ wxFAIL_MSG( _T("wxTextCtrl creation failed") );
+ return FALSE;
+ }
-#if wxUSE_VALIDATORS
- SetValidator( validator );
-#endif // wxUSE_VALIDATORS
m_vScrollbarVisible = FALSE;
SetBackgroundColour( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW) );
SetForegroundColour( parent->GetForegroundColour() );
+ m_cursor = wxCursor( wxCURSOR_IBEAM );
+
Show( TRUE );
return TRUE;
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
wxString tmp = _T("");
if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE)
{
gtk_entry_set_text( GTK_ENTRY(m_text), tmp.mbc_str() );
}
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
void wxTextCtrl::WriteText( const wxString &text )
if (text.IsEmpty()) return;
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
if (m_windowStyle & wxTE_MULTILINE)
{
/* this moves the cursor pos to behind the inserted text */
/* bring entry's cursor uptodate. bug in GTK. */
gtk_entry_set_position( GTK_ENTRY(m_text), GTK_EDITABLE(m_text)->current_pos );
}
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
void wxTextCtrl::AppendText( const wxString &text )
if (text.IsEmpty()) return;
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
if (m_windowStyle & wxTE_MULTILINE)
{
bool hasSpecialAttributes = m_font.Ok() ||
{
gtk_entry_append_text( GTK_ENTRY(m_text), text.mbc_str() );
}
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
wxString wxTextCtrl::GetLineText( long lineNo ) const
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
void wxTextCtrl::Replace( long from, long to, const wxString &value )
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (!value.IsEmpty())
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
#endif
}
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
void wxTextCtrl::Cut()
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
#if (GTK_MINOR_VERSION > 0)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
void wxTextCtrl::Copy()
{
wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
- gtk_signal_disconnect_by_func( GTK_OBJECT(m_text),
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
-
#if (GTK_MINOR_VERSION > 0)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
#endif
-
- gtk_signal_connect( GTK_OBJECT(m_text), "changed",
- GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
}
bool wxTextCtrl::CanCopy() const
{
event.Enable( CanRedo() );
}
+
+void wxTextCtrl::OnInternalIdle()
+{
+ wxCursor cursor = m_cursor;
+ if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+ if (cursor.Ok() && m_currentGdkCursor != cursor)
+ {
+ m_currentGdkCursor = cursor;
+
+ GdkWindow *window = (GdkWindow*) NULL;
+ if (HasFlag(wxTE_MULTILINE))
+ window = GTK_TEXT(m_text)->text_area;
+ else
+ window = GTK_ENTRY(m_text)->text_area;
+
+ if (window)
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+
+ if (!g_globalCursor.Ok())
+ cursor = *wxSTANDARD_CURSOR;
+
+ window = m_widget->window;
+ if (window)
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+ }
+}