X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2830bf19dc5094794e8f1fee05aceb591ffe215b..aae24d21a33faa2a23fccde24255365ca845c46f:/src/gtk/textctrl.cpp diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index bb72ccea1b..61c406c6fb 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -20,6 +20,16 @@ #include #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "gdk/gdkkeysyms.h" + +//----------------------------------------------------------------------------- +// data +//----------------------------------------------------------------------------- + +extern bool g_blockEventsOnDrag; + //----------------------------------------------------------------------------- // "changed" //----------------------------------------------------------------------------- @@ -48,7 +58,6 @@ gtk_text_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* WXUNUSED(all win->CalculateScrollbar(); } - //----------------------------------------------------------------------------- // wxTextCtrl //----------------------------------------------------------------------------- @@ -59,13 +68,21 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_CHAR(wxTextCtrl::OnChar) END_EVENT_TABLE() +#ifndef NO_TEXT_WINDOW_STREAM wxTextCtrl::wxTextCtrl() : streambuf() { if (allocate()) setp(base(),ebuf()); m_modified = FALSE; } +#else +wxTextCtrl::wxTextCtrl() +{ + m_modified = FALSE; +} +#endif +#ifndef NO_TEXT_WINDOW_STREAM wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int style, const wxValidator& validator, const wxString &name ) : streambuf() @@ -75,12 +92,22 @@ wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, m_modified = FALSE; Create( parent, id, value, pos, size, style, validator, name ); } +#else +wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, + const wxPoint &pos, const wxSize &size, + int style, const wxValidator& validator, const wxString &name ) +{ + m_modified = FALSE; + Create( parent, id, value, pos, size, style, validator, name ); +} +#endif bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int style, const wxValidator& validator, const wxString &name ) { m_needParent = TRUE; + m_acceptsFocus = TRUE; PreCreation( parent, id, pos, size, style, name ); @@ -152,9 +179,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, } // 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); + gtk_signal_connect( GTK_OBJECT(m_text), "changed", + GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); if (!value.IsNull()) { @@ -277,7 +303,7 @@ bool wxTextCtrl::LoadFile( const wxString &file ) Clear(); - FILE *fp = NULL; + FILE *fp = (FILE*) NULL; struct stat statb; if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || @@ -303,7 +329,8 @@ bool wxTextCtrl::LoadFile( const wxString &file ) if (m_windowStyle & wxTE_MULTILINE) { - gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len ); + gint pos = 0; + gtk_editable_insert_text( GTK_EDITABLE(m_text), text, len, &pos ); } else { @@ -331,7 +358,7 @@ bool wxTextCtrl::SaveFile( const wxString &file ) } else { - char *text = NULL; + char *text = (char*) NULL; gint len = 0; if (m_windowStyle & wxTE_MULTILINE) @@ -555,7 +582,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value ) gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); if (value.IsNull()) return; - gint pos = (gint)to; + gint pos = (gint)from; gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); } @@ -607,18 +634,11 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event ) event.SetEventObject(this); if (GetEventHandler()->ProcessEvent(event)) return; } - else if (key_event.KeyCode() == WXK_TAB) - { - wxNavigationKeyEvent event; - event.SetDirection( key_event.m_shiftDown ); - event.SetWindowChange(FALSE); - event.SetEventObject(this); - if (GetEventHandler()->ProcessEvent(event)) return; - } key_event.Skip(); } +#ifndef NO_TEXT_WINDOW_STREAM int wxTextCtrl::overflow( int WXUNUSED(c) ) { int len = pptr() - pbase(); @@ -695,6 +715,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c) WriteText(buf); return *this; } +#endif GtkWidget* wxTextCtrl::GetConnectWidget() {