2007-05-31 14:33:42 -04:00
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
2007-07-26 07:04:04 -04:00
|
|
|
#if 0
|
2007-06-01 07:50:18 -04:00
|
|
|
static void
|
|
|
|
on_entry_text_changed (ClutterEntry *entry)
|
|
|
|
{
|
|
|
|
g_print ("Text changed\n");
|
|
|
|
}
|
2007-07-26 07:04:04 -04:00
|
|
|
#endif
|
2007-06-01 07:50:18 -04:00
|
|
|
|
2007-05-31 14:33:42 -04:00
|
|
|
void
|
|
|
|
on_key_release_cb (ClutterStage *stage, ClutterEvent *event, ClutterEntry *entry)
|
|
|
|
{
|
2007-06-01 07:34:40 -04:00
|
|
|
if (event->type == CLUTTER_KEY_RELEASE)
|
|
|
|
{
|
2007-05-31 14:33:42 -04:00
|
|
|
ClutterKeyEvent* kev = (ClutterKeyEvent *) event;
|
2007-06-01 07:34:40 -04:00
|
|
|
clutter_entry_handle_key_event (entry, kev);
|
|
|
|
return;
|
2007-05-31 14:33:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-07 17:23:07 -04:00
|
|
|
static void
|
|
|
|
on_entry_activated (ClutterEntry *entry, gpointer null)
|
|
|
|
{
|
|
|
|
g_print ("Activated: %s\n", clutter_entry_get_text (entry));
|
|
|
|
}
|
|
|
|
|
2007-05-31 14:33:42 -04:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
ClutterActor *entry;
|
|
|
|
ClutterActor *stage;
|
|
|
|
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
|
|
|
|
ClutterColor entry_color = { 0x33, 0xdd, 0xff, 0xff };
|
|
|
|
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
|
|
|
|
stage = clutter_stage_get_default ();
|
|
|
|
|
|
|
|
clutter_actor_set_size (stage, 800, 600);
|
|
|
|
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
|
2007-06-19 10:10:25 -04:00
|
|
|
clutter_stage_set_title (CLUTTER_STAGE (stage), "ClutterEntry Test");
|
2007-06-19 05:10:37 -04:00
|
|
|
|
2007-05-31 14:33:42 -04:00
|
|
|
entry = clutter_entry_new_with_text ("Sans 14",
|
|
|
|
"Type something, be sure to use the "
|
|
|
|
"left/right arrow keys to move the "
|
|
|
|
"cursor position.");
|
|
|
|
clutter_entry_set_color (CLUTTER_ENTRY (entry), &entry_color);
|
|
|
|
clutter_actor_set_size (entry, 600, 50);
|
|
|
|
clutter_actor_set_position (entry, 100, 100);
|
2007-06-01 11:58:17 -04:00
|
|
|
/*clutter_entry_set_visibility (CLUTTER_ENTRY (entry), FALSE);*/
|
2007-06-01 13:18:21 -04:00
|
|
|
/*clutter_entry_set_max_length (CLUTTER_ENTRY (entry), 50);*/
|
2007-06-01 11:58:17 -04:00
|
|
|
|
2007-05-31 14:33:42 -04:00
|
|
|
clutter_group_add (CLUTTER_GROUP (stage), entry);
|
2007-06-19 10:10:25 -04:00
|
|
|
clutter_actor_show_all (stage);
|
2007-05-31 14:33:42 -04:00
|
|
|
|
|
|
|
g_signal_connect (stage, "key-release-event",
|
2007-07-26 07:04:04 -04:00
|
|
|
G_CALLBACK (on_key_release_cb), entry);
|
2007-06-01 07:50:18 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
g_signal_connect (entry, "text-changed",
|
|
|
|
G_CALLBACK (on_entry_text_changed), NULL);
|
|
|
|
*/
|
2007-06-07 17:23:07 -04:00
|
|
|
g_signal_connect (entry, "activate",
|
|
|
|
G_CALLBACK (on_entry_activated), NULL);
|
2007-07-26 07:04:04 -04:00
|
|
|
|
2007-05-31 14:33:42 -04:00
|
|
|
clutter_main();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|