Fix more nasty formatting.

Reduce repeated code.


SVN revision: 42753
This commit is contained in:
Christopher Michael 2009-09-28 03:23:54 +00:00
parent 9a25a4bb87
commit 803e07e83b
1 changed files with 82 additions and 81 deletions

View File

@ -17,8 +17,7 @@ typedef struct _Subinfo Subinfo;
struct _Widget_Data
{
Evas_Object *notify;
Evas_Object *content;
Evas_Object *notify, *content;
Elm_Notify_Orient orient;
@ -38,6 +37,7 @@ static void _content_resize(void *data, Evas *e, Evas_Object *obj, void *event_i
_del_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
free(wd);
}
@ -45,9 +45,11 @@ _del_hook(Evas_Object *obj)
_theme_hook(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
_elm_theme_set(wd->notify, "notify", "base", "default");
edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) * _elm_config->scale);
edje_object_scale_set(wd->notify, elm_widget_scale_get(obj) *
_elm_config->scale);
_sizing_eval(obj);
}
@ -65,6 +67,7 @@ _sizing_eval(Evas_Object *obj)
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(data);
edje_object_part_swallow(wd->notify, "elm.swallow.content", obj);
_sizing_eval(data);
}
@ -74,8 +77,10 @@ _sub_del(void *data, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *sub = event_info;
evas_object_event_callback_del
(wd->content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints);
evas_object_event_callback_del(wd->content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints);
evas_object_del(wd->content);
if (wd->timer)
{
@ -90,10 +95,10 @@ _resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
_calc(obj);
}
static void _calc(Evas_Object *obj)
static void
_calc(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
Evas_Coord x, y, w, h;
@ -108,37 +113,30 @@ static void _calc(Evas_Object *obj)
{
case ELM_NOTIFY_ORIENT_TOP:
evas_object_move(wd->notify, x + offx, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM:
evas_object_move(wd->notify, x + offx, h - minh);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_LEFT:
evas_object_move(wd->notify, 0, y + offy);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_RIGHT:
evas_object_move(wd->notify, w - minw, y + offy);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_TOP_LEFT:
evas_object_move(wd->notify, 0, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_TOP_RIGHT:
evas_object_move(wd->notify, w - minw, 0);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM_LEFT:
evas_object_move(wd->notify, 0, h - minh);
evas_object_resize(wd->notify, minw, minh);
break;
case ELM_NOTIFY_ORIENT_BOTTOM_RIGHT:
evas_object_move(wd->notify, w - minw, h - minh);
evas_object_resize(wd->notify, minw, minh);
break;
}
evas_object_resize(wd->notify, minw, minh);
}
}
@ -151,7 +149,6 @@ _timer_cb(void *data)
wd->timer = NULL;
evas_object_hide(obj);
return 0;
}
@ -159,8 +156,8 @@ _timer_cb(void *data)
_show(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
evas_object_show(wd->notify);
evas_object_show(wd->notify);
if (wd->timer)
{
ecore_timer_del(wd->timer);
@ -174,6 +171,7 @@ _show(void *data, Evas *e, Evas_Object *obj, void *event_info)
_hide(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Widget_Data *wd = elm_widget_data_get(obj);
evas_object_hide(wd->notify);
if (wd->timer)
@ -240,7 +238,8 @@ elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
{
elm_widget_sub_object_add(obj, content);
edje_object_part_swallow(wd->notify, "elm.swallow.content", content);
evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
evas_object_event_callback_add(content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
wd->content = content;
_sizing_eval(obj);
@ -258,6 +257,7 @@ elm_notify_content_set(Evas_Object *obj, Evas_Object *content)
elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient)
{
Widget_Data *wd = elm_widget_data_get(obj);
wd->orient = orient;
switch (orient)
{
@ -301,6 +301,7 @@ elm_notify_orient_set(Evas_Object *obj, Elm_Notify_Orient orient)
elm_notify_timeout_set(Evas_Object *obj, int timeout)
{
Widget_Data *wd = elm_widget_data_get(obj);
wd->timeout = timeout;
elm_notify_timer_init(obj);
}
@ -313,8 +314,8 @@ elm_notify_timeout_set(Evas_Object *obj, int timeout)
elm_notify_timer_init(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
if(wd->timer)
ecore_timer_del(wd->timer);
if (wd->timer) ecore_timer_del(wd->timer);
wd->timer = NULL;
if (wd->timeout>0)
wd->timer = ecore_timer_add(wd->timeout, _timer_cb, obj);