[elm] Introducing a new widget, along with its infrastructure -- prefs.

The prefs widgets aims to aid with the implementation of
preference/configuration windows/UI elements in Elementary-based
applications (think of Enlightenment configuration dialogs,
elementary_config, etc).

Prefs is a widget that populates its view with widgets
bound to data types (following the instructions of a ".epb" file that
describes a set of items) and handles the storage/restoration of such
data on a configuration file automatically.

There's also the prefs_data handle, which is the one dealing with
user saved data for a given epb defaults set.

The documentation on the new widget is rich (we have examples and even
an EPC reference) and there's a new test entry for it.

I'm blogging about it soon, with screeshots and more details.

Enjoy.

ps.: This is a team work by Murilo Belluzzo, Ricardo de Almeida and me.



SVN revision: 79909
devs/felipealmeida/promises
Gustavo Lima Chaves 10 years ago
parent 4029295408
commit 87648e9ace
  1. 2
      legacy/elementary/AUTHORS
  2. 2
      legacy/elementary/config/default/base.src
  3. 2
      legacy/elementary/config/mobile/base.src
  4. 2
      legacy/elementary/config/standard/base.src
  5. 4
      legacy/elementary/configure.ac
  6. 18
      legacy/elementary/data/objects/Makefile.am
  7. 150
      legacy/elementary/data/objects/test_prefs.edc
  8. 113
      legacy/elementary/data/objects/test_prefs.epc
  9. 15
      legacy/elementary/doc/Doxyfile.in
  10. 3
      legacy/elementary/doc/Makefile.am
  11. 417
      legacy/elementary/doc/examples.dox
  12. 44042
      legacy/elementary/doc/img/elm-widget-tree.eps
  13. BIN
      legacy/elementary/doc/img/elm-widget-tree.png
  14. BIN
      legacy/elementary/doc/img/prefs.eps
  15. BIN
      legacy/elementary/doc/img/prefs.png
  16. 637
      legacy/elementary/doc/img/prefs_inheritance_tree.eps
  17. BIN
      legacy/elementary/doc/img/prefs_inheritance_tree.png
  18. 10
      legacy/elementary/doc/index.doxy
  19. 13
      legacy/elementary/doc/widgets/Makefile.am
  20. 24
      legacy/elementary/doc/widgets/widget_preview_prefs.c
  21. 60
      legacy/elementary/doc/widgets/widget_preview_prefs.epc
  22. 27
      legacy/elementary/src/bin/Makefile.am
  23. 201
      legacy/elementary/src/bin/elm_prefs_cc.c
  24. 107
      legacy/elementary/src/bin/elm_prefs_cc.h
  25. 1212
      legacy/elementary/src/bin/elm_prefs_cc_handlers.c
  26. 35
      legacy/elementary/src/bin/elm_prefs_cc_mem.c
  27. 52
      legacy/elementary/src/bin/elm_prefs_cc_out.c
  28. 1426
      legacy/elementary/src/bin/elm_prefs_cc_parse.c
  29. 4
      legacy/elementary/src/bin/test.c
  30. 121
      legacy/elementary/src/bin/test_prefs.c
  31. 17
      legacy/elementary/src/examples/Makefile.am
  32. 93
      legacy/elementary/src/examples/prefs_data_example.c
  33. 113
      legacy/elementary/src/examples/prefs_example_01.c
  34. 84
      legacy/elementary/src/examples/prefs_example_01.epc
  35. 115
      legacy/elementary/src/examples/prefs_example_02.c
  36. 65
      legacy/elementary/src/examples/prefs_example_02.epc
  37. 120
      legacy/elementary/src/examples/prefs_example_03.c
  38. 150
      legacy/elementary/src/examples/prefs_example_03.edc
  39. 112
      legacy/elementary/src/examples/prefs_example_03.epc
  40. 3
      legacy/elementary/src/lib/Elementary.h.in
  41. 20
      legacy/elementary/src/lib/Makefile.am
  42. 2
      legacy/elementary/src/lib/elm_main.c
  43. 76
      legacy/elementary/src/lib/elm_module.c
  44. 2284
      legacy/elementary/src/lib/elm_prefs.c
  45. 1136
      legacy/elementary/src/lib/elm_prefs.h
  46. 1063
      legacy/elementary/src/lib/elm_prefs_data.c
  47. 300
      legacy/elementary/src/lib/elm_prefs_data.h
  48. 326
      legacy/elementary/src/lib/elm_prefs_edd.x
  49. 7
      legacy/elementary/src/lib/elm_priv.h
  50. 2
      legacy/elementary/src/lib/elm_widget.h
  51. 126
      legacy/elementary/src/lib/elm_widget_prefs.h
  52. 1
      legacy/elementary/src/modules/Makefile.am
  53. 78
      legacy/elementary/src/modules/prefs/Makefile.am
  54. 72
      legacy/elementary/src/modules/prefs/elm_button.c
  55. 100
      legacy/elementary/src/modules/prefs/elm_check.c
  56. 95
      legacy/elementary/src/modules/prefs/elm_datetime.c
  57. 280
      legacy/elementary/src/modules/prefs/elm_entry.c
  58. 99
      legacy/elementary/src/modules/prefs/elm_horizontal_box.c
  59. 118
      legacy/elementary/src/modules/prefs/elm_horizontal_frame.c
  60. 37
      legacy/elementary/src/modules/prefs/elm_label.c
  61. 15
      legacy/elementary/src/modules/prefs/elm_prefs_swallow.edc
  62. 59
      legacy/elementary/src/modules/prefs/elm_separator.c
  63. 125
      legacy/elementary/src/modules/prefs/elm_slider.c
  64. 124
      legacy/elementary/src/modules/prefs/elm_spinner.c
  65. 65
      legacy/elementary/src/modules/prefs/elm_swallow.c
  66. 99
      legacy/elementary/src/modules/prefs/elm_vertical_box.c
  67. 117
      legacy/elementary/src/modules/prefs/elm_vertical_frame.c
  68. 9
      legacy/elementary/src/modules/prefs/item_widgets.inc
  69. 4
      legacy/elementary/src/modules/prefs/page_widgets.inc
  70. 283
      legacy/elementary/src/modules/prefs/prefs_iface.c
  71. 127
      legacy/elementary/src/modules/prefs/private.h

