mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
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>
|
||||
|
||||
* clutter/clutter-effect.h:
|
||||
|
@ -63,6 +63,15 @@ enum
|
||||
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))
|
||||
|
||||
@ -392,6 +401,22 @@ clutter_entry_class_init (ClutterEntryClass *klass)
|
||||
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));
|
||||
}
|
||||
|
||||
@ -543,6 +568,7 @@ clutter_entry_set_text (ClutterEntry *entry,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,10 @@ struct _ClutterEntryClass
|
||||
/*< 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);
|
||||
|
@ -1,5 +1,11 @@
|
||||
#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)
|
||||
{
|
||||
@ -43,6 +49,10 @@ main (int argc, char *argv[])
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user