diff options
author | Rafael Antognolli <antognolli@gmail.com> | 2011-09-15 18:51:27 +0000 |
---|---|---|
committer | Rafael Antognolli <antognolli@gmail.com> | 2011-09-15 18:51:27 +0000 |
commit | 5c3474beedf7618b927844b699b5e38ad62548b0 (patch) | |
tree | 1c00725f685e32bbee221caf8c2fa1b2b7576f9a /legacy/emotion/src/lib/emotion_smart.c | |
parent | 77f43424a6c0fa2d467ae9fd622012d5719c6d7a (diff) |
emotion/border: Add support for selecting the border colors.
This is a simple API that implements colors for the borders specified by
emotion_object_border_set(), using a background rectangle behind the
emotion object.
SVN revision: 63415
Diffstat (limited to '')
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 59ffb2a0a4..f9882b096c 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -55,6 +55,7 @@ struct _Smart_Data | |||
55 | 55 | ||
56 | const char *file; | 56 | const char *file; |
57 | Evas_Object *obj; | 57 | Evas_Object *obj; |
58 | Evas_Object *bg; | ||
58 | 59 | ||
59 | Ecore_Job *job; | 60 | Ecore_Job *job; |
60 | 61 | ||
@@ -492,7 +493,7 @@ emotion_object_border_set(Evas_Object *obj, int l, int r, int t, int b) | |||
492 | } | 493 | } |
493 | 494 | ||
494 | EAPI void | 495 | EAPI void |
495 | emotion_object_border_get(Evas_Object *obj, int *l, int *r, int *t, int *b) | 496 | emotion_object_border_get(const Evas_Object *obj, int *l, int *r, int *t, int *b) |
496 | { | 497 | { |
497 | Smart_Data *sd; | 498 | Smart_Data *sd; |
498 | 499 | ||
@@ -504,6 +505,33 @@ emotion_object_border_get(Evas_Object *obj, int *l, int *r, int *t, int *b) | |||
504 | } | 505 | } |
505 | 506 | ||
506 | EAPI void | 507 | EAPI void |
508 | emotion_object_bg_color_set(Evas_Object *obj, int r, int g, int b, int a) | ||
509 | { | ||
510 | Smart_Data *sd; | ||
511 | |||
512 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); | ||
513 | |||
514 | evas_object_color_set(sd->bg, r, g, b, a); | ||
515 | |||
516 | if (!evas_object_visible_get(obj)) | ||
517 | return; | ||
518 | |||
519 | if (a > 0) | ||
520 | evas_object_show(sd->bg); | ||
521 | else | ||
522 | evas_object_hide(sd->bg); | ||
523 | } | ||
524 | |||
525 | EAPI void | ||
526 | emotion_object_bg_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a) | ||
527 | { | ||
528 | Smart_Data *sd; | ||
529 | |||
530 | E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); | ||
531 | evas_object_color_get(sd->bg, r, g, b, a); | ||
532 | } | ||
533 | |||
534 | EAPI void | ||
507 | emotion_object_play_set(Evas_Object *obj, Eina_Bool play) | 535 | emotion_object_play_set(Evas_Object *obj, Eina_Bool play) |
508 | { | 536 | { |
509 | Smart_Data *sd; | 537 | Smart_Data *sd; |
@@ -1679,10 +1707,14 @@ _smart_add(Evas_Object * obj) | |||
1679 | EINA_REFCOUNT_INIT(sd); | 1707 | EINA_REFCOUNT_INIT(sd); |
1680 | sd->state = EMOTION_WAKEUP; | 1708 | sd->state = EMOTION_WAKEUP; |
1681 | sd->obj = evas_object_image_add(evas_object_evas_get(obj)); | 1709 | sd->obj = evas_object_image_add(evas_object_evas_get(obj)); |
1710 | sd->bg = evas_object_rectangle_add(evas_object_evas_get(obj)); | ||
1711 | evas_object_color_set(sd->bg, 0, 0, 0, 0); | ||
1682 | evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd); | 1712 | evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_MOVE, _mouse_move, sd); |
1683 | evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd); | 1713 | evas_object_event_callback_add(sd->obj, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, sd); |
1684 | evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd); | 1714 | evas_object_image_pixels_get_callback_set(sd->obj, _pixels_get, sd); |
1685 | evas_object_smart_member_add(sd->obj, obj); | 1715 | evas_object_smart_member_add(sd->obj, obj); |
1716 | evas_object_smart_member_add(sd->bg, obj); | ||
1717 | evas_object_lower(sd->bg); | ||
1686 | sd->ratio = 1.0; | 1718 | sd->ratio = 1.0; |
1687 | sd->spu.button = -1; | 1719 | sd->spu.button = -1; |
1688 | evas_object_image_alpha_set(sd->obj, 0); | 1720 | evas_object_image_alpha_set(sd->obj, 0); |
@@ -1719,6 +1751,7 @@ _smart_move(Evas_Object * obj, Evas_Coord x, Evas_Coord y) | |||
1719 | int vid_w, vid_h, w, h; | 1751 | int vid_w, vid_h, w, h; |
1720 | sd->module->video_data_size_get(sd->video, &vid_w, &vid_h); | 1752 | sd->module->video_data_size_get(sd->video, &vid_w, &vid_h); |
1721 | _clipper_position_size_update(obj, vid_w, vid_h); | 1753 | _clipper_position_size_update(obj, vid_w, vid_h); |
1754 | evas_object_move(sd->bg, x, y); | ||
1722 | } | 1755 | } |
1723 | 1756 | ||
1724 | static void | 1757 | static void |
@@ -1733,18 +1766,24 @@ _smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h) | |||
1733 | 1766 | ||
1734 | sd->module->video_data_size_get(sd->video, &vid_w, &vid_h); | 1767 | sd->module->video_data_size_get(sd->video, &vid_w, &vid_h); |
1735 | _clipper_position_size_update(obj, vid_w, vid_h); | 1768 | _clipper_position_size_update(obj, vid_w, vid_h); |
1769 | evas_object_resize(sd->bg, w, h); | ||
1736 | } | 1770 | } |
1737 | 1771 | ||
1738 | static void | 1772 | static void |
1739 | _smart_show(Evas_Object * obj) | 1773 | _smart_show(Evas_Object * obj) |
1740 | { | 1774 | { |
1741 | Smart_Data *sd; | 1775 | Smart_Data *sd; |
1776 | int a; | ||
1742 | 1777 | ||
1743 | sd = evas_object_smart_data_get(obj); | 1778 | sd = evas_object_smart_data_get(obj); |
1744 | if (!sd) return; | 1779 | if (!sd) return; |
1745 | evas_object_show(sd->obj); | 1780 | evas_object_show(sd->obj); |
1746 | if (sd->crop.clipper) | 1781 | if (sd->crop.clipper) |
1747 | evas_object_show(sd->crop.clipper); | 1782 | evas_object_show(sd->crop.clipper); |
1783 | |||
1784 | evas_object_color_get(sd->bg, NULL, NULL, NULL, &a); | ||
1785 | if (a > 0) | ||
1786 | evas_object_show(sd->bg); | ||
1748 | } | 1787 | } |
1749 | 1788 | ||
1750 | static void | 1789 | static void |
@@ -1757,6 +1796,7 @@ _smart_hide(Evas_Object * obj) | |||
1757 | evas_object_hide(sd->obj); | 1796 | evas_object_hide(sd->obj); |
1758 | if (sd->crop.clipper) | 1797 | if (sd->crop.clipper) |
1759 | evas_object_hide(sd->crop.clipper); | 1798 | evas_object_hide(sd->crop.clipper); |
1799 | evas_object_hide(sd->bg); | ||
1760 | } | 1800 | } |
1761 | 1801 | ||
1762 | static void | 1802 | static void |
@@ -1781,6 +1821,7 @@ _smart_clip_set(Evas_Object * obj, Evas_Object * clip) | |||
1781 | evas_object_clip_set(sd->crop.clipper, clip); | 1821 | evas_object_clip_set(sd->crop.clipper, clip); |
1782 | else | 1822 | else |
1783 | evas_object_clip_set(sd->obj, clip); | 1823 | evas_object_clip_set(sd->obj, clip); |
1824 | evas_object_clip_set(sd->bg, clip); | ||
1784 | } | 1825 | } |
1785 | 1826 | ||
1786 | static void | 1827 | static void |
@@ -1794,5 +1835,6 @@ _smart_clip_unset(Evas_Object * obj) | |||
1794 | evas_object_clip_unset(sd->crop.clipper); | 1835 | evas_object_clip_unset(sd->crop.clipper); |
1795 | else | 1836 | else |
1796 | evas_object_clip_unset(sd->obj); | 1837 | evas_object_clip_unset(sd->obj); |
1838 | evas_object_clip_unset(sd->bg); | ||
1797 | } | 1839 | } |
1798 | 1840 | ||