Add a text-changed signal to the entry
This commit is contained in:
parent
d53497d92f
commit
71f2e05b9b
@ -1,3 +1,11 @@
|
|||||||
|
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>
|
2007-06-01 Neil J. Patel <njp@o-hand.com>
|
||||||
|
|
||||||
* clutter/clutter-effect.h:
|
* clutter/clutter-effect.h:
|
||||||
|
@ -63,6 +63,15 @@ enum
|
|||||||
PROP_CURSOR
|
PROP_CURSOR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
TEXT_CHANGED,
|
||||||
|
|
||||||
|
LAST_SIGNAL
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint entry_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
#define CLUTTER_ENTRY_GET_PRIVATE(obj) \
|
#define CLUTTER_ENTRY_GET_PRIVATE(obj) \
|
||||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ENTRY, ClutterEntryPrivate))
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CLUTTER_TYPE_ENTRY, ClutterEntryPrivate))
|
||||||
|
|
||||||
@ -392,6 +401,22 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
|||||||
TRUE,
|
TRUE,
|
||||||
CLUTTER_PARAM_READWRITE));
|
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));
|
g_type_class_add_private (gobject_class, sizeof (ClutterEntryPrivate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,6 +568,7 @@ clutter_entry_set_text (ClutterEntry *entry,
|
|||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR(entry));
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (entry), "text");
|
g_object_notify (G_OBJECT (entry), "text");
|
||||||
|
g_signal_emit (G_OBJECT (entry), entry_signals[TEXT_CHANGED], 0);
|
||||||
g_object_unref (entry);
|
g_object_unref (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,10 @@ struct _ClutterEntryClass
|
|||||||
/*< private >*/
|
/*< private >*/
|
||||||
ClutterActorClass parent_class;
|
ClutterActorClass parent_class;
|
||||||
|
|
||||||
|
/* signals */
|
||||||
|
void (* text_changed) (ClutterEntry *stage);
|
||||||
|
|
||||||
|
/* padding for future */
|
||||||
void (*_clutter_entry_1) (void);
|
void (*_clutter_entry_1) (void);
|
||||||
void (*_clutter_entry_2) (void);
|
void (*_clutter_entry_2) (void);
|
||||||
void (*_clutter_entry_3) (void);
|
void (*_clutter_entry_3) (void);
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_entry_text_changed (ClutterEntry *entry)
|
||||||
|
{
|
||||||
|
g_print ("Text changed\n");
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_key_release_cb (ClutterStage *stage, ClutterEvent *event, ClutterEntry *entry)
|
on_key_release_cb (ClutterStage *stage, ClutterEvent *event, ClutterEntry *entry)
|
||||||
{
|
{
|
||||||
@ -43,6 +49,10 @@ main (int argc, char *argv[])
|
|||||||
g_signal_connect (stage, "key-release-event",
|
g_signal_connect (stage, "key-release-event",
|
||||||
G_CALLBACK (on_key_release_cb), (gpointer)entry);
|
G_CALLBACK (on_key_release_cb), (gpointer)entry);
|
||||||
|
|
||||||
|
/*
|
||||||
|
g_signal_connect (entry, "text-changed",
|
||||||
|
G_CALLBACK (on_entry_text_changed), NULL);
|
||||||
|
*/
|
||||||
clutter_main();
|
clutter_main();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user