summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrii Kroitor <an.kroitor@samsung.com>2013-11-01 11:03:30 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-11-01 11:03:34 +0900
commit3973ecf2e80b0546bcd26cc7a56b6719f0263fee (patch)
tree127d70372d911e2260ecb0304e6e9dc24af98e3d /src
parent848cc1d1ea1fc99bf5c8181a6735a414c178076f (diff)
edje: make functions return Eina_Bool and fix documentation.
Make the following functions return Eina_Bool so the caller can detect errors: edje_edit_part_drag_x_set edje_edit_part_drag_y_set edje_edit_part_drag_step_x_set edje_edit_part_drag_step_y_set edje_edit_part_drag_count_x_set edje_edit_part_drag_count_y_set Added functions for threshold: edje_edit_part_drag_threshold_set edje_edit_part_drag_threshold_get Fixed description of 'count' parameter of dragable.x/y Reviewers: cedric, seoz Reviewed By: cedric CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D304 Signed-off-by: Cedric Bail <cedric.bail@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/bin/edje/edje_cc_handlers.c6
-rw-r--r--src/lib/edje/Edje_Edit.h43
-rw-r--r--src/lib/edje/edje_edit.c56
3 files changed, 69 insertions, 36 deletions
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 0c1e5cafc0..76cf7e19a0 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -4369,7 +4369,8 @@ st_collections_group_parts_part_access(void)
4369 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second 4369 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
4370 parameter takes any integer and will limit movement to values 4370 parameter takes any integer and will limit movement to values
4371 divisible by it, causing the part to jump from position to position. 4371 divisible by it, causing the part to jump from position to position.
4372 The third parameter, (question from the author: What is count for?). 4372 If step is set to 0 it is calculated as width of confine part divided by
4373 count.
4373 @endproperty 4374 @endproperty
4374*/ 4375*/
4375static void 4376static void
@@ -4394,7 +4395,8 @@ st_collections_group_parts_part_dragable_x(void)
4394 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second 4395 enabled, 1 will set the starting point at 0.0 and -1 at 1.0. The second
4395 parameter takes any integer and will limit movement to values 4396 parameter takes any integer and will limit movement to values
4396 divisibles by it, causing the part to jump from position to position. 4397 divisibles by it, causing the part to jump from position to position.
4397 The third parameter, (question from the author: What is count for?). 4398 If step is set to 0 it is calculated as height of confine part divided by
4399 count.
4398 @endproperty 4400 @endproperty
4399*/ 4401*/
4400static void 4402static void
diff --git a/src/lib/edje/Edje_Edit.h b/src/lib/edje/Edje_Edit.h
index ab7bda6ff7..10ad69fc80 100644
--- a/src/lib/edje/Edje_Edit.h
+++ b/src/lib/edje/Edje_Edit.h
@@ -1026,8 +1026,10 @@ EAPI int edje_edit_part_drag_x_get(Evas_Object *obj, const char *part);
1026 * @param obj Object being edited. 1026 * @param obj Object being edited.
1027 * @param part Part to set if should be dragged horizontally. 1027 * @param part Part to set if should be dragged horizontally.
1028 * @param drag 1 (or -1) if the part should be dragged horizontally, 0 otherwise. 1028 * @param drag 1 (or -1) if the part should be dragged horizontally, 0 otherwise.
1029 *
1030 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1029 */ 1031 */
1030EAPI void edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag); 1032EAPI Eina_Bool edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag);
1031 1033
1032/** Get vertical dragable state for part. 1034/** Get vertical dragable state for part.
1033 * 1035 *
@@ -1043,8 +1045,10 @@ EAPI int edje_edit_part_drag_y_get(Evas_Object *obj, const char *part);
1043 * @param obj Object being edited. 1045 * @param obj Object being edited.
1044 * @param part Part to set if should be dragged vertically. 1046 * @param part Part to set if should be dragged vertically.
1045 * @param drag 1 (or -1) of the part shpuld be dragged vertically, 0 otherwise. 1047 * @param drag 1 (or -1) of the part shpuld be dragged vertically, 0 otherwise.
1048 *
1049 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1046 */ 1050 */
1047EAPI void edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag); 1051EAPI Eina_Bool edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag);
1048 1052
1049/** Get horizontal dragable step for part. 1053/** Get horizontal dragable step for part.
1050 * 1054 *
@@ -1060,8 +1064,10 @@ EAPI int edje_edit_part_drag_step_x_get(Evas_Object *obj, const char *part);
1060 * @param obj Object being edited. 1064 * @param obj Object being edited.
1061 * @param part Part to set the drag horizontal step value. 1065 * @param part Part to set the drag horizontal step value.
1062 * @param step The step the will be dragged. 1066 * @param step The step the will be dragged.
1067 *
1068 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1063 */ 1069 */
1064EAPI void edje_edit_part_drag_step_x_set(Evas_Object *obj, const char *part, int step); 1070EAPI Eina_Bool edje_edit_part_drag_step_x_set(Evas_Object *obj, const char *part, int step);
1065 1071
1066/** Get vertical dragable step for part. 1072/** Get vertical dragable step for part.
1067 * 1073 *
@@ -1077,8 +1083,10 @@ EAPI int edje_edit_part_drag_step_y_get(Evas_Object *obj, const char *part);
1077 * @param obj Object being edited. 1083 * @param obj Object being edited.
1078 * @param part Part to set the drag vertical step value. 1084 * @param part Part to set the drag vertical step value.
1079 * @param step The step the will be dragged. 1085 * @param step The step the will be dragged.
1086 *
1087 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1080 */ 1088 */
1081EAPI void edje_edit_part_drag_step_y_set(Evas_Object *obj, const char *part, int step); 1089EAPI Eina_Bool edje_edit_part_drag_step_y_set(Evas_Object *obj, const char *part, int step);
1082 1090
1083/** Get horizontal dragable count for part. 1091/** Get horizontal dragable count for part.
1084 * 1092 *
@@ -1092,8 +1100,10 @@ EAPI int edje_edit_part_drag_count_x_get(Evas_Object *obj, const char *part);
1092 * @param obj Object being edited. 1100 * @param obj Object being edited.
1093 * @param part Part to set the drag horizontal count value. 1101 * @param part Part to set the drag horizontal count value.
1094 * @param count The count value. 1102 * @param count The count value.
1103 *
1104 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1095 */ 1105 */
1096EAPI void edje_edit_part_drag_count_x_set(Evas_Object *obj, const char *part, int count); 1106EAPI Eina_Bool edje_edit_part_drag_count_x_set(Evas_Object *obj, const char *part, int count);
1097 1107
1098/** Get vertical dragable count for part. 1108/** Get vertical dragable count for part.
1099 * 1109 *
@@ -1107,8 +1117,10 @@ EAPI int edje_edit_part_drag_count_y_get(Evas_Object *obj, const char *part);
1107 * @param obj Object being edited. 1117 * @param obj Object being edited.
1108 * @param part Part to set the drag vertical count value. 1118 * @param part Part to set the drag vertical count value.
1109 * @param count The count value. 1119 * @param count The count value.
1120 *
1121 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1110 */ 1122 */
1111EAPI void edje_edit_part_drag_count_y_set(Evas_Object *obj, const char *part, int count); 1123EAPI Eina_Bool edje_edit_part_drag_count_y_set(Evas_Object *obj, const char *part, int count);
1112 1124
1113/** Get the name of the part that is used as 'confine' for the given draggies. 1125/** Get the name of the part that is used as 'confine' for the given draggies.
1114 * 1126 *
@@ -1148,6 +1160,25 @@ EAPI const char * edje_edit_part_drag_event_get(Evas_Object *obj, const char *pa
1148 */ 1160 */
1149EAPI Eina_Bool edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event); 1161EAPI Eina_Bool edje_edit_part_drag_event_set(Evas_Object *obj, const char *part, const char *event);
1150 1162
1163/** Get the name of the part that is used as 'threshold' for the given draggies.
1164 *
1165 * @param obj Object being edited.
1166 * @param part Part to get the name that is used as 'threshold' for the given draggies.
1167 *
1168 * @return The name of the threshold part or NULL (if unset).
1169 */
1170EAPI const char * edje_edit_part_drag_threshold_get(Evas_Object *obj, const char *part);
1171
1172/** Set the name of the part that is used as 'threshold' for the given draggies.
1173 *
1174 * @param obj Object being edited.
1175 * @param part Part to set the name that is used as 'threshold' for the given draggies.
1176 * @param confine The name of the threshold part or NULL to unset confine.
1177 *
1178 * @return EINA_TRUE if successful, EINA_FALSE otherwise.
1179 */
1180EAPI Eina_Bool edje_edit_part_drag_threshold_set(Evas_Object *obj, const char *part, const char *threshold);
1181
1151 1182
1152//@} 1183//@}
1153/******************************************************************************/ 1184/******************************************************************************/
diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c
index 2699604d1b..46ad74c97d 100644
--- a/src/lib/edje/edje_edit.c
+++ b/src/lib/edje/edje_edit.c
@@ -2506,76 +2506,75 @@ EAPI int
2506edje_edit_part_drag_x_get(Evas_Object *obj, const char *part) 2506edje_edit_part_drag_x_get(Evas_Object *obj, const char *part)
2507{ 2507{
2508 GET_RP_OR_RETURN(0); 2508 GET_RP_OR_RETURN(0);
2509 //printf("Get dragX for part: %s\n", part);
2510 return rp->part->dragable.x; 2509 return rp->part->dragable.x;
2511} 2510}
2512 2511
2513EAPI void 2512EAPI Eina_Bool
2514edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag) 2513edje_edit_part_drag_x_set(Evas_Object *obj, const char *part, int drag)
2515{ 2514{
2516 GET_RP_OR_RETURN(); 2515 GET_RP_OR_RETURN(EINA_FALSE);
2517 //printf("Set dragX for part: %s\n", part);
2518 rp->part->dragable.x = drag; 2516 rp->part->dragable.x = drag;
2519 2517
2520 if (!drag && !rp->part->dragable.y) 2518 if (!drag && !rp->part->dragable.y)
2521 { 2519 {
2522 free(rp->drag); 2520 free(rp->drag);
2523 rp->drag = NULL; 2521 rp->drag = NULL;
2524 return; 2522 return EINA_TRUE;
2525 } 2523 }
2526 2524
2527 if (rp->drag) return; 2525 if (rp->drag) return EINA_TRUE;
2528 2526
2529 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag)); 2527 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
2530 if (!rp->drag) return; 2528 if (!rp->drag) return EINA_FALSE;
2531 2529
2532 rp->drag->step.x = rp->part->dragable.step_x; 2530 rp->drag->step.x = rp->part->dragable.step_x;
2533 rp->drag->step.y = rp->part->dragable.step_y; 2531 rp->drag->step.y = rp->part->dragable.step_y;
2532 return EINA_TRUE;
2534} 2533}
2535 2534
2536EAPI int 2535EAPI int
2537edje_edit_part_drag_y_get(Evas_Object *obj, const char *part) 2536edje_edit_part_drag_y_get(Evas_Object *obj, const char *part)
2538{ 2537{
2539 GET_RP_OR_RETURN(0); 2538 GET_RP_OR_RETURN(0);
2540 //printf("Get dragY for part: %s\n", part);
2541 return rp->part->dragable.y; 2539 return rp->part->dragable.y;
2542} 2540}
2543 2541
2544EAPI void 2542EAPI Eina_Bool
2545edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag) 2543edje_edit_part_drag_y_set(Evas_Object *obj, const char *part, int drag)
2546{ 2544{
2547 GET_RP_OR_RETURN(); 2545 GET_RP_OR_RETURN(EINA_FALSE);
2548 //printf("Set dragY for part: %s\n", part);
2549 rp->part->dragable.y = drag; 2546 rp->part->dragable.y = drag;
2550 2547
2551 if (!drag && !rp->part->dragable.x) 2548 if (!drag && !rp->part->dragable.x)
2552 { 2549 {
2553 free(rp->drag); 2550 free(rp->drag);
2554 rp->drag = NULL; 2551 rp->drag = NULL;
2555 return; 2552 return EINA_TRUE;
2556 } 2553 }
2557 2554
2558 if (rp->drag) return; 2555 if (rp->drag) return EINA_TRUE;
2559 2556
2560 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag)); 2557 rp->drag = _alloc(sizeof (Edje_Real_Part_Drag));
2561 if (!rp->drag) return; 2558 if (!rp->drag) return EINA_FALSE;
2562 2559
2563 rp->drag->step.x = rp->part->dragable.step_x; 2560 rp->drag->step.x = rp->part->dragable.step_x;
2564 rp->drag->step.y = rp->part->dragable.step_y; 2561 rp->drag->step.y = rp->part->dragable.step_y;
2562 return EINA_TRUE;
2565} 2563}
2566 2564
2567#define FUNC_PART_DRAG_INT(Class, Value) \ 2565#define FUNC_PART_DRAG_INT(Class, Value) \
2568 EAPI int \ 2566 EAPI int \
2569 edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \ 2567 edje_edit_part_drag_##Class##_##Value##_get(Evas_Object *obj, const char *part) \
2570 { \ 2568 { \
2571 GET_RP_OR_RETURN(0); \ 2569 GET_RP_OR_RETURN(0); \
2572 return rp->part->dragable.Class##_##Value; \ 2570 return rp->part->dragable.Class##_##Value; \
2573 } \ 2571 } \
2574 EAPI void \ 2572 EAPI Eina_Bool \
2575 edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \ 2573 edje_edit_part_drag_##Class##_##Value##_set(Evas_Object *obj, const char *part, int v) \
2576 { \ 2574 { \
2577 GET_RP_OR_RETURN(); \ 2575 GET_RP_OR_RETURN(EINA_FALSE); \
2578 rp->part->dragable.Class##_##Value = v; \ 2576 rp->part->dragable.Class##_##Value = v; \
2577 return EINA_TRUE; \
2579 } 2578 }
2580 2579
2581FUNC_PART_DRAG_INT(step, x); 2580FUNC_PART_DRAG_INT(step, x);
@@ -2620,6 +2619,7 @@ FUNC_PART_DRAG_INT(count, y);
2620 2619
2621FUNC_PART_DRAG_ID(confine); 2620FUNC_PART_DRAG_ID(confine);
2622FUNC_PART_DRAG_ID(event); 2621FUNC_PART_DRAG_ID(event);
2622FUNC_PART_DRAG_ID(threshold);
2623 2623
2624/*********************/ 2624/*********************/
2625/* PART STATES API */ 2625/* PART STATES API */