Evas_Object *obj;
Evas_Coord corner;
Eina_Bool init : 1;
+ Eina_Bool is_circle : 1;
} vg_button;
static void
Evas_Coord x, y, w, h;
evas_object_geometry_get(vd->vg[0], &x, &y, &w, &h);
evas_vg_shape_shape_reset(vd->shape[0]);
- if (vd->corner)
- evas_vg_shape_shape_append_rect(vd->shape[0], 0, 0, w, h, vd->corner, vd->corner);
- else
+ if (vd->is_circle)
{
int radius_w = w / 2;
int radius_h = h / 2;
- evas_vg_shape_shape_append_circle(vd->shape[0], radius_w, radius_h, radius_h);
+ evas_vg_shape_shape_append_circle(vd->shape[0], radius_w, radius_h, radius_w);
}
+ else
+ evas_vg_shape_shape_append_rect(vd->shape[0], 0, 0, w, h, vd->corner, vd->corner);
}
static void
evas_object_event_callback_add(vd->vg[0], EVAS_CALLBACK_DEL,
button_no_bg_del_cb, vd);
- const char *str = elm_layout_data_get(obj, "corner_radius");
- if (str) vd->corner = ELM_VG_SCALE_SIZE(obj, atoi(str));
+ // Check whether the button has circle shape.
+ // When the button has no background and has circle shape,
+ // the vector_ux will be "no_bg/circle".
+ const char *str = elm_layout_data_get(obj, "vector_ux");
+ if (strstr(str, "circle"))
+ vd->is_circle = EINA_TRUE;
+ else
+ {
+ // Since it is not circle, it has rectangle shape.
+ str = elm_layout_data_get(obj, "corner_radius");
+ if (str) vd->corner = ELM_VG_SCALE_SIZE(obj, atoi(str));
+ }
evas_object_event_callback_add(vd->vg[0], EVAS_CALLBACK_RESIZE,
button_effect_no_bg_resize_cb, vd);
Evas_Coord x, y, w, h;
evas_object_geometry_get(vd->vg[1], &x, &y, &w, &h);
evas_vg_shape_shape_reset(vd->shape[1]);
- if (vd->corner)
- evas_vg_shape_shape_append_rect(vd->shape[1], 0, 0, w, h, vd->corner, vd->corner);
- else
+ if (vd->is_circle)
{
int radius_w = w / 2;
int radius_h = h / 2;
- if (w == h)
- evas_vg_shape_shape_append_circle(vd->shape[1], radius_w, radius_h, radius_w);
- else
- evas_vg_shape_shape_append_rect(vd->shape[1], 0, 0, w, h, radius_h, radius_h);
+ evas_vg_shape_shape_append_circle(vd->shape[1], radius_w, radius_h, radius_w);
}
+ else
+ evas_vg_shape_shape_append_rect(vd->shape[1], 0, 0, w, h, vd->corner, vd->corner);
}
static void
Evas_Coord w, h;
evas_object_geometry_get(vd->vg[0], NULL, NULL, &w, &h);
evas_vg_shape_shape_reset(vd->shape[0]);
- if (vd->corner)
- evas_vg_shape_shape_append_rect(vd->shape[0], 0, 0, w, h, vd->corner, vd->corner);
- else
+ if (vd->is_circle)
{
int radius_w = w / 2;
int radius_h = h / 2;
- if (w == h)
- evas_vg_shape_shape_append_circle(vd->shape[0], radius_w, radius_h, radius_w);
- else
- evas_vg_shape_shape_append_rect(vd->shape[0], 0, 0, w, h, radius_h, radius_h);
+ evas_vg_shape_shape_append_circle(vd->shape[0], radius_w, radius_h, radius_w);
}
+ else
+ evas_vg_shape_shape_append_rect(vd->shape[0], 0, 0, w, h, vd->corner, vd->corner);
}
static void
Evas *e = evas_object_evas_get(obj);
vd->obj = obj;
- const char *str = elm_layout_data_get(obj, "corner_radius");
- if (str) vd->corner = ELM_VG_SCALE_SIZE(obj, atoi(str));
+
+ // Check whether the button has circle shape.
+ // When the button has no background and has circle shape,
+ // the vector_ux will be "no_bg/circle".
+ const char *str = elm_layout_data_get(obj, "vector_ux");
+ if (strstr(str, "circle"))
+ vd->is_circle = EINA_TRUE;
+ else
+ {
+ // Since it is not circle, it has rectangle shape.
+ str = elm_layout_data_get(obj, "corner_radius");
+ if (str) vd->corner = ELM_VG_SCALE_SIZE(obj, atoi(str));
+ }
//Base VG
vd->vg[0] = evas_object_vg_add(e);
const char *str = elm_layout_data_get(obj, "vector_ux");
if (!str) return;
- if (!strcmp(str, "no_bg"))
+ // Check whether the button has a background.
+ if (!strncmp(str, "no_bg", strlen("no_bg")))
tizen_vg_button_no_bg_set(obj);
else
tizen_vg_button_default_set(obj);