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)
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 );
}
}
// 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;
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))
// freeze/thaw
// ----------------------------------------------------------------------------
-void wxTextCtrl::Freeze()
+void wxTextCtrl::DoFreeze()
{
if ( HasFlag(wxTE_MULTILINE) )
{
}
}
-void wxTextCtrl::Thaw()
+void wxTextCtrl::DoThaw()
{
if ( HasFlag(wxTE_MULTILINE) )
{