Search code examples
tizentizen-native-app

How can I create multiple buttons in a genlist?


I wish to reach this goal with Tizen5.5 (or 4.0):

enter image description here

A nice circular genlist, with 2 buttons on top, then a groupindex then items.

More specifically:

  1. Padding
  2. Icons
  3. Groupindex
  4. Items...
  5. Padding

I'm fully aware of 1,3,4 and 5, but can't find a way to implement 2:

enter image description here

No matter which item style I choose, my Icons are always seems highlighted, which I want to avoid, as they are buttons.

Currently I'm adding these icons with content:

auto itc = elm_genlist_item_class_new();
itc->item_style = "full";
itc->func.content_get = getListItem;

Evas_Object* getListItem(void* data, Evas_Object* obj, const char* part) {
  Evas_Object* item = elm_layout_add(obj);
  elm_layout_file_set(...);
  evas_object_show(item);
  return item;
}

Layout:

parts {
  image { "elm.icon.create";
    mouse_events: 0;
    desc { "default";
      image.normal: "ic_create.png";
      rel2.relative: 0.5 1;
    }
  }
  image { "elm.icon.settings";
    mouse_events: 0;
    desc { "default";
      image.normal: "ic_settings.png";
      rel1.relative: 0.5 0;
    }
  }
}

I haven't find any useful sources online, just some design specs: https://developer.samsung.com/one-ui-watch-tizen/ui-components/buttons.html#Design-specs


Solution

  • The highlight on item is actually generated by genlist itself not item. if you can access efl-theme-tizen-wearable, you can check focus_bg part exist in elm/genlist/base/focus_bg and default(scrollable.edc).

    if you want no-effect for every item, you can set no-effect style on genlist.

    elm_object_style_set(genlist, "no-effect");
    

    there is a way to turn off focus_bg on item style, but tizen official style does not support this. so to do this, you need to customize your own item style.

    (how to add custom style on genlist, you can check here. Howto override or add genlist item style?)

    basically, you just need to copy everything on full style on genlist edc, but only need to add one data.item.

    data.item: "focus_bg" "off";
    

    this will make your item not highlightable.