Compare commits

...

13 Commits

Author SHA1 Message Date
Marcel Hollerbach e2082cf442 asdf 2020-02-03 18:06:30 +01:00
Marcel Hollerbach 2db97a9bc2 api breaks 2020-02-03 17:19:29 +01:00
Marcel Hollerbach 6db0b34e0f wip 2020-02-03 17:19:29 +01:00
Marcel Hollerbach b345305ffa wip wip wip 2020-02-03 17:19:29 +01:00
Marcel Hollerbach e3ff3453f3 wip 2020-02-03 17:19:29 +01:00
Marcel Hollerbach 8df2666e64 more wip 2020-02-03 17:19:28 +01:00
Marcel Hollerbach 60c5f89475 more wip 2020-02-03 17:19:28 +01:00
Marcel Hollerbach def6b7244c wip 2020-02-03 17:19:28 +01:00
Marcel Hollerbach a40fed7c6d more 2020-02-03 17:19:28 +01:00
Marcel Hollerbach 89c433009c wip 2020-02-03 17:19:28 +01:00
Marcel Hollerbach 9e219e4eaa more 2020-02-03 17:19:27 +01:00
Marcel Hollerbach 33e5dfd53f first 2020-02-03 17:19:27 +01:00
Marcel Hollerbach a423ce5818 efl_ui_draggable: move these events back to legacy
they are not used yet in efl.ui. namespace, and they are needed for
different events.
2020-02-03 17:19:27 +01:00
9 changed files with 360 additions and 47 deletions

View File

@ -0,0 +1,88 @@
#define FN_COL_DEFAULT 255 255 255 255; color3: 0 0 0 128
#define EFL_UI_CLICKABLE_PART_BIND(PART) \
program { \
signal: "mouse,down,1"; source: PART; \
action: SIGNAL_EMIT "efl,action,press" "efl"; \
} \
program { \
signal: "mouse,down,1,*"; source: PART; \
action: SIGNAL_EMIT "efl,action,press" "efl"; \
} \
program { \
signal: "mouse,up,1"; source: PART; \
action: SIGNAL_EMIT "efl,action,unpress" "efl"; \
} \
program { \
signal: "mouse,pressed,out"; source: PART; \
action: SIGNAL_EMIT "efl,action,mouse_out" "efl"; \
}
collections {
color_classes {
color_class { name: "button_text";
color: FN_COL_DEFAULT;
desc: "Text of a button";
}
}
group { name: "efl/button:homescreen_icon"; data.item: "version" "123";
parts {
swallow { "efl.content"; nomouse;
required;
desc { "default";
fixed: 1 0;
rel2.relative: 1.0 0.0;
rel2.to: "sizer_content";
fixed: 1 0;
aspect: 1.0 1.0;
aspect_preference: BOTH;
}
}
text { "sizer_content"; nomouse;
scale: 1;
desc { "default";
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
align: 0.0 1.0;
text {
size: 10;
min: 1 1;
ellipsis: -1;
text: "Masdfasdfsaf";
text_class: "button_text";
}
visible: 0;
}
}
text { "efl.text"; nomouse;
scale;
required;
desc { "default"
rel1.relative: 0.0 1.0;
rel2.relative: 1.0 1.0;
rel2.offset: 0 -2;
rel1.offset: 0 -2;
align: 0.0 1.0;
color3: 255 255 255 255;
text { font: "sans"; size: 10;;
align: 0.5 0.5;
min: 1 1;
text_class: "button";
ellipsis: -1;
}
visible: 1;
fixed: 0 0;
}
}
rect { "event";
desc { "default"
color: 0 0 0 0;
}
}
}
programs {
EFL_UI_CLICKABLE_PART_BIND("event")
}
}
}

View File

