From e3a4eb13c0094c2ae62bd7826c5df86e1846d981 Mon Sep 17 00:00:00 2001 From: shilpa Date: Mon, 7 Jun 2010 18:37:24 +0900 Subject: [PATCH] [popup]: addedr rotation API --- src/lib/Elementary.h.in | 7 ++++--- src/lib/elm_popup.c | 56 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index d255f02..1b33cf8 100755 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -1726,9 +1726,9 @@ extern "C" { EAPI Evas_Object *elm_popup_add(Evas_Object *parent); EAPI void elm_popup_desc_set(Evas_Object *obj, const char *text); EAPI const char* elm_popup_desc_get(Evas_Object *obj); - EAPI void elm_popup_title_label_set(Evas_Object *obj, const char *text); - EAPI const char* elm_popup_title_label_get(Evas_Object *obj); - EAPI void elm_popup_title_icon_set(Evas_Object *obj, Evas_Object *icon); + EAPI void elm_popup_title_label_set(Evas_Object *obj, const char *text); + EAPI const char* elm_popup_title_label_get(Evas_Object *obj); + EAPI void elm_popup_title_icon_set(Evas_Object *obj, Evas_Object *icon); EAPI void elm_popup_content_set(Evas_Object *obj, Evas_Object *content); EAPI Evas_Object* elm_popup_content_get(Evas_Object *obj); EAPI void elm_popup_buttons_add(Evas_Object *obj,int no_of_buttons, char *first_button_text, ...); @@ -1737,6 +1737,7 @@ extern "C" { EAPI void elm_popup_set_mode(Evas_Object *obj, Elm_Popup_Mode mode); EAPI void elm_popup_response(Evas_Object *obj, int response_id); EAPI void elm_popup_orient_set(Evas_Object *obj, Elm_Popup_Orient orient); + EAPI void elm_popup_rotation_set(Evas_Object *obj, int rot_angle); /* Contextual Popup */ typedef struct _Ctxpopup_Item Elm_Ctxpopup_Item; diff --git a/src/lib/elm_popup.c b/src/lib/elm_popup.c index 2e046df..8dfe940 100755 --- a/src/lib/elm_popup.c +++ b/src/lib/elm_popup.c @@ -130,7 +130,8 @@ _show(void *data, Evas *e, Evas_Object *obj, void *event_info) Widget_Data *wd = elm_widget_data_get(obj); if(wd->parent) evas_object_show(wd->parent); - elm_layout_theme_set(wd->layout, "popup", "base", elm_widget_style_get(obj)); + elm_layout_theme_set(wd->layout, "popup", "base", + elm_widget_style_get(obj)); _sizing_eval(obj); evas_object_show(obj); @@ -378,6 +379,7 @@ elm_popup_desc_set(Evas_Object *obj, const char *text) { Widget_Data *wd = elm_widget_data_get(obj); Evas_Object *label; + int w; if (!wd) return; if(wd->content_area) @@ -385,24 +387,20 @@ elm_popup_desc_set(Evas_Object *obj, const char *text) evas_object_del(wd->content_area); wd->content_area=NULL; } - else - { - int w; - label = elm_label_add(obj); - elm_object_style_set(label, "popup/description"); - wd->content_area = elm_scroller_add(obj); - elm_label_line_wrap_set(label, EINA_TRUE); - edje_object_part_geometry_get((Evas_Object *)elm_layout_edje_get(wd->layout), "elm.swallow.content", NULL, NULL, &w, NULL); - elm_label_wrap_width_set(label, w); - elm_scroller_content_set(wd->content_area,label); - elm_scroller_policy_set(wd->content_area, ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO); - elm_scroller_bounce_set(wd->content_area, EINA_FALSE, EINA_FALSE); - elm_label_label_set(label, text); - evas_object_show(label); - elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area); - evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _changed_size_hints, obj); - } + label = elm_label_add(obj); + elm_object_style_set(label, "popup/description"); + wd->content_area = elm_scroller_add(obj); + elm_label_line_wrap_set(label, EINA_TRUE); + edje_object_part_geometry_get((Evas_Object *)elm_layout_edje_get(wd->layout), "elm.swallow.content", NULL, NULL, &w, NULL); + elm_label_wrap_width_set(label, w); + elm_scroller_content_set(wd->content_area,label); + elm_scroller_policy_set(wd->content_area, ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO); + elm_scroller_bounce_set(wd->content_area, EINA_FALSE, EINA_FALSE); + elm_label_label_set(label, text); + evas_object_show(label); + elm_layout_content_set(wd->layout, "elm.swallow.content", wd->content_area); + evas_object_event_callback_add(wd->content_area, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); _sizing_eval(obj); } @@ -705,3 +703,23 @@ EAPI void elm_popup_response(Evas_Object *obj, int response_id) elm_notify_orient_set(wd->notify, notify_orient); } +/** + * Applications which do not pass any window to popup need to take care of rotation, only when popup is already shown. + * @param obj The popup object + * @param rot_angle the angle to which popup has to be rotated. + * + * @ingroup Popup + */ + EAPI void elm_popup_rotation_set(Evas_Object *obj, int rot_angle) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (!wd) return; + if(wd->parent) + { + if(wd->rot_angle!=rot_angle) + { + elm_win_rotation_with_resize_set(wd->parent, rot_angle); + wd->rot_angle = rot_angle; + } + } +} -- 2.7.4