static Evas_Object *
_page_grid_add(Evas_Object *parent, App_Inwin_Data *aid)
{
   Evas_Object *grid;
   char *theme, *emo;
   Eina_List *emos, *it;
   static Elm_Gengrid_Item_Class *it_class;
   it_class = elm_gengrid_item_class_new();
   it_class->item_style = "default";
   it_class->func.text_get = _emo_label_get;
   it_class->func.content_get = _emo_content_get;
   it_class->func.del = _emo_del;

   theme = elm_theme_list_item_path_get("default", NULL);
   if (!theme) return NULL;
   emos = edje_file_collection_list(theme);
   free(theme);
   if (!emos) return NULL;

   grid = elm_gengrid_add(parent);
   elm_gengrid_item_size_set(grid, 64, 80);
   evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);

   EINA_LIST_FOREACH(emos, it, emo)
     {
        char name[512];

        if (strncmp(emo, "elm/entry/emoticon/", 19))
          continue;
        sscanf(emo, "elm/entry/emoticon/%[^/]/default", name);
        elm_gengrid_item_append(grid, it_class, strdup(name), _it_sel_cb, aid);
     }
Exemplo n.º 2
0
///////////////// GENGRID /////////////////////////////
static void
_entrance_fill_gengrid(Evas_Object *obj, Entrance_Fill *ef, Eina_List *contents, Evas_Smart_Cb func)
{
   Eina_List *l;
   Elm_Gengrid_Item_Class *ggc;
   void *content;

   if (!ef->ggc)
     {
        ggc = elm_gengrid_item_class_new();
        ef->ggc = ggc;
     }
   else
     ggc = ef->ggc;
   ggc->item_style = ef->item_style;
   ggc->func.text_get = ef->func.text_get;
   ggc->func.content_get = ef->func.content_get;
   ggc->func.state_get = ef->func.state_get;
   ggc->func.del = ef->func.del;

   EINA_LIST_FOREACH(contents, l, content)
      elm_gengrid_item_append(obj, ggc,
                              content, func, content);
}
Exemplo n.º 3
0
#include "include.h"

PREFIX void ml_Elm_Gengrid_Item_Class(
        Elm_Gen_Item_Class** class, void** data, value v)
{
        Elm_Gen_Item_Class* c = elm_gengrid_item_class_new();
        if(c == NULL) caml_raise_out_of_memory();

        c->item_style = String_val(Field(v, 0));
        c->func.text_get = ml_Elm_Gen_Item_Text_Get_Cb;
        c->func.content_get = ml_Elm_Gen_Item_Content_Get_Cb;
        c->func.state_get = ml_Elm_Gen_Item_State_Get_Cb;
        c->func.del = ml_Elm_Gen_Item_Del_Cb;

        value* v_data = caml_stat_alloc(sizeof(value));
        *v_data = v;
        caml_register_global_root(v_data);

        *class = c;
        *data = v_data;
}