@ -69,3 +69,5 @@ Jiyoun Park <jy0703.park@samsung.com>
KoziarekBeata <b.koziarek@samsung.com>
Daniel Zaoui <daniel.zaoui@samsung.com>
Yakov Goldberg <yakov.g@samsung.com>
Murilo Belluzzo <murilo.belluzzo@profusion.mobi>
Ricardo de Almeida Gonzaga <ricardo@profusion.mobi>

@ -31,7 +31,7 @@ group "Elm_Config" struct {
value "finger_size" int: 40;
value "fps" double: 60.0;
value "theme" string: "default";
value "modules" string: "access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;

@ -31,7 +31,7 @@ group "Elm_Config" struct {
value "finger_size" int: 40;
value "fps" double: 60.0;
value "theme" string: "default";
value "modules" string: "access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;

@ -31,7 +31,7 @@ group "Elm_Config" struct {
value "finger_size" int: 5;
value "fps" double: 60.0;
value "theme" string: "default-desktop";
value "modules" string: "access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "modules" string: "prefs>prefs_iface:access_output>access/api:datetime_input_ctxpopup>datetime/api";
value "tooltip_delay" double: 1.0;
value "cursor_engine_only" uchar: 1;
value "focus_highlight_enable" uchar: 0;

@ -705,11 +705,13 @@ AC_SUBST(requirement_elm)
EFL_WITH_BIN([eet], [eet-eet], [eet])
EFL_WITH_BIN([edje], [edje-cc], [edje_cc])
EFL_WITH_BIN([elementary], [elementary-codegen], [elementary_codegen])
EFL_WITH_BIN([elementary], [elm-prefs-cc], [elm_prefs_cc])
EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
EFL_ENABLE_BIN([elementary-test])
EFL_ENABLE_BIN([elementary-codegen])
EFL_ENABLE_BIN([elm-prefs-cc])
EFL_ENABLE_BIN([elementary-config])
m4_ifdef([AM_GNU_GETTEXT_VERSION], [
@ -767,6 +769,7 @@ src/lib/Makefile
src/lib/Elementary.h
src/bin/Makefile
src/modules/Makefile
src/modules/prefs/Makefile
src/modules/access_output/Makefile
src/modules/datetime_input_ctxpopup/Makefile
src/modules/test_entry/Makefile
@ -826,6 +829,7 @@ echo " edje_cc..................: ${edje_cc}"
echo
echo " Build elementary_test....: ${have_elementary_test}"
echo " Build elementary_codegen.: ${have_elementary_codegen}"
echo " Build elm_prefs_cc.......: ${have_elm_prefs_cc}"
echo " Examples.................: ${enable_build_examples}"
echo " Examples installed.......: ${enable_install_examples}"
echo " Build elementary_config..: ${have_elementary_config}"

@ -9,11 +9,15 @@ EDJE_FLAGS = $(EDJE_FLAGS_$(V)) -id $(top_srcdir)/data/objects -fd $(top_srcdir)
filesdir = $(datadir)/elementary/objects
files_DATA = test.edj test_external.edj multip.edj cursors.edj font_preview.edj postit_ent.edj multibuttonentry.edj
files_DATA = test.edj test_external.edj multip.edj cursors.edj font_preview.edj postit_ent.edj multibuttonentry.edj test_prefs.edj test_prefs.epb
ELM_PREFS_CC = @elm_prefs_cc@
EXTRA_DIST = \
test.edc \
test_external.edc \
test_prefs.edc \
test_prefs.epc \
multip.edc \
cursors.edc \
font_preview.edc \
@ -63,6 +67,16 @@ multibuttonentry.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/data/objects/multibuttonentry.edc \
$(top_builddir)/data/objects/multibuttonentry.edj
test_prefs.edj: Makefile test_prefs.edc
$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/data/objects/test_prefs.edc \
$(top_builddir)/data/objects/test_prefs.edj
test_prefs.epb: Makefile test_prefs.epc
$(ELM_PREFS_CC) $(ELM_PREFS_FLAGS) \
$(top_srcdir)/data/objects/test_prefs.epc \
$(top_builddir)/data/objects/test_prefs.epb
clean-local:
rm -f *.edj

@ -0,0 +1,150 @@
#define MSG_ID_VEL (1)
collections {
group {
name: "prefs_edje";
max: 450 450;
min: 50 50;
parts {
part {
name: "bg";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
min: 450 450;
max: 450 450;
color: 255 255 255 0;
align: 0.0 0.0;
}
}
part {
name: "square1";
type: RECT;
scale: 1;
description {
state: "default" 0.0;
min: 50 50;
max: 50 50;
color: 0 0 255 255;
align: 0.0 0.5;
}
description {
state: "invert" 0.0;
inherit: "default" 0.0;
color: 0 255 0 255;
align: 1 0.5;
}
}
part {
name: "square2";
type: RECT;
description {
state: "default" 0.0;
min: 50 50;
max: 50 50;
color: 0 255 0 255;
align: 0.5 0.0;
}
description {
state: "invert" 0.0;
inherit: "default" 0.0;
color: 0 0 255 255;
align: 0.5 1.0;
}
}
}
program {
name: "animation_start";
signal: "start";
source: "animation";
after: "animation,clear";
}
program {
name: "call_animation,state1";
script {
cancel_anim(anim_id);
set_int(anim_id, anim(get_float(global_speed), "animation_1", 0));
set_int(anim_n, 1);
}
}
program {
name: "call_animation,state2";
script {
cancel_anim(anim_id);
set_int(anim_id, anim(get_float(global_speed), "animation_2", 0));
set_int(anim_n, 2);
}
}
program {
name: "animation,stop";
signal: "stop";
source: "animation";
script {
cancel_anim(get_int(anim_id));
}
}
program {
name: "animation,clear";
script {
cancel_anim(get_int(anim_id));
if (get_int(anim_n) == 2)
set_float(anim_pos, (get_float(anim_pos) - 1) * ( -1));
}
after: "call_animation,state1";
}
script {
public global_speed;
public anim_id;
public anim_pos;
public anim_n;
public message(Msg_Type:type, id, ...) {
if ((type == MSG_FLOAT) && (id == MSG_ID_VEL))
set_float(global_speed, Float:getarg(2));
}
public animation_1(val, Float:pos) {
if (pos >= get_float(anim_pos) && get_int(anim_n) == 1)
{
set_tween_state(PART:"square1", pos, "default", 0.0,
"invert", 0.0);
set_tween_state(PART:"square2", pos, "default", 0.0,
"invert", 0.0);
set_float(anim_pos, pos);
}
if (pos >= 1)
{
run_program(PROGRAM:"call_animation,state2");
set_float(anim_pos, 0.0);
}
}
public animation_2(val, Float:pos) {
if (pos >= get_float(anim_pos) && get_int(anim_n) == 2)
{
set_tween_state(PART:"square1", pos, "invert", 0.0,
"default", 0.0);
set_tween_state(PART:"square2", pos, "invert", 0.0,
"default", 0.0);
set_float(anim_pos, pos);
}
if (pos >= 1)
{
run_program(PROGRAM:"call_animation,state1");
set_float(anim_pos, 0.0);
}
}
}
}
#undef MSG_ID_VEL

@ -0,0 +1,113 @@
collection
{
page
{
name: "main";
version: 1;
title: "Preferences Widget";
subtitle: "Prefs";
widget: "elm/vertical_frame";
items {
item {
name: "universe";
type: INT;
label: "Ultimate Answer of Life, the Universe and Everything";
editable: 1;
int {
default: 42;
min: 0;
max: 150;
}
}
item {
name: "label";
type: LABEL;
label: "Just a label...";
}
item {
name: "text";
type: TEXT;
editable: 1;
text {
placeholder: "This is a text field (:";
default: "default str.";
deny: "^[0-9]*$";
}
}
item {
name: "date";
type: DATE;
label: "First EFL Developer Day";
date {
default: 2012 11 05;
min: 1980 11 1;
max: 2200 12 2;
}
}
item {
name: "animation";
type: BOOL;
persistent: 1;
label: "Animation";
bool {
default: true;
}
}
item {
name: "animation_time";
type: FLOAT;
persistent: 1;
label: "Animation Time";
float {
default: 0.6;
min: 0.0;
max: 1.0;
}
}
item {
name: "sep";
type: SEPARATOR;
}
item {
name: "swal";
type: SWALLOW;
}
item {
name: "sep2";
type: SEPARATOR;
}
item {
name: "save";
type: SAVE;
label: "Save";
}
item {
name: "reset";
type: RESET;
label: "Reset";
}
item {
name: "action";
type: ACTION;
label: "Action!";
}
}
}
}

@ -1,7 +1,7 @@
PROJECT_NAME = Elementary
PROJECT_NUMBER =
OUTPUT_DIRECTORY = .
INPUT = @srcdir@/examples.dox @top_srcdir@/src/lib @srcdir@/index.doxy
INPUT = @srcdir@/examples.dox @top_srcdir@/src/lib @srcdir@/index.doxy @top_srcdir@/src/bin/elm_prefs_cc_handlers.c
IMAGE_PATH = @srcdir@/img
OUTPUT_LANGUAGE = English
GENERATE_HTML = YES
@ -49,7 +49,18 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
# Aliases used by epcref
ALIASES = block="<tr><td class=\"block\"><b>"
ALIASES += context="</b></td><td class=\"context\" colspan=2>\code"
ALIASES += description="\endcode</td></tr><tr><td>&nbsp;</td><td class=\"description\" colspan=2>"
ALIASES += endblock="</td></tr>"
ALIASES += property="<tr><td>&nbsp;</td><td><table class=\"edcref\" border=\"0\"><tr><td class=\"property\"><tt>"
ALIASES += parameters="</tt></td><td class=\"parameters\"><tt>"
ALIASES += effect="</tt></td></tr><tr><td>&nbsp;</td><td class=\"effect\">"
ALIASES += endproperty="</td></tr></table></td></tr>"
ALIASES += epcsection{2}="<tr class=\"section\"><td class=\"section\" colspan=\"2\">\anchor sec_\1 \ref sec_quickaccess \"\2\"</td></tr>"
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
OPTIMIZE_OUTPUT_FOR_C = YES

@ -69,6 +69,8 @@ WGT_PREVIEW = \
panes:preview-00.png:widget_preview_panes:200:100 \
photocam:preview-00.png:widget_preview_photocam:243:162 \
popup:preview-00.png:widget_preview_popup:480:400 \
prefs:preview-00.png:widget_preview_prefs:200:160 \
prefs:preview-00.png:widget_preview_prefs:280:250 \
progressbar:preview-00.png:widget_preview_progressbar:150:50 \
radio:preview-00.png:widget_preview_radio:60:20 \
scroller:preview-00.png:widget_preview_scroller:100:30 \
@ -137,6 +139,7 @@ WGT_TREE = \
player \
plug \
popup \
prefs \
progressbar \
radio \
route \

@ -112,6 +112,12 @@
* @ref efl_thread_5
*
* @ref efl_thread_6
*
* @ref prefs_example_01
*
* @ref prefs_example_02
*
* @ref prefs_example_03
*/
/**
@ -1784,7 +1790,7 @@
* taken from system @b locale. Note, besides, that the strings are different
* for different language settings.
*
* <b>Datetime format</b> can be programmatically set by using
* <b>Datetime format</b> can be programmatically set by using
* elm_datetime_format_set():
* @dontinclude datetime_example.c
* @skip DATE and TIME
@ -5130,7 +5136,7 @@
* @skip Format callback
* @until }
* @until }
*
*
* The last horizontal progress bar has a callback that gets called when its
* value is @b changed. This callback updates a label to provide an estimate
* when the operation finishes.
@ -5422,7 +5428,7 @@
* And now get to the "color,item,selected" callback that sets the color of the rectangle:
* @until }
*
* And now get to the "color,item,longpressed" callback that gets and displays
* And now get to the "color,item,longpressed" callback that gets and displays
* the color of the rectangle:
* @until }
*
@ -6177,6 +6183,369 @@
* @include efl_thread_6.c
*/
/**
* @page prefs_example_01 Prefs Example 01
*
* This example shows how to create a simple prefs widget with Elementary,
* where the items values are "reset" on each timer tick. We do that
* <b>programmatically</b>, to demonstrate that by touching a given prefs
* widgets prefs data values, the changes reflect instantly on the UI.
*
* We'll create items on the .EPC file and after handle it on the .C file.
*
* @section prefs-epc-01 Creating items on EPC file
* @dontinclude prefs_example_01.epc
*
* First we'll create prefs items on .EPC file that we'll use later on
* the .C file. Note that the code is similar to .EDC (edje) files.
*
* @skip collection
* @until subtitle: "Example 01";
*
* Here we define a page item. Pages are group of items grouped together,
* on a given prefs widget.
*
* @skipline widget: "elm/vertical_box";
*
* In this part, we create a @c INT type item, that by default will
* become a spinner widget in the UI, and default, min and max
* parameters are optional as well as in @c FLOAT type.
*
* @skip items {
* @until max: 150;
* @skipline }
* @skipline }
*
* Other @c INT type widget implementations may exist, as is exemplifyed
* on the item that follows.
*
* @skip item {
* @until min: 0;
* @skipline }
* @skipline }
*
* Now we create a LABEL type item and by default will become a read-only
* label in UI.
*
* @skip item {
* @until }
*
* Now we create a TEXT type item and by default will become a single-line
* text entry in UI. Note that we use a Regular Expression to deny only
* entries with numbers.
*
* @skip item {
* @until }
* @skipline }
*
* In this part we create a DATE type item, by default will become a datetime
* in UI, and default, min and max parameters are optional.
*
* @skip item {
* @until }
*
* Here we create a SEPARATOR type item, it has no value bound,
* serves only to divide and organize prefs items.
*
* @skip item {
* @until }
*
* In this part, we create a SAVE type item that will get all the values
* bounded to items and save it on CFG file. Next time you execute the
* application, all the values that you saved before will be loaded.
*
* @skip item {
* @until }
*
* Here we create a RESET type item that will return all the values bounded
* to items as default declared on .EPC file.
*
* @skip item {
* @until }
*
* Pages and items have default implementation widgets, but, with the tag
* 'widget', you can use different widgets for prefs items. To a list of
* default widgets supported by each type, by default, refer to the Elementary
* Prefs Collection reference sheet. One can also register, at run time,
* custom item widget handlers too.
*
* @section prefs-c-01 Handling items on C File
* @dontinclude prefs_example_01.c
*
* Now we're handling the .C file and first we'll create a prefs widget.
*
* @skip prefs = elm_prefs_add(win);
* @until evas_object_show(prefs);
*
* Here we add some specific callbacks, for example "item,changed" that will
* be called when any item that we created on EPC file changes.
*
* @skip evas_object_smart_callback_add
* @until _item_changed_cb, win);
*
* Here we set the prefs to save its values back (on the user data file)
* automatically on every UI element changes.
*
* @skipline elm_prefs_autosave_set(prefs, EINA_TRUE);
*
* In this part we create the prefs data handle and set the .EPB file
* (.EPC compiled). This .EPB file contains all the default values from the
* items that we created, this file will be loaded when the program starts or
* when clicked on a RESET type item. There is another file created when
* the values from prefs items are saved, the .CFG file, that contains all the
* non-standard saved values from the prefs items, this file will be loaded
* when program starts as well.
*
* @dontinclude prefs_example_01.c
* @skipline Elm_Prefs_Data *prefs_data;
*
* @skip prefs_data = elm_prefs_data_new
* @until elm_prefs_data_set(prefs, prefs_data);
*
* Here we just create a notify widget to appear when the values are reset.
*
* @skip label = elm_label_add(win);
* @until evas_object_show(notify);
*
* Now we add a timer to reset the items values on each 5.0 seconds and
* show the notify.
*
* @skipline evas_object_data_set(notify
* @skipline timer = ecore_timer_add(5.0,
*
* @dontinclude prefs_example_01.c
* @skip _elm_prefs_data_change(void *data)
* @until return ECORE_CALLBACK_RENEW;
* @skipline }
*
* Here we finish the example. The full source code can be found on
* @ref prefs_example_01_c and
* @ref prefs_example_01_epc
*
*/
/**
* @page prefs_example_02 Prefs Example 02
*
* This example shows how to create a simple prefs widget with Elementary,
* where some items properties are changed on each timer tick.
*
* We'll create items on the .EPC file and after handle it on the .C file.
*
* @section prefs-epc-02 Creating items on EPC file
* @dontinclude prefs_example_02.epc
*
* First we'll create prefs items on .EPC file that we'll use later on
* the .C file. Note that the code is similar to .EDC (edje) files.
*
* @skip collection
* @until widget: "elm/vertical_frame";
*
* In this part, we create a @c TEXTAREA item and, by default, it will
* become a multi-line text entry in the UI. Note that we use a
* regular expression to accept only characters and whitespaces in it.
*
* @skip items {
* @until }
* @skipline }
*
* Now we create a FLOAT type item, by default will become a spinner in UI,
* and default, min and max parameters are optional as well as in INT type.
*
* @skip item {
* @until }
* @skipline }
*
* Here we create a BOOL type item, by default will become a checkbox in UI.
*
* @skip item {
* @until }
* @skipline }
*
* Here we create two items, separator and save types, that we've already
* covered in
* @ref prefs_example_01
*
* @skip item {
* @until label: "Save";
* @skipline }
*
* In this part, we create a ACTION type item. when clicked, the
* action item will emit a signal to .C file and call a smart callback.
*
* @skip item {
* @until }
* @skipline }
* @skipline }
* @skipline }
*
* @section prefs-c-02 Handling items on C File
* @dontinclude prefs_example_02.c
*
* Now we're handling the .C file and first we'll create a prefs widget.
*
* @skip prefs = elm_prefs_add(win);
* @until evas_object_show(prefs);
*
* In this part we add the action smart callback, that will be called when
* the action item be clicked.
*
* @skipline evas_object_smart_callback_add
*
* Here we add a simple action item callback that sets a text to another item.
*
* @dontinclude prefs_example_02.c
* @skip _action_cb(void *data
* @until }
*
* Now we set the prefs to save its values back (on the user data file)
* automatically on every UI element changes.
*
* @skipline elm_prefs_autosave_set(prefs, EINA_TRUE);
*
* In this part we create the prefs data handle and set the .EPB file
* (.EPC compiled).
*
* @dontinclude prefs_example_02.c
* @skipline Elm_Prefs_Data *prefs_data;
*
* @skip prefs_data = elm_prefs_data_new
* @until elm_prefs_data_set(prefs, prefs_data);
*
* Here we just create a notify widget to appear when the items properties
* are changed.
*
* @skip label = elm_label_add(win);
* @until evas_object_show(notify);
*
* Now we add a timer to change text editable, spinners visibility and checkbox
* enable/disable properties on each 5.0 seconds and show the notify.
*
* @skip evas_object_data_set(notify
* @until _elm_prefs_items_change, notify);
*
* @dontinclude prefs_example_02.c
* @skip _elm_prefs_items_change(void *data)
* @until return ECORE_CALLBACK_RENEW;
* @skipline }
*
* Here we finish the example. The full source code can be found on
* @ref prefs_example_02_c and
* @ref prefs_example_02_epc
*
*/
/**
* @page prefs_example_03 Prefs Example 03
*
* This example shows how to create a prefs widget with Elementary, where some
* prefs item values are changed, some actions take place on an object
* different than the prefs widget (an Edge object). With this new object,
* we're also exemplifying the prefs SWALLOW item type, as the Edje object is
* put inside the prefs widget's viewport.
*
* It also shows how subpages can be created using the prefs PAGE item type.
*
* Explain step by step the .EDC file is out of scope, the source code
* can be found at
* @ref prefs_example_03_edc
*
* @section prefs-epc-03 Creating items on EPC file
* @dontinclude prefs_example_03.epc
*
* First we'll create prefs items on .EPC file that we'll use later on
* the .C file.
*
* @skip collection
* @until widget: "elm/vertical_frame";
*
* In the following part, we create an item of the PAGE type, that will create a
* subpage inside the main page. The source parameter is used to set which page
* will be used to fill the subpage, in this example, the page named
* "configpage" will be used.
*
* @skip items {
* @until type: SEPARATOR;
* @skipline }
*
* Now we create a SWALLOW type item, that, as the name suggests, will
* swallow an Evas_Object.
*
* @skip item {
* @until }
*
* Now we create the page that will be used to fill the item "config" of the
* main page. It has another two subpages and a SEPARATOR item arranged
* horizontally so we could achieve the desired layout.
*
* @skip page
* @until source: "buttonspage";
* @skipline }
* @skipline }
* @skipline }
*
* Then we create the pages used by the "configpage" page, whose items
* were covered in @ref prefs_example_01 and @ref prefs_example_02.
*
* @skip page
* @until label: "Reset";
* @skipline }
* @skipline }
* @skipline }
*
* @section prefs-c-03 Handling items on C File
* @dontinclude prefs_example_03.c
*
* Now we're handling the .C file and first we'll create a layout setting the
* edje file to after a prefs item swallows it.
*
* @skip layout = elm_layout_add(win);
* @until "prefs_edje");
*
* Here we create the prefs widget, add smart callbacks and create the prefs
* data handle.
*
* @skip prefs = elm_prefs_add(win);
* @until elm_prefs_data_set(prefs, prefs_data);
*
* Now we "swallow" the layout into the SWALLOW item of the prefs widget.
*
* @skipline elm_prefs_item_swallow(prefs,
*
* Page loaded and item changed callbacks will call update functions.
*
* @dontinclude prefs_example_03.c
* @skip _page_loaded_cb(void *data,
* @until _update_animation(obj, layout);
* @skipline }
*
* These update functions will be called in order to get the new value from
* the items and pass it as signal to edje handle it and affects on animation.
*
* @dontinclude prefs_example_03.c
* @skip _update(Evas_Object *prefs,
* @until }
*
* In this function we'll get the checkbox (bool) value and start or stop
* the animation on edje.
*
* @dontinclude prefs_example_03.c
* @skip _update_animation(Evas_Object *prefs,
* @until }
*
* In this function we'll get the slider (float item) value and send it as
* animation time to edje.
*
* @skip _update_animation_time(Evas_Object *prefs,
* @until }
*
* Here we finish the example. The full source code can be found on
* @ref prefs_example_03_c,
* @ref prefs_example_03_epc and
* @ref prefs_example_03_edc
*
*/
/**
* @page bg_example_01_c bg_example_01.c
* @include bg_example_01.c
@ -6385,3 +6754,45 @@
* @include efl_thread_6.c
* @example efl_thread_6.c
*/
/**
* @page prefs_example_01_c prefs_example_01.c
* @include prefs_example_01.c
* @example prefs_example_01.c
*/
/**
* @page prefs_example_01_epc prefs_example_01.epc
* @include prefs_example_01.epc
* @example prefs_example_01.epc
*/
/**
* @page prefs_example_02_c prefs_example_02.c
* @include prefs_example_02.c
* @example prefs_example_02.c
*/
/**
* @page prefs_example_02_epc prefs_example_02.epc
* @include prefs_example_02.epc
* @example prefs_example_02.epc
*/
/**
* @page prefs_example_03_c prefs_example_03.c
* @include prefs_example_03.c
* @example prefs_example_03.c
*/
/**
* @page prefs_example_03_epc prefs_example_03.epc
* @include prefs_example_03.epc
* @example prefs_example_03.epc
*/
/**
* @page prefs_example_03_edc prefs_example_03.edc
* @include prefs_example_03.edc
* @example prefs_example_03.edc
*/

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 372 KiB

After

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

@ -0,0 +1,637 @@
%!PS-Adobe-3.0 EPSF-3.0
%%Creator: (ImageMagick)
%%Title: (../doc/img/prefs_inheritance_tree.eps)
%%CreationDate: (2012-11-12T16:26:00-02:00)
%%BoundingBox: -0 -0 83 155
%%HiResBoundingBox: 0 0 83 155
%%DocumentData: Clean7Bit
%%LanguageLevel: 1
%%Pages: 1
%%EndComments
%%BeginDefaults
%%EndDefaults
%%BeginProlog
%
% Display a color image. The image is displayed in color on
% Postscript viewers or printers that support color, otherwise
% it is displayed as grayscale.
%
/DirectClassPacket
{
%
% Get a DirectClass packet.
%
% Parameters:
% red.
% green.
% blue.
% length: number of pixels minus one of this color (optional).
%
currentfile color_packet readhexstring pop pop
compression 0 eq
{
/number_pixels 3 def
}
{
currentfile byte readhexstring pop 0 get
/number_pixels exch 1 add 3 mul def
} ifelse
0 3 number_pixels 1 sub
{
pixels exch color_packet putinterval
} for
pixels 0 number_pixels getinterval
} bind def
/DirectClassImage
{
%
% Display a DirectClass image.
%
systemdict /colorimage known
{
columns rows 8
[
columns 0 0
rows neg 0 rows
]
{ DirectClassPacket } false 3 colorimage
}
{
%
% No colorimage operator; convert to grayscale.
%
columns rows 8
[
columns 0 0
rows neg 0 rows
]
{ GrayDirectClassPacket } image
} ifelse
} bind def
/GrayDirectClassPacket
{
%
% Get a DirectClass packet; convert to grayscale.
%
% Parameters:
% red
% green
% blue
% length: number of pixels minus one of this color (optional).
%
currentfile color_packet readhexstring pop pop
color_packet 0 get 0.299 mul
color_packet 1 get 0.587 mul add
color_packet 2 get 0.114 mul add
cvi
/gray_packet exch def
compression 0 eq
{
/number_pixels 1 def
}
{
currentfile byte readhexstring pop 0 get
/number_pixels exch 1 add def
} ifelse
0 1 number_pixels 1 sub
{
pixels exch gray_packet put
} for
pixels 0 number_pixels getinterval
} bind def
/GrayPseudoClassPacket
{
%
% Get a PseudoClass packet; convert to grayscale.
%
% Parameters:
% index: index into the colormap.
% length: number of pixels minus one of this color (optional).
%
currentfile byte readhexstring pop 0 get
/offset exch 3 mul def
/color_packet colormap offset 3 getinterval def
color_packet 0 get 0.299 mul
color_packet 1 get 0.587 mul add
color_packet 2 get 0.114 mul add
cvi
/gray_packet exch def
compression 0 eq
{
/number_pixels 1 def
}
{
currentfile byte readhexstring pop 0 get
/number_pixels exch 1 add def
} ifelse
0 1 number_pixels 1 sub
{
pixels exch gray_packet put
} for
pixels 0 number_pixels getinterval
} bind def
/PseudoClassPacket
{
%
% Get a PseudoClass packet.
%
% Parameters:
% index: index into the colormap.
% length: number of pixels minus one of this color (optional).
%
currentfile byte readhexstring pop 0 get
/offset exch 3 mul def
/color_packet colormap offset 3 getinterval def
compression 0 eq
{
/number_pixels 3 def
}
{
currentfile byte readhexstring pop 0 get
/number_pixels exch 1 add 3 mul def
} ifelse
0 3 number_pixels 1 sub
{
pixels exch color_packet putinterval
} for
pixels 0 number_pixels getinterval
} bind def
/PseudoClassImage
{
%
% Display a PseudoClass image.
%
% Parameters:
% class: 0-PseudoClass or 1-Grayscale.
%
currentfile buffer readline pop
token pop /class exch def pop
class 0 gt
{
currentfile buffer readline pop
token pop /depth exch def pop
/grays columns 8 add depth sub depth mul 8 idiv string def
columns rows depth
[
columns 0 0
rows neg 0 rows
]
{ currentfile grays readhexstring pop } image
}
{
%
% Parameters:
% colors: number of colors in the colormap.
% colormap: red, green, blue color packets.
%
currentfile buffer readline pop
token pop /colors exch def pop
/colors colors 3 mul def
/colormap colors string def
currentfile colormap readhexstring pop pop
systemdict /colorimage known
{
columns rows 8
[
columns 0 0
rows neg 0 rows
]
{ PseudoClassPacket } false 3 colorimage
}
{
%
% No colorimage operator; convert to grayscale.
%
columns rows 8
[
columns 0 0
rows neg 0 rows
]
{ GrayPseudoClassPacket } image
} ifelse
} ifelse
} bind def
/DisplayImage
{
%
% Display a DirectClass or PseudoClass image.
%
% Parameters:
% x & y translation.
% x & y scale.
% label pointsize.
% image label.
% image columns & rows.
% class: 0-DirectClass or 1-PseudoClass.
% compression: 0-none or 1-RunlengthEncoded.
% hex color packets.
%
gsave
/buffer 512 string def
/byte 1 string def
/color_packet 3 string def
/pixels 768 string def
currentfile buffer readline pop
token pop /x exch def
token pop /y exch def pop
x y translate
currentfile buffer readline pop
token pop /x exch def
token pop /y exch def pop
currentfile buffer readline pop
token pop /pointsize exch def pop
/Times-Roman findfont pointsize scalefont setfont
x y scale
currentfile buffer readline pop
token pop /columns exch def
token pop /rows exch def pop
currentfile buffer readline pop
token pop /class exch def pop
currentfile buffer readline pop
token pop /compression exch def pop
class 0 gt { PseudoClassImage } { DirectClassImage } ifelse
} bind def
%%EndProlog
%%Page: 1 1
%%PageBoundingBox: 0 0 83 155
userdict begin
DisplayImage
0 0
83 155
12
83 155
1
1
1
8
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFBA199999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999C0FFFFFFFFFFFFFFFFFFB0000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000007FFFFFFFFFFFFFFFFFFA900
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA900
FFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFA900FFFFF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FFFFFFFFFFFFFFFFFFFFFFFF6907F0FFF6165AFFFF
FB3DFEFFED0027FFFD435FFEFFDC0300FFFF9002ECFF950071FFFE5DD7FFFF4516F1FF00
27FFFFFFFFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFFF
FFFFD50095FFFF4D0AF1FFB198FFFFFE0027FF9F00D1FFFFFF2500FFFF4701F9FFE90038
FFC3000000000000B3FF0027FFFFFFFFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFA9
00FFFFFFFFFFFFFFFFFFFFFFFFFF412FFEDE4A0598FF54F4FFFFFF0027FF5300F5FFFFFF
2700FFFF8100AEFFD8007DFF8E2AFFFFFFFFFFFFFF0027FFFFFFFFFFFFFFFFFFFFFFFFA9
00FFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFFFFFFFFFAD00C968D45733D473FFFF
FFFF0027FF3200E6FFFFFF2700FFFFFE9B11745087FCFF8209F4FFFFFFFFFCFF0027FFFF
FFFFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFFFFFFFFF
FB1C495DFFBF003FDDFFFFFFFF0027FF56009FFFFFFF2700FFFFFB6FD9FFFFFFFFFFAC00
7DFFFFFFD590FF0023FFFFFFFFFFFFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFA900FFFF
FFFFFFFFFFFFFFFFFFFFFFFF8301D3FFFE274CFFFFFFFFF2001BFFCA0315BAF6BD0D00DC
FF81229CB7C5D8F9FFF9250062A47B45F1FF1909D0FFFFFFFFFFFFFFFFFFFFFFA900FFFF
FFFFFFFFFFFFFFA900FFFFFFFFFFFFFFFFFFFFFFFFFFFFEB71FFFFFF9EC7F