mutter/examples/scratch.c

100 lines
2.0 KiB
C
Raw Normal View History

2005-04-13 15:49:56 -04:00
#include <clutter/cltr.h>
2005-03-22 09:53:51 -05:00
int
usage(char *progname)
{
fprintf(stderr, "Usage ... check source for now\n");
exit(-1);
}
2005-03-22 09:53:51 -05:00
int
main(int argc, char **argv)
{
int i;
CltrWidget *win = NULL, *grid = NULL, *test = NULL, *test2 = NULL;
2005-04-29 12:44:17 -04:00
CltrFont *font = NULL;
PixbufPixel col = { 0xff, 0, 0, 0xff };
gchar *img_path = NULL;
gboolean want_fullscreen = FALSE;
gint cols = 3;
2005-03-29 18:26:36 -05:00
cltr_init(&argc, &argv);
for (i = 1; i < argc; i++)
2005-03-24 11:46:49 -05:00
{
if (!strcmp ("--image-path", argv[i]) || !strcmp ("-i", argv[i]))
{
if (++i>=argc) usage (argv[0]);
img_path = argv[i];
continue;
}
if (!strcmp ("--cols", argv[i]) || !strcmp ("-c", argv[i]))
{
if (++i>=argc) usage (argv[0]);
cols = atoi(argv[i]);
continue;
}
if (!strcmp ("-fs", argv[i]) || !strcmp ("--fullscreen", argv[i]))
{
want_fullscreen = TRUE;
continue;
}
if (!strcmp("--help", argv[i]) || !strcmp("-h", argv[i]))
{
usage(argv[0]);
}
usage(argv[0]);
2005-03-24 11:46:49 -05:00
}
win = cltr_window_new(800, 600);
2005-03-22 09:53:51 -05:00
if (want_fullscreen)
cltr_window_set_fullscreen(CLTR_WINDOW(win));
2005-03-22 09:53:51 -05:00
2005-04-29 12:44:17 -04:00
font = font_new("Sans 20");
2005-04-07 18:46:43 -04:00
2005-04-29 12:44:17 -04:00
test = cltr_button_new_with_label("ButtonBoooo\ndsfdsfdsf sss\nsjhsjhsjhs", font, &col);
2005-04-29 12:44:17 -04:00
test2 = cltr_button_new_with_label("Button", font, &col);
2005-03-22 09:53:51 -05:00
2005-04-29 12:44:17 -04:00
cltr_widget_add_child(win, test, 300, 100);
cltr_widget_add_child(win, test2, 100, 100);
cltr_window_focus_widget(CLTR_WINDOW(win), test);
cltr_widget_set_focus_next(test, test2, CLTR_EAST);
cltr_widget_set_focus_next(test, test2, CLTR_WEST);
cltr_widget_set_focus_next(test2, test, CLTR_EAST);
cltr_widget_set_focus_next(test2, test, CLTR_WEST);
2005-03-22 09:53:51 -05:00
2005-04-07 18:46:43 -04:00
/*
test = cltr_scratch_new(300, 100);
test2 = cltr_scratch_new(150, 150);
2005-04-07 18:46:43 -04:00
cltr_widget_add_child(win, test, 400, 240);
2005-04-07 18:46:43 -04:00
*/
/*
cltr_widget_add_child(win, test, 320, 240);
cltr_widget_add_child(win, test2, 400, 300);
2005-04-07 18:46:43 -04:00
list = cltr_list_new(640,480,640, 160);
cltr_widget_add_child(win, list, 0, 0);
*/
2005-04-03 12:13:08 -04:00
cltr_widget_show_all(win);
2005-03-22 12:25:52 -05:00
cltr_main_loop();
2005-03-22 09:53:51 -05:00
return 0;
}