2017-11-23 21:41:31 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
2019-03-07 07:39:06 -08:00
|
|
|
#include <Efl_Ui.h>
|
2017-11-23 21:41:31 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
|
2019-06-26 06:55:41 -07:00
|
|
|
#define MAX_NUM_OF_CONTENT 17
|
2017-11-28 03:02:53 -08:00
|
|
|
|
|
|
|
const Efl_Class *content_class[MAX_NUM_OF_CONTENT];
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
_reset_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
2019-05-29 11:06:25 -07:00
|
|
|
Efl_Ui_Radio_Group *radio = data;
|
2017-11-23 21:41:31 -08:00
|
|
|
Evas_Object *target;
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
radio = efl_ui_radio_group_selected_object_get(radio);
|
2017-11-23 21:41:31 -08:00
|
|
|
target = evas_object_data_get(radio, "data");
|
|
|
|
|
|
|
|
efl_gfx_color_set(efl_part(target, "background"), 0, 0, 0, 0);
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(efl_part(target, "background"), NULL, NULL);
|
2017-11-23 21:41:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_color_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
2019-05-29 11:06:25 -07:00
|
|
|
Efl_Ui_Radio_Group *radio = data;
|
2017-11-23 21:41:31 -08:00
|
|
|
Evas_Object *target;
|
|
|
|
static Eina_Bool i;
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
radio = efl_ui_radio_group_selected_object_get(radio);
|
2017-11-23 21:41:31 -08:00
|
|
|
target = evas_object_data_get(radio, "data");
|
|
|
|
i ^= EINA_TRUE;
|
|
|
|
efl_gfx_color_set(efl_part(target, "background"), (i) ? 255 : 0, (i) ? 0 : 255, 0, 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_scale_type_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
2019-05-29 11:06:25 -07:00
|
|
|
Efl_Ui_Radio_Group *radio = data;
|
2017-11-23 21:41:31 -08:00
|
|
|
Evas_Object *target;
|
2018-04-19 04:26:59 -07:00
|
|
|
Efl_Gfx_Image_Scale_Type type;
|
2017-11-23 21:41:31 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
radio = efl_ui_radio_group_selected_object_get(radio);
|
2017-11-23 21:41:31 -08:00
|
|
|
target = evas_object_data_get(radio, "data");
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(efl_part(target, "background"), buf, NULL);
|
2018-04-19 04:26:59 -07:00
|
|
|
type = efl_gfx_image_scale_type_get(efl_part(target, "background"));
|
2017-11-23 21:41:31 -08:00
|
|
|
type = (type + 1) % 5;
|
2018-04-19 04:26:59 -07:00
|
|
|
efl_gfx_image_scale_type_set(efl_part(target, "background"), type);
|
2017-11-23 21:41:31 -08:00
|
|
|
}
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
static Efl_Ui_Radio_Group *
|
2017-11-23 21:41:31 -08:00
|
|
|
_create_box_contents(Evas_Object *box)
|
|
|
|
{
|
|
|
|
Evas_Object *hbox;
|
|
|
|
Evas_Object *radio_group, *radio;
|
|
|
|
Evas_Object *content;
|
2019-05-29 11:06:25 -07:00
|
|
|
Efl_Ui_Radio_Group *group;
|
2017-11-23 21:41:31 -08:00
|
|
|
char buf[PATH_MAX];
|
|
|
|
unsigned int i;
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
group = efl_new(EFL_UI_RADIO_GROUP_IMPL_CLASS, NULL);
|
|
|
|
|
2017-11-23 21:41:31 -08:00
|
|
|
hbox = efl_add(EFL_UI_BOX_CLASS, box,
|
2019-05-24 09:30:31 -07:00
|
|
|
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(efl_added, 1, 1),
|
2017-11-23 21:41:31 -08:00
|
|
|
efl_pack_end(box, efl_added));
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
radio_group = radio = efl_add(EFL_UI_RADIO_CLASS, hbox);
|
|
|
|
efl_gfx_hint_weight_set(radio, 0, 0);
|
|
|
|
efl_ui_radio_state_value_set(radio, 0);
|
|
|
|
efl_ui_radio_group_register(group, radio);
|
|
|
|
efl_pack_end(hbox, radio);
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
content = efl_add(EFL_UI_BOX_CLASS, hbox,
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_pack_end(hbox, efl_added));
|
2017-11-23 21:41:31 -08:00
|
|
|
evas_object_data_set(radio, "data", content);
|
|
|
|
|
|
|
|
content = efl_add(EFL_UI_TEXT_CLASS, content,
|
|
|
|
efl_text_set(efl_added, "box"),
|
2018-04-06 04:30:40 -07:00
|
|
|
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
|
2017-11-23 21:41:31 -08:00
|
|
|
efl_pack_end(content, efl_added));
|
|
|
|
|
2017-11-28 03:02:53 -08:00
|
|
|
for (i = 0; i < MAX_NUM_OF_CONTENT; i++)
|
2017-11-23 21:41:31 -08:00
|
|
|
{
|
|
|
|
if (!content_class[i]) continue;
|
|
|
|
|
|
|
|
hbox = efl_add(EFL_UI_BOX_CLASS, box,
|
2019-05-24 09:30:31 -07:00
|
|
|
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
|
2017-11-23 21:41:31 -08:00
|
|
|
efl_pack_end(box, efl_added));
|
2017-11-28 03:02:53 -08:00
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
radio = efl_add(EFL_UI_RADIO_CLASS, hbox);
|
|
|
|
efl_ui_radio_state_value_set(radio, i + 1);
|
|
|
|
efl_gfx_hint_weight_set(radio, 0, 0);
|
|
|
|
efl_ui_radio_group_register(group, radio);
|
|
|
|
efl_pack_end(hbox, radio);
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
content = efl_add(content_class[i], hbox,
|
|
|
|
efl_pack_end(hbox, efl_added));
|
2017-11-28 03:02:53 -08:00
|
|
|
|
2017-11-23 21:41:31 -08:00
|
|
|
if (efl_isa(content, efl_text_interface_get()))
|
|
|
|
efl_text_set(content, "text");
|
|
|
|
|
|
|
|
if (efl_isa(content, EFL_UI_IMAGE_CLASS))
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get());
|
2019-02-27 10:17:09 -08:00
|
|
|
efl_file_simple_load(content, buf, NULL);
|
2017-11-23 21:41:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
evas_object_data_set(radio, "data", content);
|
|
|
|
}
|
|
|
|
|
2019-05-29 11:06:25 -07:00
|
|
|
efl_ui_radio_group_selected_value_set(group, 0);
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
return radio_group;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
test_part_background(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Evas_Object *win;
|
|
|
|
Evas_Object *scr;
|
|
|
|
Evas_Object *vbox, *hbox;
|
2019-05-29 11:06:25 -07:00
|
|
|
Efl_Ui_Radio_Group *radio_group;
|
2017-11-23 21:41:31 -08:00
|
|
|
Evas_Object *reset_btn, *color_btn, *scale_btn;
|
|
|
|
|
|
|
|
content_class[0] = EFL_UI_CALENDAR_CLASS;
|
|
|
|
content_class[1] = EFL_UI_SLIDER_CLASS;
|
|
|
|
content_class[2] = EFL_UI_SLIDER_INTERVAL_CLASS;
|
2018-04-19 06:20:29 -07:00
|
|
|
content_class[3] = EFL_UI_PROGRESSBAR_CLASS;
|
|
|
|
content_class[4] = EFL_UI_CLOCK_CLASS;
|
|
|
|
content_class[5] = EFL_UI_BUTTON_CLASS;
|
|
|
|
content_class[6] = EFL_UI_CHECK_CLASS;
|
|
|
|
content_class[7] = EFL_UI_RADIO_CLASS;
|
|
|
|
content_class[8] = EFL_UI_TEXT_CLASS;
|
|
|
|
content_class[9] = EFL_UI_FLIP_CLASS;
|
|
|
|
content_class[10] = EFL_UI_PANES_CLASS;
|
|
|
|
content_class[11] = EFL_UI_VIDEO_CLASS;
|
efl_ui_bg: remove Efl.Ui.Bg interface and rename Efl.Ui.Bg_Widget class
Summary:
Efl.Ui.Bg interface does not have any new property or method.
Moreover, Efl.Ui.Bg interface is not used by widgets except
Efl.Ui.Bg_Widget and Efl.Ui.Widget_Part_Bg.
Consequently, Efl.Ui.Bg interface can be replaced by other interfaces.
Due to Efl.Ui.Bg interface, the bg widget class name becomes
Efl.UI.Bg_Widget which is not synchronized with other widget names.
Therefore, to keep consistency with other widgets, it would be better to
remove Efl.Ui.Bg interface and rename Efl.Ui.Bg_Widget to Efl.Ui.Bg.
Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike
Reviewed By: segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7304
2018-11-19 17:24:05 -08:00
|
|
|
content_class[12] = EFL_UI_BG_CLASS;
|
2018-04-19 06:20:29 -07:00
|
|
|
content_class[13] = EFL_UI_IMAGE_CLASS;
|
|
|
|
content_class[14] = EFL_UI_IMAGE_ZOOMABLE_CLASS;
|
2019-06-26 06:55:41 -07:00
|
|
|
content_class[15] = EFL_UI_SPIN_CLASS;
|
|
|
|
content_class[16] = EFL_UI_SPIN_BUTTON_CLASS;
|
2017-11-23 21:41:31 -08:00
|
|
|
|
2018-04-11 10:38:21 -07:00
|
|
|
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
|
2017-11-23 21:41:31 -08:00
|
|
|
efl_text_set(efl_added, "Widget Part Background"),
|
|
|
|
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
|
|
|
|
|
|
|
|
vbox = efl_add(EFL_UI_BOX_CLASS, win,
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(efl_added, 1, 1),
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_content_set(win, efl_added));
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
hbox = efl_add(EFL_UI_BOX_CLASS, vbox,
|
2019-05-24 09:30:31 -07:00
|
|
|
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(efl_added, 1.0, 0.0),
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_pack_end(vbox, efl_added));
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
reset_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_pack_end(hbox, efl_added),
|
|
|
|
efl_text_set(efl_added, "reset"));
|
2017-11-23 21:41:31 -08:00
|
|
|
color_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_pack_end(hbox, efl_added),
|
|
|
|
efl_text_set(efl_added, "color"));
|
2017-11-23 21:41:31 -08:00
|
|
|
scale_btn = efl_add(EFL_UI_BUTTON_CLASS, hbox,
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_pack_end(hbox, efl_added),
|
|
|
|
efl_text_set(efl_added, "scale_type"));
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
scr = elm_scroller_add(vbox);
|
|
|
|
evas_object_show(scr);
|
|
|
|
evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
|
|
evas_object_size_hint_align_set(scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
|
|
efl_pack_end(vbox, scr);
|
|
|
|
|
|
|
|
vbox = efl_add(EFL_UI_BOX_CLASS, scr,
|
2019-02-21 09:19:45 -08:00
|
|
|
efl_gfx_hint_weight_set(efl_added, 1, 1),
|
2017-11-28 03:02:53 -08:00
|
|
|
efl_content_set(scr, efl_added));
|
2017-11-23 21:41:31 -08:00
|
|
|
|
|
|
|
radio_group = _create_box_contents(vbox);
|
|
|
|
|
2019-07-29 02:42:34 -07:00
|
|
|
efl_event_callback_add(reset_btn, EFL_INPUT_EVENT_CLICKED, _reset_cb, radio_group);
|
|
|
|
efl_event_callback_add(color_btn, EFL_INPUT_EVENT_CLICKED, _color_cb, radio_group);
|
|
|
|
efl_event_callback_add(scale_btn, EFL_INPUT_EVENT_CLICKED, _scale_type_cb, radio_group);
|
2017-11-23 21:41:31 -08:00
|
|
|
|
2018-04-05 01:47:26 -07:00
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 200));
|
2017-11-23 21:41:31 -08:00
|
|
|
}
|