Example #1
0
void
theme_set(const char *edje_file)
{
   if (!edje_file) return;

   th = elm_theme_new();
   elm_theme_ref_set(th, NULL);
   elm_theme_overlay_add(th, edje_file);
}
Example #2
0
EAPI int elm_main(int argc, char **argv) {
	Evas_Object *win=NULL, *bg=NULL, *pattern=NULL, *edje=NULL, *object=NULL, *item=NULL;
	Ecore_X_Window xwin, rootxwin;
	char theme[PATH_MAX];

	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	win = elm_win_add(NULL, "e_pattern_lock", ELM_WIN_BASIC);
	elm_win_autodel_set(win, EINA_TRUE);
	elm_win_maximized_set(win, EINA_TRUE); // change to full screen and above everything for lockscreen effect
	evas_object_size_hint_min_set(win, 480, 480);
	evas_object_size_hint_max_set(win, 640, 640);
	elm_win_fullscreen_set(win, EINA_TRUE);
	elm_win_sticky_set(win, EINA_TRUE);
	elm_win_keyboard_mode_set(win, ELM_WIN_KEYBOARD_OFF);
	elm_win_layer_set(win, INT_MAX);

	xwin = elm_win_xwindow_get(win);
	rootxwin = ecore_x_window_root_get(xwin);
	ecore_x_pointer_grab(xwin);
	ecore_x_keyboard_grab(rootxwin);

	bg = elm_bg_add(win);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	elm_win_resize_object_add(win, bg);
	evas_object_show(bg);

	snprintf(theme, sizeof(theme), "%s/themes/default.edj", PKGDATADIR);
    elm_theme_extension_add(NULL, theme);
    elm_theme_overlay_add(NULL, theme);

	pattern = elm_layout_add(win);

		elm_layout_file_set(pattern, theme, "e_lock/table/default");
		evas_object_size_hint_weight_set(pattern, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_size_hint_align_set(pattern, EVAS_HINT_FILL, EVAS_HINT_FILL);
		elm_win_resize_object_add(win, pattern);

		edje = elm_layout_edje_get(pattern);

		set_event_cbs(0, 0, "top_left");    set_event_cbs(1, 0, "top");    set_event_cbs(2, 0, "top_right");
		set_event_cbs(0, 1, "left");        set_event_cbs(1, 1, "center"); set_event_cbs(2, 1, "right");
		set_event_cbs(0, 2, "bottom_left"); set_event_cbs(1, 2, "bottom"); set_event_cbs(2, 2, "bottom_right");

	evas_object_show(pattern);

	evas_object_show(win);

    elm_run();

    elm_shutdown();

	return(0);
}
static void
_btn_clicked_cb(void *data, Evas_Object *obj, void *ev)
{
   static int loaded = 1;
   if (loaded)
     elm_theme_overlay_del(NULL, "./theme_example.edj");
   else
     elm_theme_overlay_add(NULL, "./theme_example.edj");
   loaded = 1 - loaded;
}
EAPI_MAIN int
elm_main(int argc, char *argv[])
{
   Evas_Object *win, *box, *btn;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   elm_theme_overlay_add(NULL, "./theme_example.edj");

   win = elm_win_util_standard_add("theme", "Theme example");
   elm_win_autodel_set(win, EINA_TRUE);

   box = elm_box_add(win);
   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, box);
   evas_object_show(box);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Button 1");
   elm_box_pack_end(box, btn);
   evas_object_show(btn);
   evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Button 2");
   elm_box_pack_end(box, btn);
   evas_object_show(btn);
   evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Button 3");
   elm_box_pack_end(box, btn);
   evas_object_show(btn);
   evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);

   btn = elm_button_add(win);
   elm_object_text_set(btn, "Button 4");
   elm_box_pack_end(box, btn);
   evas_object_show(btn);
   evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL);

   evas_object_resize(win, 300, 320);
   evas_object_show(win);

   elm_run();

   return 0;
}
/* App init */
int app_create(void *data)
{

	Evas_Object *win;
	struct appdata *ad = data;

	/* Create window (Reqd for sys-popup) */
	win = create_win(PACKAGE);
	if (win == NULL)
		return -1;

	ad->win_main = win;

	elm_theme_overlay_add(NULL,EDJ_NAME); 

	return 0;
}
Example #6
0
static void
config_load_theme (void)
{
   if (!enna_config->theme)
     goto err_theme;

   enna_config->theme_file = (char *)
     enna_config_theme_file_get(enna_config->theme);

   if (!enna_config->theme_file)
     goto err_theme;

   elm_theme_overlay_add(enna_config->eth, enna_config->theme_file);
   return;

 err_theme:
   printf("couldn't load theme file!\n");
}
Example #7
0
static void
config_load_theme (void)
{
    if (!enna_config->theme)
        goto err_theme;

    enna_config->theme_file = (char *)
        enna_config_theme_file_get(enna_config->theme);

    if (!enna_config->theme_file)
        goto err_theme;

    elm_theme_overlay_add(enna_config->eth, enna_config->theme_file);
    return;

err_theme:
      enna_log(ENNA_MSG_CRITICAL, NULL, "couldn't load theme file!");
}
Example #8
0
EAPI int
elm_main(int argc, char **argv)
{
   Evas_Object *window;
   Evas_Object *layout;
   Evas_Object *edje;
   Evas_Object *grid;
   Evas_Object *list;
   char path[PATH_MAX];
   Eina_Bool quit_option = EINA_FALSE;
   int args;

   Ecore_Getopt_Value values[] = {
     ECORE_GETOPT_VALUE_BOOL(crazy_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_BOOL(quit_option),
     ECORE_GETOPT_VALUE_NONE
   };

   _log_domain = eina_log_domain_register("Excessive", NULL);
   if (_log_domain < 0)
     {
        EINA_LOG_CRIT("could not create log domain 'Excessive'.");
        return -1;
     }

   args = ecore_getopt_parse(&options, values, argc, argv);
   if (args < 0)
     {
        ERR("could not parse command line options.");
        return -1;
     }

   if (quit_option) return 0;

   excessive_browse_init();

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_theme_extension_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj");
   elm_theme_overlay_add(NULL, PACKAGE_DATA_DIR "/themes/theme.edj");
   elm_need_efreet();
   elm_need_ethumb();

   window = elm_win_add(NULL, PACKAGE_NAME, ELM_WIN_BASIC);
   if (!window)
     {
        ERR("could'nt create window.");
        return -1;
     }

   /* FIXME: later remember last size */
   elm_win_alpha_set(window, 1);
   evas_object_resize(window, 800, 600);
   elm_win_title_set(window, PACKAGE_STRING);
   elm_win_autodel_set(window, 1);

   layout = elm_layout_add(window);
   if (!layout)
     {
        ERR("couldn't create layout object.");
        return -1;
     }

   evas_object_size_hint_align_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_weight_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_win_resize_object_add(window, layout);

   if (!elm_layout_theme_set(layout, "layout", "application", "content"))
     {
        ERR("could not load style 'content' from theme");
        return -1;
     }

   evas_object_show(layout);
   evas_object_show(window);

   edje = elm_layout_edje_get(layout);
   grid = edje_object_part_external_object_get(edje, "grid");

   evas_object_data_set(grid, "excessive/layout", layout);
   evas_object_data_set(layout, "excessive/win", window);

   evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_gengrid_bounce_set(grid, EINA_FALSE, EINA_TRUE);
   elm_gengrid_align_set(grid, 0.5, 0.5);
   elm_gengrid_item_size_set(grid, 128, 128);

   excessive_browse_load(layout);

   list = edje_object_part_external_object_get(edje, "shortcut");

   excessive_shortcut_init(list, grid);

   if (argc < args + 1)
     {
       getcwd(path, PATH_MAX);

       excessive_browse_directory(grid, path);
     }
   else
     {
       excessive_browse_directory(grid, argv[args]);
     }

   elm_run();

   excessive_shortcut_shutdown();
   excessive_browse_shutdown();

   return 0;
}