语言

Menu
Sites
Language
Tranparency Popup Background

I want to give transparency to popup .

"circle/toast" style seems to have transparent popup message.

But my content of popup widget has some customized content.

So I used basic layout stuff which has several images. I tried to find

any clues for setting transparency of popup widget but couldn't find any tips.

Please let me know it is possible or not. If possible, how can I make it?

 

Thanks.

 

编辑者为: JAY LEE 30 7月, 2015

响应

4 回复
Vikram

Hi, I don't face such directly api or topics.

But I am search in IDE help doc, for popup like widget, we can use the notification window, such as efl_util_set_notification_window_level(). for transparency, win is inherit from the widget, possible we can define a customer group (.edc) with transparency bg color or image. 

Alex Dem

Hi,
afaik that for popup widgets it is impossible.
Alexey.

pius lee

No, It's not impossible. (But NOT PORTABLE WAY. but it would be work until 2.4)

You can make a popup with alpha background with custom theme.

Important point is you remake every groups of popup theme.

elm/notify/center/[style name]
elm/notify/block_events/[style name]
elm/popup/base/[style name]
elm/popup/content/[style name]

This 4 group must be implemented for custom popup.

Make it like following code.

In C source side.

char path[512] = {0,};
char *resdir = app_get_resource_path();
strcat(path, resdir);
strcat(path, "style.edj");

elm_theme_extension_add(NULL, path);

Evas_Object *popup = elm_popup_add(ad->win);
elm_object_style_set(popup, "alpha");
elm_popup_timeout_set(popup, 2);
elm_popup_allow_events_set(popup, EINA_FALSE);

path[0] = '\0';
strcat(path, resdir);
strcat(path, "cow.png"); // It can be any image containing the alpha background image
free(resdir);

Evas_Object *popimg = elm_image_add(popup);
elm_image_file_set(popimg, path, NULL);
int w,h;
elm_image_object_size_get(popimg, &w, &h);
evas_object_size_hint_min_set(popimg, w, h);
elm_object_content_set(popup, popimg);

style.edj 

collections {
    group { name: "elm/notify/center/alpha";
        parts {
            part { name: "elm.swallow.content";
                type: SWALLOW;
                description { state: "default" 0.0;
                    rel1.relative: 0.0 0.0;
                    rel2.relative: 1.0 1.0;
                }
            }
        }
    }

    group { name: "elm/notify/block_events/alpha";
        parts {
            part { name: "block_events_color";
                type: RECT;
                scale: 1;
                description { state: "default" 0.0;
                    color: 0 0 0 0;
                }
            }
        }
        programs {
            program { name: "block_clicked";
                signal: "mouse,clicked,1";
                source: "block_events_color";
                action: SIGNAL_EMIT "elm,action,click" "elm";
            }
        }
    }
    group { name: "elm/popup/base/alpha";
        parts {
            part { name: "bg";
                type: RECT;
                description { state: "default" 0.0;
                    color: 0 0 0 0;
                }
            }
            part { name: "elm.swallow.content";
                type: SWALLOW;
                description { state: "default" 0.0;
                }
            }
        }
    }
    group { name: "elm/popup/content/alpha";
        parts{
            part { name:"bg";
                type: RECT;
                description { state: "default" 0.0;
                    color: 0 0 0 0;
                }
            }
            part { name:"elm.swallow.content";
                type: SWALLOW;
                scale: 1;
                description { state: "default" 0.0;
                    min: 480 0;
                }
            }
        }
    }
}

 

YES four groups and signals are not written in document or spec. so It's not portable but only way.