#include "wx/textctrl.h"
#ifndef WX_PRECOMP
+ #include "wx/app.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/utils.h"
#include "wx/strconv.h"
#include "wx/fontutil.h" // for wxNativeFontInfo (GetNativeFontInfo())
+#include "wx/evtloop.h"
#include <sys/types.h>
#include <sys/stat.h>
extern "C" {
static void
gtk_insert_text_callback(GtkEditable *editable,
- const gchar *new_text,
- gint new_text_length,
- gint *position,
+ const gchar *WXUNUSED(new_text),
+ gint WXUNUSED(new_text_length),
+ gint *WXUNUSED(position),
wxTextCtrl *win)
{
if (g_isIdle)
// we should only be called if we have a max len limit at all
GtkEntry *entry = GTK_ENTRY (editable);
- wxCHECK_RET( entry->text_max_length, _T("shouldn't be called") );
+ wxCHECK_RET( entry->text_max_length, wxT("shouldn't be called") );
// check that we don't overflow the max length limit
//
wxCommandEvent event(wxEVT_COMMAND_TEXT_MAXLEN, win->GetId());
event.SetEventObject(win);
event.SetString(win->GetValue());
- win->GetEventHandler()->ProcessEvent( event );
+ win->HandleWindowEvent( event );
}
}
}
extern "C" {
static void
-gtk_text_changed_callback( GtkWidget *widget, wxTextCtrl *win )
+gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{
if ( win->IgnoreTextUpdate() )
return;
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() );
event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
+ win->HandleWindowEvent( event );
}
}
// which implicitly calls wxYield()) so we override GtkText::draw() and simply
// don't do anything if we're inside wxYield()
-extern bool wxIsInsideYield;
-
extern "C" {
typedef void (*GtkDrawCallback)(GtkWidget *widget, GdkRectangle *rect);
}
extern "C" {
static void wxgtk_text_draw( GtkWidget *widget, GdkRectangle *rect)
{
- if ( !wxIsInsideYield )
+ wxEventLoopBase* loop = wxEventLoopBase::GetActive();
+ if ( loop && !loop->IsYielding() )
{
wxCHECK_RET( gs_gtk_text_draw != wxgtk_text_draw,
- _T("infinite recursion in wxgtk_text_draw aborted") );
+ wxT("infinite recursion in wxgtk_text_draw aborted") );
gs_gtk_text_draw(widget, rect);
}
// wxTextCtrl
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
-
BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
EVT_CHAR(wxTextCtrl::OnChar)
m_modified = false;
SetUpdateFont(false);
m_text =
- m_vScrollbar = (GtkWidget *)NULL;
+ m_vScrollbar = NULL;
}
wxTextCtrl::~wxTextCtrl()
if (multi_line)
{
// create our control ...
- m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
+ m_text = gtk_text_new( NULL, NULL );
// ... and put into the upper left hand corner of the table
bool bHasHScrollbar = false;
}
}
-wxString wxTextCtrl::GetValue() const
+wxString wxTextCtrl::DoGetValue() const
{
wxCHECK_MSG( m_text != NULL, wxEmptyString, wxT("invalid text ctrl") );
// wxGTK-specific: called recursively by Enable,
// to give widgets an oppprtunity to correct their colours after they
// have been changed by Enable
-void wxTextCtrl::OnEnabled( bool enable )
+void wxTextCtrl::OnEnabled( bool WXUNUSED(enable) )
{
if ( IsSingleLine() )
return;
!GTK_TEXT(m_text)->line_start_cache )
{
// tell the programmer that it didn't work
- wxLogDebug(_T("Can't call SetSelection() before realizing the control"));
+ wxLogDebug(wxT("Can't call SetSelection() before realizing the control"));
return;
}
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
event.SetString(GetValue());
- if (GetEventHandler()->ProcessEvent(event)) return;
+ if (HandleWindowEvent(event)) return;
}
if ((key_event.GetKeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
// possible!
wxASSERT_MSG( (m_windowStyle & wxTE_MULTILINE) && m_updateFont,
- _T("shouldn't be called for single line controls") );
+ wxT("shouldn't be called for single line controls") );
wxString value = GetValue();
if ( !value.empty() )
gint l = gtk_text_get_length( GTK_TEXT(m_text) );
wxCHECK_MSG( start >= 0 && end <= l, false,
- _T("invalid range in wxTextCtrl::SetStyle") );
+ wxT("invalid range in wxTextCtrl::SetStyle") );
gint old_pos = gtk_editable_get_position( GTK_EDITABLE(m_text) );
char *text = gtk_editable_get_chars( GTK_EDITABLE(m_text), start, end );
if (cursor.Ok())
{
- GdkWindow *window = (GdkWindow*) NULL;
+ GdkWindow *window = NULL;
if (HasFlag(wxTE_MULTILINE))
window = GTK_TEXT(m_text)->text_area;
else
// freeze/thaw
// ----------------------------------------------------------------------------
-void wxTextCtrl::Freeze()
+void wxTextCtrl::DoFreeze()
{
if ( HasFlag(wxTE_MULTILINE) )
{
}
}
-void wxTextCtrl::Thaw()
+void wxTextCtrl::DoThaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{