Tiny patch for gtkentry
- From: Vidar Madsen <vidar vidar prosalg no>
- To: gtk-list redhat com
- Subject: Tiny patch for gtkentry
- Date: Wed, 11 Feb 1998 01:01:51 +0100 (CET)
Hello.
Recently I needed a GtkEntry which reacted to receiving and losing focus
(I got major(!) flickering when triggering on "changed"), so I put
together this tiny patch which introduces two new signals; "got_focus"
and "lost_focus". I thought maybe somebody else might find this useful
too, so here it is...
Vidar
---cut-here---cut-here---
diff -u origs/gtkentry.c ./gtkentry.c
--- gtkentry.c Wed Feb 11 00:35:23 1998
+++ gtkentry.c Wed Feb 11 00:47:45 1998
@@ -37,6 +37,8 @@
CHANGED,
SET_TEXT,
ACTIVATE,
+ LOST_FOCUS,
+ GOT_FOCUS,
LAST_SIGNAL
};
@@ -286,6 +288,20 @@
GTK_SIGNAL_OFFSET (GtkEntryClass, activate),
gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
+ entry_signals[LOST_FOCUS] =
+ gtk_signal_new ("lost_focus",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEntryClass, lost_focus),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
+ entry_signals[GOT_FOCUS] =
+ gtk_signal_new ("got_focus",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkEntryClass, got_focus),
+ gtk_signal_default_marshaller,
+ GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, entry_signals, LAST_SIGNAL);
@@ -1181,6 +1197,8 @@
gdk_im_begin (GTK_ENTRY(widget)->ic, GTK_ENTRY(widget)->text_area);
#endif
+ gtk_signal_emit (GTK_OBJECT (widget), entry_signals[GOT_FOCUS]);
+
return FALSE;
}
@@ -1198,6 +1216,8 @@
#ifdef USE_XIM
gdk_im_end ();
#endif
+
+ gtk_signal_emit (GTK_OBJECT (widget), entry_signals[LOST_FOCUS]);
return FALSE;
}
diff -u origs/gtkentry.h ./gtkentry.h
--- gtkentry.h Wed Feb 11 00:35:23 1998
+++ gtkentry.h Wed Feb 11 00:46:59 1998
@@ -75,6 +75,8 @@
void (* changed) (GtkEntry *entry);
void (* set_text) (GtkEntry *entry);
void (* activate) (GtkEntry *entry);
+ void (* lost_focus) (GtkEntry *entry);
+ void (* got_focus) (GtkEntry *entry);
};
guint gtk_entry_get_type (void);
---cut-here---cut-here---
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]