2017-08-29 03:04:15 -07:00
|
|
|
#include "test.h"
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2019-03-07 07:39:06 -08:00
|
|
|
#include <Efl_Ui.h>
|
2017-08-29 03:04:15 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
|
|
|
|
#define CR 100
|
|
|
|
|
2018-03-06 17:01:02 -08:00
|
|
|
#define TEST_UI_TEXTPATH_LONG_TEXT "This text follows the path which you defined. This is a <long> text designed to make it ellipsis."
|
|
|
|
#define TEST_UI_TEXTPATH_SHORT_TEXT "This text is short."
|
|
|
|
|
2017-08-29 03:04:15 -07:00
|
|
|
static Evas_Object *angle_sld, *slice_sld, *dir_chk;
|
|
|
|
static int path_type;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_ellipsis_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
efl_ui_textpath_ellipsis_set(txtpath, elm_check_state_get(event->object));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_direction_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
int angle = elm_slider_value_get(angle_sld);
|
|
|
|
Eina_Bool val = elm_check_selected_get(event->object);
|
|
|
|
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
|
|
|
|
EFL_UI_TEXTPATH_DIRECTION_CCW;
|
efl_ui_textpath: introduce efl_ui_textpath_circular_set() interface.
Summary:
This patch revises efl_ui_textpath_circle_set() interface.
Current circle_set() behavior is wrongly working,
it makes object minimal size with (x * 2, y * 2).
Insanely, how big size if the object is far from the screen origin.
Secondly, current interface requires center position,
How this center position could be guranteed if user wants to put it into a container?
Third, actual textpath output could be out of the textpath boundary,
since the textpath is originated to middle of text height.
the display boundary can be outside of the textpath geometry by (half of text height).
All in all, put altogether in fix,
I confirmed there is no methods without any compatibility break.
This brings elm_textpath_circular_set() api introduced.
@feature
Reviewers: #committers, kimcinoo, jsuya
Subscribers: zmike, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9260
2019-07-22 00:47:43 -07:00
|
|
|
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
|
2017-08-29 03:04:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_angle_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
int angle = elm_slider_value_get(event->object);
|
|
|
|
printf("angle: %d\n", angle);
|
|
|
|
Eina_Bool val = elm_check_selected_get(dir_chk);
|
|
|
|
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
|
|
|
|
EFL_UI_TEXTPATH_DIRECTION_CCW;
|
efl_ui_textpath: introduce efl_ui_textpath_circular_set() interface.
Summary:
This patch revises efl_ui_textpath_circle_set() interface.
Current circle_set() behavior is wrongly working,
it makes object minimal size with (x * 2, y * 2).
Insanely, how big size if the object is far from the screen origin.
Secondly, current interface requires center position,
How this center position could be guranteed if user wants to put it into a container?
Third, actual textpath output could be out of the textpath boundary,
since the textpath is originated to middle of text height.
the display boundary can be outside of the textpath geometry by (half of text height).
All in all, put altogether in fix,
I confirmed there is no methods without any compatibility break.
This brings elm_textpath_circular_set() api introduced.
@feature
Reviewers: #committers, kimcinoo, jsuya
Subscribers: zmike, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9260
2019-07-22 00:47:43 -07:00
|
|
|
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
|
2017-08-29 03:04:15 -07:00
|
|
|
}
|
|
|
|
|
2018-03-06 17:01:02 -08:00
|
|
|
static void
|
|
|
|
_short_text_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
Eina_Bool val = elm_check_selected_get(event->object);
|
|
|
|
|
|
|
|
if (val)
|
|
|
|
efl_text_set(txtpath, TEST_UI_TEXTPATH_SHORT_TEXT);
|
|
|
|
else
|
|
|
|
efl_text_set(txtpath, TEST_UI_TEXTPATH_LONG_TEXT);
|
|
|
|
}
|
|
|
|
|
2017-08-29 03:04:15 -07:00
|
|
|
static void
|
|
|
|
_change_shape_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
|
|
|
|
efl_gfx_path_reset(txtpath);
|
|
|
|
path_type = (path_type + 1) % 2;
|
|
|
|
if (path_type == 1)
|
|
|
|
{
|
|
|
|
efl_gfx_path_append_move_to(txtpath, 20, 300);
|
|
|
|
efl_gfx_path_append_cubic_to(txtpath, 80, 80, 240, 270, 300, 20);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int angle = elm_slider_value_get(angle_sld);
|
|
|
|
Eina_Bool val = elm_check_selected_get(dir_chk);
|
|
|
|
Efl_Ui_Textpath_Direction dir = val ? EFL_UI_TEXTPATH_DIRECTION_CW :
|
|
|
|
EFL_UI_TEXTPATH_DIRECTION_CCW;
|
efl_ui_textpath: introduce efl_ui_textpath_circular_set() interface.
Summary:
This patch revises efl_ui_textpath_circle_set() interface.
Current circle_set() behavior is wrongly working,
it makes object minimal size with (x * 2, y * 2).
Insanely, how big size if the object is far from the screen origin.
Secondly, current interface requires center position,
How this center position could be guranteed if user wants to put it into a container?
Third, actual textpath output could be out of the textpath boundary,
since the textpath is originated to middle of text height.
the display boundary can be outside of the textpath geometry by (half of text height).
All in all, put altogether in fix,
I confirmed there is no methods without any compatibility break.
This brings elm_textpath_circular_set() api introduced.
@feature
Reviewers: #committers, kimcinoo, jsuya
Subscribers: zmike, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9260
2019-07-22 00:47:43 -07:00
|
|
|
efl_ui_textpath_circular_set(txtpath, CR, angle, dir);
|
2017-08-29 03:04:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_no_changed_cb(void *data, const Efl_Event *event)
|
|
|
|
{
|
|
|
|
Evas_Object *txtpath = data;
|
|
|
|
int slice_no = elm_slider_value_get(event->object);
|
|
|
|
printf("Slice no: %d\n", slice_no);
|
|
|
|
efl_ui_textpath_slice_number_set(txtpath, slice_no);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
test_ui_textpath(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *win, *txtpath, *box, *hbox, *chk, *sld, *btn;
|
|
|
|
|
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
|
|
|
win = elm_win_util_standard_add("efl.ui.textpath", "TextPath test");
|
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
|
|
|
|
|
|
|
box = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(box, EINA_FALSE);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(box, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(box, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
|
|
|
|
txtpath = efl_add(EFL_UI_TEXTPATH_CLASS, win);
|
|
|
|
elm_box_pack_end(box, txtpath);
|
|
|
|
|
2018-03-06 17:01:02 -08:00
|
|
|
efl_text_set(txtpath, TEST_UI_TEXTPATH_LONG_TEXT);
|
2017-08-29 03:04:15 -07:00
|
|
|
|
efl_ui_textpath: introduce efl_ui_textpath_circular_set() interface.
Summary:
This patch revises efl_ui_textpath_circle_set() interface.
Current circle_set() behavior is wrongly working,
it makes object minimal size with (x * 2, y * 2).
Insanely, how big size if the object is far from the screen origin.
Secondly, current interface requires center position,
How this center position could be guranteed if user wants to put it into a container?
Third, actual textpath output could be out of the textpath boundary,
since the textpath is originated to middle of text height.
the display boundary can be outside of the textpath geometry by (half of text height).
All in all, put altogether in fix,
I confirmed there is no methods without any compatibility break.
This brings elm_textpath_circular_set() api introduced.
@feature
Reviewers: #committers, kimcinoo, jsuya
Subscribers: zmike, bu5hm4n, segfaultxavi, cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9260
2019-07-22 00:47:43 -07:00
|
|
|
efl_ui_textpath_circular_set(txtpath, CR, 0, EFL_UI_TEXTPATH_DIRECTION_CCW);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(txtpath, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
path_type = 0;
|
|
|
|
|
|
|
|
hbox = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(hbox, EINA_TRUE);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(hbox, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(box, hbox);
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
chk = efl_add(EFL_UI_CHECK_CLASS, win);
|
|
|
|
efl_text_set(chk, "Ellipsis");
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_check_state_set(chk, efl_ui_textpath_ellipsis_get(txtpath));
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_event_callback_add(chk, EFL_UI_EVENT_SELECTED_CHANGED, _ellipsis_changed_cb, txtpath);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(hbox, chk);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(chk, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
chk = efl_add(EFL_UI_CHECK_CLASS, win);
|
|
|
|
efl_text_set(chk, "Clockwise");
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_event_callback_add(chk, EFL_UI_EVENT_SELECTED_CHANGED, _direction_changed_cb, txtpath);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(hbox, chk);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(chk, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
dir_chk = chk;
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
chk = efl_add(EFL_UI_CHECK_CLASS, win);
|
|
|
|
efl_text_set(chk, "Short text");
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_event_callback_add(chk, EFL_UI_EVENT_SELECTED_CHANGED, _short_text_changed_cb, txtpath);
|
2018-03-06 17:01:02 -08:00
|
|
|
elm_box_pack_end(hbox, chk);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(chk, EINA_TRUE);
|
2018-03-06 17:01:02 -08:00
|
|
|
|
2017-08-29 03:04:15 -07:00
|
|
|
hbox = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(hbox, EINA_TRUE);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(hbox, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(box, hbox);
|
|
|
|
|
|
|
|
sld = elm_slider_add(win);
|
|
|
|
elm_object_text_set(sld, "Angle");
|
|
|
|
elm_slider_min_max_set(sld, 0, 360);
|
|
|
|
elm_slider_value_set(sld, 0);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_align_set(sld, 0.5, EVAS_HINT_FILL);
|
|
|
|
efl_gfx_hint_weight_set(sld, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_size_min_set(sld, EINA_SIZE2D(150, 0));
|
2019-07-22 03:27:20 -07:00
|
|
|
efl_event_callback_add(sld, EFL_UI_RANGE_EVENT_CHANGED, _angle_changed_cb, txtpath);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(hbox, sld);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(sld, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
angle_sld = sld;
|
|
|
|
|
|
|
|
sld = elm_slider_add(win);
|
|
|
|
elm_object_text_set(sld, "Slice No");
|
|
|
|
elm_slider_min_max_set(sld, 20, 300);
|
|
|
|
elm_slider_value_set(sld, 99);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_align_set(sld, 0.5, EVAS_HINT_FILL);
|
|
|
|
efl_gfx_hint_weight_set(sld, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_size_min_set(sld, EINA_SIZE2D(150, 0));
|
2019-07-22 03:27:20 -07:00
|
|
|
efl_event_callback_add(sld, EFL_UI_RANGE_EVENT_CHANGED, _slice_no_changed_cb, txtpath);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(hbox, sld);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(sld, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
slice_sld = sld;
|
|
|
|
|
|
|
|
hbox = elm_box_add(win);
|
|
|
|
elm_box_horizontal_set(hbox, EINA_TRUE);
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(hbox, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND);
|
|
|
|
efl_gfx_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
elm_box_pack_end(box, hbox);
|
|
|
|
|
|
|
|
btn = elm_button_add(win);
|
|
|
|
elm_object_text_set(btn, "Change Path");
|
|
|
|
evas_object_smart_callback_add(btn, "clicked", _change_shape_cb, txtpath);
|
|
|
|
elm_box_pack_end(hbox, btn);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_visible_set(btn, EINA_TRUE);
|
2017-08-29 03:04:15 -07:00
|
|
|
|
|
|
|
elm_win_resize_object_add(win, box);
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 400));
|
|
|
|
efl_gfx_entity_visible_set(win, 1);
|
2017-08-29 03:04:15 -07:00
|
|
|
}
|