int main (int argc, char **argv) { MxWindow *window; MxApplication *app; ClutterActor *stage, *bar, *button, *hbox; app = mx_application_new (&argc, &argv, "Test PathBar", 0); window = mx_application_create_window (app); stage = (ClutterActor *)mx_window_get_clutter_stage (window); bar = mx_path_bar_new (); mx_path_bar_set_clear_on_change (MX_PATH_BAR (bar), TRUE); hbox = mx_box_layout_new (); button = mx_button_new_with_label ("Add crumb"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_cb), bar); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); button = mx_button_new_with_label ("Remove crumb"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (remove_cb), bar); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); button = mx_button_new_with_label ("Toggle editable"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (toggle_editable_cb), bar); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); button = mx_button_new_with_label ("Re-label first crumb"); g_signal_connect_swapped (button, "clicked", G_CALLBACK (relabel_cb), bar); clutter_container_add_actor (CLUTTER_CONTAINER (hbox), button); /* -a for 'alternative packing'... */ if (argc > 1 && g_str_equal (argv[1], "-a")) { ClutterActor *vbox = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (vbox), MX_ORIENTATION_VERTICAL); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), bar); clutter_container_add_actor (CLUTTER_CONTAINER (vbox), hbox); mx_window_set_child (window, vbox); mx_path_bar_set_editable (MX_PATH_BAR (bar), TRUE); } else { MxToolbar *toolbar = mx_window_get_toolbar (window); clutter_container_add_actor (CLUTTER_CONTAINER (toolbar), bar); mx_window_set_child (window, hbox); } clutter_actor_show (stage); mx_application_run (app); return 0; }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *info_panel, *align; MxApplication *app; MxWindow *window; MexFeed *feed; MexProgram *program; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-info-panel-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *) mx_window_get_clutter_stage (window); clutter_stage_set_color ((ClutterStage *) stage, &grey); align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); mx_window_set_child (window, align); info_panel = mex_info_panel_new (MEX_INFO_PANEL_MODE_FULL); mx_bin_set_child (MX_BIN (align), info_panel); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 1024, 768); feed = mex_feed_new ("source", "title"); program = mex_program_new (feed); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_MIMETYPE, "video/mp4"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_TITLE, "The cats on the moon"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_SYNOPSIS, "An original title where cats are sent to the moon to catch all the mice which are naturally attracted there due to the large consistency of cheese, this results in a space race between NASA and CATSA, leading to war on the moon over territory claimed by cats"); mex_content_set_metadata (MEX_CONTENT (program), MEX_CONTENT_METADATA_STILL, "http://farm5.static.flickr.com/4013/4305303148_5cbc986a44_m.jpg"); mex_content_view_set_content (MEX_CONTENT_VIEW (info_panel), MEX_CONTENT (program)); clutter_actor_show (stage); clutter_main (); return 0; }
int main (int argc, char *argv[]) { ClutterActor *button, *box, *stage; MxApplication *application; MxWindow *window; application = mx_application_new (&argc, &argv, "Test Mx focus handling", MX_APPLICATION_SINGLE_INSTANCE); window = mx_application_create_window (application); stage = (ClutterActor *)mx_window_get_clutter_stage (window); box = mx_box_layout_new (); mx_box_layout_set_orientation (MX_BOX_LAYOUT (box), MX_ORIENTATION_VERTICAL); mx_window_set_child (window, box); button = mx_button_new_with_label ("button #1 (activate to remove)"); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL); mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1); mx_focus_manager_push_focus (mx_focus_manager_get_for_stage (CLUTTER_STAGE (stage)), MX_FOCUSABLE (button)); button = mx_button_new_with_label ("button #2 (activate to remove)"); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL); mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1); button = mx_button_new_with_label ("button #3 (activate to remove)"); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL); mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1); button = mx_button_new_with_label ("button #4 (activate to remove)"); g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), NULL); mx_box_layout_insert_actor (MX_BOX_LAYOUT (box), button, -1); clutter_actor_show (stage); mx_application_run (application); return EXIT_SUCCESS; }
static void startup_cb (MxApplication *application) { MxWindow *window; ClutterActor *scroll, *child; gint i; window = mx_application_create_window (application, "Test Widgets"); /* Create scroll view */ scroll = mx_kinetic_scroll_view_new (); mx_kinetic_scroll_view_set_use_grab (MX_KINETIC_SCROLL_VIEW (scroll), TRUE); mx_kinetic_scroll_view_set_mouse_button (MX_KINETIC_SCROLL_VIEW (scroll), 3); clutter_actor_set_clip_to_allocation (scroll, TRUE); child = mx_box_layout_new_with_orientation (MX_ORIENTATION_VERTICAL); for (i = 0; i < 10000; i++) { ClutterActor *layout, *label, *icon; gchar *s = g_strdup_printf ("Row %d", i); layout = mx_box_layout_new_with_orientation (MX_ORIENTATION_HORIZONTAL); label = mx_label_new_with_text (s); clutter_actor_add_child (layout, label); g_free (s); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-left"); mx_icon_set_icon_size (MX_ICON (icon), 32); clutter_actor_add_child (layout, icon); clutter_actor_add_child (child, layout); } clutter_actor_add_child (scroll, child); mx_window_set_child (window, scroll); /* show the window */ mx_window_set_has_toolbar (window, FALSE); mx_window_show (window); }
int main (int argc, char **argv) { const ClutterColor grey = { 0x40, 0x40, 0x40, 0xff }; ClutterActor *stage, *controls, *align; MxApplication *app; MxWindow *window; mex_init (&argc, &argv); app = mx_application_new (&argc, &argv, "mex-media-controls-test", 0); mex_style_load_default (); window = mx_application_create_window (app); stage = (ClutterActor *) mx_window_get_clutter_stage (window); clutter_stage_set_color ((ClutterStage *) stage, &grey); align = g_object_new (MX_TYPE_FRAME, "x-align", MX_ALIGN_MIDDLE, "y-align", MX_ALIGN_END, NULL); mx_window_set_child (window, align); controls = mex_media_controls_new (); mx_bin_set_child (MX_BIN (align), controls); g_signal_connect_swapped (controls, "stopped", G_CALLBACK (printf), "Stopped signal received\n"); mx_window_set_has_toolbar (window, FALSE); clutter_actor_set_size (stage, 1024, 768); clutter_actor_show (stage); clutter_main (); return 0; }
static void startup_cb (MxApplication *app) { MxWindow *window; ClutterActor *stage, *toggle, *label, *table, *button, *icon; window = mx_application_create_window (app, "Test Window"); stage = (ClutterActor *)mx_window_get_clutter_stage (window); mx_window_set_icon_name (window, "window-new"); clutter_actor_set_size (stage, 480, 320); table = mx_table_new (); mx_table_set_column_spacing (MX_TABLE (table), 8); mx_table_set_row_spacing (MX_TABLE (table), 12); mx_window_set_child (window, table); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle small-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (small_screen_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 0, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 0, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle full-screen mode"); g_signal_connect (toggle, "notify::active", G_CALLBACK (fullscreen_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 1, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 1, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); label = mx_label_new_with_text ("Toggle custom window icon"); g_signal_connect (toggle, "notify::active", G_CALLBACK (icon_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 2, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 2, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle user-resizable"); g_signal_connect (toggle, "notify::active", G_CALLBACK (resizable_cb), stage); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 3, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 3, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); toggle = mx_toggle_new (); mx_toggle_set_active (MX_TOGGLE (toggle), TRUE); label = mx_label_new_with_text ("Toggle toolbar"); g_signal_connect (toggle, "notify::active", G_CALLBACK (toolbar_cb), window); mx_table_insert_actor_with_properties (MX_TABLE (table), toggle, 4, 0, "x-expand", TRUE, "x-align", MX_ALIGN_END, "x-fill", FALSE, NULL); mx_table_insert_actor_with_properties (MX_TABLE (table), label, 4, 1, "x-expand", TRUE, "x-align", MX_ALIGN_START, "y-fill", FALSE, "x-fill", FALSE, NULL); icon = mx_icon_new (); mx_icon_set_icon_name (MX_ICON (icon), "object-rotate-right"); mx_icon_set_icon_size (MX_ICON (icon), 16); button = mx_button_new (); mx_bin_set_child (MX_BIN (button), icon); g_signal_connect (button, "clicked", G_CALLBACK (rotate_clicked_cb), window); clutter_container_add_actor ( CLUTTER_CONTAINER (mx_window_get_toolbar (window)), button); mx_bin_set_alignment (MX_BIN (mx_window_get_toolbar (window)), MX_ALIGN_END, MX_ALIGN_MIDDLE); clutter_actor_show (stage); }