PREFIX inline Elm_Gengrid_Item_Scrollto_Type
Elm_Gengrid_Item_Scrollto_Type_val(value v)
{
        switch(v) {
                case Val_none: return ELM_GENGRID_ITEM_SCROLLTO_NONE;
                case Val_in: return ELM_GENGRID_ITEM_SCROLLTO_IN;
                case Val_top: return ELM_GENGRID_ITEM_SCROLLTO_TOP;
                case Val_middle: return ELM_GENGRID_ITEM_SCROLLTO_MIDDLE;
        }
Exemplo n.º 4
0
EAPI_MAIN int
elm_main(int    argc,
         char **argv)
{
   Evas_Object *win, *grid, *bx, *hbx_1, *hbx_2, *hbx_3, *bt, *ck, *sl, *sp;
   Eina_Bool bounce;
   double h, v;

   srand(time(NULL));

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_app_info_set(elm_main, "elementary", "images");

   win = elm_win_util_standard_add("gengrid", "Generic Grid Example");
   elm_win_autodel_set(win, EINA_TRUE);

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

   grid = elm_gengrid_add(win);
   elm_gengrid_item_size_set(grid, 150, 150);
   evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   evas_object_size_hint_align_set(grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
   elm_box_pack_end(bx, grid);
   evas_object_smart_callback_add(grid, "clicked,double", _double_click, NULL);
   evas_object_smart_callback_add(grid, "longpressed", _long_pressed, NULL);
   evas_object_show(grid);

   hbx_1 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_1, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_1, EINA_TRUE);
   elm_box_pack_end(bx, hbx_1);
   evas_object_show(hbx_1);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Append");
   evas_object_smart_callback_add(bt, "clicked", _append_bt_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Prepend");
   evas_object_smart_callback_add(bt, "clicked", _prepend_bt_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   before_bt = elm_button_add(win);
   elm_object_text_set(before_bt, "Insert before");
   evas_object_smart_callback_add(before_bt, "clicked", _before_bt_clicked,
                                  grid);
   elm_box_pack_end(hbx_1, before_bt);
   evas_object_show(before_bt);

   after_bt = elm_button_add(win);
   elm_object_text_set(after_bt, "Insert after");
   evas_object_smart_callback_add(after_bt, "clicked", _after_bt_clicked, grid);
   elm_box_pack_end(hbx_1, after_bt);
   evas_object_show(after_bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Clear");
   evas_object_smart_callback_add(bt, "clicked", _clear_cb, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Bring in 1st");
   evas_object_smart_callback_add(bt, "clicked", _bring_1st_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Show last");
   evas_object_smart_callback_add(bt, "clicked", _show_last_clicked, grid);
   elm_box_pack_end(hbx_1, bt);
   evas_object_show(bt);

   sp = elm_spinner_add(win);
   elm_spinner_min_max_set(sp, 10, 1024);
   elm_spinner_value_set(sp, 150);
   elm_spinner_label_format_set(sp, "Item size: %.0f");
   evas_object_smart_callback_add(sp, "changed", _size_changed, grid);
   evas_object_size_hint_weight_set(sp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_box_pack_end(hbx_1, sp);
   evas_object_show(sp);

   hbx_2 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_2, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_2, EINA_TRUE);
   elm_box_pack_end(bx, hbx_2);
   evas_object_show(hbx_2);

   bt = elm_button_add(win);
   elm_object_text_set(bt, "Disable item");
   evas_object_smart_callback_add(bt, "clicked", _toggle_disabled_cb, grid);
   elm_box_pack_end(hbx_2, bt);
   evas_object_show(bt);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Horizontal mode");
   evas_object_smart_callback_add(ck, "changed", _horizontal_grid, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Always select");
   evas_object_smart_callback_add(ck, "changed", _always_select_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_scroller_bounce_get(grid, &bounce, NULL);
   elm_object_text_set(ck, "Bouncing");
   elm_check_state_set(ck, bounce);
   evas_object_smart_callback_add(ck, "changed", _bouncing_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "Multi-selection");
   elm_check_state_set(ck, elm_gengrid_multi_select_get(grid));
   evas_object_smart_callback_add(ck, "changed", _multi_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   ck = elm_check_add(win);
   elm_object_text_set(ck, "No selection");
   evas_object_smart_callback_add(ck, "changed", _no_sel_change, grid);
   elm_box_pack_end(hbx_2, ck);
   evas_object_show(ck);

   hbx_3 = elm_box_add(win);
   evas_object_size_hint_weight_set(hbx_3, EVAS_HINT_EXPAND, 0.0);
   elm_box_horizontal_set(hbx_3, EINA_TRUE);
   elm_box_pack_end(bx, hbx_3);
   evas_object_show(hbx_3);

   elm_gengrid_align_get(grid, &h, &v);
   evas_object_smart_callback_add(grid, "scroll,anim,stop", _grid_scroll_stopped_cb, NULL);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Horiz. alignment");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, h);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   evas_object_smart_callback_add(sl, "changed", _h_align_change_cb, grid);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Vert. alignment");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, v);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   evas_object_smart_callback_add(sl, "changed", _v_align_change_cb, grid);

   elm_gengrid_align_get(grid, &h, &v);

   sl = elm_slider_add(win);
   elm_object_text_set(sl, "Page rel. size");
   elm_slider_span_size_set(sl, 100);
   evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
   evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
   elm_slider_indicator_format_set(sl, "%1.1f");
   elm_slider_value_set(sl, h);
   elm_box_pack_end(hbx_3, sl);
   evas_object_show(sl);

   _page_change_cb(grid, sl, NULL);
   evas_object_smart_callback_add(sl, "changed", _page_change_cb, grid);

   if (!gic)
     {
        gic = elm_gengrid_item_class_new();
        gic->item_style = "default";
        gic->func.text_get = _grid_label_get;
        gic->func.content_get = _grid_content_get;
        gic->func.state_get = _grid_state_get;
        gic->func.del = _grid_del;
     } // we only create the first time its needed. we dont unref/free

   _append_bt_clicked(grid, NULL, NULL);
   _append_bt_clicked(grid, NULL, NULL);
   _append_bt_clicked(grid, NULL, NULL);

   evas_object_resize(win, 600, 600);
   evas_object_show(win);

   elm_run();

   return 0;
}