语言

Menu
Sites
Language
What value can be set for the group parameter of elm_layout_theme_set()?

I'm running the codes of Setting UI sample and see below code for elm_layout_theme_set.

static Evas_Object*
gl_content_get_cb(void *data, Evas_Object *obj, const char *part)
{
 item_data_s *id = data;
 const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(id->item);
 Evas_Object *content = NULL;

 if (itc->item_style && !strcmp(itc->item_style, "1line")) {
  if (part && !strcmp(part, "elm.icon.1")) {
   content = elm_layout_add(obj);
   elm_layout_theme_set(content, "layout", "list/B/type.3", "default");
   Evas_Object *icon = create_icon(content, id->index);
   elm_layout_content_set(content, "elm.swallow.content", icon);
  }
 }

 return content;
}

The definition for this function is,

EAPI Eina_Bool elm_layout_theme_set(Evas_Object *obj, const char *clas, const char *group, const char *style);

I cannot find the definition for what values can be set for the group parameter. Anyone knows it? What "list/B/type.3" means?

 

响应

4 回复
Jeongsu Kim

You can find basic thems at below link.

https://developer.tizen.org/development/guides/native-application/ui-framework/ui-components/mobile-native/elementary/containers#layout

elm_layout_theme_set is like elm_layout_file_set. A group of edc is assigned to target layout object. elm_layout_theme_set assigns a group in the theme object(global theme object or customized theme object). elm_layout_file_set assigns a group in the edj file.

"list/B/type.3" is also one ofpredefined layout but it is only for genlist. It limits size of it's child because the size of passed part is larger than required.

You can see whole groups at below link. (It is from tizen 2.3.1, mobile profile)

https://review.tizen.org/git/?p=framework/uifw/efl-theme-tizen.git;a=blob;f=2.3-mobile/widgets/genlist.edc;hb=refs/heads/tizen_2.3.1

 

Anyway these groups are for the preloaded apps. So I think  you don't need to use these layouts.

And you don't need to check Elm_Genlist_Item_Class in the gl_content_get_cb.

Items are dynamically created and freed by genlist. gl_content_get_cb is called when item is shown. That means gl_content_get_cb will be called many times if genlist has many items and it is scrolled.
If gl_content_get_cb spends more time, it makes genlist slower. In the gl_content_get_cb, just check part and make an object and return it.

Jean Yang

Thanks Kim! But I do not find the definition for "list/B/type.3" from genlist.edc. Do you know where I can find its definition?

Br

Jean

Jeongsu Kim

You can't find its definition because it is for the preload apps. But you can guess how it limit size of its child. You can read EDC and it's definition or you can use it in content_get callback.

For example,

2727 // 2.2.1.B3
group { name: "elm/layout/list/B/type.3/default";
parts {
   PART(SPACER, "elm.padding.left",
      DSC_FROM_L("default" 0.0,
         min: LIST_B_TYPE3_LEFT_PADDING_WIDTH 0;
         max: LIST_B_TYPE3_LEFT_PADDING_WIDTH -1;
      )
   )
   PART(SPACER, "elm.padding.right",
      DSC_FROM_R("default" 0.0,
         min: 0 0;
         max: 0 -1;
      )
   )
   PART(SWALLOW, "elm.swallow.content",
      DSC_LR("default" 0.0,
         "elm.padding.left", "elm.padding.right",
         min: LIST_B_TYPE3_ICON_SIZE;
         max: LIST_B_TYPE3_ICON_SIZE;
      )
   )
}
}

It has left padding and its size is defined LIST_B_TYPE3_LEFT_PADDING_WIDTH, right padding but its size is 0x0 so it is not shown. So you can guess that its child will be shown with LIST_B_TYPE3_LEFT_PADDING_WIDTH pixels padding left.

Size of its child is LIST_B_TYPE3_ICON_SIZE.

You can find these definitions at https://review.tizen.org/git/?p=framework/uifw/efl-theme-tizen.git;a=blob;f=2.3-mobile/HVGA-inc.edc;hb=refs/heads/tizen_2.3.1 (It is for mobile profile HVGA. You can find more definitions in efl-theme-tizen git.)

Jean Yang

Thanks Kim! I got the meaning of "list/B/type.3" now.

Thanks

Jean