summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2011-10-25 00:27:18 +0000
committerChunEon Park <hermet@hermet.pe.kr>2011-10-25 00:27:18 +0000
commit9776b37332f0ce49993931d043255fd1946ef6c5 (patch)
treeb1dd4baaf5655892bd5bc1ac6e411d8adb7ac96c /legacy
parent5c28065815a935445f654aeebd8cc16ff3de580b (diff)
elemenatry/ctxpopup - proper coding convention.
SVN revision: 64367
Diffstat (limited to 'legacy')
-rw-r--r--legacy/elementary/src/lib/elc_ctxpopup.c71
1 files changed, 45 insertions, 26 deletions
diff --git a/legacy/elementary/src/lib/elc_ctxpopup.c b/legacy/elementary/src/lib/elc_ctxpopup.c
index 871fe63795..0305b9a9fb 100644
--- a/legacy/elementary/src/lib/elc_ctxpopup.c
+++ b/legacy/elementary/src/lib/elc_ctxpopup.c
@@ -497,6 +497,7 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
497 Evas_Coord_Rectangle arrow_size; 497 Evas_Coord_Rectangle arrow_size;
498 Evas_Coord_Rectangle base_size; 498 Evas_Coord_Rectangle base_size;
499 Widget_Data *wd; 499 Widget_Data *wd;
500 double drag;
500 501
501 wd = elm_widget_data_get(obj); 502 wd = elm_widget_data_get(obj);
502 if (!wd) return; 503 if (!wd) return;
@@ -513,7 +514,9 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
513 { 514 {
514 case ELM_CTXPOPUP_DIRECTION_RIGHT: 515 case ELM_CTXPOPUP_DIRECTION_RIGHT:
515 edje_object_signal_emit(wd->arrow, "elm,state,left", "elm"); 516 edje_object_signal_emit(wd->arrow, "elm,state,left", "elm");
516 edje_object_part_swallow(wd->base, "elm.swallow.arrow_left", wd->arrow); 517 edje_object_part_swallow(wd->base,
518 "elm.swallow.arrow_left",
519 wd->arrow);
517 if (base_size.h > 0) 520 if (base_size.h > 0)
518 { 521 {
519 if (y < ((arrow_size.h * 0.5) + base_size.y)) 522 if (y < ((arrow_size.h * 0.5) + base_size.y))
@@ -522,51 +525,68 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
522 y = base_size.h - arrow_size.h; 525 y = base_size.h - arrow_size.h;
523 else 526 else
524 y = y - base_size.y - (arrow_size.h * 0.5); 527 y = y - base_size.y - (arrow_size.h * 0.5);
525 edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_left", 1, 528 drag = (double) (y) / (double) (base_size.h - arrow_size.h);
526 (double) (y) / (double) (base_size.h - arrow_size.h)); 529 edje_object_part_drag_value_set(wd->base,
530 "elm.swallow.arrow_left",
531 1,
532 drag);
527 } 533 }
528 break; 534 break;
529 case ELM_CTXPOPUP_DIRECTION_LEFT: 535 case ELM_CTXPOPUP_DIRECTION_LEFT:
530 edje_object_signal_emit(wd->arrow, "elm,state,right", "elm"); 536 edje_object_signal_emit(wd->arrow, "elm,state,right", "elm");
531 edje_object_part_swallow(wd->base, "elm.swallow.arrow_right", wd->arrow); 537 edje_object_part_swallow(wd->base,
538 "elm.swallow.arrow_right",
539 wd->arrow);
532 if (base_size.h > 0) 540 if (base_size.h > 0)
533 { 541 {
534 if (y < (arrow_size.h * 0.5) + base_size.y) 542 if (y < ((arrow_size.h * 0.5) + base_size.y))
535 y = 0; 543 y = 0;
536 else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5))) 544 else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
537 y = base_size.h - arrow_size.h; 545 y = base_size.h - arrow_size.h;
538 else y = y - base_size.y - (arrow_size.h * 0.5); 546 else
539 edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_right", 0, 547 y = y - base_size.y - (arrow_size.h * 0.5);
540 (double) (y) / (double) (base_size.h - arrow_size.h)); 548 drag = (double) (y) / (double) (base_size.h - arrow_size.h);
541 } 549 edje_object_part_drag_value_set(wd->base,
550 "elm.swallow.arrow_right",
551 0,
552 drag);
553 }
542 break; 554 break;
543 case ELM_CTXPOPUP_DIRECTION_DOWN: 555 case ELM_CTXPOPUP_DIRECTION_DOWN:
544 edje_object_signal_emit(wd->arrow, "elm,state,top", "elm"); 556 edje_object_signal_emit(wd->arrow, "elm,state,top", "elm");
545 edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow); 557 edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow);
546 if (base_size.w > 0) 558 if (base_size.w > 0)
547 { 559 {
548 if (x < (arrow_size.w * 0.5) + base_size.x) 560 if (x < ((arrow_size.w * 0.5) + base_size.x))
549 x = 0; 561 x = 0;
550 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) 562 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
551 x = base_size.w - arrow_size.w; 563 x = base_size.w - arrow_size.w;
552 else 564 else
553 x = x - base_size.x - (arrow_size.w * 0.5); 565 x = x - base_size.x - (arrow_size.w * 0.5);
554 edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_up", 566 drag = (double) (x) / (double) (base_size.w - arrow_size.w);
555 (double) (x) / (double) (base_size.w - arrow_size.w), 1); 567 edje_object_part_drag_value_set(wd->base,
568 "elm.swallow.arrow_up",
569 drag,
570 1);
556 } 571 }
557 break; 572 break;
558 case ELM_CTXPOPUP_DIRECTION_UP: 573 case ELM_CTXPOPUP_DIRECTION_UP:
559 edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); 574 edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm");
560 edje_object_part_swallow(wd->base, "elm.swallow.arrow_down", wd->arrow); 575 edje_object_part_swallow(wd->base,
576 "elm.swallow.arrow_down",
577 wd->arrow);
561 if (base_size.w > 0) 578 if (base_size.w > 0)
562 { 579 {
563 if (x < (arrow_size.w * 0.5) + base_size.x) 580 if (x < ((arrow_size.w * 0.5) + base_size.x))
564 x = 0; 581 x = 0;
565 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5))) 582 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
566 x = base_size.w - arrow_size.w; 583 x = base_size.w - arrow_size.w;
567 else x = x - base_size.x - (arrow_size.w * 0.5); 584 else x = x - base_size.x - (arrow_size.w * 0.5);
568 edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_down", 585 drag = (double) (x) / (double) (base_size.w - arrow_size.w);
569 (double) (x) / (double) (base_size.w - arrow_size.w), 0); 586 edje_object_part_drag_value_set(wd->base,
587 "elm.swallow.arrow_down",
588 drag,
589 0);
570 } 590 }
571 break; 591 break;
572 default: 592 default:
@@ -721,6 +741,13 @@ _theme_hook(Evas_Object *obj)
721 _elm_widget_mirrored_reload(obj); 741 _elm_widget_mirrored_reload(obj);
722 rtl = elm_widget_mirrored_get(obj); 742 rtl = elm_widget_mirrored_get(obj);
723 743
744 _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg",
745 elm_widget_style_get(obj));
746 _elm_theme_object_set(obj, wd->base, "ctxpopup", "base",
747 elm_widget_style_get(obj));
748 _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow",
749 elm_widget_style_get(obj));
750
724 //Items 751 //Items
725 EINA_LIST_FOREACH(wd->items, elist, item) 752 EINA_LIST_FOREACH(wd->items, elist, item)
726 { 753 {
@@ -745,17 +772,9 @@ _theme_hook(Evas_Object *obj)
745 edje_object_message_signal_process(VIEW(item)); 772 edje_object_message_signal_process(VIEW(item));
746 } 773 }
747 774
748 _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg",
749 elm_widget_style_get(obj));
750 _elm_theme_object_set(obj, wd->base, "ctxpopup", "base",
751 elm_widget_style_get(obj));
752 _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow",
753 elm_widget_style_get(obj));
754
755 if (wd->scr) 775 if (wd->scr)
756 { 776 {
757 if (!strncmp(elm_object_style_get(obj), "default", 777 if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
758 strlen("default")))
759 elm_object_style_set(wd->scr, "ctxpopup"); 778 elm_object_style_set(wd->scr, "ctxpopup");
760 else 779 else
761 elm_object_style_set(wd->scr, elm_object_style_get(obj)); 780 elm_object_style_set(wd->scr, elm_object_style_get(obj));