const char *txt,
size_t len)
{
- GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
- : NULL;
+ wxFont tmpFont;
+ GdkFont *font;
+ if (attr.HasFont())
+ {
+ tmpFont = attr.GetFont();
+
+ // FIXME: if this crashes because tmpFont goes out of scope and the GdkFont is
+ // deleted, then we need to call gdk_font_ref on font.
+ // This is because attr.GetFont() now returns a temporary font since wxTextAttr
+ // no longer stores a wxFont object, for efficiency.
+
+ font = tmpFont.GetInternalFont();
+ }
+ else
+ font = NULL;
GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
: NULL;
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)
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;
// wxTextCtrl
//-----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
+IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
-BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
+BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
return tmp;
}
-void wxTextCtrl::SetValue( const wxString &value )
+void wxTextCtrl::DoSetValue( const wxString &value, int flags )
{
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
+ if ( !(flags & SetValue_SendEvent) )
+ {
+ // do not generate events
+ IgnoreNextTextUpdate();
+ }
+
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_text) );
}
}
-bool wxTextCtrl::Enable( bool enable )
+void wxTextCtrl::DoEnable( bool enable )
{
- if (!wxWindowBase::Enable(enable))
- {
- // nothing to do
- return false;
- }
-
if (m_windowStyle & wxTE_MULTILINE)
{
gtk_text_set_editable( GTK_TEXT(m_text), enable );
- OnParentEnable(enable);
}
else
{
gtk_widget_set_sensitive( m_text, enable );
}
-
- return true;
}
// wxGTK-specific: called recursively by Enable,
// to give widgets an oppprtunity to correct their colours after they
// have been changed by Enable
-void wxTextCtrl::OnParentEnable( bool enable )
+void wxTextCtrl::OnEnabled( bool WXUNUSED(enable) )
{
+ if ( IsSingleLine() )
+ return;
+
// If we have a custom background colour, we use this colour in both
// disabled and enabled mode, or we end up with a different colour under the
// text.