2007-06-01 Neil J. Patel <njp@o-hand.com>
+ * clutter/clutter-entry.c: (clutter_entry_class_init),
+ (clutter_entry_set_text):
+ * clutter/clutter-entry.h:
+ * examples/test-entry.c: (on_entry_text_changed), (main):
+ Added a text-changed signal to the entry.
+
+2007-06-01 Neil J. Patel <njp@o-hand.com>
+
* clutter/clutter-effect.h:
Removed extra G_END_DECLS outside the #endif
PROP_CURSOR
};
+enum
+{
+ TEXT_CHANGED,
+
+ LAST_SIGNAL
+};
+
+static guint entry_signals[LAST_SIGNAL] = { 0, };
+
#define CLUTTER_ENTRY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ENTRY, ClutterEntryPrivate))
"Whether the input cursor is visible ",
TRUE,
CLUTTER_PARAM_READWRITE));
+
+
+ /**
+ * ClutterEntry::text-changed:
+ * @entry: the actor which received the event
+ *
+ * The ::text-changed signal is emitted after the @entrys text changes
+ */
+ entry_signals[TEXT_CHANGED] =
+ g_signal_new ("text-changed",
+ G_TYPE_FROM_CLASS (gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ClutterEntryClass, text_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
g_type_class_add_private (gobject_class, sizeof (ClutterEntryPrivate));
}
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
g_object_notify (G_OBJECT (entry), "text");
+ g_signal_emit (G_OBJECT (entry), entry_signals[TEXT_CHANGED], 0);
g_object_unref (entry);
}
{
/*< private >*/
ClutterActorClass parent_class;
-
+
+ /* signals */
+ void (* text_changed) (ClutterEntry *stage);
+
+ /* padding for future */
void (*_clutter_entry_1) (void);
void (*_clutter_entry_2) (void);
void (*_clutter_entry_3) (void);
#include <clutter/clutter.h>
+static void
+on_entry_text_changed (ClutterEntry *entry)
+{
+ g_print ("Text changed\n");
+}
+
void
on_key_release_cb (ClutterStage *stage, ClutterEvent *event, ClutterEntry *entry)
{
g_signal_connect (stage, "key-release-event",
G_CALLBACK (on_key_release_cb), (gpointer)entry);
-
+
+ /*
+ g_signal_connect (entry, "text-changed",
+ G_CALLBACK (on_entry_text_changed), NULL);
+ */
clutter_main();
return 0;