X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Flib%2Felm_panel.c;h=a93a7e0804561d9376dbf2068d0361ad26cf98ec;hb=df949f9c4a552d857aaba20432b94273974e6851;hp=bf6a2f2f891e14f882a3ce49ea15fc5f13a9d01e;hpb=c92b2993aaf6975884b75b446148c9d6640a4ddd;p=framework%2Fuifw%2Felementary.git diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c index bf6a2f2..a93a7e0 100644 --- a/src/lib/elm_panel.c +++ b/src/lib/elm_panel.c @@ -1,22 +1,7 @@ #include #include "elm_priv.h" - -/** - * @defgroup Panel Panel - * @ingroup Elementary - * - * A panel is a type of animated container that contains subobjects. It - * can be expanded or contracted. - * - * Orientations are as follows: - * ELM_PANEL_ORIENT_TOP - * ELM_PANEL_ORIENT_BOTTOM - * ELM_PANEL_ORIENT_LEFT - * ELM_PANEL_ORIENT_RIGHT - * NOTE: Only LEFT and RIGHT orientations are implemented. - * - * THIS WIDGET IS UNDER CONSTRUCTION! - */ +#include "els_scroller.h" +#include "els_box.h" typedef struct _Widget_Data Widget_Data; struct _Widget_Data @@ -240,15 +225,55 @@ _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type ty return EINA_TRUE; } -/** - * Adds a panel object - * - * @param parent The parent object - * - * @return The panel object, or NULL on failure - * - * @ingroup Panel - */ +static void +_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd; + + if (part && strcmp(part, "default")) return; + wd = elm_widget_data_get(obj); + if (!wd) return; + if (wd->content == content) return; + if (wd->content) + evas_object_box_remove_all(wd->bx, EINA_TRUE); + wd->content = content; + if (content) + { + evas_object_box_append(wd->bx, wd->content); + evas_object_show(wd->content); + } + _sizing_eval(obj); +} + +static Evas_Object * +_content_get_hook(const Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + return wd->content; +} + +static Evas_Object * +_content_unset_hook(Evas_Object *obj, const char *part) +{ + ELM_CHECK_WIDTYPE(obj, widtype) NULL; + Widget_Data *wd; + Evas_Object *content; + if (part && strcmp(part, "default")) return NULL; + wd = elm_widget_data_get(obj); + if (!wd) return NULL; + if (!wd->content) return NULL; + content = wd->content; + evas_object_box_remove_all(wd->bx, EINA_FALSE); + wd->content = NULL; + return content; +} + EAPI Evas_Object * elm_panel_add(Evas_Object *parent) { @@ -271,6 +296,9 @@ elm_panel_add(Evas_Object *parent) elm_widget_focus_next_hook_set(obj, _elm_panel_focus_next_hook); elm_widget_can_focus_set(obj, EINA_TRUE); elm_widget_event_hook_set(obj, _event_hook); + elm_widget_content_set_hook_set(obj, _content_set_hook); + elm_widget_content_get_hook_set(obj, _content_get_hook); + elm_widget_content_unset_hook_set(obj, _content_unset_hook); wd->scr = elm_smart_scroller_add(e); elm_smart_scroller_widget_set(wd->scr, obj); @@ -301,20 +329,6 @@ elm_panel_add(Evas_Object *parent) return obj; } -/** - * Sets the orientation of the panel - * - * @param parent The parent object - * @param orient The panel orientation. Can be one of the following: - * ELM_PANEL_ORIENT_TOP - * ELM_PANEL_ORIENT_BOTTOM - * ELM_PANEL_ORIENT_LEFT - * ELM_PANEL_ORIENT_RIGHT - * - * NOTE: Only LEFT and RIGHT orientations are implemented. - * - * @ingroup Panel - */ EAPI void elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) { @@ -347,14 +361,6 @@ elm_panel_orient_set(Evas_Object *obj, Elm_Panel_Orient orient) _sizing_eval(obj); } -/** - * Get the orientation of the panel. - * - * @param obj The panel object - * @return The Elm_Panel_Orient, or ELM_PANEL_ORIENT_LEFT on failure. - * - * @ingroup Panel - */ EAPI Elm_Panel_Orient elm_panel_orient_get(const Evas_Object *obj) { @@ -364,87 +370,6 @@ elm_panel_orient_get(const Evas_Object *obj) return wd->orient; } -/** - * Set the content of the panel. - * - * Once the content object is set, a previously set one will be deleted. - * If you want to keep that old content object, use the - * elm_panel_content_unset() function. - * - * @param obj The panel object - * @param content The panel content - * - * @ingroup Panel - */ -EAPI void -elm_panel_content_set(Evas_Object *obj, Evas_Object *content) -{ - ELM_CHECK_WIDTYPE(obj, widtype); - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return; - if (wd->content == content) return; - if (wd->content) - evas_object_box_remove_all(wd->bx, EINA_TRUE); - wd->content = content; - if (content) - { - evas_object_box_append(wd->bx, wd->content); - evas_object_show(wd->content); - } - _sizing_eval(obj); -} - -/** - * Get the content of the panel. - * - * Return the content object which is set for this widget. - * - * @param obj The panel object - * @return The content that is being used - * - * @ingroup Panel - */ -EAPI Evas_Object * -elm_panel_content_get(const Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - if (!wd) return NULL; - return wd->content; -} - -/** - * Unset the content of the panel. - * - * Unparent and return the content object which was set for this widget. - * - * @param obj The panel object - * @return The content that was being used - * - * @ingroup Panel - */ -EAPI Evas_Object * -elm_panel_content_unset(Evas_Object *obj) -{ - ELM_CHECK_WIDTYPE(obj, widtype) NULL; - Widget_Data *wd = elm_widget_data_get(obj); - Evas_Object *content; - if (!wd) return NULL; - if (!wd->content) return NULL; - content = wd->content; - evas_object_box_remove_all(wd->bx, EINA_FALSE); - wd->content = NULL; - return content; -} - -/** - * Set the state of the panel. - * - * @param obj The panel object - * @param hidden If true, the panel will run the edje animation to contract - * - * @ingroup Panel - */ EAPI void elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) { @@ -455,14 +380,6 @@ elm_panel_hidden_set(Evas_Object *obj, Eina_Bool hidden) _toggle_panel(obj, NULL, "elm,action,panel,toggle", "*"); } -/** - * Get the state of the panel. - * - * @param obj The panel object - * @param hidden If true, the panel is in the "hide" state - * - * @ingroup Panel - */ EAPI Eina_Bool elm_panel_hidden_get(const Evas_Object *obj) { @@ -472,13 +389,6 @@ elm_panel_hidden_get(const Evas_Object *obj) return wd->hidden; } -/** - * Toggle the state of the panel from code - * - * @param obj The panel object - * - * @ingroup Panel - */ EAPI void elm_panel_toggle(Evas_Object *obj) {