@ -0,0 +1,217 @@
#include <Efl_Ui.h>
#include <Efreet.h>
static Efl_Ui_Spotlight_Container *over_container;
#define SCALE 0.5
typedef struct
{
Eina_Position2D position;
const char *name;
const char *icon;
Efl_Event_Cb cb;
} Icon;
static void _fake_app_cb(void *data, const Efl_Event *ev);
#define P "/usr/share/icons/hicolor/128x128/apps/"
static Icon workspace1[] = {
{ EINA_POSITION2D(0, 0), "Chrome", P"chromium.png", NULL},
{ EINA_POSITION2D(0, 1), "Cups", P"cups.png", NULL},
{ EINA_POSITION2D(2, 0), NULL, NULL, NULL},
};
static Icon workspace2[] = {
{ EINA_POSITION2D(0, 3), "Cadence", P"cadence.png", _fake_app_cb},
{ EINA_POSITION2D(1, 3), "Emacs", P"emacs.png", _fake_app_cb},
{ EINA_POSITION2D(2, 3), "etui", P"etui.png", _fake_app_cb},
{ EINA_POSITION2D(3, 3), "CAD", P"librecad.png", _fake_app_cb},
{ EINA_POSITION2D(4, 3), "Libreoffice", P"libreoffice-base.png", _fake_app_cb},
{ EINA_POSITION2D(0, 4), "Riot", P"riot.png", _fake_app_cb},
{ EINA_POSITION2D(1, 4), "Tex", P"texstudio.png", _fake_app_cb},
{ EINA_POSITION2D(2, 4), "Telegram", P"telegram.png", _fake_app_cb},
{ EINA_POSITION2D(3, 4), "Vlc", P"vlc.png", _fake_app_cb},
{ EINA_POSITION2D(4, 4), "Mono", P"monodevelop.png", _fake_app_cb},
{ EINA_POSITION2D(2, 0), NULL, NULL, NULL},
};
static Icon workspace3[] = {
{ EINA_POSITION2D(0, 0), "bla", "ic", NULL},
{ EINA_POSITION2D(1, 1), "bla", "ic2", NULL},
{ EINA_POSITION2D(0, 2), "bla", "ic", NULL},
{ EINA_POSITION2D(1, 3), "bla", "ic2", NULL},
{ EINA_POSITION2D(0, 4), "bla", "ic", NULL},
{ EINA_POSITION2D(2, 0), "bla", "ic", NULL},
{ EINA_POSITION2D(3, 1), "bla", "ic2", NULL},
{ EINA_POSITION2D(2, 2), "bla", "ic", NULL},
{ EINA_POSITION2D(3, 3), "bla", "ic2", NULL},
{ EINA_POSITION2D(2, 4), "bla", "ic", NULL},
{ EINA_POSITION2D(4, 0), "bla", "ic", NULL},
{ EINA_POSITION2D(4, 2), "bla", "ic", NULL},
{ EINA_POSITION2D(4, 4), "bla", "ic", NULL},
{ EINA_POSITION2D(0, 2), NULL, NULL, NULL},
};
static Icon* workspaces[] = {workspace1, workspace2, workspace3};
static void _home_screen_cb(void *data, const Efl_Event *cb);
static Icon start_line_config[] = {
{ EINA_POSITION2D(0, 0), "Call", "call-start", _fake_app_cb},
{ EINA_POSITION2D(0, 0), "Contact", "contact-new", _fake_app_cb},
{ EINA_POSITION2D(0, 0), "Home", "applications-internet", _home_screen_cb},
{ EINA_POSITION2D(0, 0), "Mail", "emblem-mail", _fake_app_cb},
{ EINA_POSITION2D(0, 0), "Documents", "emblem-documents", _fake_app_cb},
{ EINA_POSITION2D(0, 0), NULL, NULL, NULL},
};
static Eo *compositor;
static Efl_Ui_Widget*
_create_icon(Icon *icon, Eo *parent)
{
Eo *ret = efl_add(EFL_UI_BUTTON_CLASS, parent, efl_ui_widget_style_set(efl_added, "homescreen_icon"));
Eo *ic = efl_add(EFL_UI_IMAGE_CLASS, parent);
efl_ui_image_icon_set(ic, icon->icon);
efl_content_set(ret, ic);
efl_text_set(ret, icon->name);
if (icon->cb)
efl_event_callback_add(ret, EFL_INPUT_EVENT_CLICKED, icon->cb, icon);
return ret;
}
static Efl_Ui_Table*
_hs_screen_new(Icon *icons)
{
Efl_Ui_Table *table;
table = efl_add(EFL_UI_TABLE_CLASS, over_container);
for (int y = 0; y < 5; ++y)
{
for (int x = 0; x < 5; ++x)
{
Eo *obj = efl_add(EFL_CANVAS_RECTANGLE_CLASS, table, efl_gfx_color_set(efl_added, 0, 0, 0, 0));
efl_pack_table(table, obj, x, y, 1, 1);
}
}
for (int i = 0; icons[i].name; ++i)
{
Eo *icon = _create_icon(&icons[i], table);
efl_pack_table(table, icon, icons[i].position.x, icons[i].position.y, 1, 1);
}
return table;
}
static Efl_Ui_Widget*
_build_homescreen(Efl_Ui_Win *win)
{
Efl_Ui_Spotlight_Indicator *indicator = efl_new(EFL_UI_SPOTLIGHT_ICON_INDICATOR_CLASS);
Efl_Ui_Spotlight_Manager *scroll = efl_new(EFL_UI_SPOTLIGHT_SCROLL_MANAGER_CLASS);
over_container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_ui_spotlight_manager_set(efl_added, scroll),
efl_ui_spotlight_indicator_set(efl_added, indicator)
);
for (int i = 0; i < 3; ++i)
{
Eo *screen = _hs_screen_new(workspaces[i]);
efl_pack_end(over_container, screen);
}
return over_container;
}
static Efl_Ui_Widget*
_build_overall_structure(Efl_Ui_Win *win, Efl_Ui_Widget *homescreen)
{
Efl_Ui_Widget *o, *start_line;
o = efl_add(EFL_UI_BOX_CLASS, win);
efl_pack_end(o, homescreen);
//start line
start_line = efl_add(EFL_UI_BOX_CLASS, win);
efl_gfx_hint_weight_set(start_line, 1.0, 0.0);
efl_ui_layout_orientation_set(start_line, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_hint_size_min_set(start_line, EINA_SIZE2D(5*150*SCALE, 150*SCALE));
efl_gfx_hint_size_max_set(start_line, EINA_SIZE2D(-1, 150*SCALE));
efl_pack_end(o, start_line);
for (int i = 0; i < 5; ++i)
{
efl_pack_end(start_line, _create_icon(&start_line_config[i], start_line));
}
return o;
}
static Efl_Ui_Widget*
_build_compositor(Efl_Ui_Win *win)
{
Efl_Ui_Widget *comp;
Efl_Ui_Spotlight_Manager *stack;
stack = efl_new(EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS);
comp = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_ui_spotlight_manager_set(efl_added, stack));
return comp;
}
static void
_home_screen_cb(void *data, const Efl_Event *cb)
{
Efl_Canvas_Rectangle *rect;
rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, compositor);
efl_ui_spotlight_push(compositor, rect);
}
static void
_fake_app_cb(void *data, const Efl_Event *ev)
{
Efl_Ui_Table *table = efl_add(EFL_UI_TABLE_CLASS, compositor);
Efl_Canvas_Rectangle *rect = efl_add(EFL_CANVAS_RECTANGLE_CLASS, compositor);
efl_gfx_color_set(rect, 50, 50, 50, 255);
efl_pack_table(table, rect, 0, 0, 1, 1);
Efl_Ui_Textbox *text = efl_add(EFL_UI_TEXTBOX_CLASS , table);
efl_text_interactive_editable_set(text, EINA_FALSE);
efl_text_multiline_set(text, EINA_FALSE);
efl_text_set(text, "This is a testing application");
efl_pack_table(table, text, 0, 0, 1, 1);
efl_ui_spotlight_push(compositor, table);
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
Eo *win, *over_container, *desktop, *background;
efl_ui_theme_extension_add(efl_ui_theme_default_get(), "/home/marcel/git/efl/build/src/examples/elementary/homescreen/button_theme.edj");
win = efl_new(EFL_UI_WIN_CLASS,
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
efl_gfx_entity_size_set(win, EINA_SIZE2D(720*SCALE+15, 1280*SCALE));
over_container = _build_homescreen(win);
desktop = _build_overall_structure(win, over_container);
compositor = _build_compositor(win);
//efl_pack_end(compositor, desktop);
efl_ui_spotlight_push(compositor, desktop);
efl_gfx_entity_size_set(compositor, EINA_SIZE2D(720*SCALE, 1280*SCALE));
background = efl_add(EFL_UI_LAYOUT_CLASS, win);
efl_file_simple_load(background, "/home/marcel/git/efl/src/examples/elementary/homescreen/Lantern_Cluster.edj", "e/desktop/background");
efl_content_set(win, background);
}
EFL_MAIN()

View File

@ -0,0 +1,21 @@
foreach edc_file : ['button_theme.edc']
themes += custom_target('edje_cc_' + edc_file,
depends : edje_depends,
input : edc_file,
output : '@BASENAME@.edj',
command : edje_cc_exe + ['-beta',
'-id', meson.current_source_dir(),
'-fd', meson.current_source_dir(),
'-sd', meson.current_source_dir(),
'-vd', meson.current_source_dir(),
'-dd', meson.current_source_dir(),
'-md', meson.current_source_dir(),
'-td', meson.current_source_dir(),
'@INPUT@', '@OUTPUT@'],
)
endforeach
executable('homescreen',
['homescreen.c', themes],
dependencies: elementary,
)

View File

@ -197,3 +197,4 @@ executable('codegen_example',
subdir('sphere_hunter')
subdir('performance')
subdir('homescreen')

View File

@ -22,16 +22,4 @@ interface @beta Efl.Ui.Draggable
}
}
}
events {
/* FIXME: Explain what is the object passed through the event_infos */
drag: Efl.Object; [[Called when drag operation starts]]
drag,start: void; [[Called when drag started]]
drag,stop: Efl.Object; [[Called when drag stopped]]
drag,end: void; [[Called when drag operation ends]]
drag,start,up: Efl.Object; [[Called when drag starts into up direction]]
drag,start,down: Efl.Object; [[Called when drag starts into down direction]]
drag,start,right: Efl.Object; [[Called when drag starts into right direction]]
drag,start,left: Efl.Object; [[Called when drag starts into left direction]]
}
}

