Ejemplo n.º 1
0
int
main (int argc, char *argv[])
{
    GOptionContext *context;
    GError *error = NULL;

    setlocale (LC_ALL, "");
    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);

    context = g_option_context_new ("- dawati status panel");
    g_option_context_add_main_entries (context, status_options, GETTEXT_PACKAGE);
    g_option_context_add_group (context, clutter_get_option_group_without_init ());
    g_option_context_add_group (context, cogl_get_option_group ());
    g_option_context_add_group (context, gtk_get_option_group (FALSE));

    if (!g_option_context_parse (context, &argc, &argv, &error))
    {
        g_critical (G_STRLOC ": Error parsing option: %s", error->message);
        g_clear_error (&error);
    }

    g_option_context_free (context);

    mpl_panel_clutter_init_with_gtk (&argc, &argv);

    mx_style_load_from_file (mx_style_get_default (),
                             THEMEDIR "/panel.css",
                             &error);

    if (error)
    {
        g_critical ("Unable to load style: %s", error->message);
        g_clear_error (&error);
    }

    panel = g_new0 (DawatiStatusPanel, 1);

    if (status_standalone)
        setup_standalone (panel);
    else
        setup_panel (panel);

    clutter_main ();


    return EXIT_SUCCESS;
}
Ejemplo n.º 2
0
void setup(void)
{
	Evas_Coord pw;
	int ex, ey, ew, eh;
	Evas_Coord width, height;
	char msg[] =
	    "The Etox Test utility consists in a series "
	    "of test suites designed to exercise all of "
	    "the etox functions.\n"
	    "Informational messages will be displayed here, "
	    "the test text will be presented in the colored "
	    "rectangle below.\n"
	    "To start a test suite, select it from the "
	    "navigation panel on the left.\n";

	/* Create interface */

	/* Background */
	o_bg = evas_object_image_add(evas);
	evas_object_image_file_set(o_bg, IM "bg.png", IM "bg.png");
	evas_object_resize(o_bg, win_w, win_h);
	evas_object_image_fill_set(o_bg, 0, 0, win_w, win_h);
	evas_object_move(o_bg, 0, 0);
	evas_object_layer_set(o_bg, 0);
	evas_object_show(o_bg);

	/* Panel */
	setup_panel(evas);

	evas_object_geometry_get(o_panel, NULL, NULL, &pw, NULL);

	ey = win_h / 2;
	ew = win_w - pw - 20;
	eh = ey - 10;
	ex = pw + 10;
	ey += 10;

	/* Create message etox */
	e_msg = etox_new_all(evas, ex, 10, ew, eh , 255, ETOX_ALIGN_LEFT);
	etox_context_set_align(etox_get_context(e_msg), ETOX_ALIGN_LEFT);
	etox_context_set_font(etox_get_context(e_msg), "sinon", 14);
	etox_context_set_style(etox_get_context(e_msg), "shadow");
	etox_context_set_color(etox_get_context(e_msg), 225, 225, 225, 255);
	etox_set_soft_wrap(e_msg, 1);
	etox_set_text(e_msg, msg);
	etox_set_alpha(e_msg, 255);
	evas_object_layer_set(e_msg, 1000);
	evas_object_show(e_msg);

	/* Setup test etox */
	/* Setup test etox background */
	o_bg_etox = evas_object_rectangle_add(evas);
	evas_object_move(o_bg_etox, ex, ey);
	evas_object_resize(o_bg_etox, ew, eh);
	evas_object_color_set(o_bg_etox, 0, 100, 100, 100);
	evas_object_layer_set(o_bg_etox, 100);
	evas_object_show(o_bg_etox);

	/* Clip rectangle for bounding where the test text is drawn */
	clip_test = evas_object_rectangle_add(evas);
	evas_object_move(clip_test, ex, ey);
	evas_object_resize(clip_test, ew, eh);
	evas_object_show(clip_test);

	/* Create test etox */
	e_test = etox_new_all(evas, ex, ey, ew, eh, 255, ETOX_ALIGN_CENTER);
	etox_context_set_font(etox_get_context(e_test), "sinon", 14);
	etox_context_set_style(etox_get_context(e_test), "plain");
	etox_context_set_color(etox_get_context(e_test), 225, 225, 225, 255);
	etox_set_text(e_test, "");
	evas_object_clip_set(e_test, clip_test);
	etox_set_alpha(e_test, 255);
	evas_object_layer_set(e_test, 1000);

	/*
	 * Create the next test button
	 */
	o_next_box = evas_object_image_add(evas);
	evas_object_image_file_set(o_next_box,
			IM "panel_button1.png",
			IM "panel_button1.png");
	evas_object_image_border_set(o_next_box, 3, 3, 3, 3);
	evas_object_layer_set(o_next_box, 1000);
	evas_object_hide(o_next_box);

	o_txt_next_box = evas_object_text_add(evas);
	evas_object_text_font_set(o_txt_next_box, "andover", 24);
       	evas_object_text_text_set(o_txt_next_box, "Next");
	evas_object_color_set(o_txt_next_box, 0, 0, 0, 160);
	evas_object_layer_set(o_txt_next_box, 1000);
	evas_object_move(o_next_box, 516, 150);
	evas_object_move(o_txt_next_box, 519, 152);

	width = evas_object_text_horiz_advance_get(o_txt_next_box);
	height = evas_object_text_vert_advance_get(o_txt_next_box);

	width += 10;
	height += 5;

	evas_object_resize(o_next_box, width, height);
	evas_object_image_fill_set(o_next_box, 0, 0, width, height);
	evas_object_hide(o_txt_next_box);
	evas_object_event_callback_add(o_txt_next_box, EVAS_CALLBACK_MOUSE_DOWN,
			  next_test, NULL);

	/*
	 * Create the previous test button
	 */
	o_prev_box = evas_object_image_add(evas);
	evas_object_image_file_set(o_prev_box,
			IM "panel_button1.png",
			IM "panel_button1.png");
	evas_object_image_border_set(o_prev_box, 3, 3, 3, 3);
	evas_object_layer_set(o_prev_box, 1000);
	evas_object_hide(o_prev_box);

	o_txt_prev_box = evas_object_text_add(evas);
	evas_object_text_font_set(o_txt_prev_box, "andover", 24);
	evas_object_text_text_set(o_txt_prev_box, "Previous");
	evas_object_color_set(o_txt_prev_box, 0, 0, 0, 160);
	evas_object_layer_set(o_txt_prev_box, 1000);
	evas_object_move(o_prev_box, 416, 150);
	evas_object_move(o_txt_prev_box, 419, 152);

	width = evas_object_text_horiz_advance_get(o_txt_prev_box);
	height = evas_object_text_vert_advance_get(o_txt_prev_box);

	width += 10;
	height += 5;

	evas_object_resize(o_prev_box, width, height);
	evas_object_image_fill_set(o_prev_box, 0, 0, width, height);
	evas_object_hide(o_txt_prev_box);
	evas_object_event_callback_add(o_txt_prev_box, EVAS_CALLBACK_MOUSE_DOWN,
			  prev_test, NULL);
}