From: Mike Blumenkrantz Date: Mon, 18 Feb 2013 13:43:40 +0000 (+0000) Subject: formatting X-Git-Tag: submit/efl/20131021.015651~1226 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e466612d630edba1066a58c08494b8c610a9937;p=platform%2Fupstream%2Fenlightenment.git formatting SVN revision: 84059 --- diff --git a/src/bin/e_gadcon_popup.c b/src/bin/e_gadcon_popup.c index 4d91bac..58ca9ad 100644 --- a/src/bin/e_gadcon_popup.c +++ b/src/bin/e_gadcon_popup.c @@ -1,127 +1,6 @@ #include "e.h" /* local subsystem functions */ -static void _e_gadcon_popup_free(E_Gadcon_Popup *pop); -static void _e_gadcon_popup_locked_set(E_Gadcon_Popup *pop, Eina_Bool locked); -static void _e_gadcon_popup_size_recalc(E_Gadcon_Popup *pop, Evas_Object *obj); -static void _e_gadcon_popup_position(E_Gadcon_Popup *pop); -static void _e_gadcon_popup_changed_size_hints_cb(void *data, Evas *e, Evas_Object *obj, void *event_info); - -/* externally accessible functions */ - -EAPI E_Gadcon_Popup * -e_gadcon_popup_new(E_Gadcon_Client *gcc) -{ - E_Gadcon_Popup *pop; - Evas_Object *o; - E_Zone *zone; - - pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free); - if (!pop) return NULL; - zone = e_gadcon_client_zone_get(gcc); - pop->win = e_popup_new(zone, 0, 0, 0, 0); - e_popup_layer_set(pop->win, E_LAYER_POPUP); - - o = edje_object_add(pop->win->evas); - e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup"); - evas_object_show(o); - evas_object_move(o, 0, 0); - e_popup_edje_bg_object_set(pop->win, o); - pop->o_bg = o; - - pop->gcc = gcc; - pop->gadcon_lock = 1; - pop->gadcon_was_locked = 0; - - return pop; -} - -EAPI void -e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o) -{ - Evas_Object *old_o; - - if (!pop) return; - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); - - old_o = edje_object_part_swallow_get(pop->o_bg, "e.swallow.content"); - if (old_o != o) - { - if (old_o) - { - edje_object_part_unswallow(pop->o_bg, old_o); - evas_object_del(old_o); - } - edje_object_part_swallow(pop->o_bg, "e.swallow.content", o); - evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, - _e_gadcon_popup_changed_size_hints_cb, pop); - } - - _e_gadcon_popup_size_recalc(pop, o); -} - -EAPI void -e_gadcon_popup_show(E_Gadcon_Popup *pop) -{ - if (!pop) return; - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); - - if (pop->win->visible) return; - - e_popup_show(pop->win); - - _e_gadcon_popup_position(pop); -} - -EAPI void -e_gadcon_popup_hide(E_Gadcon_Popup *pop) -{ - if (!pop) return; - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); - if (pop->pinned) return; - e_popup_hide(pop->win); - if (pop->gadcon_was_locked) - _e_gadcon_popup_locked_set(pop, 0); -} - -EAPI void -e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop) -{ - if (!pop) return; - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); - - if (pop->pinned) - { - pop->pinned = 0; - edje_object_signal_emit(pop->o_bg, "e,state,unpinned", "e"); - } - else - { - pop->pinned = 1; - edje_object_signal_emit(pop->o_bg, "e,state,pinned", "e"); - } -} - -EAPI void -e_gadcon_popup_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting) -{ - if (!pop) return; - E_OBJECT_CHECK(pop); - E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); - - setting = !!setting; - if (pop->gadcon_lock == setting) return; - pop->gadcon_lock = setting; - - if (setting != pop->gadcon_was_locked) - _e_gadcon_popup_locked_set(pop, setting); -} - -/* local subsystem functions */ static void _e_gadcon_popup_free(E_Gadcon_Popup *pop) @@ -255,3 +134,116 @@ _e_gadcon_popup_changed_size_hints_cb(void *data, Evas *e __UNUSED__, Evas_Objec _e_gadcon_popup_size_recalc(pop, obj); } +/* externally accessible functions */ + +EAPI E_Gadcon_Popup * +e_gadcon_popup_new(E_Gadcon_Client *gcc) +{ + E_Gadcon_Popup *pop; + Evas_Object *o; + E_Zone *zone; + + pop = E_OBJECT_ALLOC(E_Gadcon_Popup, E_GADCON_POPUP_TYPE, _e_gadcon_popup_free); + if (!pop) return NULL; + zone = e_gadcon_client_zone_get(gcc); + pop->win = e_popup_new(zone, 0, 0, 0, 0); + e_popup_layer_set(pop->win, E_LAYER_POPUP); + + o = edje_object_add(pop->win->evas); + e_theme_edje_object_set(o, "base/theme/gadman", "e/gadman/popup"); + evas_object_show(o); + evas_object_move(o, 0, 0); + e_popup_edje_bg_object_set(pop->win, o); + pop->o_bg = o; + + pop->gcc = gcc; + pop->gadcon_lock = 1; + pop->gadcon_was_locked = 0; + + return pop; +} + +EAPI void +e_gadcon_popup_content_set(E_Gadcon_Popup *pop, Evas_Object *o) +{ + Evas_Object *old_o; + + if (!pop) return; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); + + old_o = edje_object_part_swallow_get(pop->o_bg, "e.swallow.content"); + if (old_o != o) + { + if (old_o) + { + edje_object_part_unswallow(pop->o_bg, old_o); + evas_object_del(old_o); + } + edje_object_part_swallow(pop->o_bg, "e.swallow.content", o); + evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _e_gadcon_popup_changed_size_hints_cb, pop); + } + + _e_gadcon_popup_size_recalc(pop, o); +} + +EAPI void +e_gadcon_popup_show(E_Gadcon_Popup *pop) +{ + if (!pop) return; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); + + if (pop->win->visible) return; + + e_popup_show(pop->win); + + _e_gadcon_popup_position(pop); +} + +EAPI void +e_gadcon_popup_hide(E_Gadcon_Popup *pop) +{ + if (!pop) return; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); + if (pop->pinned) return; + e_popup_hide(pop->win); + if (pop->gadcon_was_locked) + _e_gadcon_popup_locked_set(pop, 0); +} + +EAPI void +e_gadcon_popup_toggle_pinned(E_Gadcon_Popup *pop) +{ + if (!pop) return; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); + + if (pop->pinned) + { + pop->pinned = 0; + edje_object_signal_emit(pop->o_bg, "e,state,unpinned", "e"); + } + else + { + pop->pinned = 1; + edje_object_signal_emit(pop->o_bg, "e,state,pinned", "e"); + } +} + +EAPI void +e_gadcon_popup_lock_set(E_Gadcon_Popup *pop, Eina_Bool setting) +{ + if (!pop) return; + E_OBJECT_CHECK(pop); + E_OBJECT_TYPE_CHECK(pop, E_GADCON_POPUP_TYPE); + + setting = !!setting; + if (pop->gadcon_lock == setting) return; + pop->gadcon_lock = setting; + + if (setting != pop->gadcon_was_locked) + _e_gadcon_popup_locked_set(pop, setting); +}