View File

@ -96,8 +96,8 @@ _efl_ui_spotlight_icon_indicator_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui
if (spotlight)
{
pd->container = spotlight;
efl_event_callback_array_add(pd->container, spotlight_resized(), pd->layout);
pd->layout = efl_add(EFL_CANVAS_LAYOUT_CLASS, pd->container);
efl_event_callback_array_add(pd->container, spotlight_resized(), pd->layout);
if (elm_widget_theme_object_set(pd->container, pd->layout,
"spotlight",

View File

@ -785,7 +785,7 @@ _item_mouse_move_cb(void *data,
if ((it->dragging) && (it->down))
{
ELM_SAFE_FREE(it->long_timer, ecore_timer_del);
efl_event_callback_legacy_call(WIDGET(it), EFL_UI_EVENT_DRAG, eo_it);
evas_object_smart_callback_call(WIDGET(it), "drag", eo_it);
return;
}
@ -834,17 +834,17 @@ _item_mouse_move_cb(void *data,
if ((adx > minw) || (ady > minh))
{
const Efl_Event_Description *left_drag, *right_drag;
const char *left_drag, *right_drag;
if (!efl_ui_mirrored_get(WIDGET(it)))
{
left_drag = EFL_UI_EVENT_DRAG_START_LEFT;
right_drag = EFL_UI_EVENT_DRAG_START_RIGHT;
left_drag = "drag,start,left";
right_drag = "drag,start,right";
}
else
{
left_drag = EFL_UI_EVENT_DRAG_START_RIGHT;
right_drag = EFL_UI_EVENT_DRAG_START_LEFT;
right_drag = "drag,start,left";
left_drag = "drag,start,right";
}
it->dragging = 1;
@ -858,25 +858,23 @@ _item_mouse_move_cb(void *data,
if (dy < 0)
{
if (ady > adx)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_UP, eo_it);
evas_object_smart_callback_call(WIDGET(it), "drag,start,up", eo_it);
else
{
if (dx < 0)
efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it);
evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it);
}
}
else
{
if (ady > adx)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_DOWN, eo_it);
evas_object_smart_callback_call(WIDGET(it), "drag,start,down", eo_it);
else
{
if (dx < 0)
efl_event_callback_legacy_call(WIDGET(it), left_drag, eo_it);
evas_object_smart_callback_call(WIDGET(it), left_drag, eo_it);
else
efl_event_callback_legacy_call(WIDGET(it), right_drag, eo_it);
evas_object_smart_callback_call(WIDGET(it), right_drag, eo_it);
}
}
}
@ -1320,8 +1318,8 @@ _item_mouse_up_cb(void *data,
if (it->dragging)
{
it->dragging = EINA_FALSE;
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_STOP, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,stop", eo_it);
dragged = EINA_TRUE;
}

View File

@ -4096,31 +4096,31 @@ _item_mouse_move_cb(void *data,
if (dy < 0)
{
if (ady > adx)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_UP, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,up", eo_it);
else
{
if (dx < 0)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,left", eo_it);
else
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,right", eo_it);
}
}
else
{
if (ady > adx)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_DOWN, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,down", eo_it);
else
{
if (dx < 0)
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_LEFT, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,left", eo_it);
else
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_START_RIGHT, eo_it);
evas_object_smart_callback_call
(WIDGET(it), "drag,start,right", eo_it);
}
}
}
@ -4316,8 +4316,8 @@ _item_multi_down_cb(void *data,
if (it->dragging)
{
it->dragging = EINA_FALSE;
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it));
evas_object_smart_callback_call
(WIDGET(it), "drag,stop", EO_OBJ(it));
}
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);
if (sd->on_hold)
@ -5112,8 +5112,8 @@ _item_mouse_up_cb(void *data,
if (it->dragging)
{
it->dragging = EINA_FALSE;
efl_event_callback_legacy_call
(WIDGET(it), EFL_UI_EVENT_DRAG_STOP, EO_OBJ(it));
evas_object_smart_callback_call
(WIDGET(it), "drag,stop", EO_OBJ(it));
dragged = 1;
}
ELM_SAFE_FREE(it->item->swipe_timer, ecore_timer_del);

View File

@ -125,7 +125,7 @@ _drag_done_cb(void *unused EINA_UNUSED,
ELM_PHOTO_DATA_GET(obj, sd);
elm_object_scroll_freeze_pop(obj);
efl_event_callback_legacy_call(obj, EFL_UI_EVENT_DRAG_END, NULL);
evas_object_smart_callback_call(obj, "drag,end", NULL);
sd->drag_started = EINA_FALSE;
}
@ -189,8 +189,8 @@ _long_press_cb(void *obj)
_drag_done_cb, NULL))
{
elm_object_scroll_freeze_push(obj);
efl_event_callback_legacy_call
(obj, EFL_UI_EVENT_DRAG_START, NULL);
evas_object_smart_callback_call
(obj, "drag,start", NULL);
sd->drag_started = EINA_TRUE;
}
}