Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-07-09 21:22:35 +09:00
commit a48eb000bb
161 changed files with 3327 additions and 2573 deletions

View File

@ -38,7 +38,7 @@ if [ "$DISTRO" != "" ] ; then
MINGW_COPTS="--cross-file .ci/cross_toolchain.txt -Davahi=false -Deeze=false -Dsystemd=false \
-Dpulseaudio=false -Dx11=false -Dopengl=none -Dlibmount=false \
-Devas-loaders-disabler=json,pdf,ps,raw,svg -Devas-modules=static -Dbindings=luajit \
-Dbuild-examples=false -Dbuild-tests=false"
-Dharfbuzz=true -Dpixman=true -Dembedded-lz4=false "
if [ "$1" = "options-enabled" ]; then
OPTS="$OPTS $ENABLED_LINUX_COPTS $WAYLAND_LINUX_COPTS"

View File

@ -5,7 +5,7 @@ ar = 'x86_64-w64-mingw32-ar'
ranlib = 'x86_64-w64-mingw32-ranlib'
strip = 'x86_64-w64-mingw32-strip'
windres = 'x86_64-w64-mingw32-windres'
pkgconfig = 'pkg-config'
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
[host_machine]
system = 'windows'

View File

@ -202,7 +202,7 @@ group { "efl/spin_button/vertical";
}
}
group { "efl/spin_button/inc_button";
group { "efl/spin_button/horizontal/inc_button";
images.image: "sym_right_light_normal.png" COMP;
images.image: "sym_right_glow_normal.png" COMP;
images.image: "sym_right_dark_normal.png" COMP;
@ -352,13 +352,13 @@ group { "efl/spin_button/inc_button";
}
}
group { "efl/spin_button/entry";
group { "efl/spin_button/horizontal/entry";
alias: "efl/spin_button/vertical/entry";
inherit: "efl/text";
}
group { "efl/spin_button/dec_button";
inherit: "efl/spin_button/inc_button";
group { "efl/spin_button/horizontal/dec_button";
inherit: "efl/spin_button/horizontal/inc_button";
images.image: "sym_left_light_normal.png" COMP;
images.image: "sym_left_glow_normal.png" COMP;
images.image: "sym_left_dark_normal.png" COMP;
@ -382,7 +382,7 @@ group { "efl/spin_button/dec_button";
}
}
group { "efl/spin_button/text_button";
group { "efl/spin_button/horizontal/text_button";
alias: "efl/spin_button/vertical/text_button";
parts {
part { name: "bg";
@ -460,7 +460,7 @@ group { "efl/spin_button/text_button";
}
group { "efl/spin_button/vertical/inc_button";
inherit: "efl/spin_button/inc_button";
inherit: "efl/spin_button/horizontal/inc_button";
images.image: "sym_up_light_normal.png" COMP;
images.image: "sym_up_glow_normal.png" COMP;
images.image: "sym_up_dark_normal.png" COMP;
@ -485,7 +485,7 @@ group { "efl/spin_button/vertical/inc_button";
}
group { "efl/spin_button/vertical/dec_button";
inherit: "efl/spin_button/dec_button";
inherit: "efl/spin_button/horizontal/dec_button";
images.image: "sym_down_light_normal.png" COMP;
images.image: "sym_down_glow_normal.png" COMP;
images.image: "sym_down_dark_normal.png" COMP;

View File

@ -5,8 +5,7 @@
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
{{#inClass}}
<div class="inheritance">
<h5><a href="#collapsible-inheritance" class="expander collapsed" data-toggle="collapse">{{__global.inheritance}}</a></h5>
<div id="collapsible-inheritance" class="collapse">
<h5>{{__global.inheritance}}</h5>
{{#inheritance}}
<div class="level{{index}}"><xref uid="{{uid}}" text="{{fullName.0.value}}"/></div>
{{/inheritance}}
@ -14,7 +13,6 @@
{{#derivedClasses}}
<div class="level{{index}}"><xref uid="{{uid}}" text="{{fullName.0.value}}"/></div>
{{/derivedClasses}}
</div>
</div>
{{/inClass}}

View File

@ -2,12 +2,7 @@
{{>partials/class.header}}
{{#children}}
<h3 id="{{id}}">
<a href="#collapsible-{{id}}" class="expander collapsed" data-toggle="collapse">
{{>partials/classSubtitle}}
</a>
</h3>
<div id="collapsible-{{id}}" class="collapse">
<h3 id="{{id}}">{{>partials/classSubtitle}}</h3>
{{#children}}
{{^_disableContribution}}
{{#docurl}}
@ -195,11 +190,9 @@
</div>
{{/seealso.0}}
{{/children}}
</div>
{{/children}}
{{#implements.0}}
<h3><a href="#collapsible-implements" class="expander collapsed" data-toggle="collapse">{{__global.implements}}</a></h3>
<div id="collapsible-implements" class="collapse">
<h3 id="implements">{{__global.implements}}</h3>
{{/implements.0}}
{{#implements}}
<div>
@ -211,7 +204,6 @@
{{/definition}}
</div>
{{/implements}}
</div>
{{#extensionMethods.0}}
<h3 id="extensionmethods">{{__global.extensionMethods}}</h3>
{{/extensionMethods.0}}

View File

@ -1,28 +1,26 @@
# French translation for Efl.
# French translation for EFL.
# Copyright (C) 2012, 2013 Enlightenment development team
# This file is put in the public domain.
# batden <batden@orange.fr>, 2009.
# dazibao <dazibao@sfr.fr>, 2011.
# Jerome Pinot <ngc891@gmail.com>, 2012.
# Chidambar Zinnoury <illogict@online.fr>, 2013.
# similar <similar@orange.fr>, 2019.
#
#: src/lib/elementary/elm_config.c:4135
msgid ""
msgstr ""
"Project-Id-Version: Elementary\n"
"Report-Msgid-Bugs-To: enlightenment-devel@lists.sourceforge.net\n"
"POT-Creation-Date: 2019-04-15 12:03+0100\n"
"PO-Revision-Date: 2014-05-25 20:18+0000\n"
"Last-Translator: Eliovir <Unknown>\n"
"Language-Team: French <sansgourou@gmail.com>\n"
"PO-Revision-Date: 2019-06-27 11:57+0200\n"
"Last-Translator: Philippe Jean Guillaumie <similar@orange.fr>\n"
"Language-Team: French>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2014-05-26 05:37+0000\n"
"X-Generator: Launchpad (build 17017)\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-Language: French\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: utf-8\n"
#: src/lib/ecore/ecore_getopt.c:89
@ -72,7 +70,7 @@ msgstr "Options :\n"
#: src/lib/ecore/ecore_getopt.c:780
msgid "Positional arguments:\n"
msgstr ""
msgstr "Paramètres positionnels :\n"
#: src/lib/ecore/ecore_getopt.c:847
#, c-format
@ -166,12 +164,12 @@ msgstr "ERREUR : loption -%c requiert un argument !\n"
#: src/lib/ecore/ecore_getopt.c:1892
#, c-format
msgid "ERROR: missing required positional argument %s.\n"
msgstr ""
msgstr "ERREUR : paramètre positionnel requis manquant %s.\n"
#: src/lib/ecore/ecore_getopt.c:1924
#, c-format
msgid "ERROR: unsupported action type %d for positional argument %s\n"
msgstr ""
msgstr "ERREUR : type d'action non pris en charge %d pour le paramètre positionnel %s\n"
#: src/lib/ecore/ecore_getopt.c:2045 src/lib/ecore/ecore_getopt.c:2111
msgid "ERROR: no parser provided.\n"
@ -201,7 +199,7 @@ msgstr " Voir -%c.\n"
#: src/lib/ecore/ecore_getopt.c:2151
msgid "ERROR: invalid positional arguments found."
msgstr ""
msgstr "ERREUR : paramètres positionnels non valides détectées."
#: src/lib/ecore/ecore_getopt.c:2186
#, c-format
@ -255,7 +253,7 @@ msgstr "Home"
#: src/lib/elementary/elc_fileselector.c:1738
msgid "Search"
msgstr ""
msgstr "Rechercher"
#: src/lib/elementary/elc_fileselector.c:2012
msgid "OK"
@ -277,19 +275,19 @@ msgstr "État : désactivé"
#: src/lib/elementary/elc_hoversel.c:652
msgid "Hoversel"
msgstr ""
msgstr "Hoversel"
#: src/lib/elementary/elc_multibuttonentry.c:682
msgid "multi button entry label"
msgstr ""
msgstr "étiquette d'entrée à plusieurs boutons"
#: src/lib/elementary/elc_multibuttonentry.c:704
msgid "multi button entry item"
msgstr ""
msgstr "élément d'entrée à plusieurs boutons"
#: src/lib/elementary/elc_multibuttonentry.c:1586
msgid "multi button entry"
msgstr ""
msgstr "entrée à plusieurs boutons"
#: src/lib/elementary/elc_naviframe.c:408
#: src/lib/elementary/elc_naviframe.c:436
@ -297,9 +295,8 @@ msgid "Title"
msgstr "Titre"
#: src/lib/elementary/elc_naviframe.c:415
#, fuzzy
msgid "Subtitle"
msgstr "Titre"
msgstr "Sous-titre"
#: src/lib/elementary/elc_naviframe.c:968
#: src/lib/elementary/elc_naviframe.c:1186
@ -312,15 +309,15 @@ msgstr "Suivant"
#: src/lib/elementary/elc_popup.c:320 src/lib/elementary/elc_popup.c:984
msgid "Popup Title"
msgstr "Titre du Popup"
msgstr "Titre du pop-up"
#: src/lib/elementary/elc_popup.c:330 src/lib/elementary/elc_popup.c:1060
msgid "Popup Body Text"
msgstr "Corps du texte du Popup"
msgstr "Corps du texte du pop-up"
#: src/lib/elementary/elc_popup.c:1836
msgid "Alert"
msgstr ""
msgstr "Alerte"
#: src/lib/elementary/elm_bubble.c:163
msgid "Bubble"
@ -355,29 +352,29 @@ msgstr "élément du calendrier"
#: src/lib/elementary/elm_calendar.c:391
#: src/lib/elementary/efl_ui_calendar.c:267
msgid "calendar decrement month button"
msgstr "bouton du mois précédent"
msgstr "bouton de passage au mois précédent"
#: src/lib/elementary/elm_calendar.c:397
msgid "calendar decrement year button"
msgstr "bouton de l'année précédente"
msgstr "bouton de passage à l'année précédente"
#: src/lib/elementary/elm_calendar.c:403
#: src/lib/elementary/efl_ui_calendar.c:273
msgid "calendar increment month button"
msgstr "bouton du mois suivant"
msgstr "bouton de passage au mois suivant"
#: src/lib/elementary/elm_calendar.c:409
msgid "calendar increment year button"
msgstr "bouton de l'année suivante"
msgstr "bouton de passage à l'année suivante"
#: src/lib/elementary/elm_calendar.c:414
#: src/lib/elementary/efl_ui_calendar.c:278
msgid "calendar month"
msgstr "Mois du calendrier"
msgstr "mois du calendrier"
#: src/lib/elementary/elm_calendar.c:419
msgid "calendar year"
msgstr "Année du calendrier"
msgstr "année du calendrier"
#: src/lib/elementary/efl_ui_check.c:76 src/lib/elementary/efl_ui_check.c:200
#: src/lib/elementary/efl_ui_radio.c:136 src/lib/elementary/efl_ui_radio.c:202
@ -399,11 +396,11 @@ msgstr "À cocher"
#: src/lib/elementary/elm_clock.c:309
msgid "clock increment button for am,pm"
msgstr "Bouton d'incrémentation pour matin, après-midi"
msgstr "bouton d'incrémentation pour matin (am), après-midi (pm)"
#: src/lib/elementary/elm_clock.c:317
msgid "clock decrement button for am,pm"
msgstr "Bouton de décrémentation pour matin, après-midi"
msgstr "bouton de décrémentation pour matin (am), après-midi (pm)"
#: src/lib/elementary/elm_clock.c:714
msgid "State: Editable"
@ -415,27 +412,27 @@ msgstr "Horloge"
#: src/lib/elementary/elm_colorselector.c:939
msgid "Pick a color"
msgstr ""
msgstr "Choisir une couleur"
#: src/lib/elementary/elm_colorselector.c:977
msgid "R:"
msgstr ""
msgstr "R (rouge) :"
#: src/lib/elementary/elm_colorselector.c:979
msgid "G:"
msgstr ""
msgstr "G (vert) :"
#: src/lib/elementary/elm_colorselector.c:981
msgid "B:"
msgstr ""
msgstr "B (bleu) :"
#: src/lib/elementary/elm_colorselector.c:983
msgid "A:"
msgstr ""
msgstr "A (alpha)"
#: src/lib/elementary/elm_colorselector.c:1707
msgid "color selector palette item"
msgstr "élément de palette de choix de couleur"
msgstr "élément du sélecteur de couleur"
#. TRANSLATORS: This string is special and defines if the language
#. by default is a Left To Right or Right To Left language. Most
@ -445,15 +442,15 @@ msgstr "élément de palette de choix de couleur"
#.
#: src/lib/elementary/elm_config.c:4158
msgid "default:LTR"
msgstr "default:LTR"
msgstr "par défaut : LTR (de gauche à droite)"
#: src/lib/elementary/elm_dayselector.c:437
msgid "day selector item"
msgstr "élement de choix de date"
msgstr "élément du sélecteur du jour"
#: src/lib/elementary/elm_diskselector.c:701
msgid "diskselector item"
msgstr "élément de choix de disque"
msgstr "élément du sélecteur de disque"
#: src/lib/elementary/elm_entry.c:1749
msgid "Cut"
@ -481,7 +478,7 @@ msgstr "Index"
#: src/lib/elementary/elm_index.c:123
msgid "Index Item"
msgstr ""
msgstr "Élément de l'index"
#: src/lib/elementary/elm_label.c:403
msgid "Label"
@ -497,11 +494,11 @@ msgstr "état : fermé"
#: src/lib/elementary/elm_panel.c:127
msgid "A panel is open"
msgstr ""
msgstr "Un panneau est ouvert"
#: src/lib/elementary/elm_panel.c:129
msgid "Double tap to close panel menu"
msgstr ""
msgstr "Appuyer deux fois pour fermer le menu du panneau"
#: src/lib/elementary/elm_panel.c:181
msgid "panel button"
@ -534,28 +531,27 @@ msgstr "curseur"
#: src/lib/elementary/elm_spinner.c:1071
msgid "incremented"
msgstr ""
msgstr "augmenté"
#: src/lib/elementary/elm_spinner.c:1077
msgid "decremented"
msgstr ""
msgstr "diminué"
#: src/lib/elementary/elm_spinner.c:1110 src/lib/elementary/elm_spinner.c:1177
msgid "spinner"
msgstr "bouton fléché"
msgstr "spinner"
#: src/lib/elementary/elm_spinner.c:1119 src/lib/elementary/elm_spinner.c:1160
msgid "spinner increment button"
msgstr "bouton fléché d'incrémentation"
msgstr "bouton d'incrémentation du spinner"
#: src/lib/elementary/elm_spinner.c:1122 src/lib/elementary/elm_spinner.c:1169
msgid "spinner decrement button"
msgstr "bouton fléché de décrémentation"
msgstr "bouton de décrémentation du spinner"
#: src/lib/elementary/elm_spinner.c:1124
#, fuzzy
msgid "spinner text"
msgstr "bouton fléché"
msgstr "texte du spinner"
#: src/lib/elementary/elm_toolbar.c:1753 src/lib/elementary/elm_toolbar.c:2355
msgid "Selected"
@ -571,7 +567,7 @@ msgstr "Possède un menu"
#: src/lib/elementary/elm_toolbar.c:2350
msgid "Unselected"
msgstr "sélectionné"
msgstr "Non sélectionné"
#: src/lib/elementary/elm_toolbar.c:2367
msgid "Toolbar Item"

View File

@ -98,7 +98,7 @@ elementary_test_src = [
'test_panes.c',
'test_ui_panes.c',
'test_ui_panel.c',
'test_ui_active_view.c',
'test_ui_spotlight.c',
'test_ui_radio.c',
'test_part_bg.c',
'test_part_shadow.c',

View File

@ -386,9 +386,9 @@ void test_efl_anim_interpolator(void *data, Evas_Object *obj, void *event_info);
void test_gesture_framework(void *data, Evas_Object *obj, void *event_info);
void test_ui_tab_pager(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_stack(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_plain(void *data, Evas_Object *obj, void *event_info);
void test_ui_active_view_scroll(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_stack(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_plain(void *data, Evas_Object *obj, void *event_info);
void test_ui_spotlight_scroll(void *data, Evas_Object *obj, void *event_info);
void test_ui_relative_layout(void *data, Evas_Object *obj, void *event_info);
void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info);
@ -1117,10 +1117,10 @@ add_tests:
//------------------------------//
ADD_TEST_EO(NULL, "Tab Pager", "Efl.Ui.Tab_Pager", test_ui_tab_pager);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Plain", test_ui_active_view_plain);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Scroll", test_ui_active_view_scroll);
ADD_TEST_EO(NULL, "Active View", "Efl.Ui.Active_View Stack", test_ui_active_view_stack);
ADD_TEST_EO(NULL, "Active View", "Navigation stack", test_ui_stack);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Plain", test_ui_spotlight_plain);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Scroll", test_ui_spotlight_scroll);
ADD_TEST_EO(NULL, "Spotlight", "Efl.Ui.Spotlight Stack", test_ui_spotlight_stack);
ADD_TEST_EO(NULL, "Spotlight", "Navigation stack", test_ui_stack);
//------------------------------//
ADD_TEST(NULL, "Popups", "Ctxpopup", test_ctxpopup);
ADD_TEST(NULL, "Popups", "Hover", test_hover);

View File

@ -405,17 +405,18 @@ _cal_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
max_date.tm_year + 1900);
}
static void
static Eina_Bool
_cal_format_cb(void *data EINA_UNUSED, Eina_Strbuf *str, const Eina_Value value)
{
struct tm current_time;
//return if the value type is other than EINA_VALUE_TYPE_TM
if (eina_value_type_get(&value) != EINA_VALUE_TYPE_TM)
return;
return EINA_FALSE;
eina_value_get(&value, &current_time);
eina_strbuf_append_strftime(str, "<< %b %y >>", &current_time);
return EINA_TRUE;
}
void
@ -444,7 +445,7 @@ test_efl_ui_calendar(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
efl_ui_calendar_date_max_set(efl_added, max_date),
efl_ui_calendar_date_set(efl_added, selected_date),
efl_event_callback_add(efl_added, EFL_UI_CALENDAR_EVENT_CHANGED, _cal_changed_cb, NULL),
efl_ui_format_string_set(efl_added, "%b"),
efl_ui_format_string_set(efl_added, "%b", EFL_UI_FORMAT_STRING_TYPE_TIME),
efl_pack(box, efl_added));
efl_add(EFL_UI_CALENDAR_CLASS, win,
@ -452,7 +453,7 @@ test_efl_ui_calendar(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
efl_ui_calendar_date_max_set(efl_added, max_date),
efl_ui_calendar_date_set(efl_added, selected_date),
efl_event_callback_add(efl_added, EFL_UI_CALENDAR_EVENT_CHANGED, _cal_changed_cb, NULL),
efl_ui_format_cb_set(efl_added, NULL, _cal_format_cb, NULL),
efl_ui_format_func_set(efl_added, NULL, _cal_format_cb, NULL),
efl_pack(box, efl_added));
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));

View File

@ -9,6 +9,10 @@ typedef struct _pbdata
Eo *win;
Eo *pb1;
Eo *pb2;
Eo *pb3;
Eo *pb4;
Eo *pb5;
Eo *check;
Eo *btn_start;
Eo *btn_stop;
Eo *btn_reset;
@ -45,6 +49,9 @@ _pb_timer_cb(void *d)
{
progress_val += 1;
efl_ui_range_value_set(pd->pb2, progress_val);
efl_ui_range_value_set(pd->pb3, progress_val);
efl_ui_range_value_set(pd->pb4, progress_val);
efl_ui_range_value_set(pd->pb5, progress_val);
}
if (!_set_progress_val(pd->pb1, 0.5))
@ -97,6 +104,9 @@ _reset_btn_clicked_cb(void *d, const Efl_Event *ev EINA_UNUSED)
efl_ui_range_value_set(pd->pb1, 0.0);
efl_ui_range_value_set(pd->pb2, 0.0);
efl_ui_range_value_set(pd->pb3, 0.0);
efl_ui_range_value_set(pd->pb4, 0.0);
efl_ui_range_value_set(pd->pb5, 0.0);
}
static void
@ -109,6 +119,29 @@ _win_delete_req_cb(void *d, const Efl_Event *ev EINA_UNUSED)
free(pd);
}
static Eina_Bool
_custom_format_cb(void *data EINA_UNUSED, Eina_Strbuf *str, const Eina_Value value)
{
double v;
eina_value_get(&value, &v);
if (v < 25.f) eina_strbuf_append_printf(str, "Starting up...");
else if (v < 50.f) eina_strbuf_append_printf(str, "Working...");
else if (v < 75.f) eina_strbuf_append_printf(str, "Getting there...");
else if (v < 100.f) eina_strbuf_append_printf(str, "Almost done...");
else eina_strbuf_append_printf(str, "Done!");
return EINA_TRUE;
}
static void
_toggle_progress_label(void *data, const Efl_Event *ev)
{
Efl_Ui_Check *check = ev->object;
Efl_Ui_Progressbar *pb3 = data;
Eina_Bool state = efl_ui_check_selected_get(check);
efl_ui_progressbar_show_progress_label_set(pb3, state);
}
void
test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@ -153,6 +186,37 @@ test_ui_progressbar(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf
efl_ui_range_value_set(efl_added, 10)
);
pd->pb3 = efl_add(EFL_UI_PROGRESSBAR_CLASS, bx,
efl_pack(bx, efl_added),
efl_text_set(efl_added, "Toggle progress label"),
efl_ui_range_limits_set(efl_added, 0, 100),
efl_ui_progressbar_show_progress_label_set(efl_added, EINA_FALSE),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(250, 20))
);
pd->check = efl_add(EFL_UI_CHECK_CLASS, bx,
efl_pack(bx, efl_added),
efl_event_callback_add(efl_added, EFL_UI_CHECK_EVENT_SELECTED_CHANGED,
_toggle_progress_label, pd->pb3),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(250, 20))
);
efl_text_set(pd->check, "Show progress label of above progressbar"),
pd->pb4 = efl_add(EFL_UI_PROGRESSBAR_CLASS, bx,
efl_pack(bx, efl_added),
efl_text_set(efl_added, "Custom string"),
efl_ui_range_limits_set(efl_added, 0, 100),
efl_ui_format_string_set(efl_added, "%d rabbits", EFL_UI_FORMAT_STRING_TYPE_SIMPLE),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(250, 20))
);
pd->pb5 = efl_add(EFL_UI_PROGRESSBAR_CLASS, bx,
efl_pack(bx, efl_added),
efl_text_set(efl_added, "Custom func"),
efl_ui_range_limits_set(efl_added, 0, 100),
efl_ui_format_func_set(efl_added, NULL, _custom_format_cb, NULL),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(250, 20))
);
btbx = efl_add(EFL_UI_BOX_CLASS, bx,
efl_pack(bx, efl_added),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL)

View File

@ -50,7 +50,7 @@ test_ui_spin(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
efl_ui_range_limits_set(efl_added, 0, 10),
efl_ui_range_value_set(efl_added, 6),
efl_ui_range_step_set(efl_added, 2),
efl_ui_format_string_set(efl_added, "test %d"),
efl_ui_format_string_set(efl_added, "test %d", EFL_UI_FORMAT_STRING_TYPE_SIMPLE),
efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED,_spin_changed_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_MIN_REACHED,_spin_min_reached_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_MAX_REACHED,_spin_max_reached_cb, NULL),

View File

@ -12,22 +12,22 @@ _spin_delay_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
printf("Value delay changed %d\n", (int)efl_ui_range_value_get(ev->object));
}
static void
_spin_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
printf("Value changed %d\n", (int)efl_ui_range_value_get(ev->object));
}
void
test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *win, *bx;
int i;
Eina_Array *array;
Efl_Ui_Spin_Special_Value values[12] = {
Efl_Ui_Format_Value special_values[] = {
{1, "January"}, {2, "February"}, {3, "March"}, {4, "April"},
{5, "May"}, {6, "June"}, {7, "July"}, {8, "August"},
{9, "September"}, {10, "October"}, {11, "November"}, {12, "December"}
};
array = eina_array_new(sizeof(Efl_Ui_Spin_Special_Value));
for (i = 0; i < NUM_OF_VALS; i++)
eina_array_push(array, &values[i]);
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Spin_Button"),
@ -44,12 +44,13 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
efl_ui_spin_button_circulate_set(efl_added, EINA_TRUE),
efl_ui_spin_button_editable_set(efl_added, EINA_TRUE),
efl_event_callback_add(efl_added, EFL_UI_SPIN_BUTTON_EVENT_DELAY_CHANGED,_spin_delay_changed_cb, NULL),
efl_event_callback_add(efl_added, EFL_UI_SPIN_EVENT_CHANGED, _spin_changed_cb, NULL),
efl_pack(bx, efl_added));
efl_add(EFL_UI_SPIN_BUTTON_CLASS, bx,
efl_ui_range_limits_set(efl_added, -100.0, 100.0),
efl_ui_range_value_set(efl_added, 0),
efl_ui_format_string_set(efl_added, "test float %0.2f"),
efl_ui_format_string_set(efl_added, "test float %0.2f", EFL_UI_FORMAT_STRING_TYPE_SIMPLE),
efl_ui_spin_button_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
@ -57,10 +58,9 @@ test_ui_spin_button(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
efl_ui_range_limits_set(efl_added, 1, 12),
efl_ui_range_value_set(efl_added, 1),
efl_ui_spin_button_editable_set(efl_added, EINA_FALSE),
efl_ui_spin_special_value_set(efl_added, array),
efl_ui_format_values_set(efl_added, EINA_C_ARRAY_ACCESSOR_NEW(special_values)),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
efl_pack(bx, efl_added));
eina_array_free(array);
efl_gfx_entity_size_set(win, EINA_SIZE2D(180, 140));
}

View File

@ -28,7 +28,7 @@ typedef enum _Pack_Type
typedef struct _Params
{
Evas_Object *navi;
Eo *active_view;
Eo *spotlight;
Eo *indicator;
int w, h;
Eina_Bool wfill, hfill;
@ -36,14 +36,14 @@ typedef struct _Params
typedef struct _Page_Set_Params
{
Eo *active_view;
Eo *spotlight;
Eo *spinner;
} Page_Set_Params;
typedef struct _Pack_Params
{
Pack_Type type;
Eo *active_view;
Eo *spotlight;
Eo *pack_sp;
Eo *unpack_sp;
Eo *unpack_btn;
@ -51,13 +51,19 @@ typedef struct _Pack_Params
typedef struct _Size_Params
{
Eo *active_view;
Eo *spotlight;
Eo *slider;
Params *params;
} Size_Params;
#define PAGE_NUM 3
static void
page_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
printf("Button Page is clicked!\n");
}
static Eo *
view_add(View_Type p, Eo *parent)
{
@ -95,6 +101,7 @@ view_add(View_Type p, Eo *parent)
case BUTTON:
page = efl_add(EFL_UI_BUTTON_CLASS, parent,
efl_text_set(efl_added, "Button Page"));
efl_event_callback_add(page, EFL_UI_EVENT_CLICKED, page_clicked_cb, NULL);
efl_gfx_hint_fill_set(page, EINA_TRUE, EINA_TRUE);
break;
@ -116,21 +123,21 @@ view_add(View_Type p, Eo *parent)
static void
prev_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *active_view = data;
int active_index = efl_ui_active_view_active_index_get(active_view);
Eo *spotlight = data;
int active_index = efl_ui_spotlight_active_index_get(spotlight);
if (active_index - 1 > -1)
efl_ui_active_view_active_index_set(active_view, active_index - 1);
efl_ui_spotlight_active_index_set(spotlight, active_index - 1);
}
static void
next_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *active_view = data;
int active_index = efl_ui_active_view_active_index_get(active_view);
Eo *spotlight = data;
int active_index = efl_ui_spotlight_active_index_get(spotlight);
if (active_index + 1 < efl_content_count(active_view))
efl_ui_active_view_active_index_set(active_view, active_index + 1);
if (active_index + 1 < efl_content_count(spotlight))
efl_ui_spotlight_active_index_set(spotlight, active_index + 1);
}
static void
@ -155,7 +162,7 @@ width_slider_cb(void *data, const Efl_Event *ev)
else h = params->h;
params->w = efl_ui_range_value_get(ev->object);
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(params->w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(params->w, h));
}
static void
@ -168,7 +175,7 @@ height_slider_cb(void *data, const Efl_Event *ev)
else w = params->w;
params->h = efl_ui_range_value_get(ev->object);
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, params->h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, params->h));
}
static void
@ -188,7 +195,7 @@ width_check_cb(void *data, const Efl_Event *ev)
if (params->params->hfill) h = -1;
else h = params->params->h;
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
}
static void
@ -208,7 +215,7 @@ height_check_cb(void *data, const Efl_Event *ev)
if (params->params->hfill) h = -1;
else h = params->params->h;
efl_ui_active_view_size_set(params->active_view, EINA_SIZE2D(w, h));
efl_ui_spotlight_size_set(params->spotlight, EINA_SIZE2D(w, h));
}
static void
@ -221,30 +228,30 @@ static void
pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Pack_Params *param = data;
Eo *active_view = param->active_view;
Eo *spotlight = param->spotlight;
Eo *page = NULL, *curr_page;
int index, cnt;
if ((param->type != UNPACK_AT) && (param->type != CLEAR))
{
index = efl_content_count(active_view);
index = efl_content_count(spotlight);
switch (index % 3)
{
case 0:
page = view_add(LAYOUT, active_view);
page = view_add(LAYOUT, spotlight);
break;
case 1:
page = view_add(LIST, active_view);
page = view_add(LIST, spotlight);
break;
case 2:
page = view_add(BUTTON, active_view);
page = view_add(BUTTON, spotlight);
break;
default:
page = view_add(LAYOUT, active_view);
page = view_add(LAYOUT, spotlight);
break;
}
}
@ -252,42 +259,42 @@ pack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
switch (param->type)
{
case PACK_BEGIN:
efl_pack_begin(active_view, page);
efl_pack_begin(spotlight, page);
break;
case PACK_END:
efl_pack_end(active_view, page);
efl_pack_end(spotlight, page);
break;
case PACK_BEFORE:
index = efl_ui_active_view_active_index_get(active_view);
curr_page = efl_pack_content_get(active_view, index);
efl_pack_before(active_view, page, curr_page);
index = efl_ui_spotlight_active_index_get(spotlight);
curr_page = efl_pack_content_get(spotlight, index);
efl_pack_before(spotlight, page, curr_page);
break;
case PACK_AFTER:
index = efl_ui_active_view_active_index_get(active_view);
curr_page = efl_pack_content_get(active_view, index);
efl_pack_after(active_view, page, curr_page);
index = efl_ui_spotlight_active_index_get(spotlight);
curr_page = efl_pack_content_get(spotlight, index);
efl_pack_after(spotlight, page, curr_page);
break;
case PACK_AT:
index = efl_ui_range_value_get(param->pack_sp);
efl_pack_at(active_view, page, index);
efl_pack_at(spotlight, page, index);
break;
case UNPACK_AT:
index = efl_ui_range_value_get(param->unpack_sp);
page = efl_pack_unpack_at(active_view, index);
page = efl_pack_unpack_at(spotlight, index);
efl_del(page);
break;
case CLEAR:
efl_pack_clear(active_view);
efl_pack_clear(spotlight);
break;
}
cnt = efl_content_count(active_view);
cnt = efl_content_count(spotlight);
index = efl_ui_range_value_get(param->pack_sp);
if (index > cnt)
@ -323,7 +330,7 @@ page_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Page_Set_Params *psp = data;
efl_ui_active_view_active_index_set(psp->active_view,
efl_ui_spotlight_active_index_set(psp->spotlight,
efl_ui_range_value_get(psp->spinner));
}
@ -338,19 +345,19 @@ indicator_icon_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Params *params = data;
params->indicator = efl_add(EFL_UI_ACTIVE_VIEW_INDICATOR_ICON_CLASS, params->active_view);
efl_ui_active_view_indicator_set(params->active_view, params->indicator);
params->indicator = efl_add(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS, params->spotlight);
efl_ui_spotlight_indicator_set(params->spotlight, params->indicator);
}
static void
indicator_none_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Params *params = data;
efl_ui_active_view_indicator_set(params->active_view, NULL);
efl_ui_spotlight_indicator_set(params->spotlight, NULL);
}
static void
active_view_size(void *data,
spotlight_size(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
@ -396,7 +403,7 @@ active_view_size(void *data,
if (!size_params) return;
size_params->slider = sl;
size_params->active_view = params->active_view;
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, width_check_cb,
@ -437,7 +444,7 @@ active_view_size(void *data,
if (!size_params) return;
size_params->slider = sl;
size_params->active_view = params->active_view;
size_params->spotlight = params->spotlight;
size_params->params = params;
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, height_check_cb,
@ -456,7 +463,7 @@ _animation_cb(void *data, const Efl_Event *ev)
{
Params *params = data;
efl_ui_active_view_view_manager_animation_enabled_set(efl_ui_active_view_manager_get(params->active_view), efl_ui_check_selected_get(ev->object));
efl_ui_spotlight_manager_animation_enabled_set(efl_ui_spotlight_manager_get(params->spotlight), efl_ui_check_selected_get(ev->object));
}
static void
@ -479,7 +486,7 @@ view_animation_cb(void *data,
ck = efl_add(EFL_UI_CHECK_CLASS, box);
efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _animation_cb, params);
efl_ui_check_selected_set(ck, efl_ui_active_view_view_manager_animation_enabled_get(efl_ui_active_view_manager_get(params->active_view)));
efl_ui_check_selected_set(ck, efl_ui_spotlight_manager_animation_enabled_get(efl_ui_spotlight_manager_get(params->spotlight)));
efl_text_set(ck, "Animation");
efl_pack_end(box, ck);
efl_gfx_entity_visible_set(ck, 1);
@ -492,7 +499,7 @@ pack_cb(void *data,
{
Params *params = (Params *)data;
Evas_Object *navi = params->navi;
Eo *active_view = params->active_view;
Eo *spotlight = params->spotlight;
Eo *btn, *box, *in_box1, *in_box2, *sp1, *sp2;
Pack_Params *pack_param;
@ -512,9 +519,9 @@ pack_cb(void *data,
sp1 = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box1,
efl_ui_range_limits_set(efl_added, 0,
efl_content_count(active_view)),
efl_content_count(spotlight)),
efl_ui_range_value_set(efl_added,
efl_ui_active_view_active_index_get(active_view)));
efl_ui_spotlight_active_index_get(spotlight)));
in_box2 = efl_add(EFL_UI_BOX_CLASS, box,
efl_gfx_arrangement_content_padding_set(efl_added, 10, 10, EINA_TRUE),
@ -529,7 +536,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -547,7 +554,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -565,7 +572,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -583,7 +590,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -601,7 +608,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -622,7 +629,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -633,12 +640,12 @@ pack_cb(void *data,
efl_event_callback_add(btn, EFL_EVENT_DEL,
pack_btn_del_cb, pack_param);
if (efl_content_count(active_view) > 0)
if (efl_content_count(spotlight) > 0)
{
efl_ui_range_limits_set(sp2, 0,
(efl_content_count(active_view) - 1));
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp2,
efl_ui_active_view_active_index_get(active_view));
efl_ui_spotlight_active_index_get(spotlight));
}
else
{
@ -654,7 +661,7 @@ pack_cb(void *data,
pack_param = calloc(1, sizeof(Pack_Params));
if (!pack_param) return;
pack_param->active_view = active_view;
pack_param->spotlight = spotlight;
pack_param->pack_sp = sp1;
pack_param->unpack_sp = sp2;
pack_param->unpack_btn = btn;
@ -676,7 +683,7 @@ active_index_cb(void *data,
{
Params *params = (Params *)data;
Evas_Object *navi = params->navi;
Eo *active_view = params->active_view;
Eo *spotlight = params->spotlight;
Eo *btn, *box, *sp;
Page_Set_Params *psp = calloc(1, sizeof(Page_Set_Params));
if (!psp) return;
@ -699,12 +706,12 @@ active_index_cb(void *data,
efl_gfx_hint_align_set(efl_added, -1, -1),
efl_pack_end(box, efl_added));
if (efl_content_count(active_view) > 0)
if (efl_content_count(spotlight) > 0)
{
efl_ui_range_limits_set(sp, 0,
(efl_content_count(active_view) - 1));
(efl_content_count(spotlight) - 1));
efl_ui_range_value_set(sp,
efl_ui_active_view_active_index_get(active_view));
efl_ui_spotlight_active_index_get(spotlight));
}
else
{
@ -712,7 +719,7 @@ active_index_cb(void *data,
elm_object_disabled_set(sp, EINA_TRUE);
}
psp->active_view = active_view;
psp->spotlight = spotlight;
psp->spinner = sp;
efl_event_callback_add(btn, EFL_UI_EVENT_CLICKED, page_set_btn_cb, psp);
@ -752,18 +759,18 @@ indicator_cb(void *data,
}
void
test_ui_active_view_stack(void *data EINA_UNUSED,
test_ui_spotlight_stack(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Stack"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Stack"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -789,36 +796,36 @@ test_ui_active_view_stack(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_active_view_manager_set(active_view, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS));
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -832,40 +839,40 @@ test_ui_active_view_stack(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
}
void
test_ui_active_view_plain(void *data EINA_UNUSED,
test_ui_spotlight_plain(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Plain"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Plain"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -891,34 +898,34 @@ test_ui_active_view_plain(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -931,40 +938,40 @@ test_ui_active_view_plain(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));
}
void
test_ui_active_view_scroll(void *data EINA_UNUSED,
test_ui_spotlight_scroll(void *data EINA_UNUSED,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Eo *win, *panes, *navi, *list, *layout, *active_view, *view;
Eo *win, *panes, *navi, *list, *layout, *spotlight, *view;
Params *params = NULL;
char buf[PATH_MAX];
int i;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Active_View Scroll"),
efl_text_set(efl_added, "Efl.Ui.Spotlight Scroll"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
panes = efl_add(EFL_UI_PANES_CLASS, win,
@ -990,36 +997,36 @@ test_ui_active_view_scroll(void *data EINA_UNUSED,
efl_file_load(efl_added),
efl_content_set(efl_part(panes, "second"), efl_added));
active_view = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, layout,
spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
efl_content_set(efl_part(layout, "pager"), efl_added),
efl_ui_active_view_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_spotlight_size_set(efl_added, EINA_SIZE2D(200, 300)));
efl_ui_active_view_manager_set(active_view, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
efl_ui_spotlight_manager_set(spotlight, efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Prev"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, prev_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, prev_btn_cb, spotlight),
efl_content_set(efl_part(layout, "prev_btn"), efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_text_set(efl_added, "Next"),
efl_event_callback_add(efl_added,
EFL_UI_EVENT_CLICKED, next_btn_cb, active_view),
EFL_UI_EVENT_CLICKED, next_btn_cb, spotlight),
efl_content_set(efl_part(layout, "next_btn"), efl_added));
params = calloc(1, sizeof(Params));
if (!params) return;
params->navi = navi;
params->active_view = active_view;
params->spotlight = spotlight;
params->indicator = NULL;
params->w = 200;
params->h = 300;
params->wfill = EINA_FALSE;
params->hfill = EINA_FALSE;
elm_list_item_append(list, "View Size", NULL, NULL, active_view_size, params);
elm_list_item_append(list, "View Size", NULL, NULL, spotlight_size, params);
elm_list_item_append(list, "Pack / Unpack", NULL, NULL, pack_cb, params);
elm_list_item_append(list, "Active Index", NULL, NULL, active_index_cb, params);
elm_list_item_append(list, "Indicator", NULL, NULL, indicator_cb, params);
@ -1032,22 +1039,22 @@ test_ui_active_view_scroll(void *data EINA_UNUSED,
switch (i % 3)
{
case 0:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
case 1:
view = view_add(LIST, active_view);
view = view_add(LIST, spotlight);
break;
case 2:
view = view_add(BUTTON, active_view);
view = view_add(BUTTON, spotlight);
break;
default:
view = view_add(LAYOUT, active_view);
view = view_add(LAYOUT, spotlight);
break;
}
efl_pack_end(active_view, view);
efl_pack_end(spotlight, view);
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(580, 320));

View File

@ -19,7 +19,7 @@ static void
_stack_pop(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *stack = data;
efl_ui_active_view_pop(stack, EINA_TRUE);
efl_ui_spotlight_pop(stack, EINA_TRUE);
}
static void
@ -99,7 +99,7 @@ _fifth_layout_insert(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *nl = _navigation_layout_create(stack, "5th layout", btn);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -115,7 +115,7 @@ _third_layout_push(void *data, const Efl_Event *ev EINA_UNUSED)
_bar_right_btn_set(nl, _fifth_layout_insert, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -131,7 +131,7 @@ _second_layout_push(void *data, const Efl_Event *ev EINA_UNUSED)
_bar_right_btn_set(nl, _third_layout_push, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
static void
@ -146,7 +146,7 @@ _first_layout_push(Eo *win, Eo *stack)
_bar_left_btn_set(nl, _win_del, win);
_bar_right_btn_set(nl, _second_layout_push, stack);
efl_ui_active_view_push(stack, nl);
efl_ui_spotlight_push(stack, nl);
}
void
@ -158,7 +158,7 @@ test_ui_stack(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 500));
Eo *stack = efl_ui_active_view_util_stack_gen(win);
Eo *stack = efl_ui_spotlight_util_stack_gen(win);
efl_content_set(win, stack);

View File

@ -165,7 +165,7 @@ test_ui_tab_pager(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
efl_pack_end(tp, page);
}
efl_ui_active_view_active_index_set(tp, 0);
efl_ui_spotlight_active_index_set(tp, 0);
ad = (App_Data*)calloc(1, sizeof(App_Data));
ad->navi = navi;
@ -199,7 +199,7 @@ static void
_tab_set_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Tab_Set_Data *tsd = data;
efl_ui_active_view_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
efl_ui_spotlight_active_index_set(tsd->tab_pager, elm_spinner_value_get(tsd->spinner));
}
static void
@ -230,7 +230,7 @@ _current_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(box, efl_added));
tsd->tab_pager = tab_pager;
@ -272,7 +272,7 @@ _pack_before_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *tab_page, *cur_tab_page;
int index;
index = efl_ui_active_view_active_index_get(tab_pager);
index = efl_ui_spotlight_active_index_get(tab_pager);
cur_tab_page = efl_pack_content_get(tab_pager, index);
tab_page = tab_page_add(tab_pager);
@ -287,7 +287,7 @@ _pack_after_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
Eo *tab_page, *cur_tab_page;
int index;
index = efl_ui_active_view_active_index_get(tab_pager);
index = efl_ui_spotlight_active_index_get(tab_pager);
cur_tab_page = efl_pack_content_get(tab_pager, index);
tab_page = tab_page_add(tab_pager);
@ -364,7 +364,7 @@ _pack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@ -389,7 +389,7 @@ static void
_unpack_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *tab_pager = data;
int index = efl_ui_active_view_active_index_get(tab_pager);
int index = efl_ui_spotlight_active_index_get(tab_pager);
Eo *tab_page = efl_pack_content_get(tab_pager, index);
efl_pack_unpack(tab_pager, tab_page);
efl_del(tab_page);
@ -464,7 +464,7 @@ _unpack_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
sp = efl_add(EFL_UI_SPIN_BUTTON_CLASS, in_box,
efl_ui_range_limits_set(efl_added, 0, efl_content_count(tab_pager) - 1),
efl_ui_range_value_set(efl_added, efl_ui_active_view_active_index_get(tab_pager)),
efl_ui_range_value_set(efl_added, efl_ui_spotlight_active_index_get(tab_pager)),
efl_pack_end(in_box, efl_added));
tsd->tab_pager = tab_pager;
@ -488,7 +488,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
char *label = NULL;
char *icon = NULL;
int cur;
cur = efl_ui_active_view_active_index_get(tcd->tab_pager);
cur = efl_ui_spotlight_active_index_get(tcd->tab_pager);
tab_page = efl_pack_content_get(tcd->tab_pager, cur);
if (efl_ui_check_selected_get(tcd->label_check))
@ -556,23 +556,23 @@ _tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
static void
_tran_set_btn_scroll_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll *scroll = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS);
efl_ui_active_view_manager_set(data, scroll);
Efl_Ui_Spotlight_Manager_Scroll *scroll = efl_new(EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS);
efl_ui_spotlight_manager_set(data, scroll);
efl_unref(scroll);
}
static void
_tran_set_btn_stack_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll *stack = efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS);
efl_ui_active_view_manager_set(data, stack);
Efl_Ui_Spotlight_Manager_Scroll *stack = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
efl_ui_spotlight_manager_set(data, stack);
efl_unref(stack);
}
static void
_tran_unset_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
efl_ui_active_view_manager_set(data, NULL);
efl_ui_spotlight_manager_set(data, NULL);
}
static void

View File

@ -78,7 +78,7 @@ test_ui_tags(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_ADDED, _item_added_cb, array),
efl_event_callback_add(efl_added, EFL_UI_TAGS_EVENT_ITEM_DELETED, _item_deleted_cb, array),
efl_text_set(efl_added, "To :"),
efl_ui_format_string_set(efl_added, "+ %d items"),
efl_ui_format_string_set(efl_added, "+ %d items", EFL_UI_FORMAT_STRING_TYPE_SIMPLE),
elm_object_part_content_set(layout, "multibuttonentry", efl_added));
efl_add(EFL_UI_BUTTON_CLASS, layout,

View File

@ -150,10 +150,50 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
eina_strbuf_append(buf, "0");
}
static const char *
_free_func_get(const Eolian_Type *type)
{
const Eolian_Type *ab = eolian_type_aliased_base_get(type);
switch (eolian_type_builtin_type_get(ab))
{
/* simple types */
case EOLIAN_TYPE_BUILTIN_MSTRING:
return "free";
case EOLIAN_TYPE_BUILTIN_STRINGSHARE:
return "eina_stringshare_del";
case EOLIAN_TYPE_BUILTIN_ANY_VALUE:
return "eina_value_flush";
case EOLIAN_TYPE_BUILTIN_ANY_VALUE_PTR:
return "eina_value_free";
/* complex types */
case EOLIAN_TYPE_BUILTIN_ACCESSOR:
return "eina_accessor_free";
case EOLIAN_TYPE_BUILTIN_ARRAY:
return "eina_array_free";
case EOLIAN_TYPE_BUILTIN_FUTURE:
return "(void)";
case EOLIAN_TYPE_BUILTIN_ITERATOR:
return "eina_iterator_free";
case EOLIAN_TYPE_BUILTIN_HASH:
return "eina_hash_free";
case EOLIAN_TYPE_BUILTIN_LIST:
return "eina_list_free";
/* class and user types */
case EOLIAN_TYPE_BUILTIN_INVALID:
if (eolian_type_type_get(ab) == EOLIAN_TYPE_CLASS)
return "efl_del";
else
return eolian_typedecl_free_func_get(eolian_type_typedecl_get(ab));
/* no free func */
default:
return NULL;
}
}
static void
_generate_normal_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eina_Strbuf *parameter, const char *additional_intention)
{
const char *free_func = eolian_type_free_func_get(type);
const char *free_func = _free_func_get(type);
if (!free_func)
{
printf("No free type %s\n", eolian_type_short_name_get(type));
@ -230,7 +270,7 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
{
eina_strbuf_append_printf(*buf," eina_hash_free_cb_set(");
eina_strbuf_append_buffer(*buf, param);
eina_strbuf_append_printf(*buf, ",%s);\n",eolian_type_free_func_get(inner_type));
eina_strbuf_append_printf(*buf, ",%s);\n",_free_func_get(inner_type));
eina_strbuf_append_printf(*buf," eina_hash_free(");
eina_strbuf_append_buffer(*buf, param);
eina_strbuf_append(*buf, ");\n");

View File

@ -1,3 +1,5 @@
#include <ctype.h>
#include "main.h"
#include "headers.h"
#include "docs.h"
@ -214,6 +216,40 @@ _var_generate(const Eolian_State *state, const Eolian_Variable *vr)
return buf;
}
static Eina_Strbuf *
_err_generate(const Eolian_State *state, const Eolian_Error *err)
{
char *fn = strdup(eolian_error_name_get(err));
char *p = strrchr(fn, '.');
if (p) *p = '\0';
Eina_Strbuf *buf = eo_gen_docs_full_gen(state, eolian_error_documentation_get(err),
fn, 0);
if (p)
{
*p = '_';
while ((p = strchr(fn, '.')))
*p = '_';
}
eina_str_tolower(&fn);
if (!buf) buf = eina_strbuf_new();
else eina_strbuf_append_char(buf, '\n');
eina_strbuf_prepend_printf(buf, "EWAPI extern Eina_Error %s_get(void);\n\n", fn);
char *ufn = strdup(fn);
eina_str_toupper(&ufn);
eina_strbuf_append_printf(buf, "#define %s %s_get()", ufn, fn);
free(ufn);
free(fn);
if (eolian_error_is_beta(err))
{
eina_strbuf_prepend(buf, "#ifdef EFL_BETA_API_SUPPORT\n");
eina_strbuf_append(buf, "\n#endif /* EFL_BETA_API_SUPPORT */");
}
return buf;
}
void eo_gen_types_header_gen(const Eolian_State *state,
Eina_Iterator *itr, Eina_Strbuf *buf,
Eina_Bool full)
@ -238,6 +274,21 @@ void eo_gen_types_header_gen(const Eolian_State *state,
}
continue;
}
else if (dt == EOLIAN_OBJECT_ERROR)
{
const Eolian_Error *err = (const Eolian_Error *)decl;
if (!err || eolian_error_is_extern(err))
continue;
Eina_Strbuf *ebuf = _err_generate(state, err);
if (ebuf)
{
eina_strbuf_append(buf, eina_strbuf_string_get(ebuf));
eina_strbuf_append(buf, "\n\n");
eina_strbuf_free(ebuf);
}
continue;
}
if (dt != EOLIAN_OBJECT_TYPEDECL)
continue;
@ -270,6 +321,95 @@ void eo_gen_types_header_gen(const Eolian_State *state,
eina_iterator_free(itr);
}
static void
_source_gen_error(Eina_Strbuf *buf, const Eolian_Error *err)
{
if (eolian_error_is_extern(err))
return;
char *fn = strdup(eolian_error_name_get(err));
for (char *p = strchr(fn, '.'); p; p = strchr(p, '.'))
*p = '_';
eina_str_tolower(&fn);
eina_strbuf_append_printf(buf, "EWAPI %s_get(void)\n{\n", fn);
free(fn);
const char *msg = eolian_error_message_get(err);
eina_strbuf_append(buf, " static Eina_Error err = eina_error_msg_static_register(\"");
for (const char *p = msg; *p; ++p)
switch (*p)
{
case '\\':
case '\'':
case '\"':
{
eina_strbuf_append_char(buf, '\\');
eina_strbuf_append_char(buf, *p);
continue;
}
case '\n':
{
eina_strbuf_append_char(buf, '\\');
eina_strbuf_append_char(buf, 'n');
continue;
}
case '\t':
{
eina_strbuf_append_char(buf, '\\');
eina_strbuf_append_char(buf, 't');
continue;
}
default:
{
if (isprint(*p))
eina_strbuf_append_char(buf, *p);
else
eina_strbuf_append_printf(buf, "\\x%2X", (unsigned int)*p);
continue;
}
}
eina_strbuf_append(buf, "\");\n");
eina_strbuf_append(buf, " return err;\n}\n\n");
}
static void
_source_gen_var(Eina_Strbuf *buf, const Eolian_Variable *vr)
{
if (eolian_variable_is_extern(vr))
return;
if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT)
return;
const Eolian_Expression *vv = eolian_variable_value_get(vr);
if (!vv)
return;
char *fn = strdup(eolian_variable_name_get(vr));
for (char *p = strchr(fn, '.'); p; p = strchr(p, '.'))
*p = '_';
eina_str_toupper(&fn);
const Eolian_Type *vt = eolian_variable_base_type_get(vr);
Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT);
eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn);
eina_stringshare_del(ct);
free(fn);
Eolian_Value val = eolian_expression_eval_type(vv, vt);
Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
eina_strbuf_append(buf, lit);
eina_strbuf_append_char(buf, ';');
Eina_Stringshare *exp = eolian_expression_serialize(vv);
if (exp && strcmp(lit, exp))
eina_strbuf_append_printf(buf, " /* %s */", exp);
eina_stringshare_del(lit);
eina_stringshare_del(exp);
eina_strbuf_append(buf, "\n");
}
void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf)
{
const Eolian_Object *decl;
@ -277,42 +417,10 @@ void eo_gen_types_source_gen(Eina_Iterator *itr, Eina_Strbuf *buf)
{
Eolian_Object_Type dt = eolian_object_type_get(decl);
if (dt != EOLIAN_OBJECT_VARIABLE)
continue;
const Eolian_Variable *vr = (const Eolian_Variable *)decl;
if (eolian_variable_is_extern(vr))
continue;
if (eolian_variable_type_get(vr) == EOLIAN_VAR_CONSTANT)
continue;
const Eolian_Expression *vv = eolian_variable_value_get(vr);
if (!vv)
continue;
char *fn = strdup(eolian_variable_name_get(vr));
for (char *p = strchr(fn, '.'); p; p = strchr(p, '.'))
*p = '_';
eina_str_toupper(&fn);
const Eolian_Type *vt = eolian_variable_base_type_get(vr);
Eina_Stringshare *ct = eolian_type_c_type_get(vt, EOLIAN_C_TYPE_DEFAULT);
eina_strbuf_append_printf(buf, "EWAPI %s %s = ", ct, fn);
eina_stringshare_del(ct);
free(fn);
Eolian_Value val = eolian_expression_eval_type(vv, vt);
Eina_Stringshare *lit = eolian_expression_value_to_literal(&val);
eina_strbuf_append(buf, lit);
eina_strbuf_append_char(buf, ';');
Eina_Stringshare *exp = eolian_expression_serialize(vv);
if (exp && strcmp(lit, exp))
eina_strbuf_append_printf(buf, " /* %s */", exp);
eina_stringshare_del(lit);
eina_stringshare_del(exp);
eina_strbuf_append(buf, "\n");
if (dt == EOLIAN_OBJECT_ERROR)
_source_gen_error(buf, (const Eolian_Error *)decl);
else if (dt == EOLIAN_OBJECT_VARIABLE)
_source_gen_var(buf, (const Eolian_Variable *)decl);
}
eina_iterator_free(itr);
}

View File

@ -435,7 +435,7 @@ struct event_definition_generator
scope_tab << "{\n"
<< scope_tab << scope_tab << "add\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "lock (eventLock)\n"
<< scope_tab << scope_tab << scope_tab << "lock (eflBindingEventLock)\n"
<< scope_tab << scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "Efl.EventCb callerCb = (IntPtr data, ref Efl.Event.NativeStruct evt) =>\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "{\n"
@ -460,7 +460,7 @@ struct event_definition_generator
<< scope_tab << scope_tab << "}\n\n"
<< scope_tab << scope_tab << "remove\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "lock (eventLock)\n"
<< scope_tab << scope_tab << scope_tab << "lock (eflBindingEventLock)\n"
<< scope_tab << scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "string key = \"_" << upper_c_name << "\";\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "RemoveNativeEventHandler(" << library_name << ", key, value);\n"

View File

@ -178,9 +178,10 @@ struct function_definition_generator
std::string self = "this.NativeHandle";
// inherited is set in the constructor, true if this instance is from a pure C# class (not generated).
// IsGeneratedBindingClass is set in the constructor, true if this
// instance is from a pure C# class (not generated).
if (do_super && !f.is_static)
self = "(inherited ? Efl.Eo.Globals.efl_super(" + self + ", this.NativeClass) : " + self + ")";
self = "(IsGeneratedBindingClass ? " + self + " : Efl.Eo.Globals.efl_super(" + self + ", this.NativeClass))";
else if (f.is_static)
self = "";

View File

@ -214,7 +214,8 @@ struct klass
<< scope_tab << scope_tab << name_helpers::klass_get_name(cls) << "();\n"
<< scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << interface_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "private " << concrete_name << "(System.IntPtr raw) : base(raw)\n"
<< scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
<< scope_tab << "private " << concrete_name << "(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n"
<< scope_tab << "{\n"
<< scope_tab << "}\n\n"
)
@ -510,8 +511,8 @@ struct klass
<< scope_tab << "}\n\n"
<< scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "/// <param name=\"raw\">The native pointer to be wrapped.</param>\n"
<< scope_tab << "protected " << inherit_name << "(System.IntPtr raw) : base(raw)\n"
<< scope_tab << "/// <param name=\"wh\">The native pointer to be wrapped.</param>\n"
<< scope_tab << "protected " << inherit_name << "(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n"
<< scope_tab << "{\n"
<< scope_tab << "}\n\n"
).generate(sink, std::make_tuple(constructors, constructors, constructors), context))
@ -526,7 +527,7 @@ struct klass
scope_tab << "[Efl.Eo.PrivateNativeClass]\n"
<< scope_tab << "private class " << inherit_name << "Realized : " << inherit_name << "\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "private " << inherit_name << "Realized(IntPtr ptr) : base(ptr)\n"
<< scope_tab << scope_tab << "private " << inherit_name << "Realized(Efl.Eo.Globals.WrappingHandle wh) : base(wh)\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"

View File

@ -393,6 +393,16 @@ struct visitor_generate
return c;
}
}
, {"slice", nullptr, nullptr, [&]
{
return regular_type_def{" Eina.Slice", complex.outer.base_qualifier, {}};
}
}
, {"rw_slice", nullptr, nullptr, [&]
{
return regular_type_def{" Eina.RwSlice", complex.outer.base_qualifier, {}};
}
}
};
auto default_match = [&] (attributes::complex_type_def const& complex)

View File

@ -26,6 +26,7 @@ ffi.cdef [[
typedef struct _Eolian_Event Eolian_Event;
typedef struct _Eolian_Expression Eolian_Expression;
typedef struct _Eolian_Variable Eolian_Variable;
typedef struct _Eolian_Error Eolian_Error;
typedef struct _Eolian_Struct_Type_Field Eolian_Struct_Type_Field;
typedef struct _Eolian_Enum_Type_Field Eolian_Enum_Type_Field;
typedef struct _Eolian_Documentation Eolian_Documentation;
@ -50,7 +51,8 @@ ffi.cdef [[
EOLIAN_OBJECT_PART,
EOLIAN_OBJECT_IMPLEMENT,
EOLIAN_OBJECT_CONSTRUCTOR,
EOLIAN_OBJECT_DOCUMENTATION
EOLIAN_OBJECT_DOCUMENTATION,
EOLIAN_OBJECT_ERROR
} Eolian_Object_Type;
typedef enum
@ -331,8 +333,10 @@ ffi.cdef [[
Eina_Iterator *eolian_unit_classes_get(const Eolian_Unit *unit);
const Eolian_Variable *eolian_unit_global_by_name_get(const Eolian_Unit *unit, const char *name);
const Eolian_Variable *eolian_unit_constant_by_name_get(const Eolian_Unit *unit, const char *name);
const Eolian_Error *eolian_unit_error_by_name_get(const Eolian_Unit *unit, const char *name);
Eina_Iterator *eolian_unit_constants_get(const Eolian_Unit *unit);
Eina_Iterator *eolian_unit_globals_get(const Eolian_Unit *unit);
Eina_Iterator *eolian_unit_errors_get(const Eolian_Unit *unit);
const Eolian_Typedecl *eolian_unit_alias_by_name_get(const Eolian_Unit *unit, const char *name);
const Eolian_Typedecl *eolian_unit_struct_by_name_get(const Eolian_Unit *unit, const char *name);
const Eolian_Typedecl *eolian_unit_enum_by_name_get(const Eolian_Unit *unit, const char *name);
@ -343,6 +347,7 @@ ffi.cdef [[
const Eolian_Class *eolian_state_class_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_globals_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_constants_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_errors_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_aliases_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_structs_by_file_get(const Eolian_State *state, const char *file_name);
Eina_Iterator *eolian_state_enums_by_file_get(const Eolian_State *state, const char *file_name);
@ -435,6 +440,7 @@ ffi.cdef [[
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl *tp);
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
const Eolian_Error *eolian_type_error_get(const Eolian_Type *tp);
Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
@ -443,8 +449,6 @@ ffi.cdef [[
const char *eolian_type_c_type_get(const Eolian_Type *tp, Eolian_C_Type_Type ctype);
const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp);
const char *eolian_type_free_func_get(const Eolian_Type *tp);
const char *eolian_typedecl_free_func_get(const Eolian_Typedecl *tp);
const Eolian_Function *eolian_typedecl_function_pointer_get(const Eolian_Typedecl *tp);
@ -474,6 +478,10 @@ ffi.cdef [[
Eolian_Doc_Token_Type eolian_doc_token_type_get(const Eolian_Doc_Token *tok);
char *eolian_doc_token_text_get(const Eolian_Doc_Token *tok);
Eolian_Object_Type eolian_doc_token_ref_resolve(const Eolian_Doc_Token *tok, const Eolian_State *state, const Eolian_Object **data, const Eolian_Object **data2);
const char *eolian_error_message_get(const Eolian_Error *err);
const Eolian_Documentation *eolian_error_documentation_get(const Eolian_Error *err);
Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
]]
local cutil = require("cutil")
@ -524,7 +532,8 @@ M.object_type = {
PART = 11,
IMPLEMENT = 12,
CONSTRUCTOR = 13,
DOCUMENTATION = 14
DOCUMENTATION = 14,
ERROR = 15
}
M.object_scope = {
@ -679,6 +688,12 @@ local unit_idx, wrap_unit = gen_wrap {
return v
end,
error_by_name_get = function(self, name)
local v = eolian.eolian_unit_error_by_name_get(cast_unit(self), name)
if v == nil then return nil end
return v
end,
constants_get = function(self)
return Ptr_Iterator("const Eolian_Variable *",
eolian.eolian_unit_constants_get(cast_unit(self)))
@ -689,6 +704,11 @@ local unit_idx, wrap_unit = gen_wrap {
eolian.eolian_unit_globals_get(cast_unit(self)))
end,
errors_get = function(self)
return Ptr_Iterator("const Eolian_Error *",
eolian.eolian_unit_errors_get(cast_unit(self)))
end,
alias_by_name_get = function(self, name)
local v = eolian.eolian_unit_alias_by_name_get(cast_unit(self), name)
if v == nil then return nil end
@ -852,6 +872,11 @@ ffi.metatype("Eolian_State", {
eolian.eolian_state_constants_by_file_get(self, fname))
end,
errors_by_file_get = function(unit, fname)
return Ptr_Iterator("const Eolian_Error*",
eolian.eolian_state_errors_by_file_get(self, fname))
end,
aliases_by_file_get = function(self, fname)
return Ptr_Iterator("const Eolian_Typedecl *",
eolian.eolian_state_aliases_by_file_get(self, fname))
@ -1119,6 +1144,12 @@ M.Type = ffi.metatype("Eolian_Type", {
return v
end,
error_get = function(self)
local v = eolian.eolian_type_error_get(self)
if v == nil then return nil end
return v
end,
is_owned = function(self)
return eolian.eolian_type_is_owned(self) ~= 0
end,
@ -1135,12 +1166,6 @@ M.Type = ffi.metatype("Eolian_Type", {
local v = eolian.eolian_type_c_type_get(self, ctype)
if v == nil then return nil end
return ffi_stringshare(v)
end,
free_func_get = function(self)
local v = eolian.eolian_type_free_func_get(self)
if v == nil then return nil end
return ffi.string(v)
end
}
})
@ -1736,6 +1761,26 @@ M.Variable = ffi.metatype("Eolian_Variable", {
}
})
M.Error = ffi.metatype("Eolian_Error", {
__index = wrap_object {
documentation_get = function(self)
local v = eolian.eolian_error_documentation_get(self)
if v == nil then return nil end
return v
end,
message_get = function(self)
local v = eolian.eolian_error_message_get(self)
if v == nil then return nil end
return ffi.string(v)
end,
is_extern = function(self)
return eolian.eolian_error_is_extern(self) ~= 0
end
}
})
M.Documentation = ffi.metatype("Eolian_Documentation", {
__index = wrap_object {
summary_get = function(self)

View File

@ -295,12 +295,14 @@ public class Future
private static IntPtr ThenRaw(IntPtr previous, ResolvedCb cb)
{
FutureDesc desc = new FutureDesc();
desc.cb = NativeResolvedCb;
desc.cb = NativeResolvedCbDelegate;
GCHandle handle = GCHandle.Alloc(cb);
desc.data = GCHandle.ToIntPtr(handle);
return eina_future_then_from_desc(previous, desc);
}
private static FutureCb NativeResolvedCbDelegate = new FutureCb(NativeResolvedCb);
private static Eina.ValueNative NativeResolvedCb(IntPtr data, Eina.ValueNative value, IntPtr dead_future)
{
GCHandle handle = GCHandle.FromIntPtr(data);
@ -340,7 +342,7 @@ public class Future
for (; i < cbsList.Count(); i++)
{
ResolvedCb cb = cbsList[i];
descs[i].cb = NativeResolvedCb;
descs[i].cb = NativeResolvedCbDelegate;
GCHandle handle = GCHandle.Alloc(cb);
descs[i].data = GCHandle.ToIntPtr(handle);
}

View File

@ -47,29 +47,29 @@ public static partial class NativeMethods
/// </remarks>
public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
{
/// <sumary>
/// <summary>
/// Main constructor. Wrap the given string.
/// Have private acess to avoid wrapping a null reference,
/// use convertion or the factory method to create a new instance.
/// <see cref="Stringshare.Create(string s)"/>
/// <see cref="Stringshare.operator Stringshare(string s)"/>
/// </sumary>
/// <see cref="Create(string)"/>
/// <see cref="implicit operator Stringshare(string)"/>
/// </summary>
private Stringshare(string s)
{
Str = s;
}
/// <sumary>
/// <summary>
/// Auto-implemented property that holds the wrapped string value.
/// </sumary>
/// </summary>
public string Str { get; private set; }
/// <sumary>
/// <summary>
/// Factory method to instantiate a new object.
/// Get a wrappper for the given string or a null reference if the given
/// string reference is also null.
/// <seealso cref="Stringshare.operator Stringshare(string s)"/>
/// </sumary>
/// <seealso cref="implicit operator Stringshare(string)"/>
/// </summary>
/// <returns>
/// A new instance wrapping the given string, or a null reference if
/// the given string reference is also null.
@ -84,9 +84,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return new Stringshare(s);
}
/// <sumary>
/// <summary>
/// Implicit convertion to string.
/// </sumary>
/// </summary>
public static implicit operator string(Stringshare ss)
{
if (ReferenceEquals(null, ss))
@ -97,13 +97,13 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return ss.Str;
}
/// <sumary>
/// <summary>
/// Implicit convertion from string to Stringshare.
/// </sumary>
/// </summary>
/// <remarks>
/// Note that this method can be used to create an instance of this class,
/// either via an explicit cast or an implicit convertion.
/// <seealso cref="Stringshare.Create(string s)"/>
/// <seealso cref="Create(string)"/>
/// </remarks>
public static implicit operator Stringshare(string s)
{
@ -115,9 +115,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return new Stringshare(s);
}
/// <sumary>
/// <summary>
/// Check two Stringshare objects for equality.
/// </sumary>
/// </summary>
/// <returns>
/// True if both wrapped strings have the same content or if both
/// references are null, false otherwise.
@ -128,9 +128,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
}
/// <sumary>
/// <summary>
/// Check two Stringshare objects for inequality.
/// </sumary>
/// </summary>
/// <returns>
/// True if the wrapped strings have different content or if one reference is null
/// and the other is not, false otherwise.
@ -140,20 +140,20 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return !(ss1 == ss2);
}
/// <sumary>
/// <summary>
/// Returns the wrapped string.
/// <seealso cref="Stringshare.Str"/>
/// <seealso cref="Stringshare.Get()"/>
/// </sumary>
/// <seealso cref="Str"/>
/// <seealso cref="Get()"/>
/// </summary>
/// <returns>The wrapped string. Same as the property Str.</returns>
public override string ToString()
{
return Str;
}
/// <sumary>
/// <summary>
/// Override of GetHashCode for consistency with user-defined equality methods.
/// </sumary>
/// </summary>
/// <returns>
/// The wrapped string hash code.
/// </returns>
@ -162,9 +162,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return Str.GetHashCode();
}
/// <sumary>
/// <summary>
/// Check the given object for equality.
/// </sumary>
/// </summary>
/// <returns>
/// True if the given object is the same object or if it is another Stringshare object
/// and both wrapped strings are equal or if it is a string object and its content
@ -191,9 +191,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return other.GetType() == typeof(Stringshare) && this == ((Stringshare)other);
}
/// <sumary>
/// <summary>
/// Check the given Stringshare for equality.
/// </sumary>
/// </summary>
/// <returns>
/// True if the given Stringshare object is not null and its wrapped string
/// have the same content of this.Str, false otherwise.
@ -203,9 +203,9 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return this == other;
}
/// <sumary>
/// <summary>
/// Check the given Stringshare for equality.
/// </sumary>
/// </summary>
/// <returns>
/// True if the given string is not null and the wrapped string have the same
/// content of the given string, false otherwise.
@ -215,11 +215,11 @@ public class Stringshare : IEquatable<Stringshare>, IEquatable<string>
return this.Str == other;
}
/// <sumary>
/// <summary>
/// Get the wrapped string.
/// <seealso cref="Stringshare.Str"/>
/// <seealso cref="Stringshare.ToString()"/>
/// </sumary>
/// <seealso cref="Str"/>
/// <seealso cref="ToString()"/>
/// </summary>
/// <returns>The wrapped string. Same as the property Str.</returns>
public string Get()
{

View File

@ -10,11 +10,18 @@ namespace Efl
namespace Eo
{
/// <summary>
/// Abstract class that delivers base level binding to Efl Objects.
///
/// Most of it is protected functionalities to serve the generated
/// binding classes that inherit from it.
/// </summary>
public abstract class EoWrapper : IWrapper, IDisposable
{
protected readonly object eventLock = new object();
protected bool inherited = false;
protected System.IntPtr handle = IntPtr.Zero;
/// <summary>Object used to synchronize access to EFL events.</summary>
protected readonly object eflBindingEventLock = new object();
private bool generated = true;
private System.IntPtr handle = IntPtr.Zero;
private static Efl.EventCb ownershipUniqueDelegate = new Efl.EventCb(OwnershipUniqueCallback);
private static Efl.EventCb ownershipSharedDelegate = new Efl.EventCb(OwnershipSharedCallback);
@ -32,7 +39,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
/// <param name="ch">Tag struct storing the native handle of the object being constructed.</param>
protected EoWrapper(ConstructingHandle ch)
{
inherited = true;
generated = false;
handle = Efl.Eo.Globals.efl_constructor(Efl.Eo.Globals.efl_super(ch.NativeHandle, Efl.Eo.Globals.efl_class_get(ch.NativeHandle)));
if (handle == IntPtr.Zero)
{
@ -47,11 +54,12 @@ public abstract class EoWrapper : IWrapper, IDisposable
}
/// <summary>Initializes a new instance of the <see cref="Object"/> class.
/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>
/// <param name="raw">The native pointer to be wrapped.</param>
protected EoWrapper(System.IntPtr raw)
/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.
/// Do not implement this constructor.</summary>
/// <param name="wh">The native pointer to be wrapped.</param>
protected EoWrapper(Efl.Eo.Globals.WrappingHandle wh)
{
handle = raw;
handle = wh.NativeHandle;
AddWrapperSupervisor();
}
@ -67,9 +75,9 @@ public abstract class EoWrapper : IWrapper, IDisposable
[CallerFilePath] string file = null,
[CallerLineNumber] int line = 0)
{
inherited = ((object)this).GetType() != managedType;
generated = ((object)this).GetType() == managedType;
IntPtr actual_klass = baseKlass;
if (inherited)
if (!generated)
{
actual_klass = Efl.Eo.ClassRegister.GetInheritKlassOrRegister(baseKlass, ((object)this).GetType());
}
@ -82,7 +90,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
parent_ptr = parent.NativeHandle;
}
if (!inherited)
if (generated)
{
handle = Efl.Eo.Globals._efl_add_internal_start(file, line, actual_klass, parent_ptr, 1, 0);
}
@ -123,6 +131,20 @@ public abstract class EoWrapper : IWrapper, IDisposable
get;
}
/// <summary>
/// Whether this object type is one of the generated binding classes or a custom
/// class defined by the user and that inherit from one of the generated ones.
/// </summary>
/// <returns>
/// True if this object type is one of the generated binding classes,
/// false if it is class that is manually defined and that inherits from
/// one of the generated ones, including user defined classes.
/// </returns>
protected bool IsGeneratedBindingClass
{
get { return generated; }
}
/// <summary>Releases the underlying native instance.</summary>
protected virtual void Dispose(bool disposing)
{
@ -263,7 +285,7 @@ public abstract class EoWrapper : IWrapper, IDisposable
ws.MakeShared();
}
/// <sumary>Create and set to the internal native state a C# supervisor for this Eo wrapper. For internal use only.</sumary>
/// <summary>Create and set to the internal native state a C# supervisor for this Eo wrapper. For internal use only.</summary>
private void AddWrapperSupervisor()
{
var ws = new Efl.Eo.WrapperSupervisor(this);
@ -285,16 +307,24 @@ public abstract class EoWrapper : IWrapper, IDisposable
Eina.Error.RaiseIfUnhandledException();
}
/// <summary>
/// Struct to be used when constructing objects from native code.
/// Wraps the pointer handle to the native object instance.
/// </summary>
protected struct ConstructingHandle
{
/// <summary>Constructor for wrapping the native handle.</summary>
public ConstructingHandle(IntPtr h)
{
NativeHandle = h;
}
public IntPtr NativeHandle { get; set; }
/// <summary>Pointer to the native instance.</summary>
public IntPtr NativeHandle { get; private set; }
}
/// <summary>Wrapper for native methods and virtual method delegates.
/// For internal use by generated code only.</summary>
public abstract class NativeMethods : Efl.Eo.NativeClass
{
private static EflConstructorDelegate csharpEflConstructorStaticDelegate = new EflConstructorDelegate(Constructor);
@ -302,6 +332,8 @@ public abstract class EoWrapper : IWrapper, IDisposable
private delegate IntPtr EflConstructorDelegate(IntPtr obj, IntPtr pd);
/// <summary>Gets the list of Eo operations to override.</summary>
/// <returns>The list of Eo operations to be overload.</returns>
public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(Type type)
{
var descs = new System.Collections.Generic.List<Efl_Op_Description>();

View File

@ -624,14 +624,15 @@ public class Globals
try
{
var flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
constructor = managedType.GetConstructor(flags, null, new Type[1] { typeof(System.IntPtr) }, null);
constructor = managedType.GetConstructor(flags, null, new Type[1] { typeof(WrappingHandle) }, null);
}
catch (InvalidOperationException)
{
throw new InvalidOperationException($"Can't get constructor for type {managedType}");
}
var ret = (Efl.Eo.IWrapper) constructor.Invoke(new object[1] { handle });
WrappingHandle wh = new WrappingHandle(handle);
var ret = (Efl.Eo.IWrapper) constructor.Invoke(new object[1] { wh });
if (ret == null)
{
@ -715,6 +716,21 @@ public class Globals
Monitor.Exit(Efl.All.InitLock);
}
/// <summary>
/// Internal struct used by the binding to pass the native handle pointer
/// to the managed object wrapping constructor.
/// Internal usage only: do not use this class in inherited classes.
/// </summary>
public struct WrappingHandle
{
public WrappingHandle(IntPtr h)
{
NativeHandle = h;
}
public IntPtr NativeHandle { get; private set; }
}
} // Globals
public static class Config

View File

@ -155,7 +155,7 @@ efl_mono = library('efl_mono',
mono_generator_target + mono_files + [efl_src],
install : true,
install_dir : efl_mono_install_dir,
cs_args : extra_cs_args + ['-doc:' + efl_mono_xml_doc]
cs_args : extra_cs_args + ['-doc:' + efl_mono_xml_doc, '-warnaserror+']
)
meson.add_install_script(join_paths(meson.source_root(), 'meson', 'meson_csharp_docs.sh'),

View File

@ -1,5 +1,7 @@
#define EFL_CXXPERIMENTAL // for background part
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
using efl::eo::instantiate;

View File

@ -6,7 +6,9 @@
*/
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>

View File

@ -1,7 +1,9 @@
// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` button_cxx_example_00.cc -o button_cxx_example_00
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
#include <iostream>

View File

@ -1,7 +1,9 @@
// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` button_cxx_example_01.cc -o button_cxx_example_01
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
using efl::eo::instantiate;

View File

@ -26,17 +26,20 @@ struct appData
auto wcal(cal._get_wref());
// FIXME: How does one figure out the argument types for the function?
auto cb_a = std::bind([=](
auto cb_a = std::bind([](
efl::eina::strbuf_wrapper& sb,
efl::eina::value_view const& value) {
efl::eina::value_view const& value) -> bool {
try {
sb.append_strftime("%b. %y", efl::eina::get<tm>(value));
} catch (std::system_error const&) {
sb.append(value.to_string());
}
std::cout << "Month: " << std::string(sb) << std::endl;
return true;
}, _1, _2);
cal.format_cb_set(cb_a);
// FIXME XAR: I broke this and I do not know how to fix it
// cal.format_func_set(cb_a);
(void)cb_a;
}
void destroy() {

View File

@ -2,7 +2,7 @@
#include <Elementary.h>
static Efl_Ui_Active_View_Container *container;
static Efl_Ui_Spotlight_Container *container;
static Eina_Bool play_state = EINA_FALSE;
static Efl_Loop_Timer *show_timer = NULL;
@ -25,9 +25,9 @@ _show_next(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl_del(show_timer);
show_timer = NULL;
int current_index = efl_ui_active_view_active_index_get(container);
int current_index = efl_ui_spotlight_active_index_get(container);
int new_index = (current_index + 1) % efl_content_count(container);
efl_ui_active_view_active_index_set(container, new_index);
efl_ui_spotlight_active_index_set(container, new_index);
}
static void
@ -90,11 +90,11 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
table = efl_add(EFL_UI_TABLE_CLASS, win);
efl_content_set(win, table);
container = efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_END, _container_end, NULL),
container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
efl_event_callback_add(efl_added, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, _container_end, NULL),
efl_pack_table(table, efl_added, 0, 0, 1, 1));
efl_ui_active_view_indicator_set(container, efl_new(EFL_UI_ACTIVE_VIEW_INDICATOR_ICON_CLASS));
efl_ui_active_view_manager_set(container, efl_new(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS));
efl_ui_spotlight_indicator_set(container, efl_new(EFL_UI_SPOTLIGHT_INDICATOR_ICON_CLASS));
efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
for (int i = 0; i < IMG_NUM; i++)
{

View File

@ -1,7 +1,9 @@
// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` radio_cxx_example_01.cc -o radio_cxx_example_01
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
#include <iostream>

View File

@ -1,7 +1,9 @@
// g++ -g `pkg-config --cflags --libs elementary-cxx efl-cxx eina-cxx eo-cxx ecore-cxx evas-cxx edje-cxx` slider_cxx_example.cc -o slider_cxx_example
#define EFL_CXXPERIMENTAL
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
using namespace std::placeholders;

View File

@ -7,7 +7,9 @@
#warning This example requires yet unfinished EO APIs
#ifndef EFL_BETA_API_SUPPORT
#define EFL_BETA_API_SUPPORT
#endif
#include <Efl_Ui.hh>
EAPI int

View File

@ -1,59 +1,62 @@
enum @beta Efl.Exe_Signal {
[[ ]]
int,
quit,
term,
kill,
cont,
stop,
hup,
usr1,
usr2
[[Signal is a notification, a message sent by either operating system or some application to our program.
Signals are a mechanism for one-way asynchronous notifications. A signal may be sent from the kernel to
a process, from a process to another process, or from a process to itself. Signal typically alert a
process to some event, such as a segmentation fault, or the user pressing Ctrl-C.]]
int, [[Terminal interrupt.]]
quit, [[Terminal quit.]]
term, [[Termination.]]
kill, [[Kill(can't be caught or ignored).]]
cont, [[Continue executing, if stopped.]]
stop, [[Stop executing(can't be caught or ignored).]]
hup, [[Hangup.]]
usr1, [[User defined signal 1.]]
usr2 [[User defined signal 2.]]
}
enum @beta Efl.Exe_Flags {
[[ ]]
none = 0,
group_leader = 1,
exit_with_parent = 2,
hide_io = 4
[[Flags to customize task behavior.]] // TODO: This needs more detail.
none = 0, [[No special flags.]]
group_leader = 1, [[Process will be executed in its own session.]]
exit_with_parent = 2, [[Exit process when parent process exits.]]
hide_io = 4 [[All console IO will be hidden.]]
}
class @beta Efl.Exe extends Efl.Task implements Efl.Io.Reader, Efl.Io.Writer, Efl.Io.Closer, Efl.Core.Command_Line
{
[[ ]]
[[Further customization of @Efl.Task, including signals and environment control.]] // TODO: This needs more detail
methods {
signal {
[[Send a signal to this task.]]
params {
sig: Efl.Exe_Signal; [[ Send this signal to the task ]]
sig: Efl.Exe_Signal; [[Signal number to send.]]
}
}
@property exe_flags {
[[Customize the task's behavior.]]
set { }
get { }
values {
flags: Efl.Exe_Flags; [[ ]]
flags: Efl.Exe_Flags; [[Flags.]]
}
}
@property exit_signal {
[[ The final exit signal of this task. ]]
[[The final exit signal of this task.]]
get { }
values {
sig: int; [[ The exit signal, or -1 if no exit signal happened ]]
sig: int; [[The exit signal, or -1 if no exit signal happened.]]
}
}
@property env {
[[ If $env is $null then the process created by this object is
going to inherit the environment of this process.
[[If $env is $null then the process created by this object is
going to inherit the environment of this process.
In case $env is not $null then the environment variables declared
in this object will represent the environment passed to the new process.
In case $env is not $null then the environment variables declared
in this object will represent the environment passed to the new process.
]]
get {
[[ Get the object assosiated with this object ]]
}
set {
[[ Set the object assosiated with this object ]]
}
values {
env : Efl.Core.Env; [[$env will be referenced until this object does not need it anymore.]]

View File

@ -1,60 +1,62 @@
enum Efl.Task_Priority {
[[
[[How much processor time will this task get compared to other tasks running on
the same processor.
@since 1.22
]]
normal,
background,
low,
high,
ultra
normal, [[Neither above nor below average priority. This is the default.]]
background, [[Far below average priority.]]
low, [[Below average priority.]]
high, [[Above average priority.]]
ultra [[Far above average priority.]]
}
enum Efl.Task_Flags {
[[
[[Flags to further customize task's behavior.
@since 1.22
]]
none = 0,
use_stdin = 1,
use_stdout = 2,
no_exit_code_error = 4,
none = 0, [[No special flags.]]
use_stdin = 1, [[Task will require console input.]]
use_stdout = 2, [[Task will require console output.]]
no_exit_code_error = 4, [[Task will not produce an exit code upon termination.]]
}
abstract Efl.Task extends Efl.Loop_Consumer
{
[[
[[EFL's abstraction for a task (process).
@since 1.22
]]
]] // TODO: This needs more detail.
methods {
@property priority {
[[ The priority of this task. ]]
[[The priority of this task.]]
get { }
set { }
values {
priority: Efl.Task_Priority; [[ ]]
priority: Efl.Task_Priority; [[Desired priority.]]
}
}
@property exit_code {
[[ The final exit code of this task. ]]
[[The final exit code of this task. This is the code that will be produced upon task completion.]]
get { }
values {
code: int; [[ ]]
code: int; [[The exit code.]]
}
}
@property flags {
[[Flags to further customize task's behavior.]]
set { }
get { }
values {
flags: Efl.Task_Flags; [[ ]]
flags: Efl.Task_Flags; [[Desired task flags.]]
}
}
run @pure_virtual {
[[ Actually run the task ]]
return: future<void> @owned; [[ A future triggered when task exits and is passed int exit code ]]
[[Actually run the task.]]
return: future<void> @owned; [[A future triggered when task exits and is passed int exit code.]]
}
end @pure_virtual {
[[ Request the task end (may send a signal or interrupt
signal resulting in a terminate event being tiggered in the
target task loop) ]]
[[Request the task end (may send a signal or interrupt
signal resulting in a terminate event being tiggered in the
target task loop).]]
}
}
events {

View File

@ -15,7 +15,11 @@ _ector_renderer_efl_object_destructor(Eo *obj, Ector_Renderer_Data *pd)
efl_destructor(efl_super(obj, MY_CLASS));
if (pd->m) free(pd->m);
efl_unref(pd->surface);
/*FIXME: pd-> surface will try efl_xref whenever surface_set is called.
desturctor is called from a subclass, ref and unref do not match.
So, Add this condition temporarily.*/
if (efl_ref_count(pd->surface) > 0)
efl_unref(pd->surface);
}
static Efl_Object *

View File

@ -1,13 +1,13 @@
enum @beta Efl.Canvas.Layout_Part_Text_Expand
{
[[Text layout policy to enforce. If none is set, min/max descriptions
are taken in considerations solely.
[[Text layout policy to enforce. If none is set, only min/max descriptions
are taken into account.
]]
none = 0, [[No policy. Use default description parameters.]]
min_x = 1,
min_y = 1 << 1,
max_x = 1 << 2,
max_y = 1 << 3,
none = 0, [[No policy. Use default description parameters.]]
min_x = 1, [[Text is tied to the left side of the container.]]
min_y = 1 << 1, [[Text is tied to the top side of the container.]]
max_x = 1 << 2, [[Text is tied to the right side of the container.]]
max_y = 1 << 3, [[Text is tied to the bottom side of the container.]]
}
class @beta Efl.Canvas.Layout_Part_Text extends Efl.Canvas.Layout_Part implements Efl.Text,
@ -27,7 +27,7 @@ Efl.Text_Markup, Efl.Text_Markup_Interactive, Efl.Text_Format, Efl.Text_Font, Ef
line-wrapping etc.
]]
values {
type: Efl.Canvas.Layout_Part_Text_Expand;
type: Efl.Canvas.Layout_Part_Text_Expand; [[Desired sizing policy.]]
}
}

View File

@ -147,7 +147,6 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
#include "interfaces/efl_ui_property_bind.eo.h"
#include "interfaces/efl_ui_factory.eo.h"
#include "interfaces/efl_ui_factory_bind.eo.h"
#include "interfaces/efl_ui_format.eo.h"
#include "interfaces/efl_cached_item.eo.h"
/* Observable interface */

View File

@ -8,6 +8,8 @@
#include <Efl.h>
#define ERR(...) EINA_LOG_DOM_ERR(EINA_LOG_DOMAIN_DEFAULT, __VA_ARGS__)
#define MY_CLASS EFL_GFX_SHAPE_MIXIN
typedef struct _Efl_Gfx_Shape_Data
@ -142,6 +144,17 @@ EOLIAN static void
_efl_gfx_shape_stroke_color_set(Eo *obj EINA_UNUSED, Efl_Gfx_Shape_Data *pd,
int r, int g, int b, int a)
{
Eina_Bool err = EINA_FALSE;
if (a > 255) { a = 255; err = EINA_TRUE; }
if (a < 0) { a = 0; err = EINA_TRUE; }
if (r > a) { r = a; err = EINA_TRUE; }
if (r < 0) { r = 0; err = EINA_TRUE; }
if (g > a) { g = a; err = EINA_TRUE; }
if (g < 0) { g = 0; err = EINA_TRUE; }
if (b > a) { b = a; err = EINA_TRUE; }
if (b < 0) { b = 0; err = EINA_TRUE; }
if (err)
ERR("Only handles premultiplied colors (0 <= R,G,B <= A <= 255)");
pd->public.stroke.color.r = r;
pd->public.stroke.color.g = g;
pd->public.stroke.color.b = b;

View File

@ -1,169 +0,0 @@
#include "config.h"
#include "Efl.h"
#define ERR(...) EINA_LOG_DOM_ERR(EINA_LOG_DOMAIN_DEFAULT, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(EINA_LOG_DOMAIN_DEFAULT, __VA_ARGS__)
typedef enum _Format_Type
{
FORMAT_TYPE_INVALID,
FORMAT_TYPE_DOUBLE,
FORMAT_TYPE_INT,
FORMAT_TYPE_STRING,
FORMAT_TYPE_STATIC
} Format_Type;
typedef struct
{
const char *template;
Format_Type format_type;
} Efl_Ui_Format_Data;
static Eina_Bool
_is_valid_digit(char x)
{
return ((x >= '0' && x <= '9') || (x == '.')) ? EINA_TRUE : EINA_FALSE;
}
static Format_Type
_format_string_check(const char *fmt)
{
const char *itr;
Eina_Bool found = EINA_FALSE;
Format_Type ret_type = FORMAT_TYPE_STATIC;
for (itr = fmt; *itr; itr++)
{
if (itr[0] != '%') continue;
if (itr[1] == '%')
{
itr++;
if (ret_type == FORMAT_TYPE_STATIC)
ret_type = FORMAT_TYPE_STRING;
continue;
}
if (!found)
{
found = EINA_TRUE;
for (itr++; *itr; itr++)
{
// FIXME: This does not properly support int64 or unsigned.
if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') ||
(*itr == 'o') || (*itr == 'x') || (*itr == 'X'))
{
ret_type = FORMAT_TYPE_INT;
break;
}
else if ((*itr == 'f') || (*itr == 'F'))
{
ret_type = FORMAT_TYPE_DOUBLE;
break;
}
else if (*itr == 's')
{
ret_type = FORMAT_TYPE_STRING;
break;
}
else if (_is_valid_digit(*itr))
{
continue;
}
else
{
ERR("Format string '%s' has unknown format element '%c' in format. It must have one format element of type 's', 'f', 'F', 'd', 'u', 'i', 'o', 'x' or 'X'", fmt, *itr);
found = EINA_FALSE;
break;
}
}
if (!(*itr)) break;
}
else
{
ret_type = FORMAT_TYPE_INVALID;
break;
}
}
if (ret_type == FORMAT_TYPE_INVALID)
{
ERR("Format string '%s' is invalid. It must have one and only one format element of type 's', 'f', 'F', 'd', 'u', 'i', 'o', 'x' or 'X'", fmt);
}
return ret_type;
}
static void
_default_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
{
Efl_Ui_Format_Data *sd = data;
Eina_Value copy;
if (sd->format_type == FORMAT_TYPE_DOUBLE)
{
double v = 0.0;
eina_value_setup(&copy, EINA_VALUE_TYPE_DOUBLE);
eina_value_convert(&value, &copy);
eina_value_get(&copy, &v);
eina_strbuf_append_printf(str, sd->template, v);
eina_value_flush(&copy);
}
else if (sd->format_type == FORMAT_TYPE_INT)
{
int v = 0;
eina_value_setup(&copy, EINA_VALUE_TYPE_INT);
eina_value_convert(&value, &copy);
eina_value_get(&copy, &v);
eina_strbuf_append_printf(str, sd->template, v);
eina_value_flush(&copy);
}
else if (sd->format_type == FORMAT_TYPE_STRING)
{
char *v = eina_value_to_string(&value);
eina_strbuf_append_printf(str, sd->template, v);
free(v);
}
else if (sd->format_type == FORMAT_TYPE_STATIC)
{
eina_strbuf_append(str, sd->template);
}
else
{
// Error: Discard format string and just print value.
DBG("Could not guess value type in format string: '%s'", sd->template);
char *v = eina_value_to_string(&value);
eina_strbuf_append(str, v);
free(v);
}
}
static void
_default_format_free_cb(void *data)
{
Efl_Ui_Format_Data *sd = data;
if (sd && sd->template)
{
eina_stringshare_del(sd->template);
sd->template = NULL;
}
}
EOLIAN static void
_efl_ui_format_format_string_set(Eo *obj, Efl_Ui_Format_Data *sd, const char *template)
{
if (!template) return;
eina_stringshare_replace(&sd->template, template);
sd->format_type = _format_string_check(sd->template);
efl_ui_format_cb_set(obj, sd, _default_format_cb, _default_format_free_cb);
}
EOLIAN static const char *
_efl_ui_format_format_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *sd)
{
return sd->template;
}
#include "interfaces/efl_ui_format.eo.c"

View File

@ -1,42 +0,0 @@
import eina_types;
function @beta Efl.Ui.Format_Func_Cb {
[[Function pointer for format function hook]]
params {
@in str: strbuf; [[the formated string to be appended by user.]]
@in value: const(any_value); [[The @Eina.Value passed by $obj.]]
}
};
mixin @beta Efl.Ui.Format
{
[[interface class for format_func]]
methods {
@property format_cb {
set @pure_virtual {
[[Set the format function pointer to format the string.
]]
}
values {
func: Efl.Ui.Format_Func_Cb; [[The format function callback]]
}
}
@property format_string {
[[Control the format string for a given units label
If $NULL is passed to $format, it will hide $obj's units
area completely. If not, it'll set the <b>format
string</b> for the units label text. The units label is
provided as a floating point value, so the units text can display
at most one floating point value. Note that the units label is
optional. Use a format string such as "%1.2f meters" for example.
Note: The default format string is an integer percentage,
as in $"%.0f %%".
]]
values {
units: string; [[The format string for $obj's units label.]]
}
}
}
}

View File

@ -1,19 +1,23 @@
enum @beta Efl.Ui.Scrollbar_Mode
{
[[When should the scrollbar be shown.]]
auto = 0, [[Visible if necessary]]
on, [[Always visible]]
off, [[Always invisible]]
last [[For internal use only]]
on, [[Always visible]]
off, [[Always invisible]]
last [[For internal use only]]
}
enum @beta Efl.Ui.Scrollbar_Direction
{
horizontal = 0,
vertical,
last
[[What kind of scrollbar is this.]]
horizontal = 0, [[Goes along the X axis.]]
vertical, [[Goes along the Y axis.]]
last [[For internal use only]]
}
interface @beta Efl.Ui.Scrollbar
{
[[Interface used by widgets which can display scrollbars, enabling them to contain more content
than actually fits inside them.]]
methods {
@property bar_mode {
[[Scrollbar visibility policy]]
@ -22,19 +26,19 @@ interface @beta Efl.Ui.Scrollbar
get {
}
values {
hbar: Efl.Ui.Scrollbar_Mode; [[Horizontal scrollbar]]
vbar: Efl.Ui.Scrollbar_Mode; [[Vertical scrollbar]]
hbar: Efl.Ui.Scrollbar_Mode; [[Horizontal scrollbar.]]
vbar: Efl.Ui.Scrollbar_Mode; [[Vertical scrollbar.]]
}
}
@property bar_size {
[[Scrollbar size.
It is calculated based on viewport size-content sizes.
]]
]] // TODO: This needs more details. What does 1.0 mean?
get {
}
values {
width: double; [[Value between 0.0 and 1.0]]
height: double; [[Value between 0.0 and 1.0]]
width: double; [[Value between 0.0 and 1.0.]]
height: double; [[Value between 0.0 and 1.0.]]
}
}
@property bar_position {
@ -46,25 +50,25 @@ interface @beta Efl.Ui.Scrollbar
get {
}
values {
posx: double; [[Value between 0.0 and 1.0]]
posy: double; [[Value between 0.0 and 1.0]]
posx: double; [[Value between 0.0 and 1.0.]]
posy: double; [[Value between 0.0 and 1.0.]]
}
}
bar_visibility_update @protected @beta{
[[ Update bar visibility.
[[Update bar visibility.
The object will call this function whenever the bar
need to be shown or hidden.
The object will call this function whenever the bar
needs to be shown or hidden.
]]
}
}
events {
bar,press: Efl.Ui.Scrollbar_Direction; [[Called when bar is pressed]]
bar,unpress: Efl.Ui.Scrollbar_Direction; [[Called when bar is unpressed]]
bar,drag: Efl.Ui.Scrollbar_Direction; [[Called when bar is dragged]]
bar,size,changed: void; [[Called when bar size is changed]]
bar,pos,changed: void; [[Called when bar position is changed]]
bar,show: Efl.Ui.Scrollbar_Direction; [[Callend when bar is shown]]
bar,hide: Efl.Ui.Scrollbar_Direction; [[Called when bar is hidden]]
bar,press: Efl.Ui.Scrollbar_Direction; [[Called when bar is pressed.]]
bar,unpress: Efl.Ui.Scrollbar_Direction; [[Called when bar is unpressed.]]
bar,drag: Efl.Ui.Scrollbar_Direction; [[Called when bar is dragged.]]
bar,size,changed: void; [[Called when bar size is changed.]]
bar,pos,changed: void; [[Called when bar position is changed.]]
bar,show: Efl.Ui.Scrollbar_Direction; [[Callend when bar is shown.]]
bar,hide: Efl.Ui.Scrollbar_Direction; [[Called when bar is hidden.]]
}
}

View File

@ -94,7 +94,6 @@ pub_eo_files = [
'efl_observer.eo',
'efl_observable.eo',
'efl_ui_autorepeat.eo',
'efl_ui_format.eo',
'efl_gfx_color_class.eo',
'efl_gfx_text_class.eo',
'efl_gfx_size_class.eo',
@ -166,7 +165,6 @@ efl_src += files([
'efl_io_queue.c',
'efl_observer.c',
'efl_file.c',
'efl_ui_format.c',
'efl_ui_layout_orientable_readonly.c',
'efl_text_markup_util.c',
])

View File

@ -189,3 +189,64 @@ eina_accessor_unlock(Eina_Accessor *accessor)
return accessor->unlock(accessor);
return EINA_TRUE;
}
typedef struct _Eina_Accessor_CArray_Length Eina_Accessor_CArray_Length;
struct _Eina_Accessor_CArray_Length
{
Eina_Accessor accessor;
void** array;
void** current;
void** end;
unsigned int step;
};
static Eina_Bool
eina_carray_length_accessor_get_at(Eina_Accessor_CArray_Length *accessor, unsigned int idx, void **data)
{
if (accessor->array + idx*accessor->step >= accessor->end)
return EINA_FALSE;
memcpy(data, (void*) accessor->array + idx*accessor->step, accessor->step);
accessor->current += accessor->step;
return EINA_TRUE;
}
static void**
eina_carray_length_accessor_get_container(Eina_Accessor_CArray_Length *accessor)
{
return accessor->array;
}
static void
eina_carray_length_accessor_free(Eina_Accessor_CArray_Length *accessor)
{
free(accessor);
}
EAPI Eina_Accessor *
eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length)
{
Eina_Accessor_CArray_Length *accessor;
accessor = calloc(1, sizeof (Eina_Accessor_CArray_Length));
if (!accessor) return NULL;
EINA_MAGIC_SET(&accessor->accessor, EINA_MAGIC_ACCESSOR);
accessor->array = array;
accessor->current = accessor->array;
accessor->end = accessor->current + length * step;
accessor->step = step;
accessor->accessor.version = EINA_ACCESSOR_VERSION;
accessor->accessor.get_at = FUNC_ACCESSOR_GET_AT(eina_carray_length_accessor_get_at);
accessor->accessor.get_container = FUNC_ACCESSOR_GET_CONTAINER(
eina_carray_length_accessor_get_container);
accessor->accessor.free = FUNC_ACCESSOR_FREE(eina_carray_length_accessor_free);
return &accessor->accessor;
}

View File

@ -348,6 +348,38 @@ EAPI Eina_Bool eina_accessor_unlock(Eina_Accessor *accessor) EINA_ARG_NONNULL(1)
eina_accessor_data_get((accessor), (counter), (void **)(void *)&(data)); \
(counter)++)
/**
* @brief Creates an Eina_Accessor that wraps a plain fixed size C array
*
* @param[in] array The array
* @param[in] step The size of one element in the array
* @param[in] length The number of elements in the array
* @return The accessor that will give access to the passed array
*
* You can create it like this:
* int array[] = {1, 2, 3, 4, 1337, 42};
*
* Eina_Accessor* accessor = eina_carray_length_accessor_new(array, sizeof(int), sizeof(array)/sizeof(int));
*
* @since 1.23
*/
EAPI Eina_Accessor* eina_carray_length_accessor_new(void** array, unsigned int step, unsigned int length);
/**
* @def EINA_C_ARRAY_ACCESSOR_NEW
* @brief Creates an Eina_Accessor that wraps a plain fixed size C array
*
* @param[in] array The array
* @return The accessor that will give access to the passed array
*
* You can create it like this:
* int array[] = {1, 2, 3, 4, 1337, 42};
*
* Eina_Accessor* accessor = EINA_C_ARRAY_ACCESSOR_NEW(array)
*
* @since 1.23
*/
#define EINA_C_ARRAY_ACCESSOR_NEW(Array) eina_carray_length_accessor_new((void**) Array, sizeof (Array[0]), EINA_C_ARRAY_LENGTH(Array))
/**
* @}
*/

View File

@ -227,18 +227,18 @@ EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
# include <efl_ui_panes_eo.h>
# include <efl_ui_panes_part.eo.h>
#define _EFL_UI_ACTIVE_VIEW_VIEW_MANAGEREO_CLASS_TYPE
typedef Eo Efl_Ui_Active_View_View_Manager;
#define _EFL_UI_ACTIVE_VIEW_INDICATOR_EO_CLASS_TYPE
typedef Eo Efl_Ui_Active_View_Indicator;
#define _EFL_UI_SPOTLIGHT_MANAGEREO_EO_CLASS_TYPE
typedef Eo Efl_Ui_Spotlight_Manager;
#define _EFL_UI_SPOTLIGHT_INDICATOR_EO_CLASS_TYPE
typedef Eo Efl_Ui_Spotlight_Indicator;
# include <efl_ui_active_view_container.eo.h>
# include <efl_ui_active_view_view_manager.eo.h>
# include <efl_ui_active_view_indicator.eo.h>
# include <efl_ui_active_view_indicator_icon.eo.h>
# include <efl_ui_active_view_view_manager_scroll.eo.h>
# include <efl_ui_active_view_view_manager_stack.eo.h>
# include <efl_ui_active_view_util.eo.h>
# include <efl_ui_spotlight_container.eo.h>
# include <efl_ui_spotlight_manager.eo.h>
# include <efl_ui_spotlight_indicator.eo.h>
# include <efl_ui_spotlight_indicator_icon.eo.h>
# include <efl_ui_spotlight_manager_scroll.eo.h>
# include <efl_ui_spotlight_manager_stack.eo.h>
# include <efl_ui_spotlight_util.eo.h>
# include <efl_ui_navigation_bar.eo.h>
# include <efl_ui_navigation_bar_part.eo.h>
@ -246,6 +246,9 @@ typedef Eo Efl_Ui_Active_View_Indicator;
# include <efl_ui_navigation_layout.eo.h>
# include <efl_ui_clickable.eo.h>
# include <efl_ui_clickable_util.eo.h>
# include <efl_ui_format.eo.h>
# include <efl_ui_spin.eo.h>
# include <efl_ui_spin_button.eo.h>
/**
* Initialize Elementary

View File

@ -1,111 +0,0 @@
struct @beta Efl.Ui.Active_View.Transition_Event {
[[Information regarding transition events.]]
from : int; [[The view index from where the transition started, -1 if not known.]]
to : int; [[The view index to where the transition is headed, -1 if not known.]]
}
class @beta Efl.Ui.Active_View.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
{
[[The Active View widget is a container for other sub-widgets (views), where only one sub-widget is active at any given time.
Views are added using the @Efl.Pack_Linear interface and the active view is selected using @.active_index.
The way the different views are rendered can be customized through the @.view_manager object. For example, only the active view
might be shown, or it might be shown in a central position whereas the other views are displayed on the sides, or grayed-out.
All views are displayed with the same size, selected with @.active_view_size.
Additionally, the transition from one view to another can be animated. This animation is also controlled by the @.view_manager object.
Also, an indicator widget can be used to show a visual cue of how many views are there and which one is the active one.
This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each view represents a "page" full
of other widgets. All these cases can be implemented with a different @.view_manager and use the same @Efl.Ui.Active_View.Container.
]]
c_prefix: efl_ui_active_view;
methods {
@property view_manager {
[[This object defines how views are rendered and animated.
If it is not set, only the active view is shown and transitions are instantaneous (not animated).
]]
values {
view_manager : Efl.Ui.Active_View.View_Manager @owned; [[The View Manager object or $NULL.]]
}
}
@property indicator {
[[An indicator object to use, which will display the current state of the Active View (number of views and active one).
When this object is set, it is immediately updated to reflect the current state of the widget.
Its location inside the container is controlled by the @.view_manager.
]]
values {
indicator : Efl.Ui.Active_View.Indicator @owned; [[The Indicator object or $NULL.]]
}
}
@property active_index {
[[Currently active view among all the views added to this widget.
Changing this value might trigger an animation.
]]
values {
index: int; [[Index of the active view, from 0 to the number of views - 1 (@Efl.Container.content_count - 1).]]
}
}
@property active_view_size {
[[The size to use when displaying the Active View. This is used by the @.view_manager to perform the rendering.
Views other than the Active one may or may not use this size.]]
values {
size: Eina.Size2D; [[Render size for the Active View. (-1, -1) means that all available space inside the container is used.]]
}
}
push @beta {
[[Packs a new view at the position indicated by @.active_index (0 by default).
This is the same behavior as a push operation on a stack.
An animation might be triggered to make the new active view come into position.
]]
params {
view : Efl.Gfx.Entity; [[View to add and set to be the active view.]]
}
}
pop @beta {
[[Removes the active view from the widget.
The views behind it naturally flow down so the next one becomes the active view. This is the same behavior as a pop operation on a stack.
When combined with @.push you don't have to worry about @.active_index since only the first view is manipulated.
An animation might be triggered to make the new active view come into position and the old one disappear.
The removed view can be returned to the caller or deleted (depending on $delete_on_transition_end).
]]
params {
deletion_on_transition_end : bool; [[ if $true, then the object will be deleted before resolving the future, and a NULL pointer is the value of the future. $false if no operation should be applied to it]]
}
return : future<Efl.Gfx.Entity>; [[ This Future gets resolved when any transition animation finishes and the popped view is ready for collection.
If there is no animation, the Future resolves immediately.
If $deletion_on_transition_end is $true then this widget will destroy the popped view and the Future will contain no Value. Otherwise, the caller becomes the owner of the view contained in the Future and must dispose of it appropriately. ]]
}
}
events {
transition,start : Efl.Ui.Active_View.Transition_Event; [[A transition animation has started.]]
transition,end : Efl.Ui.Active_View.Transition_Event; [[A transition animation has ended.]]
}
implements {
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.invalidate;
Efl.Container.content_count;
Efl.Container.content_iterate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Pack_Linear.pack_begin;
Efl.Pack_Linear.pack_end;
Efl.Pack_Linear.pack_before;
Efl.Pack_Linear.pack_after;
Efl.Pack_Linear.pack_at;
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at;
}
}

View File

@ -1,8 +0,0 @@
class @beta Efl.Ui.Active_View.Indicator_Icon extends Efl.Ui.Active_View.Indicator {
implements {
Efl.Ui.Active_View.Indicator.bind;
Efl.Ui.Active_View.Indicator.content_del;
Efl.Ui.Active_View.Indicator.content_add;
Efl.Ui.Active_View.Indicator.position_update;
}
}

View File

@ -1,21 +0,0 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include "elm_priv.h"
typedef struct {
} Efl_Ui_Active_View_Util_Data;
EOLIAN static Efl_Ui_Active_View_Container*
_efl_ui_active_view_util_stack_gen(Efl_Ui_Widget *parent)
{
Efl_Ui_Active_View_View_Manager *manager = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS, parent);
return efl_add(EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS, parent,
efl_ui_active_view_manager_set(efl_added, manager));
}
#include "efl_ui_active_view_util.eo.c"

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Plain extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Scroll extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -1,12 +0,0 @@
class @beta Efl.Ui.Active_View.View_Manager_Stack extends Efl.Ui.Active_View.View_Manager
{
implements {
Efl.Ui.Active_View.View_Manager.bind;
Efl.Ui.Active_View.View_Manager.content_add;
Efl.Ui.Active_View.View_Manager.content_del;
Efl.Ui.Active_View.View_Manager.switch_to;
Efl.Ui.Active_View.View_Manager.view_size {set;}
Efl.Ui.Active_View.View_Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -5,6 +5,7 @@
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
#define EFL_UI_FOCUS_OBJECT_PROTECTED
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
#define EFL_UI_FORMAT_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
@ -167,37 +168,17 @@ _disable(Efl_Ui_Calendar_Data *sd,
static void
_set_month_year(Efl_Ui_Calendar_Data *sd)
{
Eina_Strbuf *strbuf = eina_strbuf_new();
Eina_Value val;
sd->filling = EINA_TRUE;
if (sd->format_cb)
{
Eina_Value val;
const char *buf;
eina_value_setup(&val, EINA_VALUE_TYPE_TM);
eina_value_set(&val, sd->shown_date);
eina_strbuf_reset(sd->format_strbuf);
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
buf = eina_strbuf_string_get(sd->format_strbuf);
eina_value_flush(&val);
if (buf)
elm_layout_text_set(sd->obj, "month_text", buf);
else
elm_layout_text_set(sd->obj, "month_text", "");
}
else
{
char *buf;
buf = eina_strftime(E_("%B %Y"), &sd->shown_date);
if (buf)
{
elm_layout_text_set(sd->obj, "month_text", buf);
free(buf);
}
else elm_layout_text_set(sd->obj, "month_text", "");
}
eina_value_setup(&val, EINA_VALUE_TYPE_TM);
eina_value_set(&val, sd->shown_date);
efl_ui_format_formatted_value_get(sd->obj, strbuf, val);
elm_layout_text_set(sd->obj, "month_text", eina_strbuf_string_get(strbuf));
eina_value_flush(&val);
eina_strbuf_free(strbuf);
sd->filling = EINA_FALSE;
}
@ -841,9 +822,6 @@ _efl_ui_calendar_efl_object_destructor(Eo *obj, Efl_Ui_Calendar_Data *sd)
ecore_timer_del(sd->update_timer);
efl_ui_format_cb_set(obj, NULL, NULL, NULL);
eina_strbuf_free(sd->format_strbuf);
for (i = 0; i < ELM_DAY_LAST; i++)
eina_stringshare_del(sd->weekdays[i]);
@ -919,7 +897,6 @@ _efl_ui_calendar_constructor_internal(Eo *obj, Efl_Ui_Calendar_Data *priv)
priv->today_it = -1;
priv->selected_it = -1;
priv->first_day_it = -1;
priv->format_cb = NULL;
edje_object_signal_callback_add
(wd->resize_obj, "efl,action,selected", "*",
@ -1146,64 +1123,11 @@ _efl_ui_calendar_date_get(const Eo *obj EINA_UNUSED, Efl_Ui_Calendar_Data *sd)
}
EOLIAN static void
_efl_ui_calendar_efl_ui_format_format_cb_set(Eo *obj, Efl_Ui_Calendar_Data *sd, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
_efl_ui_calendar_efl_ui_format_apply_formatted_value(Eo *obj, Efl_Ui_Calendar_Data *pd EINA_UNUSED)
{
if ((sd->format_cb_data == func_data) && (sd->format_cb == func))
return;
if (sd->format_cb_data && sd->format_free_cb)
sd->format_free_cb(sd->format_cb_data);
sd->format_cb = func;
sd->format_cb_data = func_data;
sd->format_free_cb = func_free_cb;
if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
evas_object_smart_changed(obj);
}
static void
_calendar_format_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
{
Efl_Ui_Calendar_Data *sd = data;
const Eina_Value_Type *type = eina_value_type_get(&value);
struct tm v;
if (type == EINA_VALUE_TYPE_TM)
{
eina_value_get(&value, &v);
eina_strbuf_append_strftime(str, sd->format_template, &v);
}
}
static void
_calendar_format_free_cb(void *data)
{
Efl_Ui_Calendar_Data *sd = data;
if (sd && sd->format_template)
{
eina_stringshare_del(sd->format_template);
sd->format_template = NULL;
}
}
EOLIAN static void
_efl_ui_calendar_efl_ui_format_format_string_set(Eo *obj, Efl_Ui_Calendar_Data *sd, const char *template)
{
if (!template) return;
eina_stringshare_replace(&sd->format_template, template);
efl_ui_format_cb_set(obj, sd, _calendar_format_cb, _calendar_format_free_cb);
}
EOLIAN static const char *
_efl_ui_calendar_efl_ui_format_format_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Calendar_Data *sd)
{
return sd->format_template;
}
EOLIAN static void
_efl_ui_calendar_first_day_of_week_set(Eo *obj, Efl_Ui_Calendar_Data *sd, Efl_Ui_Calendar_Weekday day)
{

View File

@ -111,8 +111,7 @@ class @beta Efl.Ui.Calendar extends Efl.Ui.Layout_Base implements Efl.Ui.Focus.C
Efl.Ui.Focus.Object.on_focus_update;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Access.Widget.Action.elm_actions { get; }
Efl.Ui.Format.format_cb { set; }
Efl.Ui.Format.format_string { set; get;}
Efl.Ui.Format.apply_formatted_value;
}
events {
changed: void; [[Emitted when the selected date in the calendar is changed]]

View File

@ -39,15 +39,9 @@ struct _Efl_Ui_Calendar_Data
Evas_Object *month_access;
Eo *items[42];
Efl_Ui_Calendar_Weekday first_week_day;
Efl_Ui_Calendar_Weekday first_week_day;
unsigned char first_day_it;
const char *format_template;
Efl_Ui_Format_Func_Cb format_cb;
Eina_Free_Cb format_free_cb;
void *format_cb_data;
Eina_Strbuf *format_strbuf;
Eina_Bool selected : 1;
Eina_Bool filling : 1;
Eina_Bool weekdays_set : 1;

View File

@ -96,6 +96,8 @@ _activate(Evas_Object *obj)
// "elm,state,check,on" or "elm,state,check,off" for legacy
// "efl,state,check,on" or "efl,state,check,off" for eo-api
efl_ui_check_selected_set(obj, !efl_ui_check_selected_get(obj));
if (elm_widget_is_legacy(obj))
evas_object_smart_callback_call(obj, "changed", NULL);
if (_elm_config->atspi_mode)
efl_access_state_changed_signal_emit(obj,
@ -291,9 +293,7 @@ _efl_ui_check_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, Eina_Bool value)
pd->selected = value;
if (elm_widget_is_legacy(obj))
evas_object_smart_callback_call(obj, "changed", NULL);
else
if (!elm_widget_is_legacy(obj))
efl_event_callback_call(obj, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, &pd->selected);
}

View File

@ -38,9 +38,24 @@ _on_mouse_out(void *data,
efl_ui_clickable_button_state_reset(data, 1);
}
static void
_theme_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Input_Pointer *pointer = ev->info;
if (efl_input_processed_get(pointer))
efl_ui_clickable_button_state_reset(data, 1);
}
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
{EFL_EVENT_POINTER_MOVE, _theme_move_cb},
)
EOLIAN static void
_efl_ui_clickable_util_bind_to_theme(Efl_Canvas_Layout *object, Efl_Ui_Clickable *clickable)
{
efl_event_callback_array_add(object, bind_to_theme_callbacks(), clickable);
efl_layout_signal_callback_add(object, "efl,action,press", "*", clickable, _on_press_cb, NULL);
efl_layout_signal_callback_add(object, "efl,action,unpress", "*", clickable, _on_unpress_cb, NULL);
efl_layout_signal_callback_add(object, "efl,action,mouse_out", "*", clickable, _on_mouse_out, NULL);
@ -84,7 +99,7 @@ _unpress_cb(void *data, const Efl_Event *ev EINA_UNUSED)
}
}
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
EFL_CALLBACKS_ARRAY_DEFINE(bind_to_object_callbacks,
{EFL_EVENT_POINTER_DOWN, _press_cb},
{EFL_EVENT_POINTER_UP, _unpress_cb},
)
@ -92,7 +107,7 @@ EFL_CALLBACKS_ARRAY_DEFINE(bind_to_theme_callbacks,
EOLIAN static void
_efl_ui_clickable_util_bind_to_object(Efl_Input_Interface *object, Efl_Ui_Clickable *clickable)
{
efl_event_callback_array_add(object, bind_to_theme_callbacks(), clickable);
efl_event_callback_array_add(object, bind_to_object_callbacks(), clickable);
}

View File

@ -45,6 +45,7 @@ struct @beta Efl.Dnd.Drag_Accept {
}
struct @beta Efl.Dnd.Drag_Pos {
[[Dragging position information.]]
pos: Eina.Position2D; [[Evas Coordinate]]
action: Efl.Ui.Selection_Action; [[The drag action]]
format: Efl.Ui.Selection_Format; [[The drag format]]
@ -52,6 +53,7 @@ struct @beta Efl.Dnd.Drag_Pos {
}
struct @beta Efl.Dnd.Drag_Item_Container_Drop {
[[Drop information for a drag&drop operation.]]
item: Efl.Canvas.Object; [[The item object]]
data: Efl.Ui.Selection_Data; [[The selection data]]
pos: Eina.Position2D; [[Position relative to item (left (-1), middle (0), right (1)]]

View File

@ -0,0 +1,345 @@
#define EFL_UI_FORMAT_PROTECTED 1
#include "config.h"
#include "Efl_Ui.h"
#include "elm_priv.h" /* To be able to use elm_widget_is_legacy() */
typedef enum _Format_Type
{
/* When a format string is used, it is parsed to find out the expected data type */
FORMAT_TYPE_INVALID, /* Format description not understood */
FORMAT_TYPE_DOUBLE, /* double */
FORMAT_TYPE_INT, /* int */
FORMAT_TYPE_TM, /* struct tm, for time and date values */
FORMAT_TYPE_STRING, /* const char* */
FORMAT_TYPE_STATIC /* No value is passed, the format string IS the formatted output */
} Format_Type;
typedef struct
{
Efl_Ui_Format_Func format_func; /* User-supplied formatting function */
void *format_func_data; /* User data for the above function */
Eina_Free_Cb format_func_free; /* How to free the above data */
Eina_Inarray *format_values; /* Array of formatting values, owned by us */
const char *format_string; /* User-supplied formatting string, stringshare */
Format_Type format_string_type; /* Type of data expected in the above string */
} Efl_Ui_Format_Data;
static Eina_Bool
_is_valid_digit(char x)
{
return ((x >= '0' && x <= '9') || (x == '.')) ? EINA_TRUE : EINA_FALSE;
}
static Format_Type
_format_string_check(const char *fmt, Efl_Ui_Format_String_Type type)
{
const char *itr;
Eina_Bool found = EINA_FALSE;
Format_Type ret_type = FORMAT_TYPE_STATIC;
if (type == EFL_UI_FORMAT_STRING_TYPE_TIME) return FORMAT_TYPE_TM;
for (itr = fmt; *itr; itr++)
{
if (itr[0] != '%') continue;
if (itr[1] == '%')
{
itr++;
if (ret_type == FORMAT_TYPE_STATIC)
ret_type = FORMAT_TYPE_STRING;
continue;
}
if (!found)
{
found = EINA_TRUE;
for (itr++; *itr; itr++)
{
// FIXME: This does not properly support int64 or unsigned.
if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') ||
(*itr == 'o') || (*itr == 'x') || (*itr == 'X'))
{
ret_type = FORMAT_TYPE_INT;
break;
}
else if ((*itr == 'f') || (*itr == 'F'))
{
ret_type = FORMAT_TYPE_DOUBLE;
break;
}
else if (*itr == 's')
{
ret_type = FORMAT_TYPE_STRING;
break;
}
else if (_is_valid_digit(*itr))
{
continue;
}
else
{
ERR("Format string '%s' has unknown format element '%c' in format. It must have one format element of type 's', 'f', 'F', 'd', 'u', 'i', 'o', 'x' or 'X'", fmt, *itr);
found = EINA_FALSE;
break;
}
}
if (!(*itr)) break;
}
else
{
ret_type = FORMAT_TYPE_INVALID;
break;
}
}
if (ret_type == FORMAT_TYPE_INVALID)
{
ERR("Format string '%s' is invalid. It must have one and only one format element of type 's', 'f', 'F', 'd', 'u', 'i', 'o', 'x' or 'X'", fmt);
}
return ret_type;
}
static Eina_Bool
_do_format_string(Efl_Ui_Format_Data *pd, Eina_Strbuf *str, const Eina_Value value)
{
switch (pd->format_string_type)
{
case FORMAT_TYPE_DOUBLE:
{
double v = 0.0;
eina_value_double_convert(&value, &v);
eina_strbuf_append_printf(str, pd->format_string, v);
break;
}
case FORMAT_TYPE_INT:
{
int v = 0;
eina_value_int_convert(&value, &v);
eina_strbuf_append_printf(str, pd->format_string, v);
break;
}
case FORMAT_TYPE_STRING:
{
char *v = eina_value_to_string(&value);
eina_strbuf_append_printf(str, pd->format_string, v);
free(v);
break;
}
case FORMAT_TYPE_STATIC:
{
eina_strbuf_append(str, pd->format_string);
break;
}
case FORMAT_TYPE_TM:
{
struct tm v;
char *buf;
eina_value_get(&value, &v);
buf = eina_strftime(pd->format_string, &v);
eina_strbuf_append(str, buf);
free(buf);
break;
}
default:
return EINA_FALSE;
}
return EINA_TRUE;
}
static Eina_Bool
_legacy_default_format_func(void *data, Eina_Strbuf *str, const Eina_Value value)
{
if (!_do_format_string(data, str, value))
{
/* Fallback to just printing the value if format string fails (legacy behavior) */
char *v = eina_value_to_string(&value);
eina_strbuf_append(str, v);
free(v);
}
return EINA_TRUE;
}
EOLIAN static void
_efl_ui_format_format_func_set(Eo *obj, Efl_Ui_Format_Data *pd, void *func_data, Efl_Ui_Format_Func func, Eina_Free_Cb func_free_cb)
{
if (pd->format_func_free)
pd->format_func_free(pd->format_func_data);
pd->format_func = func;
pd->format_func_data = func_data;
pd->format_func_free = func_free_cb;
if (efl_alive_get(obj))
efl_ui_format_apply_formatted_value(obj);
}
EOLIAN static Efl_Ui_Format_Func
_efl_ui_format_format_func_get(const Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *pd)
{
return pd->format_func;
}
static int
_value_compare(const Efl_Ui_Format_Value *val1, const Efl_Ui_Format_Value *val2)
{
return val1->value - val2->value;
}
EOLIAN static void
_efl_ui_format_format_values_set(Eo *obj, Efl_Ui_Format_Data *pd, Eina_Accessor *values)
{
Efl_Ui_Format_Value v;
int i;
if (pd->format_values)
{
Efl_Ui_Format_Value *vptr;
/* Delete previous values array */
EINA_INARRAY_FOREACH(pd->format_values, vptr)
{
eina_stringshare_del(vptr->text);
}
eina_inarray_free(pd->format_values);
pd->format_values = NULL;
}
if (values == NULL)
{
if (efl_alive_get(obj))
efl_ui_format_apply_formatted_value(obj);
return;
}
/* Copy the values to our internal array */
pd->format_values = eina_inarray_new(sizeof(Efl_Ui_Format_Value), 4);
EINA_ACCESSOR_FOREACH(values, i, v)
{
Efl_Ui_Format_Value vcopy = { v.value, eina_stringshare_add(v.text) };
eina_inarray_insert_sorted(pd->format_values, &vcopy, (Eina_Compare_Cb)_value_compare);
}
eina_accessor_free(values);
if (efl_alive_get(obj))
efl_ui_format_apply_formatted_value(obj);
}
EOLIAN static Eina_Accessor *
_efl_ui_format_format_values_get(const Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *pd)
{
if (!pd->format_values) return NULL;
return eina_inarray_accessor_new(pd->format_values);
}
EOLIAN static void
_efl_ui_format_format_string_set(Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *sd, const char *string, Efl_Ui_Format_String_Type type)
{
eina_stringshare_replace(&sd->format_string, string);
if (string)
sd->format_string_type = _format_string_check(sd->format_string, type);
else
sd->format_string_type = FORMAT_TYPE_INVALID;
/* In legacy, setting the format string installs a default format func.
Some widgets then override the format_func_set method so we keep that behavior. */
if (elm_widget_is_legacy(obj))
efl_ui_format_func_set(obj, sd, _legacy_default_format_func, NULL);
if (efl_alive_get(obj))
efl_ui_format_apply_formatted_value(obj);
}
EOLIAN static void
_efl_ui_format_format_string_get(const Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *sd, const char **string, Efl_Ui_Format_String_Type *type)
{
if (string) *string = sd->format_string;
if (type) *type = sd->format_string_type == FORMAT_TYPE_TM ?
EFL_UI_FORMAT_STRING_TYPE_TIME : EFL_UI_FORMAT_STRING_TYPE_SIMPLE;
}
EOLIAN static void
_efl_ui_format_formatted_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *pd, Eina_Strbuf *str, const Eina_Value value)
{
char *v;
eina_strbuf_reset(str);
if (pd->format_values)
{
/* Search in the format_values array if we have one */
Efl_Ui_Format_Value v = { 0 };
int ndx;
eina_value_int_convert(&value, &v.value);
ndx = eina_inarray_search_sorted(pd->format_values, &v, (Eina_Compare_Cb)_value_compare);
if (ndx > -1) {
Efl_Ui_Format_Value *entry = eina_inarray_nth(pd->format_values, ndx);
eina_strbuf_append(str, entry->text);
return;
}
}
if (pd->format_func)
{
/* If we have a formatting function, try to use it */
if (pd->format_func(pd->format_func_data, str, value))
return;
}
if (pd->format_string)
{
/* If we have a formatting string, use it */
if (_do_format_string(pd, str, value))
return;
}
/* Fallback to just printing the value if everything else fails */
v = eina_value_to_string(&value);
eina_strbuf_append(str, v);
free(v);
}
EOLIAN static int
_efl_ui_format_decimal_places_get(Eo *obj EINA_UNUSED, Efl_Ui_Format_Data *pd)
{
char result[16] = "0";
const char *start;
/* This method can only be called if a format_string has been supplied */
if (!pd->format_string) return 0;
start = strchr(pd->format_string, '%');
while (start)
{
if (start[1] != '%')
{
start = strchr(start, '.');
if (start)
start++;
break;
}
else
start = strchr(start + 2, '%');
}
if (start)
{
const char *p = strchr(start, 'f');
if ((p) && ((p - start) < 15))
sscanf(start, "%[^f]", result);
}
return atoi(result);
}
EOLIAN static void
_efl_ui_format_efl_object_destructor(Eo *obj, Efl_Ui_Format_Data *pd EINA_UNUSED)
{
/* Legacy widgets keep their own formatting data and have their own destructors */
if (!elm_widget_is_legacy(obj))
{
/* Otherwise, free formatting data */
efl_ui_format_func_set(obj, NULL, NULL, NULL);
efl_ui_format_values_set(obj, NULL);
efl_ui_format_string_set(obj, NULL, 0);
}
efl_destructor(efl_super(obj, EFL_UI_FORMAT_MIXIN));
}
#include "efl_ui_format.eo.c"

View File

@ -0,0 +1,149 @@
import eina_types;
function @beta Efl.Ui.Format_Func
{
[[A function taking an @Eina.Value and producing its textual representation.
See @Efl.Ui.Format.format_func.
]]
params {
@in str: strbuf; [[Output formatted string. Its contents will be overwritten by this method.]]
@in value: const(any_value); [[The @Eina.Value to convert to text.]]
}
return: bool; [[Whether the conversion succeeded or not.]]
};
struct @beta Efl.Ui.Format_Value
{
[[A value which should always be displayed as a specific text string.
See @Efl.Ui.Format.format_values.
]]
value: int; [[Input value.]]
text: string; [[Text string to replace it.]]
}
enum @beta Efl.Ui.Format_String_Type
{
[[Type of formatting string.]]
simple, [[This is the simplest formatting mechanism, working pretty much like $printf.
Accepted formats are $s, $f, $F, $d, $u, $i, $o, $x and $X.
For example, "%1.2f meters", "%.0%%" or "%d items".
]]
time [[A strftime-style string used to format date and time values.
For example, "%A" for the full name of the day or "%y" for the year as a decimal number
without a century (range 00 to 99). Note that these are not the $printf formats.
See the man page for the $strftime function for the complete list.
]]
}
mixin @beta Efl.Ui.Format requires Efl.Object
{
[[Helper mixin that simplifies converting numerical values to text.
A number of widgets represent a numerical value but display a text representation.
For example, an @Efl.Ui.Progressbar can hold the number 0.75 but display the string "75%",
or an @Efl.Ui.Spin can hold numbers 1 to 7, but display the strings "Monday" thru "Sunday".
This conversion can be controlled through the @.format_func, @.format_values and @.format_string properties.
Only one of them needs to be set. When more than one is set @.format_values has the highest priority, followed by @.format_func and then @.format_string.
If one mechanism fails to produce a valid string the others will be tried (if provided) in descending
order of priority.
If no user-provided mechanism works, a fallback is used that just displays the value.
Widgets including this mixin offer their users different properties to control how
@Eina.Value's are converted to text.
]]
methods {
@property format_func {
[[User-provided function which takes care of converting an @Eina.Value into a text string.
The user is then completely in control of how the string is generated, but it is the
most cumbersome method to use.
If the conversion fails the other mechanisms will be tried, according to their priorities.
]]
values {
func: Efl.Ui.Format_Func; [[User-provided formatting function.]]
}
}
@property format_values {
[[User-provided list of values which are to be rendered using specific text strings.
This is more convenient to use than @.format_func and is perfectly suited for cases
where the strings make more sense than the numerical values. For example, weekday names
("Monday", "Tuesday", ...) are friendlier than numbers 1 to 7.
If a value is not found in the list, the other mechanisms will be tried according to their priorities.
List members do not need to be in any particular order. They are sorted internally for
performance reasons.
]]
values {
values: accessor<Efl.Ui.Format_Value>; [[Accessor over a list of value-text pairs.
The method will dispose of the accessor, but not of
its contents.
For convenience, Eina offers a range of helper
methods to obtain accessors from Eina.Array,
Eina.List or even plain C arrays.
]]
}
}
@property format_string {
[[A user-provided, string used to format the numerical value.
For example, "%1.2f meters", "%.0%%" or "%d items".
This is the simplest formatting mechanism, working pretty much like $printf.
Different format specifiers (the character after the %) are available, depending on the
$type used. Use @Efl.Ui.Format_String_Type.simple for simple numerical values and
@Efl.Ui.Format_String_Type.time for time and date values.
For instance, %d means "integer" when the first type is used, but it means "day of the month
as a decimal number" in the second.
Pass $NULL to disable this mechanism.
]]
values {
string: string; [[Formatting string containing regular characters and format specifiers.]]
type: Efl.Ui.Format_String_Type(Efl.Ui.Format_String_Type.simple);
[[Type of formatting string, which controls how the
different format specifiers are to be traslated.]]
}
}
formatted_value_get @protected {
[[Internal method to be used by widgets including this mixin to perform the conversion
from the internal numerical value into the text representation (Users of these widgets
do not need to call this method).
@.formatted_value_get uses any user-provided mechanism to perform the conversion, according to their
priorities, and implements a simple fallback if all mechanisms fail.
]]
params {
@in str: strbuf; [[Output formatted string. Its contents will be overwritten by this method.]]
@in value: const(any_value); [[The @Eina.Value to convert to text.]]
}
}
decimal_places_get @protected {
[[Internal method to be used by widgets including this mixin.
It can only be used when a @.format_string has been supplied, and it returns the number
of decimal places that the format string will produce for floating point values.
For example, "%.2f" returns 2, and "%d" returns 0;
]]
return: int; [[Number of decimal places, or 0 for non-floating point types.]]
}
apply_formatted_value @pure_virtual @protected {
[[Internal method to be implemented by widgets including this mixin.
The mixin will call this method to signal the widget that the formatting has changed
and therefore the current value should be converted and rendered again.
Widgets must typically call @.formatted_value_get and display the returned string. This
is something they are already doing (whenever the value changes, for example) so there
should be no extra code written to implement this method.
]]
}
}
implements {
Efl.Object.destructor;
}
}

View File

@ -1,6 +1,6 @@
/* FIXME: Define these structs in EO, or they are useless to bindings */
struct @extern Elm.Photocam.Error;
struct @extern Elm.Photocam.Progress;
/* TODO: Define these structs in EO, or they are useless to bindings */
struct @extern Elm.Photocam.Error; [[Photocam error information.]]
struct @extern Elm.Photocam.Progress; [[Photocam progress information.]]
class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom,
Efl.Ui.Scrollable_Interactive,

View File

@ -2,9 +2,10 @@ import elm_general;
struct @beta Efl.Ui.List_View_Item_Event
{
layout: Efl.Ui.Layout;
child: Efl.Model;
index: int;
[[Information related to item events.]] // TODO: This needs to be filled in.
layout: Efl.Ui.Layout; [[TBD]]
child: Efl.Model; [[TBD]]
index: int; [[TBD]]
}
class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements Efl.Ui.Scrollable_Interactive, Efl.Ui.Scrollbar,
Efl.Access.Widget.Action, Efl.Access.Selection, Efl.Ui.Focus.Composition, Efl.Ui.Focus.Manager_Sub,
@ -12,15 +13,14 @@ class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements Efl.Ui.Scroll
{
methods {
@property homogeneous {
[[When in homogeneous mode, all items have the same height and width. Otherwise, each item's size is respected.
]]
get {
[[Get whether the homogeneous mode is enabled.]]
}
set {
[[Enable/disable homogeneous mode.]]
}
values {
homogeneous: bool; [[Assume the items within the genlist are of
the same height and width. Default is $false.]]
homogeneous: bool; [[Homogeneous mode setting. Default is $false.]]
}
}
@property select_mode {
@ -32,8 +32,9 @@ class @beta Efl.Ui.List_View extends Efl.Ui.Layout_Base implements Efl.Ui.Scroll
}
}
@property default_style {
[[TBD]] // TODO: This needs to be filled in. Does not seem to be in use.
values {
style: stringshare;
style: stringshare; [[TBD]]
}
}
@property layout_factory {

View File

@ -9,4 +9,4 @@ struct @beta @free(free) Efl.Ui.List_View_Layout_Item {
pos: Eina.Position2D;
}
struct @beta Efl_Ui_List_View_Seg_Array;
struct @beta Efl_Ui_List_View_Seg_Array; [[TBD]]

View File

@ -19,14 +19,14 @@ _back_button_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *navigation_bar = data;
Eo *active_view = efl_provider_find(navigation_bar, EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS);
if (!active_view)
Eo *spotlight = efl_provider_find(navigation_bar, EFL_UI_SPOTLIGHT_CONTAINER_CLASS);
if (!spotlight)
{
ERR("Cannot find EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS instance!");
ERR("Cannot find EFL_UI_SPOTLIGHT_CONTAINER_CLASS instance!");
return;
}
efl_ui_active_view_pop(active_view, EINA_TRUE);
efl_ui_spotlight_pop(spotlight, EINA_TRUE);
}
EOLIAN static Eo *

View File

@ -6,6 +6,7 @@
#define ELM_LAYOUT_PROTECTED
#define EFL_ACCESS_VALUE_PROTECTED
#define EFL_PART_PROTECTED
#define EFL_UI_FORMAT_PROTECTED
#include <Elementary.h>
@ -73,7 +74,7 @@ _units_set(Evas_Object *obj)
{
EFL_UI_PROGRESSBAR_DATA_GET(obj, sd);
if (sd->format_cb)
if (sd->show_progress_label)
{
Eina_Value val;
@ -84,8 +85,8 @@ _units_set(Evas_Object *obj)
if (sd->is_legacy_format_string && !sd->is_legacy_format_cb)
eina_value_set(&val, 100 * sd->val);
eina_strbuf_reset(sd->format_strbuf);
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
efl_ui_format_formatted_value_get(obj, sd->format_strbuf, val);
eina_value_flush(&val);
@ -240,7 +241,7 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *
if (sd->pulse_state)
elm_layout_signal_emit(obj, "elm,state,pulse,start", "elm");
if (sd->format_cb && (!sd->pulse))
if (sd->show_progress_label && (!sd->pulse))
elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
}
else
@ -253,7 +254,7 @@ _efl_ui_progressbar_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *
if (sd->pulse_state)
elm_layout_signal_emit(obj, "efl,state,pulse,start", "efl");
if (sd->format_cb && (!sd->pulse))
if (sd->show_progress_label && (!sd->pulse))
elm_layout_signal_emit(obj, "efl,state,units,visible", "efl");
}
sd->has_status_text_part = edje_object_part_exists(obj, statuspart[elm_widget_is_legacy(obj)]);
@ -361,7 +362,7 @@ _efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data
free(group);
efl_ui_format_string_set(obj, "%.0f%%");
efl_ui_format_string_set(obj, "%.0f%%", EFL_UI_FORMAT_STRING_TYPE_SIMPLE);
priv->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
evas_object_color_set(priv->spacer, 0, 0, 0, 0);
@ -402,8 +403,8 @@ _efl_ui_progressbar_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Progressbar_Data
}
}
efl_ui_format_cb_set(obj, NULL, NULL, NULL);
eina_strbuf_free(sd->format_strbuf);
sd->format_strbuf = NULL;
efl_canvas_group_del(efl_super(obj, MY_CLASS));
}
@ -415,6 +416,7 @@ _efl_ui_progressbar_efl_object_constructor(Eo *obj, Efl_Ui_Progressbar_Data *_pd
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_PROGRESS_BAR);
efl_ui_range_limits_set(obj, 0.0, 1.0);
efl_ui_progressbar_show_progress_label_set(obj, EINA_TRUE);
return obj;
}
@ -591,6 +593,17 @@ _progressbar_part_value_get(Efl_Ui_Progressbar_Data *sd, const char* part)
EOLIAN static void
_efl_ui_progressbar_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, double val)
{
if (val < sd->val_min)
{
ERR("Error, value is less than minimum");
return;
}
if (val > sd->val_max)
{
ERR("Error, value is greater than maximum");
return;
}
if (EINA_DBL_EQ(sd->val, val)) return;
if (elm_widget_is_legacy(obj))
@ -609,32 +622,6 @@ _efl_ui_progressbar_efl_ui_range_display_range_value_get(const Eo *obj, Efl_Ui_P
return efl_ui_range_value_get(efl_part(obj, "efl.cur.progressbar"));
}
EOLIAN static void
_efl_ui_progressbar_efl_ui_format_format_cb_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
if (sd->format_cb_data == func_data && sd->format_cb == func)
return;
if (sd->format_cb_data && sd->format_free_cb)
sd->format_free_cb(sd->format_cb_data);
sd->format_cb = func;
sd->format_cb_data = func_data;
sd->format_free_cb = func_free_cb;
if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
if (elm_widget_is_legacy(obj))
elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
else
elm_layout_signal_emit(obj, "efl,state,units,visible", "efl");
edje_object_message_signal_process(wd->resize_obj);
_units_set(obj);
elm_layout_sizing_eval(obj);
}
EOLIAN static void
_efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state)
{
@ -668,6 +655,16 @@ _efl_ui_progressbar_pulse_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data
EOLIAN static void
_efl_ui_progressbar_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, double min, double max)
{
if (max < min)
{
ERR("Wrong params. min(%lf) is greater than max(%lf).", min, max);
return;
}
if (EINA_DBL_EQ(max, min))
{
ERR("min and max must have a different value");
return;
}
if (elm_widget_is_legacy(obj))
_progress_part_min_max_set(obj, sd, "elm.cur.progressbar", min, max);
else
@ -749,6 +746,35 @@ _efl_ui_progressbar_part_efl_ui_range_display_range_limits_get(const Eo *obj, vo
}
}
EOLIAN static void
_efl_ui_progressbar_show_progress_label_set(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *pd, Eina_Bool show)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
char signal_name[32];
const char *ns = elm_widget_is_legacy(obj) ? "elm" : "efl";
pd->show_progress_label = show;
snprintf(signal_name, sizeof(signal_name), "%s,state,units,%s", ns,
show ? "visible" : "hidden");
elm_layout_signal_emit(obj, signal_name, ns);
edje_object_message_signal_process(wd->resize_obj);
_units_set(obj);
elm_layout_sizing_eval(obj);
}
EOLIAN static Eina_Bool
_efl_ui_progressbar_show_progress_label_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *pd)
{
return pd->show_progress_label;
}
EOLIAN static void
_efl_ui_progressbar_efl_ui_format_apply_formatted_value(Eo *obj, Efl_Ui_Progressbar_Data *pd EINA_UNUSED)
{
_units_set(obj);
}
#include "efl_ui_progressbar_part.eo.c"
/* Efl.Part end */
@ -958,7 +984,7 @@ typedef struct
progressbar_freefunc_type format_free_cb;
} Pb_Format_Wrapper_Data;
static void
static Eina_Bool
_format_legacy_to_format_eo_cb(void *data, Eina_Strbuf *str, const Eina_Value value)
{
Pb_Format_Wrapper_Data *pfwd = data;
@ -974,6 +1000,8 @@ _format_legacy_to_format_eo_cb(void *data, Eina_Strbuf *str, const Eina_Value va
if (buf)
eina_strbuf_append(str, buf);
if (pfwd->format_free_cb) pfwd->format_free_cb(buf);
return EINA_TRUE;
}
static void
@ -994,8 +1022,8 @@ elm_progressbar_unit_format_function_set(Evas_Object *obj, progressbar_func_type
pfwd->format_free_cb = free_func;
sd->is_legacy_format_cb = EINA_TRUE;
efl_ui_format_cb_set(obj, pfwd, _format_legacy_to_format_eo_cb,
_format_legacy_to_format_eo_free_cb);
efl_ui_format_func_set(obj, pfwd, _format_legacy_to_format_eo_cb,
_format_legacy_to_format_eo_free_cb);
}
EAPI void
@ -1018,13 +1046,15 @@ elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
EFL_UI_PROGRESSBAR_DATA_GET_OR_RETURN(obj, sd);
sd->is_legacy_format_string = EINA_TRUE;
efl_ui_format_string_set(obj, units);
efl_ui_format_string_set(obj, units, EFL_UI_FORMAT_STRING_TYPE_SIMPLE);
}
EAPI const char *
elm_progressbar_unit_format_get(const Evas_Object *obj)
{
return efl_ui_format_string_get(obj);
const char *fmt;
efl_ui_format_string_get(obj, &fmt, NULL);
return fmt;
}
EAPI void

View File

@ -41,6 +41,16 @@ class @beta Efl.Ui.Progressbar extends Efl.Ui.Layout_Base implements Efl.Ui.Rang
state: bool; [[$true, to start the pulsing animation, $false to stop it]]
}
}
@property show_progress_label {
[[Whether a textual progress label is shown alongside the progressbar to give an exact
numerical indication of the current progress.
Not to be confused with the widget label set through @Efl.Text.text.
]]
values {
show: bool; [[$true to show the progress label.]]
}
}
}
implements {
Efl.Object.constructor;
@ -48,7 +58,7 @@ class @beta Efl.Ui.Progressbar extends Efl.Ui.Layout_Base implements Efl.Ui.Rang
Efl.Ui.Range_Display.range_value { get; set; }
Efl.Ui.Range_Display.range_limits {get; set; }
Efl.Ui.Layout_Orientable.orientation { get; set; }
Efl.Ui.Format.format_cb { set; }
Efl.Ui.Format.apply_formatted_value;
Efl.Part.part_get;
Efl.Access.Value.value_and_text { get; }
Efl.Text.text { get; set; }

View File

@ -38,9 +38,6 @@ struct _Efl_Ui_Progressbar_Data
Eina_List *progress_status; /**< The list of _Elm_Progress_Status. To save the progress value(in percentage) each part of given progress bar */
Efl_Ui_Format_Func_Cb format_cb;
Eina_Free_Cb format_free_cb;
void *format_cb_data;
Eina_Strbuf *format_strbuf;
Efl_Ui_Layout_Orientation dir; /**< Orientation of the progressbar */
@ -51,6 +48,7 @@ struct _Efl_Ui_Progressbar_Data
Eina_Bool is_legacy_format_cb : 1;
Eina_Bool has_status_text_part : 1;
Eina_Bool has_cur_progressbar_part : 1;
Eina_Bool show_progress_label : 1; /**< Show a progress text label besides the progressbar */
};
struct _Efl_Ui_Progress_Status

View File

@ -139,6 +139,7 @@ _activate(Evas_Object *obj)
if (_elm_config->access_mode)
_elm_access_say(E_("State: On"));
}
evas_object_smart_callback_call(obj, "changed", NULL);
}
else
{

View File

@ -52,6 +52,7 @@ function @beta Efl.Ui.Selection_Data_Ready {
struct @beta Efl.Ui.Selection_Changed
{
[[Selection-changed specific information.]] // TODO: This needs to be filled in.
type: Efl.Ui.Selection_Type; [[Selection type]]
seat: int; [[The seat on which the selection changed, or NULL for "default"]]
display: void_ptr; [[The display connection object, NULL under X11]]

View File

@ -719,7 +719,17 @@ _efl_ui_slider_efl_ui_layout_orientable_orientation_get(const Eo *obj EINA_UNUSE
EOLIAN static void
_efl_ui_slider_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Slider_Data *sd, double min, double max)
{
if ((sd->val_min == min) && (sd->val_max == max)) return;
if (max < min)
{
ERR("Wrong params. min(%lf) is greater than max(%lf).", min, max);
return;
}
if (EINA_DBL_EQ(max, min))
{
ERR("min and max must have a different value");
return;
}
if ((EINA_DBL_EQ(sd->val_min, min)) && (EINA_DBL_EQ(sd->val_max, max))) return;
sd->val_min = min;
sd->val_max = max;
if (sd->val < sd->val_min) sd->val = sd->val_min;
@ -738,7 +748,19 @@ _efl_ui_slider_efl_ui_range_display_range_limits_get(const Eo *obj EINA_UNUSED,
EOLIAN static void
_efl_ui_slider_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Slider_Data *sd, double val)
{
if (sd->val == val) return;
if (val < sd->val_min)
{
ERR("Error, value is less than minimum");
return;
}
if (val > sd->val_max)
{
ERR("Error, value is greater than maximum");
return;
}
if (EINA_DBL_EQ(val, sd->val)) return;
sd->val = val;
if (sd->val < sd->val_min) sd->val = sd->val_min;
@ -762,10 +784,13 @@ _efl_ui_slider_efl_ui_range_interactive_range_step_get(const Eo *obj EINA_UNUSED
EOLIAN static void
_efl_ui_slider_efl_ui_range_interactive_range_step_set(Eo *obj EINA_UNUSED, Efl_Ui_Slider_Data *sd, double step)
{
if (sd->step == step) return;
if (step <= 0)
{
ERR("Wrong param. The step(%lf) should be greater than 0.0", step);
return;
}
if (step < 0.0) step = 0.0;
else if (step > 1.0) step = 1.0;
if (sd->step == step) return;
sd->step = step;
}

View File

@ -5,6 +5,7 @@
#define EFL_ACCESS_OBJECT_PROTECTED
#define EFL_ACCESS_VALUE_PROTECTED
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
#define EFL_UI_FORMAT_PROTECTED
#include <Elementary.h>
@ -15,142 +16,17 @@
#define MY_CLASS_NAME "Efl.Ui.Spin"
static Eina_Bool
_is_valid_digit(char x)
{
return ((x >= '0' && x <= '9') || (x == '.')) ? EINA_TRUE : EINA_FALSE;
}
static Efl_Ui_Spin_Format_Type
_is_label_format_integer(const char *fmt)
{
const char *itr = NULL;
const char *start = NULL;
Eina_Bool found = EINA_FALSE;
Efl_Ui_Spin_Format_Type ret_type = SPIN_FORMAT_INVALID;
start = strchr(fmt, '%');
if (!start) return SPIN_FORMAT_INVALID;
while (start)
{
if (found && start[1] != '%')
{
return SPIN_FORMAT_INVALID;
}
if (start[1] != '%' && !found)
{
found = EINA_TRUE;
for (itr = start + 1; *itr != '\0'; itr++)
{
if ((*itr == 'd') || (*itr == 'u') || (*itr == 'i') ||
(*itr == 'o') || (*itr == 'x') || (*itr == 'X'))
{
ret_type = SPIN_FORMAT_INT;
break;
}
else if ((*itr == 'f') || (*itr == 'F'))
{
ret_type = SPIN_FORMAT_FLOAT;
break;
}
else if (_is_valid_digit(*itr))
{
continue;
}
else
{
return SPIN_FORMAT_INVALID;
}
}
}
start = strchr(start + 2, '%');
}
return ret_type;
}
static void
_label_write(Evas_Object *obj)
_label_write(Evas_Object *obj, Efl_Ui_Spin_Data *sd)
{
Efl_Ui_Spin_Special_Value *sv;
unsigned int i;
Eina_Array_Iterator iterator;
Eina_Strbuf *strbuf = eina_strbuf_new();
Eina_Value val = eina_value_double_init(sd->val);
efl_ui_format_formatted_value_get(obj, strbuf, val);
Efl_Ui_Spin_Data *sd = efl_data_scope_get(obj, MY_CLASS);
elm_layout_text_set(obj, "efl.text", eina_strbuf_string_get(strbuf));
EINA_ARRAY_ITER_NEXT(sd->special_values, i, sv, iterator)
{
if (sv->value == sd->val)
{
char buf[1024];
snprintf(buf, sizeof(buf), "%s", sv->label);
elm_layout_text_set(obj, "elm.text", buf);
sd->templates = sv->label;
return;
}
}
if (sd->format_cb)
{
const char *buf;
Eina_Value val;
if (sd->format_type == SPIN_FORMAT_INT)
{
eina_value_setup(&val, EINA_VALUE_TYPE_INT);
eina_value_set(&val, (int)sd->val);
}
else
{
eina_value_setup(&val, EINA_VALUE_TYPE_DOUBLE);
eina_value_set(&val, sd->val);
}
eina_strbuf_reset(sd->format_strbuf);
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
buf = eina_strbuf_string_get(sd->format_strbuf);
eina_value_flush(&val);
elm_layout_text_set(obj, "efl.text", buf);
sd->templates = buf;
}
else
{
char buf[1024];
snprintf(buf, sizeof(buf), "%.0f", sd->val);
elm_layout_text_set(obj, "efl.text", buf);
evas_object_show(obj);
}
}
static int
_decimal_points_get(const char *label)
{
char result[16] = "0";
const char *start = strchr(label, '%');
while (start)
{
if (start[1] != '%')
{
start = strchr(start, '.');
if (start)
start++;
break;
}
else
start = strchr(start + 2, '%');
}
if (start)
{
const char *p = strchr(start, 'f');
if ((p) && ((p - start) < 15))
sscanf(start, "%[^f]", result);
}
return atoi(result);
eina_value_flush(&val);
eina_strbuf_free(strbuf);
}
EOLIAN static void
@ -188,48 +64,6 @@ _efl_ui_spin_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Spin_Data
return EINA_TRUE;
}
EOLIAN static void
_efl_ui_spin_special_value_set(Eo *obj, Efl_Ui_Spin_Data *sd, const Eina_Array *values)
{
EINA_SAFETY_ON_NULL_RETURN(values);
unsigned int i;
Efl_Ui_Spin_Special_Value *sv;
Efl_Ui_Spin_Special_Value *temp;
Eina_Array_Iterator iterator;
if (eina_array_count(sd->special_values))
{
EINA_ARRAY_ITER_NEXT(sd->special_values, i, sv, iterator)
{
eina_stringshare_del(sv->label);
free(sv);
}
eina_array_clean(sd->special_values);
}
if (eina_array_count(values))
EINA_ARRAY_ITER_NEXT(values, i, temp, iterator)
{
sv = calloc(1, sizeof(*sv));
if (!sv) return;
sv->value = temp->value;
sv->label = eina_stringshare_add(temp->label);
eina_array_push(sd->special_values, sv);
}
_label_write(obj);
}
EOLIAN static const Eina_Array*
_efl_ui_spin_special_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spin_Data *sd)
{
if (eina_array_count(sd->special_values))
return sd->special_values;
else
return NULL;
}
EOLIAN static Eo *
_efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
{
@ -241,7 +75,6 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
sd->val_max = 100.0;
sd->step = 1.0;
sd->special_values = eina_array_new(sizeof(Efl_Ui_Spin_Special_Value));
if (elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj),
@ -249,7 +82,7 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
CRI("Failed to set layout!");
_label_write(obj);
_label_write(obj, sd);
elm_widget_can_focus_set(obj, EINA_TRUE);
elm_layout_sizing_eval(obj);
@ -260,50 +93,13 @@ _efl_ui_spin_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Data *sd)
EOLIAN static void
_efl_ui_spin_efl_object_destructor(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
{
Efl_Ui_Spin_Special_Value *sv;
Eina_Array_Iterator iterator;
unsigned int i;
efl_ui_format_cb_set(obj, NULL, NULL, NULL);
EINA_ARRAY_ITER_NEXT(sd->special_values, i, sv, iterator)
{
eina_stringshare_del(sv->label);
free(sv);
}
eina_array_free(sd->special_values);
efl_destructor(efl_super(obj, MY_CLASS));
}
EOLIAN static void
_efl_ui_spin_efl_ui_format_format_cb_set(Eo *obj, Efl_Ui_Spin_Data *sd, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
_efl_ui_spin_efl_ui_format_apply_formatted_value(Eo *obj, Efl_Ui_Spin_Data *sd EINA_UNUSED)
{
if (sd->format_cb_data == func_data && sd->format_cb == func)
return;
if (sd->format_cb_data && sd->format_free_cb)
sd->format_free_cb(sd->format_cb_data);
sd->format_cb = func;
sd->format_cb_data = func_data;
sd->format_free_cb = func_free_cb;
if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
const char *format = efl_ui_format_string_get(obj);
if (format)
{
sd->format_type = _is_label_format_integer(format);
if (sd->format_type == SPIN_FORMAT_INVALID)
{
ERR("format:\"%s\" is invalid, cannot be set", format);
return;
}
else if (sd->format_type == SPIN_FORMAT_FLOAT)
sd->decimal_points = _decimal_points_get(format);
}
_label_write(obj);
_label_write(obj, sd);
elm_layout_sizing_eval(obj);
}
@ -312,10 +108,13 @@ _efl_ui_spin_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Spin_Data *sd
{
if (max < min)
{
ERR("Wrong params. min(%lf) is bigger than max(%lf). It will swaped.", min, max);
double t = min;
min = max;
max = t;
ERR("Wrong params. min(%lf) is greater than max(%lf).", min, max);
return;
}
if (EINA_DBL_EQ(max, min))
{
ERR("min and max must have a different value");
return;
}
if ((EINA_DBL_EQ(sd->val_min, min)) && (EINA_DBL_EQ(sd->val_max, max))) return;
@ -325,7 +124,7 @@ _efl_ui_spin_efl_ui_range_display_range_limits_set(Eo *obj, Efl_Ui_Spin_Data *sd
if (sd->val < sd->val_min) sd->val = sd->val_min;
if (sd->val > sd->val_max) sd->val = sd->val_max;
_label_write(obj);
_label_write(obj, sd);
}
EOLIAN static void
@ -357,9 +156,16 @@ EOLIAN static void
_efl_ui_spin_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Spin_Data *sd, double val)
{
if (val < sd->val_min)
val = sd->val_min;
else if (val > sd->val_max)
val = sd->val_max;
{
ERR("Error, value is less than minimum");
return;
}
if (val > sd->val_max)
{
ERR("Error, value is greater than maximum");
return;
}
if (EINA_DBL_EQ(val, sd->val)) return;
@ -372,7 +178,7 @@ _efl_ui_spin_efl_ui_range_display_range_value_set(Eo *obj, Efl_Ui_Spin_Data *sd,
efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL);
_label_write(obj);
_label_write(obj, sd);
}
EOLIAN static double

View File

@ -1,36 +1,11 @@
struct @beta Efl.Ui.Spin_Special_Value
{
[[Special value]]
value: double; [[Target value]]
label: string; [[String to replace]]
}
class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Interactive, Efl.Ui.Format,
Efl.Access.Value, Efl.Access.Widget.Action
{
[[A Spin.
This is a widget which allows the user to increase or decrease numeric values
using user interactions. It's a basic type of widget for choosing and displaying values.
This is a widget which allows the user to increase or decrease a numeric value
using arrow buttons. It's a basic type of widget for choosing and displaying values.
]]
methods {
@property special_value {
[[Control special string to display in the place of the numerical value.
It's useful for cases when a user should select an item that is
better indicated by a label than a value. For example, weekdays or months.
Note: If another label was previously set to $value, it will be replaced
by the new label.]]
set {
}
get {
}
values {
values: const(array<ptr(Efl.Ui.Spin_Special_Value)>); [[The array of special values, or NULL if none]]
}
}
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
@ -38,7 +13,7 @@ class @beta Efl.Ui.Spin extends Efl.Ui.Layout_Base implements Efl.Ui.Range_Inter
Efl.Ui.Range_Display.range_limits { get; set; }
Efl.Ui.Range_Interactive.range_step { get; set; }
Efl.Ui.Range_Display.range_value { get; set; }
Efl.Ui.Format.format_cb { set; }
Efl.Ui.Format.apply_formatted_value;
}
events {
changed: void; [[Called when spin changed]]

View File

@ -6,6 +6,7 @@
#define EFL_ACCESS_VALUE_PROTECTED
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
#define EFL_UI_FOCUS_COMPOSITION_PROTECTED
#define EFL_UI_FORMAT_PROTECTED
#include <Elementary.h>
@ -20,6 +21,11 @@
#define EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME 0.2
//when a item is pressed but not released, this time passes by
//until another step is added or removed from the current value.
//given in seconds
#define REPEAT_INTERVAL 0.85
static const char PART_NAME_ENTRY[] = "entry";
static const char PART_NAME_DEC_BUTTON[] = "dec_button";
static const char PART_NAME_TEXT_BUTTON[] = "text_button";
@ -28,12 +34,6 @@ static const char PART_NAME_INC_BUTTON[] = "inc_button";
static void
_inc_dec_button_clicked_cb(void *data, const Efl_Event *event);
static void
_inc_dec_button_pressed_cb(void *data, const Efl_Event *event);
static void
_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event);
static void
_inc_dec_button_mouse_move_cb(void *data, const Efl_Event *event);
static void
_entry_activated_cb(void *data, const Efl_Event *event);
static void
_entry_focus_changed_cb(void *data, const Efl_Event *event);
@ -42,37 +42,26 @@ _access_increment_decrement_info_say(Evas_Object *obj, Eina_Bool is_incremented)
EFL_CALLBACKS_ARRAY_DEFINE(_inc_dec_button_cb,
{ EFL_UI_EVENT_CLICKED, _inc_dec_button_clicked_cb},
{ EFL_UI_EVENT_PRESSED, _inc_dec_button_pressed_cb},
{ EFL_UI_EVENT_UNPRESSED, _inc_dec_button_unpressed_cb},
{ EFL_EVENT_POINTER_MOVE, _inc_dec_button_mouse_move_cb }
{ EFL_UI_AUTOREPEAT_EVENT_REPEATED, _inc_dec_button_clicked_cb},
);
static void
_entry_show(Evas_Object *obj)
{
Efl_Ui_Spin_Special_Value *sv;
Eina_Array_Iterator iterator;
unsigned int i;
char buf[32], fmt[32] = "%0.f";
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
EINA_ARRAY_ITER_NEXT(pd->special_values, i, sv, iterator)
{
if (sv->value == pd->val)
{
snprintf(buf, sizeof(buf), "%s", sv->label);
elm_object_text_set(sd->ent, buf);
}
}
const char *format_string;
efl_ui_format_string_get(obj, &format_string, NULL);
/* try to construct just the format from given label
* completely ignoring pre/post words
*/
if (pd->templates)
if (format_string)
{
const char *start = strchr(pd->templates, '%');
const char *start = strchr(format_string, '%');
while (start)
{
/* handle %% */
@ -103,10 +92,7 @@ _entry_show(Evas_Object *obj)
}
}
if (pd->format_type == SPIN_FORMAT_INT)
snprintf(buf, sizeof(buf), fmt, (int)pd->val);
else
snprintf(buf, sizeof(buf), fmt, pd->val);
snprintf(buf, sizeof(buf), fmt, pd->val);
elm_object_text_set(sd->ent, buf);
}
@ -115,20 +101,16 @@ static void
_label_write(Evas_Object *obj)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
if (pd->templates)
{
efl_text_set(sd->text_button, pd->templates);
}
else
{
char buf[1024];
Eina_Strbuf *strbuf = eina_strbuf_new();
Eina_Value val = eina_value_double_init(pd->val);
efl_ui_format_formatted_value_get(obj, strbuf, val);
snprintf(buf, sizeof(buf), "%.0f", pd->val);
efl_text_set(sd->text_button, buf);
}
efl_text_set(sd->text_button, eina_strbuf_string_get(strbuf));
eina_value_flush(&val);
eina_strbuf_free(strbuf);
}
static Eina_Bool
@ -156,6 +138,12 @@ _value_set(Evas_Object *obj,
else if (new_val > pd->val_max)
new_val = pd->val_min;
}
else
{
new_val = MIN(pd->val_max, MAX(pd->val_min, new_val));
}
if (EINA_DBL_EQ(new_val, efl_ui_range_value_get(obj))) return EINA_TRUE;
efl_ui_range_value_set(obj, new_val);
ecore_timer_del(sd->delay_change_timer);
@ -182,16 +170,11 @@ _entry_hide(Evas_Object *obj)
static void
_entry_value_apply(Evas_Object *obj)
{
Efl_Ui_Spin_Special_Value *sv;
Eina_Array_Iterator iterator;
unsigned int i;
const char *str;
double val;
char *end;
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
if (!sd->entry_visible) return;
efl_event_callback_del(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
@ -200,18 +183,8 @@ _entry_value_apply(Evas_Object *obj)
str = elm_object_text_get(sd->ent);
if (!str) return;
EINA_ARRAY_ITER_NEXT(pd->special_values, i, sv, iterator)
if (sv->value == pd->val)
if (!strcmp(sv->label, str)) return;
val = strtod(str, &end);
if (((*end != '\0') && (!isspace(*end))) || (fabs(val - pd->val) < DBL_EPSILON)) return;
efl_ui_range_value_set(obj, val);
efl_event_callback_call(obj, EFL_UI_SPIN_EVENT_CHANGED, NULL);
ecore_timer_del(sd->delay_change_timer);
sd->delay_change_timer = ecore_timer_add(EFL_UI_SPIN_BUTTON_DELAY_CHANGE_TIME,
_delay_change_timer_cb, obj);
_value_set(obj, val);
}
static void
@ -267,14 +240,14 @@ static void
_entry_accept_filter_add(Evas_Object *obj)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
static Elm_Entry_Filter_Accept_Set digits_filter_data;
int decimal_places = efl_ui_format_decimal_places_get(obj);
if (!sd->ent) return;
elm_entry_markup_filter_remove(sd->ent, elm_entry_filter_accept_set, &digits_filter_data);
if (pd->decimal_points > 0)
if (decimal_places > 0)
digits_filter_data.accepted = "-.0123456789";
else
digits_filter_data.accepted = "-0123456789";
@ -307,6 +280,7 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
char *insert, *new_str = NULL;
double val;
int max_len = 0, len;
int decimal_places = efl_ui_format_decimal_places_get(data);
EINA_SAFETY_ON_NULL_RETURN(data);
EINA_SAFETY_ON_NULL_RETURN(obj);
@ -322,12 +296,12 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
if (!new_str) return;
if (strchr(new_str, '-')) max_len++;
if (pd->format_type == SPIN_FORMAT_FLOAT)
if (decimal_places > 0)
{
point = strchr(new_str, '.');
if (point)
{
if ((int) strlen(point + 1) > pd->decimal_points)
if ((int) strlen(point + 1) > decimal_places)
{
*insert = 0;
goto end;
@ -379,10 +353,6 @@ _toggle_entry(Evas_Object *obj)
// filter feature implemented.
// (Current efl_ui_text has missed filter feature.)
sd->ent = elm_entry_add(obj);
Eina_Strbuf *buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "spinner/%s", elm_widget_style_get(obj));
elm_widget_style_set(sd->ent, eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
evas_object_event_callback_add
(sd->ent, EVAS_CALLBACK_SHOW, _entry_show_cb, obj);
elm_entry_single_line_set(sd->ent, EINA_TRUE);
@ -393,6 +363,7 @@ _toggle_entry(Evas_Object *obj)
elm_entry_markup_filter_append(sd->ent, _min_max_validity_filter, obj);
efl_event_callback_add(sd->ent, ELM_ENTRY_EVENT_ACTIVATED,
_entry_activated_cb, obj);
elm_widget_element_update(obj, sd->ent, "entry");
}
efl_event_callback_add(sd->ent, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
@ -421,42 +392,14 @@ _entry_toggle_cb(void *data EINA_UNUSED,
_toggle_entry(obj);
}
static Eina_Bool
_spin_value(void *data)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(data, EFL_UI_SPIN_CLASS);
if (_value_set(data, pd->val + (sd->inc_val ? pd->step : -pd->step)))
_label_write(data);
return ECORE_CALLBACK_RENEW;
}
static void
_spin_stop(Evas_Object *obj)
_spin_value(Efl_Ui_Spin *obj, Eina_Bool inc)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spin_Data *pd = efl_data_scope_get(obj, EFL_UI_SPIN_CLASS);
ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
int absolut_value = efl_ui_range_value_get(obj) + (inc ? pd->step : -pd->step);
elm_widget_scroll_freeze_pop(obj);
}
static Eina_Bool
_inc_dec_button_press_start(void *data)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
sd->interval = sd->first_interval;
sd->longpress_timer = NULL;
ecore_timer_del(sd->spin_timer);
sd->spin_timer = ecore_timer_add(sd->interval, _spin_value, data);
_spin_value(data);
elm_widget_scroll_freeze_push(data);
return ECORE_CALLBACK_CANCEL;
_value_set(obj, absolut_value);
}
static void
@ -464,58 +407,14 @@ _inc_dec_button_clicked_cb(void *data, const Efl_Event *event)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
_spin_stop(data);
sd->inc_val = sd->inc_button == event->object ? EINA_TRUE : EINA_FALSE;
_spin_value(data);
if (sd->entry_visible) _entry_value_apply(data);
_spin_value(data, sd->inc_button == event->object);
if (_elm_config->access_mode)
_access_increment_decrement_info_say(data, EINA_TRUE);
}
static void
_inc_dec_button_pressed_cb(void *data, const Efl_Event *event)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
sd->inc_val = sd->inc_button == event->object ? EINA_TRUE : EINA_FALSE;
if (sd->longpress_timer) ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = ecore_timer_add
(_elm_config->longpress_timeout,
_inc_dec_button_press_start, data);
if (sd->entry_visible) _entry_value_apply(data);
}
static void
_inc_dec_button_unpressed_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
if (sd->longpress_timer)
{
ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = NULL;
}
_spin_stop(data);
}
static void
_inc_dec_button_mouse_move_cb(void *data, const Efl_Event *event)
{
Efl_Input_Pointer *ev = event->info;
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
if (efl_input_processed_get(ev) && sd->longpress_timer)
{
ecore_timer_del(sd->longpress_timer);
sd->longpress_timer = NULL;
}
}
static void
_text_button_focus_changed_cb(void *data, const Efl_Event *event)
{
@ -531,18 +430,11 @@ _entry_activated_cb(void *data, const Efl_Event *event EINA_UNUSED)
static void
_entry_focus_changed_cb(void *data, const Efl_Event *event)
{
if (!efl_ui_focus_object_focus_get(event->object))
_toggle_entry(data);
}
static void
_text_button_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(data, MY_CLASS);
if (sd->entry_visible) return;
_toggle_entry(data);
if (efl_ui_focus_object_focus_get(event->object) && sd->entry_visible) return;
_toggle_entry(data);
}
static Eina_Bool
@ -550,8 +442,7 @@ _key_action_toggle(Evas_Object *obj, const char *params EINA_UNUSED)
{
Efl_Ui_Spin_Button_Data *sd = efl_data_scope_get(obj, MY_CLASS);
if (sd->spin_timer) _spin_stop(obj);
else if (sd->entry_visible) _entry_toggle_cb(NULL, obj, NULL, NULL);
if (sd->entry_visible) _entry_toggle_cb(NULL, obj, NULL, NULL);
return EINA_FALSE;
}
@ -562,25 +453,9 @@ _efl_ui_spin_button_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Spi
Eo *ev = eo_event->info;
if (efl_input_processed_get(ev)) return EINA_FALSE;
if (eo_event->desc == EFL_EVENT_KEY_DOWN)
if (eo_event->desc == EFL_EVENT_POINTER_WHEEL)
{
if (sd->spin_timer) _spin_stop(obj);
else return EINA_FALSE;
}
else if (eo_event->desc == EFL_EVENT_KEY_UP)
{
if (sd->spin_timer) _spin_stop(obj);
else return EINA_FALSE;
}
else if (eo_event->desc == EFL_EVENT_POINTER_WHEEL)
{
sd->interval = sd->first_interval;
if (efl_input_pointer_wheel_delta_get(ev) < 0)
sd->inc_val = EINA_TRUE;
else
sd->inc_val = EINA_FALSE;
_spin_value(obj);
_spin_value(obj, efl_input_pointer_wheel_delta_get(ev) < 0);
}
else return EINA_FALSE;
@ -596,13 +471,7 @@ _efl_ui_spin_button_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Spin_But
int_ret = efl_ui_focus_object_on_focus_update(efl_super(obj, MY_CLASS));
if (!int_ret) return EINA_FALSE;
if (!efl_ui_focus_object_focus_get(obj))
{
ELM_SAFE_FREE(sd->delay_change_timer, ecore_timer_del);
ELM_SAFE_FREE(sd->spin_timer, ecore_timer_del);
ELM_SAFE_FREE(sd->longpress_timer, ecore_timer_del);
}
else
if (efl_ui_focus_object_focus_get(obj))
{
if (sd->entry_reactivate)
{
@ -615,20 +484,6 @@ _efl_ui_spin_button_efl_ui_focus_object_on_focus_update(Eo *obj, Efl_Ui_Spin_But
return EINA_TRUE;
}
EOLIAN static void
_efl_ui_spin_button_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Spin_Button_Data *_pd EINA_UNUSED)
{
Evas_Coord minw = -1, minh = -1;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
edje_object_size_min_restricted_calc
(wd->resize_obj, &minw, &minh, minw, minh);
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
evas_object_size_hint_min_set(obj, minw, minh);
evas_object_size_hint_max_set(obj, -1, -1);
}
static char *
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
{
@ -735,71 +590,21 @@ _access_spinner_register(Evas_Object *obj, Eina_Bool is_access)
}
}
static const char *
_theme_group_modify_pos_get(const char *cur_group, const char *search, size_t len)
static void
_sync_widget_theme_klass(Eo *obj, Efl_Ui_Spin_Button_Data *pd)
{
const char *pos = NULL;
const char *temp_str = NULL;
temp_str = cur_group + len - strlen(search);
if (temp_str >= cur_group)
{
if (!strcmp(temp_str, search))
pos = temp_str;
}
return pos;
}
static char *
_efl_ui_spin_button_theme_group_get(Evas_Object *obj, Efl_Ui_Spin_Button_Data *sd)
{
const char *pos = NULL;
const char *cur_group = elm_widget_theme_element_get(obj);
Eina_Strbuf *new_group = eina_strbuf_new();
size_t len = 0;
if (cur_group)
{
len = strlen(cur_group);
pos = _theme_group_modify_pos_get(cur_group, "horizontal", len);
if (!pos)
pos = _theme_group_modify_pos_get(cur_group, "vertical", len);
// TODO: change separator when it is decided.
// can skip when prev_group == cur_group
if (!pos)
{
eina_strbuf_append(new_group, cur_group);
eina_strbuf_append(new_group, "/");
}
else
{
eina_strbuf_append_length(new_group, cur_group, pos - cur_group);
}
}
if (efl_ui_layout_orientation_is_horizontal(sd->dir, EINA_TRUE))
eina_strbuf_append(new_group, "horizontal");
if (efl_ui_layout_orientation_is_horizontal(pd->dir, EINA_TRUE))
elm_widget_theme_klass_set(obj, "spin_button/horizontal");
else
eina_strbuf_append(new_group, "vertical");
return eina_strbuf_release(new_group);
elm_widget_theme_klass_set(obj, "spin_button/vertical");
}
EOLIAN static Eina_Error
_efl_ui_spin_button_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *sd EINA_UNUSED)
{
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
char *group;
group = _efl_ui_spin_button_theme_group_get(obj, sd);
if (group)
{
elm_widget_theme_element_set(obj, group);
free(group);
}
_sync_widget_theme_klass(obj, sd);
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
@ -827,39 +632,37 @@ _efl_ui_spin_button_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Spin_Button_Data *
EOLIAN static Eo *
_efl_ui_spin_button_efl_object_constructor(Eo *obj, Efl_Ui_Spin_Button_Data *sd)
{
char *group;
obj = efl_constructor(efl_super(obj, MY_CLASS));
elm_widget_theme_klass_set(obj, "spin_button");
_sync_widget_theme_klass(obj, sd);
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
group = _efl_ui_spin_button_theme_group_get(obj, sd);
if (elm_widget_theme_object_set(obj, wd->resize_obj,
elm_widget_theme_klass_get(obj),
group,
elm_widget_theme_element_get(obj),
elm_widget_theme_style_get(obj)) == EFL_UI_THEME_APPLY_ERROR_GENERIC)
CRI("Failed to set layout!");
free(group);
sd->first_interval = 0.85;
sd->inc_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
efl_ui_autorepeat_enabled_set(efl_added, EINA_TRUE),
efl_ui_autorepeat_initial_timeout_set(efl_added, _elm_config->longpress_timeout),
efl_ui_autorepeat_gap_timeout_set(efl_added, REPEAT_INTERVAL),
elm_widget_element_update(obj, efl_added, PART_NAME_INC_BUTTON),
efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj),
efl_content_set(efl_part(obj, "efl.inc_button"), efl_added));
sd->text_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
elm_widget_element_update(obj, efl_added, PART_NAME_TEXT_BUTTON),
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
_text_button_clicked_cb, obj),
efl_event_callback_add(efl_added, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED,
_text_button_focus_changed_cb, obj),
efl_content_set(efl_part(obj, "efl.text_button"), efl_added));
sd->dec_button = efl_add(EFL_UI_BUTTON_CLASS, obj,
efl_ui_autorepeat_enabled_set(efl_added, EINA_TRUE),
efl_ui_autorepeat_initial_timeout_set(efl_added, _elm_config->longpress_timeout),
efl_ui_autorepeat_gap_timeout_set(efl_added, REPEAT_INTERVAL),
elm_widget_element_update(obj, efl_added, PART_NAME_DEC_BUTTON),
efl_event_callback_array_add(efl_added, _inc_dec_button_cb(), obj),
efl_content_set(efl_part(obj, "efl.dec_button"), efl_added));
@ -997,7 +800,4 @@ _efl_ui_spin_button_efl_access_object_i18n_name_get(const Eo *obj, Efl_Ui_Spin_B
// A11Y Accessibility - END
#define EFL_UI_SPIN_BUTTON_EXTRA_OPS \
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_spin_button), \
#include "efl_ui_spin_button.eo.c"

View File

@ -4,18 +4,14 @@
typedef struct _Efl_Ui_Spin_Button_Data Efl_Ui_Spin_Button_Data;
struct _Efl_Ui_Spin_Button_Data
{
double interval, first_interval;
Evas_Object *ent, *inc_button, *dec_button, *text_button;
Ecore_Timer *delay_change_timer; /**< a timer for a delay,changed smart callback */
Ecore_Timer *spin_timer; /**< a timer for a repeated spinner value change on mouse down */
Ecore_Timer *longpress_timer; /**< a timer to detect long press. After longress timeout,
start continuous change of values until mouse up */
Efl_Ui_Layout_Orientation dir;
Eina_Bool entry_visible : 1;
Eina_Bool entry_reactivate : 1;
Eina_Bool editable : 1;
Eina_Bool inc_val : 1;
Eina_Bool circulate : 1;
};

View File

@ -3,29 +3,11 @@
#include "Elementary.h"
typedef enum _Efl_Ui_Spin_Format_Type
{
SPIN_FORMAT_FLOAT,
SPIN_FORMAT_INT,
SPIN_FORMAT_INVALID
} Efl_Ui_Spin_Format_Type;
typedef struct _Efl_Ui_Spin_Data Efl_Ui_Spin_Data;
struct _Efl_Ui_Spin_Data
{
const char *templates;
double val, val_min, val_max;
double step; /**< step for the value change. 1 by default. */
int decimal_points;
Ecore_Timer *spin_timer; /**< a timer for a repeated spin value change on mouse down */
Efl_Ui_Spin_Format_Type format_type;
Efl_Ui_Format_Func_Cb format_cb;
Eina_Free_Cb format_free_cb;
void *format_cb_data;
Eina_Strbuf *format_strbuf;
Eina_Array *special_values;
};
#endif

View File

@ -4,9 +4,9 @@
#include <Efl_Ui.h>
#include "elm_priv.h"
#include "efl_ui_active_view_view_manager_plain.eo.h"
#include "efl_ui_spotlight_manager_plain.eo.h"
typedef struct _Efl_Ui_Active_View_Container_Data
typedef struct _Efl_Ui_Spotlight_Container_Data
{
Eina_List *content_list;
Eo *page_root, *event;
@ -27,21 +27,21 @@ typedef struct _Efl_Ui_Active_View_Container_Data
Eina_Promise *transition_done;
Efl_Gfx_Entity *content;
} transition_done;
Efl_Ui_Active_View_View_Manager *transition;
Efl_Ui_Active_View_Indicator *indicator;
Efl_Ui_Spotlight_Manager *transition;
Efl_Ui_Spotlight_Indicator *indicator;
double position;
Eina_Bool fill_width: 1;
Eina_Bool fill_height: 1;
Eina_Bool prevent_transition_interaction : 1;
} Efl_Ui_Active_View_Container_Data;
} Efl_Ui_Spotlight_Container_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_CONTAINER_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_CONTAINER_CLASS
static void _unpack(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj, int index);
static void _unpack_all(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Eina_Bool clear);
static void _unpack(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj, int index);
static void _unpack_all(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool clear);
static int
clamp_index(Efl_Ui_Active_View_Container_Data *pd, int index)
clamp_index(Efl_Ui_Spotlight_Container_Data *pd, int index)
{
if (index < ((int)eina_list_count(pd->content_list)) * -1)
return -1;
@ -51,7 +51,7 @@ clamp_index(Efl_Ui_Active_View_Container_Data *pd, int index)
}
static int
index_rollover(Efl_Ui_Active_View_Container_Data *pd, int index)
index_rollover(Efl_Ui_Spotlight_Container_Data *pd, int index)
{
int c = eina_list_count(pd->content_list);
if (index < c * -1)
@ -64,9 +64,9 @@ index_rollover(Efl_Ui_Active_View_Container_Data *pd, int index)
}
static void
_transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
Efl_Ui_Active_View_Transition_Event ev;
Efl_Ui_Spotlight_Transition_Event ev;
if (pd->prevent_transition_interaction) return;
@ -81,16 +81,16 @@ _transition_end(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
ev.from = pd->show_request.from;
ev.to = pd->show_request.to;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_END, &ev);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, &ev);
pd->show_request.active = EINA_FALSE;
pd->show_request.from = -1;
pd->show_request.to = -1;
}
static void
_transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, int from, int to, double progress)
_transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, int from, int to, double progress)
{
Efl_Ui_Active_View_Transition_Event ev;
Efl_Ui_Spotlight_Transition_Event ev;
if (pd->prevent_transition_interaction) return;
@ -103,23 +103,23 @@ _transition_start(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, in
pd->show_request.last_pos = progress;
ev.from = pd->show_request.from;
ev.to = pd->show_request.to;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_EVENT_TRANSITION_START, &ev);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_START, &ev);
}
static void
_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, double progress)
_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, double progress)
{
if (progress < -1.0) progress = -1.0;
if (progress > eina_list_count(pd->content_list)) progress = eina_list_count(pd->content_list);
if (pd->indicator)
{
efl_ui_active_view_indicator_position_update(pd->indicator, progress);
efl_ui_spotlight_indicator_position_update(pd->indicator, progress);
}
pd->position = progress;
}
static void
_transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
if (pd->show_request.active)
{
@ -146,7 +146,7 @@ _transition_event_emission(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Dat
static void
_resize_cb(void *data, const Efl_Event *ev)
{
Efl_Ui_Active_View_Container_Data *pd = data;
Efl_Ui_Spotlight_Container_Data *pd = data;
Eina_Size2D sz;
sz = efl_gfx_entity_size_get(ev->object);
@ -155,12 +155,12 @@ _resize_cb(void *data, const Efl_Event *ev)
if (pd->fill_height) pd->page_spec.sz.h = sz.h;
if (pd->transition)
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
}
EOLIAN static Eo *
_efl_ui_active_view_container_efl_object_constructor(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_object_constructor(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
@ -185,7 +185,7 @@ _efl_ui_active_view_container_efl_object_constructor(Eo *obj,
pd->fill_width = EINA_TRUE;
pd->fill_height = EINA_TRUE;
efl_ui_active_view_size_set(obj, EINA_SIZE2D(-1, -1));
efl_ui_spotlight_size_set(obj, EINA_SIZE2D(-1, -1));
elm_widget_can_focus_set(obj, EINA_FALSE);
@ -204,39 +204,39 @@ _efl_ui_active_view_container_efl_object_constructor(Eo *obj,
}
EOLIAN static Efl_Object*
_efl_ui_active_view_container_efl_object_finalize(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED)
_efl_ui_spotlight_container_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager *manager;
Efl_Ui_Spotlight_Manager *manager;
obj = efl_finalize(efl_super(obj, MY_CLASS));
manager = efl_ui_active_view_manager_get(obj);
manager = efl_ui_spotlight_manager_get(obj);
//set a view manager in case nothing is here
if (!manager)
{
Eo *plain;
plain = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS, obj);
efl_ui_active_view_manager_set(obj, plain);
plain = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj);
efl_ui_spotlight_manager_set(obj, plain);
}
else
{
efl_ui_active_view_view_manager_animation_enabled_set(manager, EINA_TRUE);
efl_ui_spotlight_manager_animation_enabled_set(manager, EINA_TRUE);
}
return obj;
}
EOLIAN static void
_efl_ui_active_view_container_efl_object_invalidate(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_object_invalidate(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_TRUE);
efl_invalidate(efl_super(obj, MY_CLASS));
}
EOLIAN static int
_efl_ui_active_view_container_efl_container_content_count(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_container_content_count(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return eina_list_count(pd->content_list);
}
@ -244,13 +244,13 @@ _efl_ui_active_view_container_efl_container_content_count(Eo *obj EINA_UNUSED,
static void
_child_inv(void *data, const Efl_Event *ev)
{
Efl_Ui_Active_View_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
int index = eina_list_data_idx(pd->content_list, ev->object);
_unpack(data, pd, ev->object, index);
}
static Eina_Bool
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj)
_register_child(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(subobj, EINA_FALSE);
if (eina_list_data_find(pd->content_list, subobj))
@ -267,7 +267,7 @@ _register_child(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_
}
static void
_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index)
_update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index)
{
Eina_Bool curr_page_update = EINA_FALSE;
@ -279,19 +279,19 @@ _update_internals(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd, Ef
pd->prevent_transition_interaction = EINA_TRUE;
if (pd->transition)
efl_ui_active_view_view_manager_content_add(pd->transition, subobj, index);
efl_ui_spotlight_manager_content_add(pd->transition, subobj, index);
if (pd->indicator)
efl_ui_active_view_indicator_content_add(pd->indicator, subobj, index);
efl_ui_spotlight_indicator_content_add(pd->indicator, subobj, index);
if (curr_page_update && !pd->transition && eina_list_count(pd->content_list) != 1)
_position_set(obj, pd, pd->curr.page);
pd->prevent_transition_interaction = EINA_FALSE;
if (eina_list_count(pd->content_list) == 1)
efl_ui_active_view_active_index_set(obj, 0);
efl_ui_spotlight_active_index_set(obj, 0);
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
@ -301,8 +301,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_begin(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!_register_child(obj, pd, subobj)) return EINA_FALSE;
@ -312,8 +312,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_end(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
@ -326,8 +326,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_before(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
const Efl_Gfx_Entity *existing)
{
@ -340,8 +340,8 @@ _efl_ui_active_view_container_efl_pack_linear_pack_after(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_linear_pack_at(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_at(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
int index)
{
@ -372,24 +372,24 @@ _efl_ui_active_view_container_efl_pack_linear_pack_at(Eo *obj,
}
EOLIAN static Efl_Gfx_Entity *
_efl_ui_active_view_container_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_content_get(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
return eina_list_nth(pd->content_list, index_rollover(pd, index));
}
EOLIAN static int
_efl_ui_active_view_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_index_get(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
const Efl_Gfx_Entity *subobj)
{
return eina_list_data_idx(pd->content_list, (void *)subobj);
}
EOLIAN static void
_efl_ui_active_view_container_active_index_set(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_active_index_set(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
int before;
@ -414,26 +414,26 @@ _efl_ui_active_view_container_active_index_set(Eo *obj EINA_UNUSED,
int old_curr_page = pd->curr.page;
pd->curr.page = index;
efl_ui_active_view_view_manager_switch_to(pd->transition, old_curr_page, pd->curr.page);
efl_ui_spotlight_manager_switch_to(pd->transition, old_curr_page, pd->curr.page);
}
EOLIAN static int
_efl_ui_active_view_container_active_index_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_active_index_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->curr.page;
}
EOLIAN Eina_Size2D
_efl_ui_active_view_container_active_view_size_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_spotlight_size_get(const Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->page_spec.sz;
}
EOLIAN static void
_efl_ui_active_view_container_active_view_size_set(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_spotlight_size_set(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Eina_Size2D sz)
{
Eina_Size2D size;
@ -450,12 +450,12 @@ _efl_ui_active_view_container_active_view_size_set(Eo *obj,
pd->page_spec.sz.w = size.w;
if (pd->transition)
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
}
static void
_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd,
Efl_Ui_Spotlight_Container_Data *pd,
Eina_Bool clear)
{
pd->curr.page = -1;
@ -472,8 +472,8 @@ _unpack_all(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_TRUE);
@ -481,8 +481,8 @@ _efl_ui_active_view_container_efl_pack_pack_clear(Eo *obj EINA_UNUSED,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
Efl_Ui_Spotlight_Container_Data *pd)
{
_unpack_all(obj, pd, EINA_FALSE);
@ -491,7 +491,7 @@ _efl_ui_active_view_container_efl_pack_unpack_all(Eo *obj EINA_UNUSED,
static void
_unpack(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj,
int index)
{
@ -506,9 +506,9 @@ _unpack(Eo *obj,
pd->curr.page--;
if (pd->transition)
efl_ui_active_view_view_manager_content_del(pd->transition, subobj, index);
efl_ui_spotlight_manager_content_del(pd->transition, subobj, index);
if (pd->indicator)
efl_ui_active_view_indicator_content_del(pd->indicator, subobj, index);
efl_ui_spotlight_indicator_content_del(pd->indicator, subobj, index);
//we deleted the current index
if (early_curr_page == index)
@ -519,7 +519,7 @@ _unpack(Eo *obj,
if (deletion_of_active && new_curr_page == pd->curr.page)
pd->curr.page = index -1;
if (eina_list_count(pd->content_list) > 0 && efl_alive_get(obj))
efl_ui_active_view_active_index_set(obj, new_curr_page);
efl_ui_spotlight_active_index_set(obj, new_curr_page);
else
pd->curr.page = -1;
}
@ -527,14 +527,14 @@ _unpack(Eo *obj,
//position has updated
if (early_curr_page != pd->curr.page && early_curr_page != index &&
pd->indicator && !pd->transition)
efl_ui_active_view_indicator_position_update(pd->indicator, pd->curr.page);
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->curr.page);
efl_event_callback_del(subobj, EFL_EVENT_INVALIDATE, _child_inv, obj);
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_unpack(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_unpack(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
Efl_Gfx_Entity *subobj)
{
if (!subobj) return EINA_FALSE;
@ -552,8 +552,8 @@ _efl_ui_active_view_container_efl_pack_unpack(Eo *obj,
}
EOLIAN static Efl_Gfx_Entity *
_efl_ui_active_view_container_efl_pack_linear_pack_unpack_at(Eo *obj,
Efl_Ui_Active_View_Container_Data *pd,
_efl_ui_spotlight_container_efl_pack_linear_pack_unpack_at(Eo *obj,
Efl_Ui_Spotlight_Container_Data *pd,
int index)
{
Efl_Gfx_Entity *subobj = eina_list_nth(pd->content_list, index_rollover(pd, index_rollover(pd, index)));
@ -564,13 +564,13 @@ _efl_ui_active_view_container_efl_pack_linear_pack_unpack_at(Eo *obj,
}
EOLIAN static Eina_Bool
_efl_ui_active_view_container_efl_pack_pack(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
_efl_ui_spotlight_container_efl_pack_pack(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *subobj)
{
return efl_pack_begin(obj, subobj);
}
EOLIAN static Eina_Iterator*
_efl_ui_active_view_container_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
_efl_ui_spotlight_container_efl_container_content_iterate(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
return eina_list_iterator_new(pd->content_list);
}
@ -578,7 +578,7 @@ _efl_ui_active_view_container_efl_container_content_iterate(Eo *obj EINA_UNUSED,
static void
_pos_updated(void *data, const Efl_Event *event)
{
Efl_Ui_Active_View_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Container_Data *pd = efl_data_scope_get(data, MY_CLASS);
double progress = *((double*)event->info);
//ignore this here, this could result in unintendet transition,start / end calls
if (EINA_DBL_EQ(progress, pd->position))
@ -588,16 +588,16 @@ _pos_updated(void *data, const Efl_Event *event)
}
EOLIAN static void
_efl_ui_active_view_container_view_manager_set(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Ui_Active_View_View_Manager *transition)
_efl_ui_spotlight_container_spotlight_manager_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Manager *transition)
{
if (!transition)
pd->transition = efl_add(EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS, obj);
pd->transition = efl_add(EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS, obj);
else
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_CLASS));
EINA_SAFETY_ON_FALSE_RETURN(efl_isa(transition, EFL_UI_SPOTLIGHT_MANAGER_CLASS));
if (pd->transition)
{
efl_ui_active_view_view_manager_bind(pd->transition, NULL, NULL);
efl_ui_spotlight_manager_bind(pd->transition, NULL, NULL);
efl_del(pd->transition);
}
@ -607,57 +607,57 @@ _efl_ui_active_view_container_view_manager_set(Eo *obj, Efl_Ui_Active_View_Conta
{
efl_parent_set(pd->transition, obj);
//disable animation when not finalized yet, this help reducing the overhead of scheduling a animation that will not be displayed
efl_ui_active_view_view_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj));
efl_ui_active_view_view_manager_bind(pd->transition, obj,
efl_ui_spotlight_manager_animation_enabled_set(pd->transition, efl_finalized_get(obj));
efl_ui_spotlight_manager_bind(pd->transition, obj,
pd->page_root);
efl_ui_active_view_view_manager_view_size_set(pd->transition, pd->page_spec.sz);
efl_event_callback_add(pd->transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, _pos_updated, obj);
efl_ui_spotlight_manager_size_set(pd->transition, pd->page_spec.sz);
efl_event_callback_add(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, _pos_updated, obj);
}
}
EOLIAN static Efl_Ui_Active_View_View_Manager*
_efl_ui_active_view_container_view_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
EOLIAN static Efl_Ui_Spotlight_Manager*
_efl_ui_spotlight_container_spotlight_manager_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
if (efl_isa(pd->transition, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS))
if (efl_isa(pd->transition, EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS))
return NULL;
else
return pd->transition;
}
EOLIAN static void
_efl_ui_active_view_container_indicator_set(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Efl_Ui_Active_View_Indicator *indicator)
_efl_ui_spotlight_container_indicator_set(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Efl_Ui_Spotlight_Indicator *indicator)
{
if (pd->indicator)
{
efl_ui_active_view_indicator_bind(pd->indicator, obj);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
efl_del(pd->indicator);
}
pd->indicator = indicator;
if (pd->indicator)
{
efl_ui_active_view_indicator_bind(pd->indicator, obj);
efl_ui_spotlight_indicator_bind(pd->indicator, obj);
if (pd->position != -1)
efl_ui_active_view_indicator_position_update(pd->indicator, pd->position);
efl_ui_spotlight_indicator_position_update(pd->indicator, pd->position);
}
}
EOLIAN static Efl_Ui_Active_View_Indicator*
_efl_ui_active_view_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Container_Data *pd)
EOLIAN static Efl_Ui_Spotlight_Indicator*
_efl_ui_spotlight_container_indicator_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Container_Data *pd)
{
return pd->indicator;
}
EOLIAN static void
_efl_ui_active_view_container_push(Eo *obj, Efl_Ui_Active_View_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *view)
_efl_ui_spotlight_container_push(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd EINA_UNUSED, Efl_Gfx_Entity *view)
{
int old_active_index = efl_ui_active_view_active_index_get(obj);
int old_active_index = efl_ui_spotlight_active_index_get(obj);
if (old_active_index == -1)
old_active_index = 0;
efl_pack_at(obj, view, old_active_index);
efl_ui_active_view_active_index_set(obj, old_active_index);
efl_ui_spotlight_active_index_set(obj, old_active_index);
}
static Eina_Value
@ -669,7 +669,7 @@ _delete_obj(void *data EINA_UNUSED, const Eina_Value value, const Eina_Future *d
}
EOLIAN static Eina_Future*
_efl_ui_active_view_container_pop(Eo *obj, Efl_Ui_Active_View_Container_Data *pd, Eina_Bool del)
_efl_ui_spotlight_container_pop(Eo *obj, Efl_Ui_Spotlight_Container_Data *pd, Eina_Bool del)
{
Eina_Future *transition_done;
int new_index;
@ -677,21 +677,21 @@ _efl_ui_active_view_container_pop(Eo *obj, Efl_Ui_Active_View_Container_Data *pd
if (eina_list_count(pd->content_list) < 2)
new_index = -1;
new_index = efl_ui_active_view_active_index_get(obj) + 1;
new_index = efl_ui_spotlight_active_index_get(obj) + 1;
if (new_index >= (int)eina_list_count(pd->content_list))
new_index -= 2;
pd->transition_done.content = efl_pack_content_get(obj, efl_ui_active_view_active_index_get(obj));
pd->transition_done.content = efl_pack_content_get(obj, efl_ui_spotlight_active_index_get(obj));
pd->transition_done.transition_done = efl_loop_promise_new(obj);
transition_done = eina_future_new(pd->transition_done.transition_done);
if (del)
transition_done = eina_future_then(transition_done, _delete_obj, NULL);
efl_ui_active_view_active_index_set(obj, new_index);
efl_ui_spotlight_active_index_set(obj, new_index);
return transition_done;
}
#include "efl_ui_active_view_container.eo.c"
#include "efl_ui_spotlight_container.eo.c"

View File

@ -0,0 +1,111 @@
struct @beta Efl.Ui.Spotlight.Transition_Event {
[[Information regarding transition events.]]
from : int; [[The index from where the transition started, -1 if not known.]]
to : int; [[The index to where the transition is headed, -1 if not known.]]
}
class @beta Efl.Ui.Spotlight.Container extends Efl.Ui.Layout_Base implements Efl.Pack_Linear
{
[[The Spotlight widget is a container for other sub-widgets, where only one sub-widget is active at any given time.
Sub-widgets are added using the @Efl.Pack_Linear interface and the active one (the one in the "spotlight") is selected using @.active_index.
The way the different sub-widgets are rendered can be customized through the @.spotlight_manager object. For example, only the active sub-widget
might be shown, or it might be shown in a central position whereas the other sub-widgets are displayed on the sides, or grayed-out.
All sub-widgets are displayed with the same size, selected with @.spotlight_size.
Additionally, the transition from one sub-widget to another can be animated. This animation is also controlled by the @.spotlight_manager object.
Also, an indicator widget can be used to show a visual cue of how many sub-widgets are there and which one is the active one.
This class can be used to create other widgets like Pagers, Tabbed pagers or Stacks, where each sub-widget represents a "page" full
of other widgets. All these cases can be implemented with a different @.spotlight_manager and use the same @Efl.Ui.Spotlight.Container.
]]
c_prefix: efl_ui_spotlight;
methods {
@property spotlight_manager {
[[This object defines how sub-widgets are rendered and animated.
If it is not set, only the active sub-widget is shown and transitions are instantaneous (not animated).
]]
values {
spotlight_manager : Efl.Ui.Spotlight.Manager @owned; [[The Spotlight Manager object or $NULL.]]
}
}
@property indicator {
[[An indicator object to use, which will display the current state of the spotlight (number of sub-widgets and active one).
When this object is set, it is immediately updated to reflect the current state of the widget.
Its location inside the container is controlled by the @.spotlight_manager.
]]
values {
indicator : Efl.Ui.Spotlight.Indicator @owned; [[The Indicator object or $NULL.]]
}
}
@property active_index {
[[Currently active sub-widget (the one with the spotlight) among all the sub-widgets added to this widget
Changing this value might trigger an animation.
]]
values {
index: int; [[Index of the sub-widget that has the spotlight, from 0 to the number of sub-widgets - 1 (@Efl.Container.content_count - 1).]]
}
}
@property spotlight_size {
[[The size to use when displaying the Sub-Widget which has the spotlight. This is used by the @.spotlight_manager to perform the rendering.
Sub-Widgets other than the Active one may or may not use this size.]]
values {
size: Eina.Size2D; [[Render size for the spotlight. (-1, -1) means that all available space inside the container is used.]]
}
}
push @beta {
[[Packs a new sub-widget at the position indicated by @.active_index (0 by default).
This is the same behavior as a push operation on a stack.
An animation might be triggered to give the new sub-widget the spotlight and come into position.
]]
params {
widget : Efl.Gfx.Entity; [[Sub-Widget to add and set to be the spotlight sub-widget.]]
}
}
pop @beta {
[[Removes the sub-widget that has the spotlight from the widget.
The sub-widgets behind it naturally flow down so the next one gets the spotlight. This is the same behavior as a pop operation on a stack.
When combined with @.push you don't have to worry about @.active_index since only the first sub-widget is manipulated.
An animation might be triggered to give the new sub-widget the spotlight, come into position and the old one disappear.
The removed sub-widget can be returned to the caller or deleted (depending on $delete_on_transition_end).
]]
params {
deletion_on_transition_end : bool; [[ if $true, then the object will be deleted before resolving the future, and a NULL pointer is the value of the future. $false if no operation should be applied to it]]
}
return : future<Efl.Gfx.Entity>; [[ This Future gets resolved when any transition animation finishes and the popped sub-widget is ready for collection.
If there is no animation, the Future resolves immediately.
If $deletion_on_transition_end is $true then this widget will destroy the popped sub-widget and the Future will contain no Value. Otherwise, the caller becomes the owner of the sub-widget contained in the Future and must dispose of it appropriately. ]]
}
}
events {
transition,start : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has started.]]
transition,end : Efl.Ui.Spotlight.Transition_Event; [[A transition animation has ended.]]
}
implements {
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.invalidate;
Efl.Container.content_count;
Efl.Container.content_iterate;
Efl.Pack.pack_clear;
Efl.Pack.unpack_all;
Efl.Pack.unpack;
Efl.Pack.pack;
Efl.Pack_Linear.pack_begin;
Efl.Pack_Linear.pack_end;
Efl.Pack_Linear.pack_before;
Efl.Pack_Linear.pack_after;
Efl.Pack_Linear.pack_at;
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at;
}
}

View File

@ -9,7 +9,7 @@
typedef struct {
} Efl_Ui_Active_View_Indicator_Data;
} Efl_Ui_Spotlight_Indicator_Data;
#include "efl_ui_active_view_indicator.eo.c"
#include "efl_ui_spotlight_indicator.eo.c"

View File

@ -1,25 +1,25 @@
abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
[[Object used by @Efl.Ui.Active_View.Container to render an indication of the active view's position among
the rest of the container's views.
abstract @beta Efl.Ui.Spotlight.Indicator extends Efl.Object {
[[Object used by @Efl.Ui.Spotlight.Container to render an indication of the active widgets's position among
the rest of the container's widgets.
An example would be Android's little dots in the home screen.
]]
methods {
bind @pure_virtual {
[[This method is called the first time an @Efl.Ui.Active_View.Indicator is assigned to an @Efl.Ui.Active_View.Container, binding them together.
[[This method is called the first time an @Efl.Ui.Spotlight.Indicator is assigned to an @Efl.Ui.Spotlight.Container, binding them together.
This call can be used to setup the indicator part of the $active_view.
This call can be used to setup the indicator part of the $spotlight.
The Active View of the container (if there is any) will be informed to the indicator by a later call to @.position_update.
]]
params {
active_view : Efl.Ui.Active_View.Container; [[The container to bind this indicator to.]]
spotlight : Efl.Ui.Spotlight.Container; [[The container to bind this indicator to.]]
}
}
content_add @pure_virtual {
[[A $subobj has been added at position $index in the bound container.
The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
shifted due to the insertion of the new object.
]]
params {
@ -30,7 +30,7 @@ abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
content_del @pure_virtual {
[[The $subobj at position $index in the bound container has been removed.
The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
shifted due to the removal of the object.
]]
params {
@ -39,7 +39,7 @@ abstract @beta Efl.Ui.Active_View.Indicator extends Efl.Object {
}
}
position_update @pure_virtual {
[[This method tells the indicator that @Efl.Ui.Active_View.Container.active_index has changed in the bound container.
[[This method tells the indicator that @Efl.Ui.Spotlight.Container.active_index has changed in the bound container.
$position ranges from -1 to the number of views in the bound container (@Efl.Container.content_count).
Notice this allows moving to a position before the first view or past the last view, which might happen if the view

View File

@ -9,9 +9,9 @@
typedef struct {
Efl_Ui_Box *indicator;
Efl_Ui_Active_View_Container *container;
Efl_Ui_Spotlight_Container *container;
double last_position;
} Efl_Ui_Active_View_Indicator_Icon_Data;
} Efl_Ui_Spotlight_Indicator_Icon_Data;
static void
_flush_state(Eo *item, double val)
@ -22,7 +22,7 @@ _flush_state(Eo *item, double val)
}
static void
_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
_add_item(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
{
Efl_Canvas_Layout *item;
@ -37,7 +37,7 @@ _add_item(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
}
static void
_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
_flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd)
{
int next = -1, closer;
double closer_val;
@ -71,12 +71,12 @@ _flush_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd)
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_bind(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Ui_Active_View_Container *active_view)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_bind(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Ui_Spotlight_Container *spotlight)
{
if (active_view)
if (spotlight)
{
pd->container = active_view;
pd->indicator = efl_add(EFL_UI_BOX_CLASS, active_view);
pd->container = spotlight;
pd->indicator = efl_add(EFL_UI_BOX_CLASS, spotlight);
efl_ui_widget_internal_set(pd->indicator, EINA_TRUE);
efl_content_set(efl_part(pd->container, "efl.indicator"), pd->indicator);
efl_gfx_entity_visible_set(pd->indicator, EINA_TRUE);
@ -91,24 +91,24 @@ _efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_bind(Eo *obj, Ef
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_content_add(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_add(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
{
_add_item(obj, pd);
_flush_position(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_content_del(Eo *obj, Efl_Ui_Active_View_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_content_del(Eo *obj, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, Efl_Gfx_Entity *subobj EINA_UNUSED, int index EINA_UNUSED)
{
efl_del(efl_pack_content_get(pd->indicator, 0));
_flush_position(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_indicator_icon_efl_ui_active_view_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_Indicator_Icon_Data *pd, double position)
_efl_ui_spotlight_indicator_icon_efl_ui_spotlight_indicator_position_update(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Indicator_Icon_Data *pd, double position)
{
pd->last_position = position;
_flush_position(obj, pd);
}
#include "efl_ui_active_view_indicator_icon.eo.c"
#include "efl_ui_spotlight_indicator_icon.eo.c"

View File

@ -0,0 +1,8 @@
class @beta Efl.Ui.Spotlight.Indicator_Icon extends Efl.Ui.Spotlight.Indicator {
implements {
Efl.Ui.Spotlight.Indicator.bind;
Efl.Ui.Spotlight.Indicator.content_del;
Efl.Ui.Spotlight.Indicator.content_add;
Efl.Ui.Spotlight.Indicator.position_update;
}
}

View File

@ -9,7 +9,7 @@
typedef struct {
} Efl_Ui_Active_View_View_Manager_Data;
} Efl_Ui_Spotlight_Manager_Data;
#include "efl_ui_active_view_view_manager.eo.c"
#include "efl_ui_spotlight_manager.eo.c"

View File

@ -1,25 +1,25 @@
abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
[[Manager object used by @Efl.Ui.Active_View.Container to handle rendering and animation of its views, and user interaction.
abstract @beta Efl.Ui.Spotlight.Manager extends Efl.Object {
[[Manager object used by @Efl.Ui.Spotlight.Container to handle rendering and animation of its sub-widgets, and user interaction.
For instance, changes to the currently active view (@Efl.Ui.Active_View.Container.active_index) can be animated with a transition.
This object can also handle user interaction. For example, dragging the active view to one side to get to a different view (like an Android home screen).
Such user interactions should end up setting a new @Efl.Ui.Active_View.Container.active_index.
For instance, changes to the current sub-widget in the spotlight (@Efl.Ui.Spotlight.Container.active_index) can be animated with a transition.
This object can also handle user interaction. For example, dragging the sub-widget to one side to get to a different sub-widget (like an smartphone home screen).
Such user interactions should end up setting a new @Efl.Ui.Spotlight.Container.active_index.
During a transition, the evolution of the current position should be exposed by emitting $pos_update events.
]]
methods {
bind @pure_virtual {
[[This method is called the first time an @Efl.Ui.Active_View.View_Manager is assigned to an @Efl.Ui.Active_View.Container, binding them together.
[[This method is called the first time an @Efl.Ui.Spotlight.Manager is assigned to an @Efl.Ui.Spotlight.Container, binding them together.
The manager can read the current content of the container, subscribe to events, or do any initialization it requires.
]]
params {
active_view : Efl.Ui.Active_View.Container; [[The container to bind the view manager to.]]
spotlight : Efl.Ui.Spotlight.Container; [[The container to bind the manager to.]]
group : Efl.Canvas.Group; [[The graphical group where the views should be added with @Efl.Canvas.Group.group_member_add and removed with @Efl.Canvas.Group.group_member_remove.]]
}
}
content_add @pure_virtual {
[[A $subobj has been added at position $index in the bound container.
The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
shifted due to the insertion of the new object.
]]
params {
@ -30,7 +30,7 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
content_del @pure_virtual {
[[The $subobj at position $index in the bound container has been removed.
The manager should check the container's @Efl.Ui.Active_View.Container.active_index since indices might have
The manager should check the container's @Efl.Ui.Spotlight.Container.active_index since indices might have
shifted due to the removal of the object.
]]
params {
@ -39,20 +39,20 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
}
}
switch_to @pure_virtual {
[[Switch from one view to another. If there was no previous view, $from might be -1.
This function should display an animation if the @Efl.Ui.Active_View.View_Manager supports them.
[[Switch from one sub-widget to another. If there was no previous sub-widget, $from might be -1.
This function should display an animation if the @Efl.Ui.Spotlight.Manager supports them.
]]
params {
from : int; [[Index of the starting view in the container's list. Might be -1 if unknown.]]
to : int; [[Index of the target view in the container's list.]]
from : int; [[Index of the starting sub-widget in the container's list. Might be -1 if unknown.]]
to : int; [[Index of the target sub-widget in the container's list.]]
}
}
@property view_size @pure_virtual {
[[Will be called whenever the @Efl.Ui.Active_View.Container.active_view_size changes so the @Efl.Ui.Active_View.View_Manager can update itself.]]
@property size @pure_virtual {
[[Will be called whenever the @Efl.Ui.Spotlight.Container.spotlight_size changes so the @Efl.Ui.Spotlight.Manager can update itself.]]
set {
}
values {
size : Eina.Size2D; [[The new size of the views.]]
size : Eina.Size2D; [[The new size of the sub-widgets.]]
}
}
@property animation_enabled @pure_virtual {
@ -63,8 +63,8 @@ abstract @beta Efl.Ui.Active_View.View_Manager extends Efl.Object {
}
}
events {
pos_update : double; [[Index of the view currently being displayed. Fractional values indicate a position in-between views.
For instance, when transitioning from view 2 to view 3, this event should be emitted with monotonically
pos_update : double; [[Index of the sub-widget currently being displayed. Fractional values indicate a position in-between sub-widgets.
For instance, when transitioning from sub-widget 2 to sub-widget 3, this event should be emitted with monotonically
increasing values ranging from 2.0 to 3.0.
Animations can perform any movement they want, but the reported $pos_update must move in the same direction.]]
}

View File

@ -4,27 +4,27 @@
#include <Efl_Ui.h>
#include "elm_priv.h"
#include "efl_ui_active_view_view_manager_plain.eo.h"
#include "efl_ui_spotlight_manager_plain.eo.h"
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Eina_Size2D page_size;
int current_content;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Plain_Data;
} Efl_Ui_Spotlight_Manager_Plain_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_PLAIN_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_PLAIN_CLASS
static void
_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_emit_position(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
double absolut_position = pd->current_content;
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &absolut_position);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
}
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
Efl_Gfx_Entity *entity = efl_pack_content_get(pd->container, pd->current_content);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
@ -54,23 +54,23 @@ EFL_CALLBACKS_ARRAY_DEFINE(group_callback,
)
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Ui_Active_View_Container *active_view, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
int index;
pd->container = active_view;
pd->container = spotlight;
pd->group = group;
efl_event_callback_array_add(pd->group, group_callback(), obj);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
index = efl_ui_active_view_active_index_get(active_view);
index = efl_ui_spotlight_active_index_get(spotlight);
if (index != -1)
{
pd->current_content = index;
@ -82,12 +82,12 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_bind(Eo *
}
static void
_content_changed(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_content_changed(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
if (efl_ui_active_view_active_index_get(pd->container) != pd->current_content)
if (efl_ui_spotlight_active_index_get(pd->container) != pd->current_content)
{
int old_current_content = pd->current_content;
pd->current_content = efl_ui_active_view_active_index_get(pd->container);
pd->current_content = efl_ui_spotlight_active_index_get(pd->container);
efl_gfx_entity_visible_set(efl_pack_content_get(pd->container, old_current_content), EINA_FALSE);
efl_gfx_entity_visible_set(efl_pack_content_get(pd->container, pd->current_content), EINA_TRUE);
_geom_sync(obj, pd);
@ -96,7 +96,7 @@ _content_changed(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_add(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_add(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_add(pd->group, subobj);
efl_gfx_entity_visible_set(subobj, EINA_FALSE);
@ -104,13 +104,13 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_a
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_content_del(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_content_del(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_remove(pd->group, subobj);
_content_changed(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, int from EINA_UNUSED, int to)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, int from EINA_UNUSED, int to)
{
Efl_Gfx_Entity *to_obj, *from_obj;
to_obj = efl_pack_content_get(pd->container, to);
@ -132,14 +132,14 @@ _efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_switch_to
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_view_size_set(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Plain_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Manager_Plain_Data *pd EINA_UNUSED)
{
efl_destructor(efl_super(obj, MY_CLASS));
@ -153,16 +153,16 @@ _efl_ui_active_view_view_manager_plain_efl_object_destructor(Eo *obj, Efl_Ui_Act
}
EOLIAN static void
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd, Eina_Bool animation)
{
pd->animation = animation;
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_plain_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Plain_Data *pd)
_efl_ui_spotlight_manager_plain_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Plain_Data *pd)
{
return pd->animation;
}
#include "efl_ui_active_view_view_manager_plain.eo.c"
#include "efl_ui_spotlight_manager_plain.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Plain extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -6,7 +6,7 @@
#include "elm_priv.h"
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group, *foreclip, *backclip;
Eina_Size2D page_size;
struct {
@ -22,20 +22,20 @@ typedef struct {
Eina_Position2D mouse_start;
} mouse_move;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Scroll_Data;
} Efl_Ui_Spotlight_Manager_Scroll_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS
static void _page_set_animation(void *data, const Efl_Event *event);
static void
_propagate_progress(Eo *obj, double pos)
{
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &pos);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &pos);
}
static void
_apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
_apply_box_properties(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
{
Eina_Rect geometry = EINA_RECT_EMPTY();
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
@ -44,7 +44,7 @@ _apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
if (pd->transition.active)
current_pos = pd->transition.from + ((double)pd->transition.to - pd->transition.from)*pd->transition.progress;
else
current_pos = efl_ui_active_view_active_index_get(pd->container);
current_pos = efl_ui_spotlight_active_index_get(pd->container);
efl_gfx_entity_geometry_set(pd->foreclip, group_pos);
//first calculate the size
@ -78,13 +78,13 @@ _apply_box_properties(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
static void
_resize_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
}
static void
_move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_SCROLL_CLASS));
_apply_box_properties(data, efl_data_scope_get(data, EFL_UI_SPOTLIGHT_MANAGER_SCROLL_CLASS));
}
static void
@ -93,7 +93,7 @@ _mouse_down_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
if (efl_input_pointer_button_get(ev) != 1) return;
if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
@ -103,7 +103,7 @@ _mouse_down_cb(void *data,
efl_event_callback_del(pd->container, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _page_set_animation, obj);
pd->mouse_move.active = EINA_TRUE;
pd->mouse_move.from = efl_ui_active_view_active_index_get(pd->container);
pd->mouse_move.from = efl_ui_spotlight_active_index_get(pd->container);
pd->mouse_move.mouse_start = efl_input_pointer_position_get(ev);
pd->transition.from = pd->mouse_move.from;
@ -117,7 +117,7 @@ _mouse_move_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Eina_Position2D pos;
int pos_y_diff;
@ -127,6 +127,10 @@ _mouse_move_cb(void *data,
pos = efl_input_pointer_position_get(ev);
pos_y_diff = pd->mouse_move.mouse_start.x - pos.x;
//Set input processed not to cause clicked event to content button.
if (!efl_input_processed_get(ev))
efl_input_processed_set(ev, EINA_TRUE);
pd->transition.active = EINA_TRUE;
pd->transition.progress = (double)pos_y_diff / (double)pd->page_size.w;
@ -141,7 +145,7 @@ _mouse_up_cb(void *data,
{
Efl_Input_Pointer *ev = event->info;
Eo *obj = data;
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(obj, MY_CLASS);
if (efl_input_event_flags_get(ev) & EFL_INPUT_FLAGS_PROCESSED) return;
if (!pd->mouse_move.active) return;
@ -149,7 +153,7 @@ _mouse_up_cb(void *data,
double absolut_current_position = (double)pd->transition.from + pd->transition.progress;
int result = round(absolut_current_position);
efl_ui_active_view_active_index_set(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
efl_ui_spotlight_active_index_set(pd->container, MIN(MAX(result, 0), efl_content_count(pd->container) - 1));
}
EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
@ -159,11 +163,11 @@ EFL_CALLBACKS_ARRAY_DEFINE(mouse_listeners,
);
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Ui_Active_View_Container *active_view, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
pd->container = active_view;
pd->container = spotlight;
pd->group = group;
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
@ -177,8 +181,8 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo
evas_object_static_clip_set(pd->backclip, EINA_TRUE);
efl_gfx_entity_visible_set(pd->backclip, EINA_FALSE);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_object_clipper_set(elem, pd->backclip);
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_TRUE);
@ -191,7 +195,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_bind(Eo
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_gfx_entity_visible_set(subobj, EINA_TRUE);
efl_canvas_object_clipper_set(subobj, pd->backclip);
@ -203,7 +207,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_object_clipper_set(subobj, NULL);
efl_canvas_group_member_remove(pd->group, subobj);
@ -215,7 +219,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_content_
static void
_page_set_animation(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Scroll_Data *pd = efl_data_scope_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Scroll_Data *pd = efl_data_scope_get(data, MY_CLASS);
double p = (ecore_loop_time_get() - pd->transition.start_time) / pd->transition.max_time;
if (p >= 1.0) p = 1.0;
@ -234,7 +238,7 @@ _page_set_animation(void *data, const Efl_Event *event EINA_UNUSED)
}
static void
_animation_request_switch(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, int from, int to)
_animation_request_switch(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to)
{
//if there is already a transition ongoing, which is no mouse transition, but goes to the same position, then do nothing
if (pd->transition.active && !pd->mouse_move.active && pd->transition.to == to)
@ -269,7 +273,7 @@ _animation_request_switch(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, int from, int to)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, int from, int to)
{
if (pd->animation)
{
@ -285,7 +289,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_switch_t
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_view_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_size_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
if (!pd->transition.active)
@ -293,7 +297,7 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_view_siz
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd, Eina_Bool animation)
{
pd->animation = animation;
if (pd->transition.active && !animation)
@ -305,14 +309,14 @@ _efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animatio
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_scroll_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd)
_efl_ui_spotlight_manager_scroll_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Scroll_Data *pd)
{
return pd->animation;
}
EOLIAN static void
_efl_ui_active_view_view_manager_scroll_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Scroll_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_scroll_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Manager_Scroll_Data *pd EINA_UNUSED)
{
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
@ -329,4 +333,4 @@ _efl_ui_active_view_view_manager_scroll_efl_object_destructor(Eo *obj, Efl_Ui_Ac
}
#include "efl_ui_active_view_view_manager_scroll.eo.c"
#include "efl_ui_spotlight_manager_scroll.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Scroll extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -7,19 +7,19 @@
typedef struct {
Efl_Ui_Active_View_Container * container;
Efl_Ui_Spotlight_Container * container;
Efl_Gfx_Entity *group;
Efl_Canvas_Animation_Player *hide, *show;
int from, to;
Efl_Gfx_Entity *content;
Eina_Size2D page_size;
Eina_Bool animation;
} Efl_Ui_Active_View_View_Manager_Stack_Data;
} Efl_Ui_Spotlight_Manager_Stack_Data;
#define MY_CLASS EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_STACK_CLASS
#define MY_CLASS EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS
static void
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd)
_geom_sync(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
{
Eina_Array *array = eina_array_new(2);
Eina_Rect group_pos = efl_gfx_entity_geometry_get(pd->group);
@ -61,11 +61,11 @@ _move_cb(void *data, const Efl_Event *ev EINA_UNUSED)
static void
_running_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
//calculate absolut position, multiply pos with 2.0 because duration is only 0.5)
double absolut_position = pd->from + (pd->to - pd->from)*(efl_player_pos_get(pd->show)*2.0);
efl_event_callback_call(data, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &absolut_position);
efl_event_callback_call(data, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &absolut_position);
}
static void
@ -80,7 +80,7 @@ _anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event)
static void
_hide_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Canvas_Object *content;
EINA_SAFETY_ON_NULL_RETURN(pd);
@ -91,7 +91,7 @@ _hide_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
static void
_show_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
Efl_Ui_Active_View_View_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Ui_Spotlight_Manager_Stack_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
Efl_Canvas_Object *content;
EINA_SAFETY_ON_NULL_RETURN(pd);
@ -112,12 +112,12 @@ EFL_CALLBACKS_ARRAY_DEFINE(_anim_hide_event_cb,
)
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Ui_Active_View_Container *active_view, Efl_Canvas_Group *group)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_bind(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
{
if (active_view && group)
if (spotlight && group)
{
Efl_Canvas_Animation_Alpha *show_anim, *hide_anim;
pd->container = active_view;
pd->container = spotlight;
pd->group = group;
efl_event_callback_add(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
@ -144,14 +144,14 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *
efl_player_play_set(pd->hide, EINA_FALSE);
efl_event_callback_array_add(pd->hide, _anim_hide_event_cb(), obj);
for (int i = 0; i < efl_content_count(active_view) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(active_view, i);
for (int i = 0; i < efl_content_count(spotlight) ; ++i) {
Efl_Gfx_Entity *elem = efl_pack_content_get(spotlight, i);
efl_canvas_group_member_add(pd->group, elem);
efl_gfx_entity_visible_set(elem, EINA_FALSE);
}
if (efl_ui_active_view_active_index_get(active_view) != -1)
if (efl_ui_spotlight_active_index_get(spotlight) != -1)
{
pd->content = efl_pack_content_get(pd->container, efl_ui_active_view_active_index_get(active_view));
pd->content = efl_pack_content_get(pd->container, efl_ui_spotlight_active_index_get(spotlight));
efl_gfx_entity_visible_set(pd->content, EINA_TRUE);
_geom_sync(obj, pd);
}
@ -159,14 +159,14 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_bind(Eo *
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_add(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_add(pd->group, subobj);
efl_gfx_entity_visible_set(subobj, EINA_FALSE);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_content_del(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
{
efl_canvas_group_member_remove(pd->group, subobj);
}
@ -189,7 +189,7 @@ is_valid(Eo *obj, int index)
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, int from, int to)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_switch_to(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, int from, int to)
{
if (efl_pack_content_get(pd->container, to) == pd->content)
return;
@ -217,21 +217,21 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_switch_to
pd->content = efl_pack_content_get(pd->container, to);
efl_gfx_entity_visible_set(pd->content, EINA_TRUE);
efl_event_callback_call(obj, EFL_UI_ACTIVE_VIEW_VIEW_MANAGER_EVENT_POS_UPDATE, &pos);
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &pos);
}
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_view_size_set(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Eina_Size2D size)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_size_set(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Size2D size)
{
pd->page_size = size;
_geom_sync(obj, pd);
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_object_destructor(Eo *obj, Efl_Ui_Active_View_View_Manager_Stack_Data *pd EINA_UNUSED)
_efl_ui_spotlight_manager_stack_efl_object_destructor(Eo *obj, Efl_Ui_Spotlight_Manager_Stack_Data *pd EINA_UNUSED)
{
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _resize_cb, obj);
efl_event_callback_del(pd->group, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _move_cb, obj);
@ -260,7 +260,7 @@ _reset_player(Efl_Animation_Player *player, Eina_Bool vis)
}
EOLIAN static void
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd, Eina_Bool animation)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd, Eina_Bool animation)
{
_reset_player(pd->hide, EINA_FALSE);
_reset_player(pd->show, EINA_TRUE);
@ -268,10 +268,10 @@ _efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation
}
EOLIAN static Eina_Bool
_efl_ui_active_view_view_manager_stack_efl_ui_active_view_view_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Active_View_View_Manager_Stack_Data *pd)
_efl_ui_spotlight_manager_stack_efl_ui_spotlight_manager_animation_enabled_get(const Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Manager_Stack_Data *pd)
{
return pd->animation;
}
#include "efl_ui_active_view_view_manager_stack.eo.c"
#include "efl_ui_spotlight_manager_stack.eo.c"

View File

@ -0,0 +1,12 @@
class @beta Efl.Ui.Spotlight.Manager_Stack extends Efl.Ui.Spotlight.Manager
{
implements {
Efl.Ui.Spotlight.Manager.bind;
Efl.Ui.Spotlight.Manager.content_add;
Efl.Ui.Spotlight.Manager.content_del;
Efl.Ui.Spotlight.Manager.switch_to;
Efl.Ui.Spotlight.Manager.size {set;}
Efl.Ui.Spotlight.Manager.animation_enabled {set; get;}
Efl.Object.destructor;
}
}

View File

@ -0,0 +1,21 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include "elm_priv.h"
typedef struct {
} Efl_Ui_Spotlight_Util_Data;
EOLIAN static Efl_Ui_Spotlight_Container*
_efl_ui_spotlight_util_stack_gen(Efl_Ui_Widget *parent)
{
Efl_Ui_Spotlight_Manager *manager = efl_add(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS, parent);
return efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, parent,
efl_ui_spotlight_manager_set(efl_added, manager));
}
#include "efl_ui_spotlight_util.eo.c"

View File

@ -1,11 +1,11 @@
class @beta Efl.Ui.Active_View.Util {
class @beta Efl.Ui.Spotlight.Util {
methods {
stack_gen @class {
[[Get a preconfigured stack obejct]]
params {
parent : Efl.Ui.Widget;
}
return : Efl.Ui.Active_View.Container;
return : Efl.Ui.Spotlight.Container;
}
}
}

View File

@ -1,11 +1,12 @@
enum @beta Efl.Ui.Tab_Page_Tab_Changed {
label = 0, [[Label changed]]
icon [[Icon changed]]
[[Which part of the tab has changed.]]
label = 0, [[Label has changed.]]
icon [[Icon has changed.]]
}
struct @beta Efl.Ui.Tab_Page_Tab_Changed_Event {
[[Information of changed event]]
changed_info: Efl.Ui.Tab_Page_Tab_Changed;
[[Information of changed event.]]
changed_info: Efl.Ui.Tab_Page_Tab_Changed; [[Which part of the tab has changed.]]
}
class @beta Efl.Ui.Tab_Page extends Efl.Ui.Layout_Base implements Efl.Content

View File

@ -25,8 +25,8 @@ static void
_tab_select_cb(void *data, const Efl_Event *event)
{
int index = efl_ui_tab_bar_current_tab_get(event->object);
if (efl_ui_active_view_active_index_get(data) != index)
efl_ui_active_view_active_index_set(data, index);
if (efl_ui_spotlight_active_index_get(data) != index)
efl_ui_spotlight_active_index_set(data, index);
}
static void
@ -77,9 +77,9 @@ _efl_ui_tab_pager_tab_bar_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Pager_Data *
}
EOLIAN static void
_efl_ui_tab_pager_efl_ui_active_view_container_active_index_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index)
_efl_ui_tab_pager_efl_ui_spotlight_container_active_index_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd EINA_UNUSED, int index)
{
efl_ui_active_view_active_index_set(efl_super(obj, MY_CLASS), index);
efl_ui_spotlight_active_index_set(efl_super(obj, MY_CLASS), index);
_select(obj, index);
}

View File

@ -1,4 +1,4 @@
class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Active_View.Container
class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Spotlight.Container
{
[[Tab Pager class]]
methods {
@ -23,6 +23,6 @@ class @beta Efl.Ui.Tab_Pager extends Efl.Ui.Active_View.Container
Efl.Pack_Linear.pack_content_get;
Efl.Pack_Linear.pack_index_get;
Efl.Pack_Linear.pack_unpack_at; // TODO
Efl.Ui.Active_View.Container.active_index { set; }
Efl.Ui.Spotlight.Container.active_index { set; }
}
}

View File

@ -2,6 +2,8 @@
# include "elementary_config.h"
#endif
#define EFL_UI_FORMAT_PROTECTED
#include <Elementary.h>
#include "elm_priv.h"
#include "efl_ui_tags_private.h"
@ -75,7 +77,6 @@ _shrink_mode_set(Eo *obj,
EINA_LIST_FOREACH(sd->layouts, l, layout)
{
char buf[32];
Evas_Coord w_label_count = 0, h = 0;
elm_box_pack_end(sd->box, layout);
@ -92,19 +93,12 @@ _shrink_mode_set(Eo *obj,
if (count > 0)
{
if (sd->format_cb)
{
eina_strbuf_reset(sd->format_strbuf);
eina_value_set(&val, count);
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
edje_object_part_text_escaped_set(sd->end, "efl.text",
eina_strbuf_string_get(sd->format_strbuf));
}
else
{
snprintf(buf, sizeof(buf), "+ %d", count);
edje_object_part_text_escaped_set(sd->end, "efl.text", buf);
}
Eina_Strbuf *strbuf = eina_strbuf_new();
eina_value_set(&val, count);
efl_ui_format_formatted_value_get(obj, strbuf, val);
edje_object_part_text_escaped_set(sd->end, "efl.text",
eina_strbuf_string_get(strbuf));
eina_strbuf_free(strbuf);
edje_object_size_min_calc(sd->end, &w_label_count, NULL);
elm_coords_finger_size_adjust(1, &w_label_count, 1, NULL);
@ -112,23 +106,16 @@ _shrink_mode_set(Eo *obj,
if ((w < 0) || (w < w_label_count))
{
Eina_Strbuf *strbuf = eina_strbuf_new();
elm_box_unpack(sd->box, layout);
evas_object_hide(layout);
count++;
if (sd->format_cb)
{
eina_strbuf_reset(sd->format_strbuf);
eina_value_set(&val, count);
sd->format_cb(sd->format_cb_data, sd->format_strbuf, val);
edje_object_part_text_escaped_set(sd->end, "efl.text",
eina_strbuf_string_get(sd->format_strbuf));
}
else
{
snprintf(buf, sizeof(buf), "+ %d", count);
edje_object_part_text_escaped_set(sd->end, "efl.text", buf);
}
eina_value_set(&val, count);
efl_ui_format_formatted_value_get(obj, strbuf, val);
edje_object_part_text_escaped_set(sd->end, "efl.text",
eina_strbuf_string_get(strbuf));
eina_strbuf_free(strbuf);
edje_object_size_min_calc(sd->end, &w_label_count, &h);
elm_coords_finger_size_adjust(1, &w_label_count, 1, &h);
@ -1021,7 +1008,6 @@ _efl_ui_tags_efl_object_constructor(Eo *obj, Efl_Ui_Tags_Data *sd)
sd->last_it_select = EINA_TRUE;
sd->editable = EINA_TRUE;
sd->parent = obj;
sd->format_cb = NULL;
sd->it_array = eina_array_new(4);
_view_init(obj, sd);
@ -1054,9 +1040,6 @@ _efl_ui_tags_efl_object_destructor(Eo *obj, Efl_Ui_Tags_Data *sd)
evas_object_del(sd->end);
ecore_timer_del(sd->longpress_timer);
efl_ui_format_cb_set(obj, NULL, NULL, NULL);
eina_strbuf_free(sd->format_strbuf);
efl_destructor(efl_super(obj, MY_CLASS));
}
@ -1072,23 +1055,6 @@ _efl_ui_tags_efl_text_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tags_Data *sd)
return (sd->label_str ? sd->label_str : NULL);
}
EOLIAN static void
_efl_ui_tags_efl_ui_format_format_cb_set(Eo *obj EINA_UNUSED, Efl_Ui_Tags_Data *sd, void *func_data, Efl_Ui_Format_Func_Cb func, Eina_Free_Cb func_free_cb)
{
if ((sd->format_cb_data == func_data) && (sd->format_cb == func))
return;
if (sd->format_cb_data && sd->format_free_cb)
sd->format_free_cb(sd->format_cb_data);
sd->format_cb = func;
sd->format_cb_data = func_data;
sd->format_free_cb = func_free_cb;
if (!sd->format_strbuf) sd->format_strbuf = eina_strbuf_new();
_view_update(sd);
}
EOLIAN static Eina_Bool
_efl_ui_tags_expanded_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tags_Data *sd)
{
@ -1171,6 +1137,11 @@ _efl_ui_tags_items_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tags_Data *sd)
return sd->it_array;
}
EOLIAN static void
_efl_ui_tags_efl_ui_format_apply_formatted_value(Eo *obj EINA_UNUSED, Efl_Ui_Tags_Data *pd)
{
_view_update(pd);
}
#define EFL_UI_TAGS_EXTRA_OPS \
ELM_LAYOUT_SIZING_EVAL_OPS(efl_ui_tags), \

View File

@ -47,7 +47,7 @@ class @beta Efl.Ui.Tags extends Efl.Ui.Layout_Base implements Efl.Text, Efl.Ui.F
Efl.Object.destructor;
Efl.Ui.Widget.widget_input_event_handler;
Efl.Text.text { get; set; }
Efl.Ui.Format.format_cb { set; }
Efl.Ui.Format.apply_formatted_value;
}
events {
/* FIXME: Returning a basic type is not future-proof, better return a struct */

Some files were not shown because too many files have changed in this diff Show More