Languages

Menu
Sites
Language
Change theme background color

Hi,

I'm trying to change the background color of a Naviframe; in the .edc file I have:

collections {
   group { name: "main";
      parts {
         part { name: "txt_title";
            type: TEXT;
            mouse_events: 0;
            description { state: "default" 0.0;
               align: 0.0 0.0;
               rel1 { relative: 0.0 0.0; }
               rel2 { relative: 0.0 0.0; }
               text { font: "Tizen:style=regular"; size: 40; min: 1 1; }
               color: 255 201 117 255;
            }
         }
      
         // New part for backgroud color
         part { name: "title_bg"; 
            type: RECT; 
            scale: 1; 
            description   { state: "default" 0.0; 
            min: 1 100; 
            align: 0.0 0.0; 
            fixed: 0 1; 
            rel1 { relative: 0.0 0.0; } 
            rel2 { relative: 1.0 1.0; }
            color: 255 201 117 255; 
         } 
        } 
      }
   }
}

 

In C, I load this file in this way:

elm_theme_extension_add(NULL, edj_path);
elm_object_style_set(widget, "main");

But nothing happens...

Do you know what I'm doing wrong?

Thanks.

Responses

2 Replies
pius lee

Style parameter of elm_object_style_set() has undocumented format.

So format of style name has always "class" and "group". but unfortunately it is not documented. if you want it, you must read a elementary source code.

Additionaly, differently than other widget, Naviframe has child part. If you want make new style of naviframe, you should make both of them.

Format of style name is shown as following. group name of edc file must be a format like it.

elm/naviframe/base/default
elm/naviframe/item/basic/default

internal code for theme name is like it.

// if style name is exist
snprintf(buf2, sizeof(buf2), "elm/%s/%s/%s", clas, group, style);


// if style name is not exist
snprintf(buf2, sizeof(buf2), "elm/%s/%s/default", clas, group);

 

In naviframe case, "clas" is "naviframe" and group is "base"

so if you want make "Container" of naviframe style, must name group to "elm/naviframe/base/[naviframe style]"

And style name for child of naviframe is determinded internally in the following code.


// if no item style
strcpy(buf, "item/basic");

// if item style is set
snprintf(buf, sizeof(buf), "item/%s", item_style);

So If you want make "Item" of naviframe style, must name a group to "elm/naviframe/item/[item style]/[naviframe style]"

pius lee

I think it's most weak point of elementary (EFL).

if you want change color of background and font in title area, You must make naviframe item style.

But Elementary style is not just have color or layout, it has most part of widget's behavior.

So If you want your new style widget behavior works same as original one, you should implment every parts and signals program of edje group in original theme.

basic style has following part and signal

parts

elm.swallow.content
elm.swallow.icon
elm.swallow.prev
elm.text.subtitle
elm.text.title

signals

elm,action,popped,finished
elm,action,pushed,finished
elm,action,show,finished
elm,action,title,clicked
elm,action,title,hide
elm,action,title,show

Yes, you don't implement every parts or signals if you don't want every behavior of original widget.

but if you wan't same widget but has different color background, you should implement everything.

It's too sad. but I don't know how  to change only color and layout.