diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/examples | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
20 files changed, 5413 insertions, 0 deletions
diff --git a/libraries/evas/src/examples/Makefile.am b/libraries/evas/src/examples/Makefile.am new file mode 100644 index 0000000..f748c12 --- /dev/null +++ b/libraries/evas/src/examples/Makefile.am | |||
@@ -0,0 +1,149 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | ||
2 | |||
3 | pkglibdir = $(datadir)/$(PACKAGE)/examples | ||
4 | |||
5 | #put here all EDCs one needs to the tests | ||
6 | EDCS = aspect.edc | ||
7 | |||
8 | filesdir = $(datadir)/$(PACKAGE)/examples | ||
9 | files_DATA = | ||
10 | |||
11 | if BUILD_EXAMPLES | ||
12 | |||
13 | AM_CPPFLAGS = \ | ||
14 | -I. \ | ||
15 | -I$(top_srcdir)/src/lib \ | ||
16 | -I$(top_srcdir)/src/lib/include \ | ||
17 | -DPACKAGE_BIN_DIR=\"$(bindir)\" \ | ||
18 | -DPACKAGE_LIB_DIR=\"$(libdir)\" \ | ||
19 | -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ | ||
20 | -DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ | ||
21 | @EINA_CFLAGS@ \ | ||
22 | @FREETYPE_CFLAGS@ \ | ||
23 | @PIXMAN_CFLAGS@ \ | ||
24 | @FRIBIDI_CFLAGS@ \ | ||
25 | @EET_CFLAGS@ \ | ||
26 | @FONTCONFIG_CFLAGS@ \ | ||
27 | @pthread_cflags@ | ||
28 | |||
29 | AM_CFLAGS = @WIN32_CFLAGS@ | ||
30 | |||
31 | pkglib_PROGRAMS = | ||
32 | |||
33 | if BUILD_ENGINE_BUFFER | ||
34 | AM_CPPFLAGS += -I$(top_srcdir)/src/modules/engines/buffer | ||
35 | |||
36 | pkglib_PROGRAMS += evas_buffer_simple | ||
37 | evas_buffer_simple_SOURCES = evas-buffer-simple.c | ||
38 | evas_buffer_simple_LDADD = $(top_builddir)/src/lib/libevas.la | ||
39 | endif | ||
40 | |||
41 | pkglib_PROGRAMS += evas_init_shutdown | ||
42 | evas_init_shutdown_SOURCES = evas-init-shutdown.c | ||
43 | evas_init_shutdown_LDADD = $(top_builddir)/src/lib/libevas.la | ||
44 | |||
45 | #the ones using ecore_evas follow | ||
46 | AM_CPPFLAGS += @ECORE_EVAS_CFLAGS@ | ||
47 | |||
48 | pkglib_PROGRAMS += evas_images | ||
49 | evas_images_SOURCES = evas-images.c | ||
50 | evas_images_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
51 | |||
52 | pkglib_PROGRAMS += evas_events | ||
53 | evas_events_SOURCES = evas-events.c | ||
54 | evas_events_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
55 | |||
56 | pkglib_PROGRAMS += evas_object_manipulation | ||
57 | evas_object_manipulation_SOURCES = evas-object-manipulation.c | ||
58 | evas_object_manipulation_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
59 | |||
60 | pkglib_PROGRAMS += evas_hints | ||
61 | evas_hints_SOURCES = evas-hints.c | ||
62 | evas_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
63 | |||
64 | pkglib_PROGRAMS += evas_stacking | ||
65 | evas_stacking_SOURCES = evas-stacking.c | ||
66 | evas_stacking_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
67 | |||
68 | pkglib_PROGRAMS += evas_images2 | ||
69 | evas_images2_SOURCES = evas-images2.c | ||
70 | evas_images2_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
71 | |||
72 | pkglib_PROGRAMS += evas_text | ||
73 | evas_text_SOURCES = evas-text.c | ||
74 | evas_text_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
75 | |||
76 | pkglib_PROGRAMS += evas_smart_object | ||
77 | evas_smart_object_SOURCES = evas-smart-object.c | ||
78 | evas_smart_object_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
79 | |||
80 | pkglib_PROGRAMS += evas_box | ||
81 | evas_box_SOURCES = evas-box.c | ||
82 | evas_box_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EINA_LIBS@ | ||
83 | |||
84 | #the ones using ecore_evas and edje follow | ||
85 | AM_CPPFLAGS += @EDJE_CFLAGS@ | ||
86 | |||
87 | pkglib_PROGRAMS += evas_aspect_hints | ||
88 | evas_aspect_hints_DEPS = $(srcdir)/aspect.edc | ||
89 | evas_aspect_hints_SOURCES = evas-aspect-hints.c | ||
90 | evas_aspect_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EDJE_LIBS@ | ||
91 | |||
92 | pkglib_PROGRAMS += evas_map_utils | ||
93 | evas_map_utils_SOURCES = evas-map-utils.c | ||
94 | evas_map_utils_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
95 | |||
96 | aspect.edj: ${evas_aspect_hints_DEPS} | ||
97 | |||
98 | .edc.edj: | ||
99 | $(edje_cc) -v -id $(srcdir) $< $(builddir)/$(@F) | ||
100 | |||
101 | EDJS = $(EDCS:%.edc=%.edj) | ||
102 | |||
103 | files_DATA += $(EDJS) | ||
104 | |||
105 | endif # if BUILD_EXAMPLES | ||
106 | |||
107 | if INSTALL_EXAMPLES | ||
108 | |||
109 | #put here additional data when installing examples | ||
110 | files_DATA += $(srcdir)/enlightenment.png \ | ||
111 | $(srcdir)/red.png \ | ||
112 | $(srcdir)/im1.png \ | ||
113 | $(srcdir)/cube1.png | ||
114 | |||
115 | files_DATA += \ | ||
116 | $(EDCS) \ | ||
117 | $(srcdir)/evas-buffer-simple.c \ | ||
118 | $(srcdir)/evas-init-shutdown.c \ | ||
119 | $(srcdir)/evas-images.c \ | ||
120 | $(srcdir)/evas-images2.c \ | ||
121 | $(srcdir)/evas-object-manipulation.c \ | ||
122 | $(srcdir)/evas-events.c \ | ||
123 | $(srcdir)/evas-aspect-hints.c \ | ||
124 | $(srcdir)/evas-hints.c \ | ||
125 | $(srcdir)/evas-stacking.c \ | ||
126 | $(srcdir)/evas-map-utils.c \ | ||
127 | $(srcdir)/evas-text.c \ | ||
128 | $(srcdir)/evas-smart-object.c \ | ||
129 | $(srcdir)/evas-box.c | ||
130 | endif | ||
131 | |||
132 | EXTRA_DIST = $(EDCS) \ | ||
133 | $(srcdir)/evas-buffer-simple.c \ | ||
134 | $(srcdir)/evas-init-shutdown.c \ | ||
135 | $(srcdir)/evas-images.c \ | ||
136 | $(srcdir)/evas-images2.c \ | ||
137 | $(srcdir)/evas-object-manipulation.c \ | ||
138 | $(srcdir)/evas-events.c \ | ||
139 | $(srcdir)/evas-aspect-hints.c \ | ||
140 | $(srcdir)/evas-hints.c \ | ||
141 | $(srcdir)/evas-stacking.c \ | ||
142 | $(srcdir)/evas-map-utils.c \ | ||
143 | $(srcdir)/evas-text.c \ | ||
144 | $(srcdir)/evas-smart-object.c \ | ||
145 | $(srcdir)/evas-box.c \ | ||
146 | $(srcdir)/enlightenment.png \ | ||
147 | $(srcdir)/red.png \ | ||
148 | $(srcdir)/im1.png \ | ||
149 | $(srcdir)/cube1.png | ||
diff --git a/libraries/evas/src/examples/Makefile.in b/libraries/evas/src/examples/Makefile.in new file mode 100644 index 0000000..5332650 --- /dev/null +++ b/libraries/evas/src/examples/Makefile.in | |||
@@ -0,0 +1,983 @@ | |||
1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
2 | # @configure_input@ | ||
3 | |||
4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
6 | # Inc. | ||
7 | # This Makefile.in is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
14 | # PARTICULAR PURPOSE. | ||
15 | |||
16 | @SET_MAKE@ | ||
17 | |||
18 | |||
19 | VPATH = @srcdir@ | ||
20 | pkgdatadir = $(datadir)/@PACKAGE@ | ||
21 | pkgincludedir = $(includedir)/@PACKAGE@ | ||
22 | pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
24 | install_sh_DATA = $(install_sh) -c -m 644 | ||
25 | install_sh_PROGRAM = $(install_sh) -c | ||
26 | install_sh_SCRIPT = $(install_sh) -c | ||
27 | INSTALL_HEADER = $(INSTALL_DATA) | ||
28 | transform = $(program_transform_name) | ||
29 | NORMAL_INSTALL = : | ||
30 | PRE_INSTALL = : | ||
31 | POST_INSTALL = : | ||
32 | NORMAL_UNINSTALL = : | ||
33 | PRE_UNINSTALL = : | ||
34 | POST_UNINSTALL = : | ||
35 | build_triplet = @build@ | ||
36 | host_triplet = @host@ | ||
37 | @BUILD_EXAMPLES_TRUE@pkglib_PROGRAMS = $(am__EXEEXT_1) \ | ||
38 | @BUILD_EXAMPLES_TRUE@ evas_init_shutdown$(EXEEXT) \ | ||
39 | @BUILD_EXAMPLES_TRUE@ evas_images$(EXEEXT) evas_events$(EXEEXT) \ | ||
40 | @BUILD_EXAMPLES_TRUE@ evas_object_manipulation$(EXEEXT) \ | ||
41 | @BUILD_EXAMPLES_TRUE@ evas_hints$(EXEEXT) \ | ||
42 | @BUILD_EXAMPLES_TRUE@ evas_stacking$(EXEEXT) \ | ||
43 | @BUILD_EXAMPLES_TRUE@ evas_images2$(EXEEXT) evas_text$(EXEEXT) \ | ||
44 | @BUILD_EXAMPLES_TRUE@ evas_smart_object$(EXEEXT) \ | ||
45 | @BUILD_EXAMPLES_TRUE@ evas_box$(EXEEXT) \ | ||
46 | @BUILD_EXAMPLES_TRUE@ evas_aspect_hints$(EXEEXT) \ | ||
47 | @BUILD_EXAMPLES_TRUE@ evas_map_utils$(EXEEXT) | ||
48 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__append_1 = -I$(top_srcdir)/src/modules/engines/buffer | ||
49 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__append_2 = evas_buffer_simple | ||
50 | @BUILD_EXAMPLES_TRUE@am__append_3 = $(EDJS) | ||
51 | |||
52 | #put here additional data when installing examples | ||
53 | @INSTALL_EXAMPLES_TRUE@am__append_4 = $(srcdir)/enlightenment.png \ | ||
54 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/red.png $(srcdir)/im1.png \ | ||
55 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/cube1.png $(EDCS) \ | ||
56 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-buffer-simple.c \ | ||
57 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-init-shutdown.c \ | ||
58 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-images.c \ | ||
59 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-images2.c \ | ||
60 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-object-manipulation.c \ | ||
61 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-events.c \ | ||
62 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-aspect-hints.c \ | ||
63 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-hints.c \ | ||
64 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-stacking.c \ | ||
65 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-map-utils.c \ | ||
66 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-text.c \ | ||
67 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-smart-object.c \ | ||
68 | @INSTALL_EXAMPLES_TRUE@ $(srcdir)/evas-box.c | ||
69 | subdir = src/examples | ||
70 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in | ||
71 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
72 | am__aclocal_m4_deps = $(top_srcdir)/m4/efl_attribute.m4 \ | ||
73 | $(top_srcdir)/m4/efl_coverage.m4 \ | ||
74 | $(top_srcdir)/m4/efl_doxygen.m4 \ | ||
75 | $(top_srcdir)/m4/efl_fnmatch.m4 \ | ||
76 | $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ | ||
77 | $(top_srcdir)/m4/evas_check_engine.m4 \ | ||
78 | $(top_srcdir)/m4/evas_check_loader.m4 \ | ||
79 | $(top_srcdir)/m4/evas_converter.m4 \ | ||
80 | $(top_srcdir)/m4/evas_dither.m4 \ | ||
81 | $(top_srcdir)/m4/evas_scaler.m4 $(top_srcdir)/m4/libtool.m4 \ | ||
82 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ | ||
83 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
84 | $(top_srcdir)/configure.ac | ||
85 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
86 | $(ACLOCAL_M4) | ||
87 | mkinstalldirs = $(install_sh) -d | ||
88 | CONFIG_HEADER = $(top_builddir)/config.h | ||
89 | CONFIG_CLEAN_FILES = | ||
90 | CONFIG_CLEAN_VPATH_FILES = | ||
91 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am__EXEEXT_1 = evas_buffer_simple$(EXEEXT) | ||
92 | am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)" | ||
93 | PROGRAMS = $(pkglib_PROGRAMS) | ||
94 | am__evas_aspect_hints_SOURCES_DIST = evas-aspect-hints.c | ||
95 | @BUILD_EXAMPLES_TRUE@am_evas_aspect_hints_OBJECTS = \ | ||
96 | @BUILD_EXAMPLES_TRUE@ evas-aspect-hints.$(OBJEXT) | ||
97 | evas_aspect_hints_OBJECTS = $(am_evas_aspect_hints_OBJECTS) | ||
98 | @BUILD_EXAMPLES_TRUE@evas_aspect_hints_DEPENDENCIES = \ | ||
99 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
100 | AM_V_lt = $(am__v_lt_$(V)) | ||
101 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | ||
102 | am__v_lt_0 = --silent | ||
103 | am__evas_box_SOURCES_DIST = evas-box.c | ||
104 | @BUILD_EXAMPLES_TRUE@am_evas_box_OBJECTS = evas-box.$(OBJEXT) | ||
105 | evas_box_OBJECTS = $(am_evas_box_OBJECTS) | ||
106 | @BUILD_EXAMPLES_TRUE@evas_box_DEPENDENCIES = \ | ||
107 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
108 | am__evas_buffer_simple_SOURCES_DIST = evas-buffer-simple.c | ||
109 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@am_evas_buffer_simple_OBJECTS = evas-buffer-simple.$(OBJEXT) | ||
110 | evas_buffer_simple_OBJECTS = $(am_evas_buffer_simple_OBJECTS) | ||
111 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_DEPENDENCIES = $(top_builddir)/src/lib/libevas.la | ||
112 | am__evas_events_SOURCES_DIST = evas-events.c | ||
113 | @BUILD_EXAMPLES_TRUE@am_evas_events_OBJECTS = evas-events.$(OBJEXT) | ||
114 | evas_events_OBJECTS = $(am_evas_events_OBJECTS) | ||
115 | @BUILD_EXAMPLES_TRUE@evas_events_DEPENDENCIES = \ | ||
116 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
117 | am__evas_hints_SOURCES_DIST = evas-hints.c | ||
118 | @BUILD_EXAMPLES_TRUE@am_evas_hints_OBJECTS = evas-hints.$(OBJEXT) | ||
119 | evas_hints_OBJECTS = $(am_evas_hints_OBJECTS) | ||
120 | @BUILD_EXAMPLES_TRUE@evas_hints_DEPENDENCIES = \ | ||
121 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
122 | am__evas_images_SOURCES_DIST = evas-images.c | ||
123 | @BUILD_EXAMPLES_TRUE@am_evas_images_OBJECTS = evas-images.$(OBJEXT) | ||
124 | evas_images_OBJECTS = $(am_evas_images_OBJECTS) | ||
125 | @BUILD_EXAMPLES_TRUE@evas_images_DEPENDENCIES = \ | ||
126 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
127 | am__evas_images2_SOURCES_DIST = evas-images2.c | ||
128 | @BUILD_EXAMPLES_TRUE@am_evas_images2_OBJECTS = evas-images2.$(OBJEXT) | ||
129 | evas_images2_OBJECTS = $(am_evas_images2_OBJECTS) | ||
130 | @BUILD_EXAMPLES_TRUE@evas_images2_DEPENDENCIES = \ | ||
131 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
132 | am__evas_init_shutdown_SOURCES_DIST = evas-init-shutdown.c | ||
133 | @BUILD_EXAMPLES_TRUE@am_evas_init_shutdown_OBJECTS = \ | ||
134 | @BUILD_EXAMPLES_TRUE@ evas-init-shutdown.$(OBJEXT) | ||
135 | evas_init_shutdown_OBJECTS = $(am_evas_init_shutdown_OBJECTS) | ||
136 | @BUILD_EXAMPLES_TRUE@evas_init_shutdown_DEPENDENCIES = \ | ||
137 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
138 | am__evas_map_utils_SOURCES_DIST = evas-map-utils.c | ||
139 | @BUILD_EXAMPLES_TRUE@am_evas_map_utils_OBJECTS = \ | ||
140 | @BUILD_EXAMPLES_TRUE@ evas-map-utils.$(OBJEXT) | ||
141 | evas_map_utils_OBJECTS = $(am_evas_map_utils_OBJECTS) | ||
142 | @BUILD_EXAMPLES_TRUE@evas_map_utils_DEPENDENCIES = \ | ||
143 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
144 | am__evas_object_manipulation_SOURCES_DIST = \ | ||
145 | evas-object-manipulation.c | ||
146 | @BUILD_EXAMPLES_TRUE@am_evas_object_manipulation_OBJECTS = \ | ||
147 | @BUILD_EXAMPLES_TRUE@ evas-object-manipulation.$(OBJEXT) | ||
148 | evas_object_manipulation_OBJECTS = \ | ||
149 | $(am_evas_object_manipulation_OBJECTS) | ||
150 | @BUILD_EXAMPLES_TRUE@evas_object_manipulation_DEPENDENCIES = \ | ||
151 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
152 | am__evas_smart_object_SOURCES_DIST = evas-smart-object.c | ||
153 | @BUILD_EXAMPLES_TRUE@am_evas_smart_object_OBJECTS = \ | ||
154 | @BUILD_EXAMPLES_TRUE@ evas-smart-object.$(OBJEXT) | ||
155 | evas_smart_object_OBJECTS = $(am_evas_smart_object_OBJECTS) | ||
156 | @BUILD_EXAMPLES_TRUE@evas_smart_object_DEPENDENCIES = \ | ||
157 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
158 | am__evas_stacking_SOURCES_DIST = evas-stacking.c | ||
159 | @BUILD_EXAMPLES_TRUE@am_evas_stacking_OBJECTS = \ | ||
160 | @BUILD_EXAMPLES_TRUE@ evas-stacking.$(OBJEXT) | ||
161 | evas_stacking_OBJECTS = $(am_evas_stacking_OBJECTS) | ||
162 | @BUILD_EXAMPLES_TRUE@evas_stacking_DEPENDENCIES = \ | ||
163 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
164 | am__evas_text_SOURCES_DIST = evas-text.c | ||
165 | @BUILD_EXAMPLES_TRUE@am_evas_text_OBJECTS = evas-text.$(OBJEXT) | ||
166 | evas_text_OBJECTS = $(am_evas_text_OBJECTS) | ||
167 | @BUILD_EXAMPLES_TRUE@evas_text_DEPENDENCIES = \ | ||
168 | @BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/libevas.la | ||
169 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) | ||
170 | depcomp = $(SHELL) $(top_srcdir)/depcomp | ||
171 | am__depfiles_maybe = depfiles | ||
172 | am__mv = mv -f | ||
173 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ | ||
174 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) | ||
175 | LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
176 | $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ | ||
177 | $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ | ||
178 | $(AM_CFLAGS) $(CFLAGS) | ||
179 | AM_V_CC = $(am__v_CC_$(V)) | ||
180 | am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) | ||
181 | am__v_CC_0 = @echo " CC " $@; | ||
182 | AM_V_at = $(am__v_at_$(V)) | ||
183 | am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) | ||
184 | am__v_at_0 = @ | ||
185 | CCLD = $(CC) | ||
186 | LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ | ||
187 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ | ||
188 | $(AM_LDFLAGS) $(LDFLAGS) -o $@ | ||
189 | AM_V_CCLD = $(am__v_CCLD_$(V)) | ||
190 | am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) | ||
191 | am__v_CCLD_0 = @echo " CCLD " $@; | ||
192 | AM_V_GEN = $(am__v_GEN_$(V)) | ||
193 | am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) | ||
194 | am__v_GEN_0 = @echo " GEN " $@; | ||
195 | SOURCES = $(evas_aspect_hints_SOURCES) $(evas_box_SOURCES) \ | ||
196 | $(evas_buffer_simple_SOURCES) $(evas_events_SOURCES) \ | ||
197 | $(evas_hints_SOURCES) $(evas_images_SOURCES) \ | ||
198 | $(evas_images2_SOURCES) $(evas_init_shutdown_SOURCES) \ | ||
199 | $(evas_map_utils_SOURCES) $(evas_object_manipulation_SOURCES) \ | ||
200 | $(evas_smart_object_SOURCES) $(evas_stacking_SOURCES) \ | ||
201 | $(evas_text_SOURCES) | ||
202 | DIST_SOURCES = $(am__evas_aspect_hints_SOURCES_DIST) \ | ||
203 | $(am__evas_box_SOURCES_DIST) \ | ||
204 | $(am__evas_buffer_simple_SOURCES_DIST) \ | ||
205 | $(am__evas_events_SOURCES_DIST) $(am__evas_hints_SOURCES_DIST) \ | ||
206 | $(am__evas_images_SOURCES_DIST) \ | ||
207 | $(am__evas_images2_SOURCES_DIST) \ | ||
208 | $(am__evas_init_shutdown_SOURCES_DIST) \ | ||
209 | $(am__evas_map_utils_SOURCES_DIST) \ | ||
210 | $(am__evas_object_manipulation_SOURCES_DIST) \ | ||
211 | $(am__evas_smart_object_SOURCES_DIST) \ | ||
212 | $(am__evas_stacking_SOURCES_DIST) \ | ||
213 | $(am__evas_text_SOURCES_DIST) | ||
214 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; | ||
215 | am__vpath_adj = case $$p in \ | ||
216 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ | ||
217 | *) f=$$p;; \ | ||
218 | esac; | ||
219 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; | ||
220 | am__install_max = 40 | ||
221 | am__nobase_strip_setup = \ | ||
222 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` | ||
223 | am__nobase_strip = \ | ||
224 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" | ||
225 | am__nobase_list = $(am__nobase_strip_setup); \ | ||
226 | for p in $$list; do echo "$$p $$p"; done | \ | ||
227 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ | ||
228 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ | ||
229 | if (++n[$$2] == $(am__install_max)) \ | ||
230 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ | ||
231 | END { for (dir in files) print dir, files[dir] }' | ||
232 | am__base_list = \ | ||
233 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ | ||
234 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | ||
235 | DATA = $(files_DATA) | ||
236 | ETAGS = etags | ||
237 | CTAGS = ctags | ||
238 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
239 | pkglibdir = $(datadir)/$(PACKAGE)/examples | ||
240 | ACLOCAL = @ACLOCAL@ | ||
241 | ALLOCA = @ALLOCA@ | ||
242 | AMTAR = @AMTAR@ | ||
243 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | ||
244 | AR = @AR@ | ||
245 | AS = @AS@ | ||
246 | AUTOCONF = @AUTOCONF@ | ||
247 | AUTOHEADER = @AUTOHEADER@ | ||
248 | AUTOMAKE = @AUTOMAKE@ | ||
249 | AWK = @AWK@ | ||
250 | CC = @CC@ | ||
251 | CCDEPMODE = @CCDEPMODE@ | ||
252 | CFLAGS = @CFLAGS@ | ||
253 | CHECK_CFLAGS = @CHECK_CFLAGS@ | ||
254 | CHECK_LIBS = @CHECK_LIBS@ | ||
255 | CPP = @CPP@ | ||
256 | CPPFLAGS = @CPPFLAGS@ | ||
257 | CXX = @CXX@ | ||
258 | CXXCPP = @CXXCPP@ | ||
259 | CXXDEPMODE = @CXXDEPMODE@ | ||
260 | CXXFLAGS = @CXXFLAGS@ | ||
261 | CYGPATH_W = @CYGPATH_W@ | ||
262 | DEFS = @DEFS@ | ||
263 | DEPDIR = @DEPDIR@ | ||
264 | DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ | ||
265 | DIRECTFB_LIBS = @DIRECTFB_LIBS@ | ||
266 | DLLTOOL = @DLLTOOL@ | ||
267 | DSYMUTIL = @DSYMUTIL@ | ||
268 | DUMPBIN = @DUMPBIN@ | ||
269 | ECHO_C = @ECHO_C@ | ||
270 | ECHO_N = @ECHO_N@ | ||
271 | ECHO_T = @ECHO_T@ | ||
272 | ECORE_EVAS_CFLAGS = @ECORE_EVAS_CFLAGS@ | ||
273 | ECORE_EVAS_LIBS = @ECORE_EVAS_LIBS@ | ||
274 | EDB_CFLAGS = @EDB_CFLAGS@ | ||
275 | EDB_LIBS = @EDB_LIBS@ | ||
276 | EDJE_CFLAGS = @EDJE_CFLAGS@ | ||
277 | EDJE_LIBS = @EDJE_LIBS@ | ||
278 | EET_CFLAGS = @EET_CFLAGS@ | ||
279 | EET_LIBS = @EET_LIBS@ | ||
280 | EFL_COVERAGE_CFLAGS = @EFL_COVERAGE_CFLAGS@ | ||
281 | EFL_COVERAGE_LIBS = @EFL_COVERAGE_LIBS@ | ||
282 | EFL_FNMATCH_LIBS = @EFL_FNMATCH_LIBS@ | ||
283 | EGREP = @EGREP@ | ||
284 | EINA_CFLAGS = @EINA_CFLAGS@ | ||
285 | EINA_LIBS = @EINA_LIBS@ | ||
286 | EVAS_CFLAGS = @EVAS_CFLAGS@ | ||
287 | EVAS_LIBS = @EVAS_LIBS@ | ||
288 | EVAS_SSE3_CFLAGS = @EVAS_SSE3_CFLAGS@ | ||
289 | EVIL_CFLAGS = @EVIL_CFLAGS@ | ||
290 | EVIL_LIBS = @EVIL_LIBS@ | ||
291 | EXEEXT = @EXEEXT@ | ||
292 | FGREP = @FGREP@ | ||
293 | FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ | ||
294 | FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ | ||
295 | FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ | ||
296 | FREETYPE_LIBS = @FREETYPE_LIBS@ | ||
297 | FRIBIDI_CFLAGS = @FRIBIDI_CFLAGS@ | ||
298 | FRIBIDI_LIBS = @FRIBIDI_LIBS@ | ||
299 | GL_EET_CFLAGS = @GL_EET_CFLAGS@ | ||
300 | GL_EET_LIBS = @GL_EET_LIBS@ | ||
301 | GREP = @GREP@ | ||
302 | HARFBUZZ_CFLAGS = @HARFBUZZ_CFLAGS@ | ||
303 | HARFBUZZ_LIBS = @HARFBUZZ_LIBS@ | ||
304 | INSTALL = @INSTALL@ | ||
305 | INSTALL_DATA = @INSTALL_DATA@ | ||
306 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
307 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
308 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
309 | LD = @LD@ | ||
310 | LDFLAGS = @LDFLAGS@ | ||
311 | LIBOBJS = @LIBOBJS@ | ||
312 | LIBS = @LIBS@ | ||
313 | LIBTOOL = @LIBTOOL@ | ||
314 | LINEBREAK_CFLAGS = @LINEBREAK_CFLAGS@ | ||
315 | LINEBREAK_LIBS = @LINEBREAK_LIBS@ | ||
316 | LIPO = @LIPO@ | ||
317 | LN_S = @LN_S@ | ||
318 | LTLIBOBJS = @LTLIBOBJS@ | ||
319 | MAKEINFO = @MAKEINFO@ | ||
320 | MKDIR_P = @MKDIR_P@ | ||
321 | MODULE_ARCH = @MODULE_ARCH@ | ||
322 | NM = @NM@ | ||
323 | NMEDIT = @NMEDIT@ | ||
324 | OBJC = @OBJC@ | ||
325 | OBJCDEPMODE = @OBJCDEPMODE@ | ||
326 | OBJCFLAGS = @OBJCFLAGS@ | ||
327 | OBJDUMP = @OBJDUMP@ | ||
328 | OBJEXT = @OBJEXT@ | ||
329 | OTOOL = @OTOOL@ | ||
330 | OTOOL64 = @OTOOL64@ | ||
331 | PACKAGE = @PACKAGE@ | ||
332 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
333 | PACKAGE_NAME = @PACKAGE_NAME@ | ||
334 | PACKAGE_STRING = @PACKAGE_STRING@ | ||
335 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
336 | PACKAGE_URL = @PACKAGE_URL@ | ||
337 | PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
338 | PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
339 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | ||
340 | PIXMAN_LIBS = @PIXMAN_LIBS@ | ||
341 | PKG_CONFIG = @PKG_CONFIG@ | ||
342 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
343 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
344 | PNG_CFLAGS = @PNG_CFLAGS@ | ||
345 | PNG_LIBS = @PNG_LIBS@ | ||
346 | RANLIB = @RANLIB@ | ||
347 | SDL_CFLAGS = @SDL_CFLAGS@ | ||
348 | SDL_LIBS = @SDL_LIBS@ | ||
349 | SED = @SED@ | ||
350 | SET_MAKE = @SET_MAKE@ | ||
351 | SHELL = @SHELL@ | ||
352 | SHM_OPEN_LINK = @SHM_OPEN_LINK@ | ||
353 | STRIP = @STRIP@ | ||
354 | SVG_CFLAGS = @SVG_CFLAGS@ | ||
355 | SVG_LIBS = @SVG_LIBS@ | ||
356 | VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ | ||
357 | VALGRIND_LIBS = @VALGRIND_LIBS@ | ||
358 | VERSION = @VERSION@ | ||
359 | VMAJ = @VMAJ@ | ||
360 | WIN32_CFLAGS = @WIN32_CFLAGS@ | ||
361 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | ||
362 | XCB_CFLAGS = @XCB_CFLAGS@ | ||
363 | XCB_GL_CFLAGS = @XCB_GL_CFLAGS@ | ||
364 | XCB_GL_LIBS = @XCB_GL_LIBS@ | ||
365 | XCB_LIBS = @XCB_LIBS@ | ||
366 | XEXT_CFLAGS = @XEXT_CFLAGS@ | ||
367 | XEXT_LIBS = @XEXT_LIBS@ | ||
368 | XMKMF = @XMKMF@ | ||
369 | X_CFLAGS = @X_CFLAGS@ | ||
370 | X_EXTRA_LIBS = @X_EXTRA_LIBS@ | ||
371 | X_LIBS = @X_LIBS@ | ||
372 | X_PRE_LIBS = @X_PRE_LIBS@ | ||
373 | abs_builddir = @abs_builddir@ | ||
374 | abs_srcdir = @abs_srcdir@ | ||
375 | abs_top_builddir = @abs_top_builddir@ | ||
376 | abs_top_srcdir = @abs_top_srcdir@ | ||
377 | ac_ct_CC = @ac_ct_CC@ | ||
378 | ac_ct_CXX = @ac_ct_CXX@ | ||
379 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
380 | ac_ct_OBJC = @ac_ct_OBJC@ | ||
381 | altivec_cflags = @altivec_cflags@ | ||
382 | am__include = @am__include@ | ||
383 | am__leading_dot = @am__leading_dot@ | ||
384 | am__quote = @am__quote@ | ||
385 | am__tar = @am__tar@ | ||
386 | am__untar = @am__untar@ | ||
387 | bindir = @bindir@ | ||
388 | build = @build@ | ||
389 | build_alias = @build_alias@ | ||
390 | build_cpu = @build_cpu@ | ||
391 | build_os = @build_os@ | ||
392 | build_vendor = @build_vendor@ | ||
393 | builddir = @builddir@ | ||
394 | datadir = @datadir@ | ||
395 | datarootdir = @datarootdir@ | ||
396 | dlopen_libs = @dlopen_libs@ | ||
397 | docdir = @docdir@ | ||
398 | dvidir = @dvidir@ | ||
399 | edje_cc = @edje_cc@ | ||
400 | efl_doxygen = @efl_doxygen@ | ||
401 | efl_have_doxygen = @efl_have_doxygen@ | ||
402 | evas_engine_buffer_cflags = @evas_engine_buffer_cflags@ | ||
403 | evas_engine_buffer_libs = @evas_engine_buffer_libs@ | ||
404 | evas_engine_direct3d_cflags = @evas_engine_direct3d_cflags@ | ||
405 | evas_engine_direct3d_libs = @evas_engine_direct3d_libs@ | ||
406 | evas_engine_directfb_cflags = @evas_engine_directfb_cflags@ | ||
407 | evas_engine_directfb_libs = @evas_engine_directfb_libs@ | ||
408 | evas_engine_fb_cflags = @evas_engine_fb_cflags@ | ||
409 | evas_engine_fb_libs = @evas_engine_fb_libs@ | ||
410 | evas_engine_gl_cocoa_cflags = @evas_engine_gl_cocoa_cflags@ | ||
411 | evas_engine_gl_cocoa_libs = @evas_engine_gl_cocoa_libs@ | ||
412 | evas_engine_gl_common_libs = @evas_engine_gl_common_libs@ | ||
413 | evas_engine_gl_sdl_cflags = @evas_engine_gl_sdl_cflags@ | ||
414 | evas_engine_gl_sdl_libs = @evas_engine_gl_sdl_libs@ | ||
415 | evas_engine_gl_xcb_cflags = @evas_engine_gl_xcb_cflags@ | ||
416 | evas_engine_gl_xcb_libs = @evas_engine_gl_xcb_libs@ | ||
417 | evas_engine_gl_xlib_cflags = @evas_engine_gl_xlib_cflags@ | ||
418 | evas_engine_gl_xlib_libs = @evas_engine_gl_xlib_libs@ | ||
419 | evas_engine_psl1ght_cflags = @evas_engine_psl1ght_cflags@ | ||
420 | evas_engine_psl1ght_libs = @evas_engine_psl1ght_libs@ | ||
421 | evas_engine_software_16_ddraw_cflags = @evas_engine_software_16_ddraw_cflags@ | ||
422 | evas_engine_software_16_ddraw_libs = @evas_engine_software_16_ddraw_libs@ | ||
423 | evas_engine_software_16_sdl_cflags = @evas_engine_software_16_sdl_cflags@ | ||
424 | evas_engine_software_16_sdl_libs = @evas_engine_software_16_sdl_libs@ | ||
425 | evas_engine_software_16_wince_cflags = @evas_engine_software_16_wince_cflags@ | ||
426 | evas_engine_software_16_wince_libs = @evas_engine_software_16_wince_libs@ | ||
427 | evas_engine_software_16_x11_cflags = @evas_engine_software_16_x11_cflags@ | ||
428 | evas_engine_software_16_x11_libs = @evas_engine_software_16_x11_libs@ | ||
429 | evas_engine_software_8_x11_cflags = @evas_engine_software_8_x11_cflags@ | ||
430 | evas_engine_software_8_x11_libs = @evas_engine_software_8_x11_libs@ | ||
431 | evas_engine_software_ddraw_cflags = @evas_engine_software_ddraw_cflags@ | ||
432 | evas_engine_software_ddraw_libs = @evas_engine_software_ddraw_libs@ | ||
433 | evas_engine_software_gdi_cflags = @evas_engine_software_gdi_cflags@ | ||
434 | evas_engine_software_gdi_libs = @evas_engine_software_gdi_libs@ | ||
435 | evas_engine_software_sdl_cflags = @evas_engine_software_sdl_cflags@ | ||
436 | evas_engine_software_sdl_libs = @evas_engine_software_sdl_libs@ | ||
437 | evas_engine_software_xcb_cflags = @evas_engine_software_xcb_cflags@ | ||
438 | evas_engine_software_xcb_libs = @evas_engine_software_xcb_libs@ | ||
439 | evas_engine_software_xlib_cflags = @evas_engine_software_xlib_cflags@ | ||
440 | evas_engine_software_xlib_libs = @evas_engine_software_xlib_libs@ | ||
441 | evas_image_loader_bmp_cflags = @evas_image_loader_bmp_cflags@ | ||
442 | evas_image_loader_bmp_libs = @evas_image_loader_bmp_libs@ | ||
443 | evas_image_loader_edb_cflags = @evas_image_loader_edb_cflags@ | ||
444 | evas_image_loader_edb_libs = @evas_image_loader_edb_libs@ | ||
445 | evas_image_loader_eet_cflags = @evas_image_loader_eet_cflags@ | ||
446 | evas_image_loader_eet_libs = @evas_image_loader_eet_libs@ | ||
447 | evas_image_loader_generic_cflags = @evas_image_loader_generic_cflags@ | ||
448 | evas_image_loader_generic_libs = @evas_image_loader_generic_libs@ | ||
449 | evas_image_loader_gif_cflags = @evas_image_loader_gif_cflags@ | ||
450 | evas_image_loader_gif_libs = @evas_image_loader_gif_libs@ | ||
451 | evas_image_loader_ico_cflags = @evas_image_loader_ico_cflags@ | ||
452 | evas_image_loader_ico_libs = @evas_image_loader_ico_libs@ | ||
453 | evas_image_loader_jpeg_cflags = @evas_image_loader_jpeg_cflags@ | ||
454 | evas_image_loader_jpeg_libs = @evas_image_loader_jpeg_libs@ | ||
455 | evas_image_loader_pmaps_cflags = @evas_image_loader_pmaps_cflags@ | ||
456 | evas_image_loader_pmaps_libs = @evas_image_loader_pmaps_libs@ | ||
457 | evas_image_loader_png_cflags = @evas_image_loader_png_cflags@ | ||
458 | evas_image_loader_png_libs = @evas_image_loader_png_libs@ | ||
459 | evas_image_loader_psd_cflags = @evas_image_loader_psd_cflags@ | ||
460 | evas_image_loader_psd_libs = @evas_image_loader_psd_libs@ | ||
461 | evas_image_loader_svg_cflags = @evas_image_loader_svg_cflags@ | ||
462 | evas_image_loader_svg_libs = @evas_image_loader_svg_libs@ | ||
463 | evas_image_loader_tga_cflags = @evas_image_loader_tga_cflags@ | ||
464 | evas_image_loader_tga_libs = @evas_image_loader_tga_libs@ | ||
465 | evas_image_loader_tiff_cflags = @evas_image_loader_tiff_cflags@ | ||
466 | evas_image_loader_tiff_libs = @evas_image_loader_tiff_libs@ | ||
467 | evas_image_loader_wbmp_cflags = @evas_image_loader_wbmp_cflags@ | ||
468 | evas_image_loader_wbmp_libs = @evas_image_loader_wbmp_libs@ | ||
469 | evas_image_loader_xpm_cflags = @evas_image_loader_xpm_cflags@ | ||
470 | evas_image_loader_xpm_libs = @evas_image_loader_xpm_libs@ | ||
471 | exec_prefix = @exec_prefix@ | ||
472 | have_evas_engine_gl_x11 = @have_evas_engine_gl_x11@ | ||
473 | have_evas_engine_gl_xcb = @have_evas_engine_gl_xcb@ | ||
474 | have_evas_engine_gl_xlib = @have_evas_engine_gl_xlib@ | ||
475 | have_evas_engine_software_x11 = @have_evas_engine_software_x11@ | ||
476 | have_evas_engine_software_xcb = @have_evas_engine_software_xcb@ | ||
477 | have_evas_engine_software_xlib = @have_evas_engine_software_xlib@ | ||
478 | have_lcov = @have_lcov@ | ||
479 | host = @host@ | ||
480 | host_alias = @host_alias@ | ||
481 | host_cpu = @host_cpu@ | ||
482 | host_os = @host_os@ | ||
483 | host_vendor = @host_vendor@ | ||
484 | htmldir = @htmldir@ | ||
485 | includedir = @includedir@ | ||
486 | infodir = @infodir@ | ||
487 | install_sh = @install_sh@ | ||
488 | libdir = @libdir@ | ||
489 | libexecdir = @libexecdir@ | ||
490 | localedir = @localedir@ | ||
491 | localstatedir = @localstatedir@ | ||
492 | lt_ECHO = @lt_ECHO@ | ||
493 | lt_enable_auto_import = @lt_enable_auto_import@ | ||
494 | mandir = @mandir@ | ||
495 | mkdir_p = @mkdir_p@ | ||
496 | oldincludedir = @oldincludedir@ | ||
497 | pdfdir = @pdfdir@ | ||
498 | pkgconfig_requires_private = @pkgconfig_requires_private@ | ||
499 | prefix = @prefix@ | ||
500 | program_transform_name = @program_transform_name@ | ||
501 | psdir = @psdir@ | ||
502 | pthread_cflags = @pthread_cflags@ | ||
503 | pthread_libs = @pthread_libs@ | ||
504 | release_info = @release_info@ | ||
505 | requirement_evas = @requirement_evas@ | ||
506 | sbindir = @sbindir@ | ||
507 | sharedstatedir = @sharedstatedir@ | ||
508 | srcdir = @srcdir@ | ||
509 | sysconfdir = @sysconfdir@ | ||
510 | target_alias = @target_alias@ | ||
511 | top_build_prefix = @top_build_prefix@ | ||
512 | top_builddir = @top_builddir@ | ||
513 | top_srcdir = @top_srcdir@ | ||
514 | version_info = @version_info@ | ||
515 | MAINTAINERCLEANFILES = Makefile.in | ||
516 | |||
517 | #put here all EDCs one needs to the tests | ||
518 | EDCS = aspect.edc | ||
519 | filesdir = $(datadir)/$(PACKAGE)/examples | ||
520 | files_DATA = $(am__append_3) $(am__append_4) | ||
521 | |||
522 | #the ones using ecore_evas follow | ||
523 | |||
524 | #the ones using ecore_evas and edje follow | ||
525 | @BUILD_EXAMPLES_TRUE@AM_CPPFLAGS = -I. -I$(top_srcdir)/src/lib \ | ||
526 | @BUILD_EXAMPLES_TRUE@ -I$(top_srcdir)/src/lib/include \ | ||
527 | @BUILD_EXAMPLES_TRUE@ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ | ||
528 | @BUILD_EXAMPLES_TRUE@ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ | ||
529 | @BUILD_EXAMPLES_TRUE@ -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ | ||
530 | @BUILD_EXAMPLES_TRUE@ -DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ | ||
531 | @BUILD_EXAMPLES_TRUE@ @EINA_CFLAGS@ @FREETYPE_CFLAGS@ \ | ||
532 | @BUILD_EXAMPLES_TRUE@ @PIXMAN_CFLAGS@ @FRIBIDI_CFLAGS@ \ | ||
533 | @BUILD_EXAMPLES_TRUE@ @EET_CFLAGS@ @FONTCONFIG_CFLAGS@ \ | ||
534 | @BUILD_EXAMPLES_TRUE@ @pthread_cflags@ $(am__append_1) \ | ||
535 | @BUILD_EXAMPLES_TRUE@ @ECORE_EVAS_CFLAGS@ @EDJE_CFLAGS@ \ | ||
536 | @BUILD_EXAMPLES_TRUE@ $(am__empty) | ||
537 | @BUILD_EXAMPLES_TRUE@AM_CFLAGS = @WIN32_CFLAGS@ | ||
538 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_SOURCES = evas-buffer-simple.c | ||
539 | @BUILD_ENGINE_BUFFER_TRUE@@BUILD_EXAMPLES_TRUE@evas_buffer_simple_LDADD = $(top_builddir)/src/lib/libevas.la | ||
540 | @BUILD_EXAMPLES_TRUE@evas_init_shutdown_SOURCES = evas-init-shutdown.c | ||
541 | @BUILD_EXAMPLES_TRUE@evas_init_shutdown_LDADD = $(top_builddir)/src/lib/libevas.la | ||
542 | @BUILD_EXAMPLES_TRUE@evas_images_SOURCES = evas-images.c | ||
543 | @BUILD_EXAMPLES_TRUE@evas_images_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
544 | @BUILD_EXAMPLES_TRUE@evas_events_SOURCES = evas-events.c | ||
545 | @BUILD_EXAMPLES_TRUE@evas_events_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
546 | @BUILD_EXAMPLES_TRUE@evas_object_manipulation_SOURCES = evas-object-manipulation.c | ||
547 | @BUILD_EXAMPLES_TRUE@evas_object_manipulation_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
548 | @BUILD_EXAMPLES_TRUE@evas_hints_SOURCES = evas-hints.c | ||
549 | @BUILD_EXAMPLES_TRUE@evas_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
550 | @BUILD_EXAMPLES_TRUE@evas_stacking_SOURCES = evas-stacking.c | ||
551 | @BUILD_EXAMPLES_TRUE@evas_stacking_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
552 | @BUILD_EXAMPLES_TRUE@evas_images2_SOURCES = evas-images2.c | ||
553 | @BUILD_EXAMPLES_TRUE@evas_images2_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
554 | @BUILD_EXAMPLES_TRUE@evas_text_SOURCES = evas-text.c | ||
555 | @BUILD_EXAMPLES_TRUE@evas_text_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
556 | @BUILD_EXAMPLES_TRUE@evas_smart_object_SOURCES = evas-smart-object.c | ||
557 | @BUILD_EXAMPLES_TRUE@evas_smart_object_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
558 | @BUILD_EXAMPLES_TRUE@evas_box_SOURCES = evas-box.c | ||
559 | @BUILD_EXAMPLES_TRUE@evas_box_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EINA_LIBS@ | ||
560 | @BUILD_EXAMPLES_TRUE@evas_aspect_hints_DEPS = $(srcdir)/aspect.edc | ||
561 | @BUILD_EXAMPLES_TRUE@evas_aspect_hints_SOURCES = evas-aspect-hints.c | ||
562 | @BUILD_EXAMPLES_TRUE@evas_aspect_hints_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ @EDJE_LIBS@ | ||
563 | @BUILD_EXAMPLES_TRUE@evas_map_utils_SOURCES = evas-map-utils.c | ||
564 | @BUILD_EXAMPLES_TRUE@evas_map_utils_LDADD = $(top_builddir)/src/lib/libevas.la @ECORE_EVAS_LIBS@ | ||
565 | @BUILD_EXAMPLES_TRUE@EDJS = $(EDCS:%.edc=%.edj) | ||
566 | EXTRA_DIST = $(EDCS) \ | ||
567 | $(srcdir)/evas-buffer-simple.c \ | ||
568 | $(srcdir)/evas-init-shutdown.c \ | ||
569 | $(srcdir)/evas-images.c \ | ||
570 | $(srcdir)/evas-images2.c \ | ||
571 | $(srcdir)/evas-object-manipulation.c \ | ||
572 | $(srcdir)/evas-events.c \ | ||
573 | $(srcdir)/evas-aspect-hints.c \ | ||
574 | $(srcdir)/evas-hints.c \ | ||
575 | $(srcdir)/evas-stacking.c \ | ||
576 | $(srcdir)/evas-map-utils.c \ | ||
577 | $(srcdir)/evas-text.c \ | ||
578 | $(srcdir)/evas-smart-object.c \ | ||
579 | $(srcdir)/evas-box.c \ | ||
580 | $(srcdir)/enlightenment.png \ | ||
581 | $(srcdir)/red.png \ | ||
582 | $(srcdir)/im1.png \ | ||
583 | $(srcdir)/cube1.png | ||
584 | |||
585 | all: all-am | ||
586 | |||
587 | .SUFFIXES: | ||
588 | .SUFFIXES: .c .edc .edj .lo .o .obj | ||
589 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
590 | @for dep in $?; do \ | ||
591 | case '$(am__configure_deps)' in \ | ||
592 | *$$dep*) \ | ||
593 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
594 | && { if test -f $@; then exit 0; else break; fi; }; \ | ||
595 | exit 1;; \ | ||
596 | esac; \ | ||
597 | done; \ | ||
598 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ | ||
599 | $(am__cd) $(top_srcdir) && \ | ||
600 | $(AUTOMAKE) --gnu src/examples/Makefile | ||
601 | .PRECIOUS: Makefile | ||
602 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
603 | @case '$?' in \ | ||
604 | *config.status*) \ | ||
605 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
606 | *) \ | ||
607 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
608 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
609 | esac; | ||
610 | |||
611 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
612 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
613 | |||
614 | $(top_srcdir)/configure: $(am__configure_deps) | ||
615 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
616 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
617 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
618 | $(am__aclocal_m4_deps): | ||
619 | install-pkglibPROGRAMS: $(pkglib_PROGRAMS) | ||
620 | @$(NORMAL_INSTALL) | ||
621 | test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" | ||
622 | @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ | ||
623 | for p in $$list; do echo "$$p $$p"; done | \ | ||
624 | sed 's/$(EXEEXT)$$//' | \ | ||
625 | while read p p1; do if test -f $$p || test -f $$p1; \ | ||
626 | then echo "$$p"; echo "$$p"; else :; fi; \ | ||
627 | done | \ | ||
628 | sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ | ||
629 | -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ | ||
630 | sed 'N;N;N;s,\n, ,g' | \ | ||
631 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ | ||
632 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ | ||
633 | if ($$2 == $$4) files[d] = files[d] " " $$1; \ | ||
634 | else { print "f", $$3 "/" $$4, $$1; } } \ | ||
635 | END { for (d in files) print "f", d, files[d] }' | \ | ||
636 | while read type dir files; do \ | ||
637 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ | ||
638 | test -z "$$files" || { \ | ||
639 | echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkglibdir)$$dir'"; \ | ||
640 | $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkglibdir)$$dir" || exit $$?; \ | ||
641 | } \ | ||
642 | ; done | ||
643 | |||
644 | uninstall-pkglibPROGRAMS: | ||
645 | @$(NORMAL_UNINSTALL) | ||
646 | @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ | ||
647 | files=`for p in $$list; do echo "$$p"; done | \ | ||
648 | sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ | ||
649 | -e 's/$$/$(EXEEXT)/' `; \ | ||
650 | test -n "$$list" || exit 0; \ | ||
651 | echo " ( cd '$(DESTDIR)$(pkglibdir)' && rm -f" $$files ")"; \ | ||
652 | cd "$(DESTDIR)$(pkglibdir)" && rm -f $$files | ||
653 | |||
654 | clean-pkglibPROGRAMS: | ||
655 | @list='$(pkglib_PROGRAMS)'; test -n "$$list" || exit 0; \ | ||
656 | echo " rm -f" $$list; \ | ||
657 | rm -f $$list || exit $$?; \ | ||
658 | test -n "$(EXEEXT)" || exit 0; \ | ||
659 | list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ | ||
660 | echo " rm -f" $$list; \ | ||
661 | rm -f $$list | ||
662 | evas_aspect_hints$(EXEEXT): $(evas_aspect_hints_OBJECTS) $(evas_aspect_hints_DEPENDENCIES) | ||
663 | @rm -f evas_aspect_hints$(EXEEXT) | ||
664 | $(AM_V_CCLD)$(LINK) $(evas_aspect_hints_OBJECTS) $(evas_aspect_hints_LDADD) $(LIBS) | ||
665 | evas_box$(EXEEXT): $(evas_box_OBJECTS) $(evas_box_DEPENDENCIES) | ||
666 | @rm -f evas_box$(EXEEXT) | ||
667 | $(AM_V_CCLD)$(LINK) $(evas_box_OBJECTS) $(evas_box_LDADD) $(LIBS) | ||
668 | evas_buffer_simple$(EXEEXT): $(evas_buffer_simple_OBJECTS) $(evas_buffer_simple_DEPENDENCIES) | ||
669 | @rm -f evas_buffer_simple$(EXEEXT) | ||
670 | $(AM_V_CCLD)$(LINK) $(evas_buffer_simple_OBJECTS) $(evas_buffer_simple_LDADD) $(LIBS) | ||
671 | evas_events$(EXEEXT): $(evas_events_OBJECTS) $(evas_events_DEPENDENCIES) | ||
672 | @rm -f evas_events$(EXEEXT) | ||
673 | $(AM_V_CCLD)$(LINK) $(evas_events_OBJECTS) $(evas_events_LDADD) $(LIBS) | ||
674 | evas_hints$(EXEEXT): $(evas_hints_OBJECTS) $(evas_hints_DEPENDENCIES) | ||
675 | @rm -f evas_hints$(EXEEXT) | ||
676 | $(AM_V_CCLD)$(LINK) $(evas_hints_OBJECTS) $(evas_hints_LDADD) $(LIBS) | ||
677 | evas_images$(EXEEXT): $(evas_images_OBJECTS) $(evas_images_DEPENDENCIES) | ||
678 | @rm -f evas_images$(EXEEXT) | ||
679 | $(AM_V_CCLD)$(LINK) $(evas_images_OBJECTS) $(evas_images_LDADD) $(LIBS) | ||
680 | evas_images2$(EXEEXT): $(evas_images2_OBJECTS) $(evas_images2_DEPENDENCIES) | ||
681 | @rm -f evas_images2$(EXEEXT) | ||
682 | $(AM_V_CCLD)$(LINK) $(evas_images2_OBJECTS) $(evas_images2_LDADD) $(LIBS) | ||
683 | evas_init_shutdown$(EXEEXT): $(evas_init_shutdown_OBJECTS) $(evas_init_shutdown_DEPENDENCIES) | ||
684 | @rm -f evas_init_shutdown$(EXEEXT) | ||
685 | $(AM_V_CCLD)$(LINK) $(evas_init_shutdown_OBJECTS) $(evas_init_shutdown_LDADD) $(LIBS) | ||
686 | evas_map_utils$(EXEEXT): $(evas_map_utils_OBJECTS) $(evas_map_utils_DEPENDENCIES) | ||
687 | @rm -f evas_map_utils$(EXEEXT) | ||
688 | $(AM_V_CCLD)$(LINK) $(evas_map_utils_OBJECTS) $(evas_map_utils_LDADD) $(LIBS) | ||
689 | evas_object_manipulation$(EXEEXT): $(evas_object_manipulation_OBJECTS) $(evas_object_manipulation_DEPENDENCIES) | ||
690 | @rm -f evas_object_manipulation$(EXEEXT) | ||
691 | $(AM_V_CCLD)$(LINK) $(evas_object_manipulation_OBJECTS) $(evas_object_manipulation_LDADD) $(LIBS) | ||
692 | evas_smart_object$(EXEEXT): $(evas_smart_object_OBJECTS) $(evas_smart_object_DEPENDENCIES) | ||
693 | @rm -f evas_smart_object$(EXEEXT) | ||
694 | $(AM_V_CCLD)$(LINK) $(evas_smart_object_OBJECTS) $(evas_smart_object_LDADD) $(LIBS) | ||
695 | evas_stacking$(EXEEXT): $(evas_stacking_OBJECTS) $(evas_stacking_DEPENDENCIES) | ||
696 | @rm -f evas_stacking$(EXEEXT) | ||
697 | $(AM_V_CCLD)$(LINK) $(evas_stacking_OBJECTS) $(evas_stacking_LDADD) $(LIBS) | ||
698 | evas_text$(EXEEXT): $(evas_text_OBJECTS) $(evas_text_DEPENDENCIES) | ||
699 | @rm -f evas_text$(EXEEXT) | ||
700 | $(AM_V_CCLD)$(LINK) $(evas_text_OBJECTS) $(evas_text_LDADD) $(LIBS) | ||
701 | |||
702 | mostlyclean-compile: | ||
703 | -rm -f *.$(OBJEXT) | ||
704 | |||
705 | distclean-compile: | ||
706 | -rm -f *.tab.c | ||
707 | |||
708 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-aspect-hints.Po@am__quote@ | ||
709 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-box.Po@am__quote@ | ||
710 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-buffer-simple.Po@am__quote@ | ||
711 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-events.Po@am__quote@ | ||
712 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-hints.Po@am__quote@ | ||
713 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-images.Po@am__quote@ | ||
714 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-images2.Po@am__quote@ | ||
715 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-init-shutdown.Po@am__quote@ | ||
716 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-map-utils.Po@am__quote@ | ||
717 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-object-manipulation.Po@am__quote@ | ||
718 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-smart-object.Po@am__quote@ | ||
719 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-stacking.Po@am__quote@ | ||
720 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/evas-text.Po@am__quote@ | ||
721 | |||
722 | .c.o: | ||
723 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
724 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
725 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
726 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
727 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
728 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< | ||
729 | |||
730 | .c.obj: | ||
731 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` | ||
732 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po | ||
733 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
734 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ | ||
735 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
736 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` | ||
737 | |||
738 | .c.lo: | ||
739 | @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< | ||
740 | @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo | ||
741 | @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ | ||
742 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ | ||
743 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ | ||
744 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< | ||
745 | |||
746 | mostlyclean-libtool: | ||
747 | -rm -f *.lo | ||
748 | |||
749 | clean-libtool: | ||
750 | -rm -rf .libs _libs | ||
751 | install-filesDATA: $(files_DATA) | ||
752 | @$(NORMAL_INSTALL) | ||
753 | test -z "$(filesdir)" || $(MKDIR_P) "$(DESTDIR)$(filesdir)" | ||
754 | @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ | ||
755 | for p in $$list; do \ | ||
756 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | ||
757 | echo "$$d$$p"; \ | ||
758 | done | $(am__base_list) | \ | ||
759 | while read files; do \ | ||
760 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filesdir)'"; \ | ||
761 | $(INSTALL_DATA) $$files "$(DESTDIR)$(filesdir)" || exit $$?; \ | ||
762 | done | ||
763 | |||
764 | uninstall-filesDATA: | ||
765 | @$(NORMAL_UNINSTALL) | ||
766 | @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ | ||
767 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ | ||
768 | test -n "$$files" || exit 0; \ | ||
769 | echo " ( cd '$(DESTDIR)$(filesdir)' && rm -f" $$files ")"; \ | ||
770 | cd "$(DESTDIR)$(filesdir)" && rm -f $$files | ||
771 | |||
772 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
773 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
774 | unique=`for i in $$list; do \ | ||
775 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
776 | done | \ | ||
777 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
778 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
779 | mkid -fID $$unique | ||
780 | tags: TAGS | ||
781 | |||
782 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
783 | $(TAGS_FILES) $(LISP) | ||
784 | set x; \ | ||
785 | here=`pwd`; \ | ||
786 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
787 | unique=`for i in $$list; do \ | ||
788 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
789 | done | \ | ||
790 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
791 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
792 | shift; \ | ||
793 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
794 | test -n "$$unique" || unique=$$empty_fix; \ | ||
795 | if test $$# -gt 0; then \ | ||
796 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
797 | "$$@" $$unique; \ | ||
798 | else \ | ||
799 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
800 | $$unique; \ | ||
801 | fi; \ | ||
802 | fi | ||
803 | ctags: CTAGS | ||
804 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
805 | $(TAGS_FILES) $(LISP) | ||
806 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
807 | unique=`for i in $$list; do \ | ||
808 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
809 | done | \ | ||
810 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
811 | END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
812 | test -z "$(CTAGS_ARGS)$$unique" \ | ||
813 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
814 | $$unique | ||
815 | |||
816 | GTAGS: | ||
817 | here=`$(am__cd) $(top_builddir) && pwd` \ | ||
818 | && $(am__cd) $(top_srcdir) \ | ||
819 | && gtags -i $(GTAGS_ARGS) "$$here" | ||
820 | |||
821 | distclean-tags: | ||
822 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
823 | |||
824 | distdir: $(DISTFILES) | ||
825 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
826 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
827 | list='$(DISTFILES)'; \ | ||
828 | dist_files=`for file in $$list; do echo $$file; done | \ | ||
829 | sed -e "s|^$$srcdirstrip/||;t" \ | ||
830 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
831 | case $$dist_files in \ | ||
832 | */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
833 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
834 | sort -u` ;; \ | ||
835 | esac; \ | ||
836 | for file in $$dist_files; do \ | ||
837 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
838 | if test -d $$d/$$file; then \ | ||
839 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
840 | if test -d "$(distdir)/$$file"; then \ | ||
841 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
842 | fi; \ | ||
843 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
844 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
845 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
846 | fi; \ | ||
847 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
848 | else \ | ||
849 | test -f "$(distdir)/$$file" \ | ||
850 | || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
851 | || exit 1; \ | ||
852 | fi; \ | ||
853 | done | ||
854 | check-am: all-am | ||
855 | check: check-am | ||
856 | all-am: Makefile $(PROGRAMS) $(DATA) | ||
857 | installdirs: | ||
858 | for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"; do \ | ||
859 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ | ||
860 | done | ||
861 | install: install-am | ||
862 | install-exec: install-exec-am | ||
863 | install-data: install-data-am | ||
864 | uninstall: uninstall-am | ||
865 | |||
866 | install-am: all-am | ||
867 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
868 | |||
869 | installcheck: installcheck-am | ||
870 | install-strip: | ||
871 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
872 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
873 | `test -z '$(STRIP)' || \ | ||
874 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
875 | mostlyclean-generic: | ||
876 | |||
877 | clean-generic: | ||
878 | |||
879 | distclean-generic: | ||
880 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
881 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
882 | |||
883 | maintainer-clean-generic: | ||
884 | @echo "This command is intended for maintainers to use" | ||
885 | @echo "it deletes files that may require special tools to rebuild." | ||
886 | -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) | ||
887 | clean: clean-am | ||
888 | |||
889 | clean-am: clean-generic clean-libtool clean-pkglibPROGRAMS \ | ||
890 | mostlyclean-am | ||
891 | |||
892 | distclean: distclean-am | ||
893 | -rm -rf ./$(DEPDIR) | ||
894 | -rm -f Makefile | ||
895 | distclean-am: clean-am distclean-compile distclean-generic \ | ||
896 | distclean-tags | ||
897 | |||
898 | dvi: dvi-am | ||
899 | |||
900 | dvi-am: | ||
901 | |||
902 | html: html-am | ||
903 | |||
904 | html-am: | ||
905 | |||
906 | info: info-am | ||
907 | |||
908 | info-am: | ||
909 | |||
910 | install-data-am: install-filesDATA | ||
911 | |||
912 | install-dvi: install-dvi-am | ||
913 | |||
914 | install-dvi-am: | ||
915 | |||
916 | install-exec-am: install-pkglibPROGRAMS | ||
917 | |||
918 | install-html: install-html-am | ||
919 | |||
920 | install-html-am: | ||
921 | |||
922 | install-info: install-info-am | ||
923 | |||
924 | install-info-am: | ||
925 | |||
926 | install-man: | ||
927 | |||
928 | install-pdf: install-pdf-am | ||
929 | |||
930 | install-pdf-am: | ||
931 | |||
932 | install-ps: install-ps-am | ||
933 | |||
934 | install-ps-am: | ||
935 | |||
936 | installcheck-am: | ||
937 | |||
938 | maintainer-clean: maintainer-clean-am | ||
939 | -rm -rf ./$(DEPDIR) | ||
940 | -rm -f Makefile | ||
941 | maintainer-clean-am: distclean-am maintainer-clean-generic | ||
942 | |||
943 | mostlyclean: mostlyclean-am | ||
944 | |||
945 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ | ||
946 | mostlyclean-libtool | ||
947 | |||
948 | pdf: pdf-am | ||
949 | |||
950 | pdf-am: | ||
951 | |||
952 | ps: ps-am | ||
953 | |||
954 | ps-am: | ||
955 | |||
956 | uninstall-am: uninstall-filesDATA uninstall-pkglibPROGRAMS | ||
957 | |||
958 | .MAKE: install-am install-strip | ||
959 | |||
960 | .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ | ||
961 | clean-libtool clean-pkglibPROGRAMS ctags distclean \ | ||
962 | distclean-compile distclean-generic distclean-libtool \ | ||
963 | distclean-tags distdir dvi dvi-am html html-am info info-am \ | ||
964 | install install-am install-data install-data-am install-dvi \ | ||
965 | install-dvi-am install-exec install-exec-am install-filesDATA \ | ||
966 | install-html install-html-am install-info install-info-am \ | ||
967 | install-man install-pdf install-pdf-am install-pkglibPROGRAMS \ | ||
968 | install-ps install-ps-am install-strip installcheck \ | ||
969 | installcheck-am installdirs maintainer-clean \ | ||
970 | maintainer-clean-generic mostlyclean mostlyclean-compile \ | ||
971 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ | ||
972 | tags uninstall uninstall-am uninstall-filesDATA \ | ||
973 | uninstall-pkglibPROGRAMS | ||
974 | |||
975 | |||
976 | @BUILD_EXAMPLES_TRUE@aspect.edj: ${evas_aspect_hints_DEPS} | ||
977 | |||
978 | @BUILD_EXAMPLES_TRUE@.edc.edj: | ||
979 | @BUILD_EXAMPLES_TRUE@ $(edje_cc) -v -id $(srcdir) $< $(builddir)/$(@F) | ||
980 | |||
981 | # Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
982 | # Otherwise a system limit (for SysV at least) may be exceeded. | ||
983 | .NOEXPORT: | ||
diff --git a/libraries/evas/src/examples/aspect.edc b/libraries/evas/src/examples/aspect.edc new file mode 100644 index 0000000..b8bfb31 --- /dev/null +++ b/libraries/evas/src/examples/aspect.edc | |||
@@ -0,0 +1,17 @@ | |||
1 | collections { | ||
2 | group { | ||
3 | name: "main"; | ||
4 | parts { | ||
5 | part { | ||
6 | name: "content"; | ||
7 | mouse_events: 0; | ||
8 | type: SWALLOW; | ||
9 | description { | ||
10 | state: "default" 0.0; | ||
11 | visible: 1; | ||
12 | } | ||
13 | } | ||
14 | } | ||
15 | } | ||
16 | } | ||
17 | |||
diff --git a/libraries/evas/src/examples/cube1.png b/libraries/evas/src/examples/cube1.png new file mode 100644 index 0000000..c2f4fda --- /dev/null +++ b/libraries/evas/src/examples/cube1.png | |||
Binary files differ | |||
diff --git a/libraries/evas/src/examples/enlightenment.png b/libraries/evas/src/examples/enlightenment.png new file mode 100644 index 0000000..aeb836b --- /dev/null +++ b/libraries/evas/src/examples/enlightenment.png | |||
Binary files differ | |||
diff --git a/libraries/evas/src/examples/evas-aspect-hints.c b/libraries/evas/src/examples/evas-aspect-hints.c new file mode 100644 index 0000000..de8ed50 --- /dev/null +++ b/libraries/evas/src/examples/evas-aspect-hints.c | |||
@@ -0,0 +1,249 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating aspect control hints on objects. | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one) and the png image loader also built. See stdout/stderr for | ||
6 | * output. | ||
7 | * | ||
8 | * You'll also need @b Edje for this one, as it has the only smart | ||
9 | * object implementing aspect control for children. | ||
10 | * | ||
11 | * @verbatim | ||
12 | * gcc -o evas-events evas-events.c `pkg-config --libs --cflags ecore-evas edje` | ||
13 | * @endverbatim | ||
14 | */ | ||
15 | |||
16 | #ifdef HAVE_CONFIG_H | ||
17 | |||
18 | #include "config.h" | ||
19 | #endif | ||
20 | |||
21 | #include <Ecore.h> | ||
22 | #include <Ecore_Evas.h> | ||
23 | #include <Edje.h> | ||
24 | #include <stdio.h> | ||
25 | #include <errno.h> | ||
26 | |||
27 | #define WIDTH 320 | ||
28 | #define HEIGHT 480 | ||
29 | |||
30 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
31 | static const char *edje_file_path = PACKAGE_EXAMPLES_DIR "/aspect.edj"; | ||
32 | |||
33 | struct test_data | ||
34 | { | ||
35 | Ecore_Evas *ee; | ||
36 | Evas *canvas; | ||
37 | Evas_Object *bg, *rect, *container, *border; | ||
38 | }; | ||
39 | |||
40 | static struct test_data d = {0}; | ||
41 | |||
42 | /* here just to keep our example's window size and background image's | ||
43 | * size in synchrony */ | ||
44 | static void | ||
45 | _canvas_resize_cb(Ecore_Evas *ee) | ||
46 | { | ||
47 | int w, h; | ||
48 | |||
49 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
50 | evas_object_resize(d.bg, w, h); | ||
51 | } | ||
52 | |||
53 | static const char * | ||
54 | _get_aspect_name(Evas_Aspect_Control aspect) | ||
55 | { | ||
56 | switch (aspect) | ||
57 | { | ||
58 | case 0: | ||
59 | return "NONE"; | ||
60 | |||
61 | case 1: | ||
62 | return "NEITHER"; | ||
63 | |||
64 | case 2: | ||
65 | return "HORIZONTAL"; | ||
66 | |||
67 | case 3: | ||
68 | return "VERTICAL"; | ||
69 | |||
70 | case 4: | ||
71 | return "BOTH"; | ||
72 | |||
73 | default: | ||
74 | return "INVALID"; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static void | ||
79 | _on_keydown(void *data __UNUSED__, | ||
80 | Evas *evas __UNUSED__, | ||
81 | Evas_Object *o, | ||
82 | void *einfo) | ||
83 | { | ||
84 | const Evas_Modifier *mods; | ||
85 | Evas_Event_Key_Down *ev = einfo; | ||
86 | |||
87 | mods = evas_key_modifier_get(evas_object_evas_get(o)); | ||
88 | |||
89 | if (evas_key_modifier_is_set(mods, "Shift") && | ||
90 | strcmp(ev->keyname, "h") == 0) /* print help */ | ||
91 | { | ||
92 | fprintf(stdout, "commands are:\n" | ||
93 | "\tc - cycle aspect control on object\n" | ||
94 | "\th - change horizontal aspect component\n" | ||
95 | "\tv - change vertical aspect component\n" | ||
96 | "\ts - print current object's status\n" | ||
97 | "\tH - print help\n"); | ||
98 | return; | ||
99 | } | ||
100 | |||
101 | if (strcmp(ev->keyname, "s") == 0) /* get aspect status of the obj */ | ||
102 | { | ||
103 | Evas_Coord w, h; | ||
104 | Evas_Aspect_Control aspect; | ||
105 | |||
106 | evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); | ||
107 | |||
108 | fprintf(stdout, "Object has aspect %s, with horizontal compontent %d" | ||
109 | " and vertical compontent %d\n", | ||
110 | _get_aspect_name(aspect), w, h); | ||
111 | |||
112 | return; | ||
113 | } | ||
114 | |||
115 | if (strcmp(ev->keyname, "c") == 0) /* cycle aspect control on obj */ | ||
116 | { | ||
117 | Evas_Coord w, h; | ||
118 | Evas_Aspect_Control aspect; | ||
119 | |||
120 | evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); | ||
121 | |||
122 | aspect = (aspect + 1) % 5; | ||
123 | |||
124 | evas_object_size_hint_aspect_set(d.rect, aspect, w, h); | ||
125 | |||
126 | fprintf(stdout, "Changing aspect control to %s\n", | ||
127 | _get_aspect_name(aspect)); | ||
128 | |||
129 | return; | ||
130 | } | ||
131 | |||
132 | if (strcmp(ev->keyname, "h") == 0) /* change horizontal aspect component */ | ||
133 | { | ||
134 | Evas_Coord w, h; | ||
135 | Evas_Aspect_Control aspect; | ||
136 | |||
137 | evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); | ||
138 | |||
139 | w = (w + 1) % 3; | ||
140 | |||
141 | evas_object_size_hint_aspect_set(d.rect, aspect, w, h); | ||
142 | |||
143 | fprintf(stdout, "Changing horizontal aspect component to %d\n", w); | ||
144 | |||
145 | return; | ||
146 | } | ||
147 | |||
148 | if (strcmp(ev->keyname, "v") == 0) /* change vertical aspect component */ | ||
149 | { | ||
150 | Evas_Coord w, h; | ||
151 | Evas_Aspect_Control aspect; | ||
152 | |||
153 | evas_object_size_hint_aspect_get(d.rect, &aspect, &w, &h); | ||
154 | |||
155 | h = (h + 1) % 3; | ||
156 | |||
157 | evas_object_size_hint_aspect_set(d.rect, aspect, w, h); | ||
158 | |||
159 | fprintf(stdout, "Changing vertical aspect component to %d\n", h); | ||
160 | |||
161 | return; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | int | ||
166 | main(void) | ||
167 | { | ||
168 | Eina_Bool ret; | ||
169 | |||
170 | if (!ecore_evas_init()) | ||
171 | return EXIT_FAILURE; | ||
172 | |||
173 | if (!edje_init()) | ||
174 | return EXIT_FAILURE; | ||
175 | |||
176 | /* this will give you a window with an Evas canvas under the first | ||
177 | * engine available */ | ||
178 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
179 | if (!d.ee) | ||
180 | goto error; | ||
181 | |||
182 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
183 | ecore_evas_show(d.ee); | ||
184 | |||
185 | /* the canvas pointer, de facto */ | ||
186 | d.canvas = ecore_evas_get(d.ee); | ||
187 | |||
188 | d.bg = evas_object_rectangle_add(d.canvas); | ||
189 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
190 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
191 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
192 | evas_object_show(d.bg); | ||
193 | |||
194 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
195 | evas_object_event_callback_add( | ||
196 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
197 | |||
198 | d.container = edje_object_add(d.canvas); | ||
199 | ret = edje_object_file_set(d.container, edje_file_path, "main"); | ||
200 | if (!ret) | ||
201 | { | ||
202 | Edje_Load_Error err = edje_object_load_error_get(d.container); | ||
203 | const char *msg = edje_load_error_str(err); | ||
204 | fprintf(stderr, "could not load 'main' from %s: %s", | ||
205 | edje_file_path, msg); | ||
206 | |||
207 | goto panic; | ||
208 | } | ||
209 | |||
210 | evas_object_move(d.container, (WIDTH / 4), (HEIGHT / 4)); | ||
211 | evas_object_resize(d.container, (WIDTH / 2), (HEIGHT / 2)); | ||
212 | evas_object_show(d.container); | ||
213 | |||
214 | d.rect = evas_object_rectangle_add(d.canvas); | ||
215 | evas_object_color_set(d.rect, 0, 0, 255, 255); | ||
216 | evas_object_size_hint_aspect_set(d.rect, EVAS_ASPECT_CONTROL_NONE, 1, 1); | ||
217 | evas_object_show(d.rect); | ||
218 | |||
219 | edje_object_part_swallow(d.container, "content", d.rect); | ||
220 | evas_object_smart_changed(d.container); | ||
221 | |||
222 | /* this is a border around the edje object, container of the | ||
223 | * rectangle we are going to experiment with (change its aspect | ||
224 | * hints). this way you can see how their sizes relate */ | ||
225 | d.border = evas_object_image_filled_add(d.canvas); | ||
226 | evas_object_image_file_set(d.border, border_img_path, NULL); | ||
227 | evas_object_image_border_set(d.border, 3, 3, 3, 3); | ||
228 | evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); | ||
229 | evas_object_move(d.border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3); | ||
230 | evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); | ||
231 | evas_object_show(d.border); | ||
232 | |||
233 | ecore_main_loop_begin(); | ||
234 | |||
235 | ecore_evas_free(d.ee); | ||
236 | ecore_evas_shutdown(); | ||
237 | edje_shutdown(); | ||
238 | return 0; | ||
239 | |||
240 | error: | ||
241 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
242 | " up to ecore-evas for this example to run properly.\n"); | ||
243 | panic: | ||
244 | ecore_evas_free(d.ee); | ||
245 | ecore_evas_shutdown(); | ||
246 | edje_shutdown(); | ||
247 | |||
248 | return -1; | ||
249 | } | ||
diff --git a/libraries/evas/src/examples/evas-box.c b/libraries/evas/src/examples/evas-box.c new file mode 100644 index 0000000..13f12cf --- /dev/null +++ b/libraries/evas/src/examples/evas-box.c | |||
@@ -0,0 +1,382 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating a custom Evas box object | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one). See stdout/stderr for output. | ||
6 | * | ||
7 | * @verbatim | ||
8 | * gcc -o evas-box evas-box.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
9 | * @endverbatim | ||
10 | */ | ||
11 | |||
12 | #ifdef HAVE_CONFIG_H | ||
13 | |||
14 | #include "config.h" | ||
15 | #else | ||
16 | #define PACKAGE_EXAMPLES_DIR "." | ||
17 | #define __UNUSED__ | ||
18 | #endif | ||
19 | |||
20 | #include <Ecore.h> | ||
21 | #include <Ecore_Evas.h> | ||
22 | |||
23 | #include <stdlib.h> | ||
24 | #include <stdio.h> | ||
25 | #include <string.h> | ||
26 | |||
27 | #define WIDTH (640) | ||
28 | #define HEIGHT (480) | ||
29 | |||
30 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
31 | |||
32 | static const char *commands = \ | ||
33 | "commands are:\n" | ||
34 | "\ta - change the box's alignment values\n" | ||
35 | "\tp - change the box's padding values\n" | ||
36 | "\t1 - change the box's layout to horizontal\n" | ||
37 | "\t2 - change the box's layout to vertical\n" | ||
38 | "\t3 - change the box's layout to horizontal homogeneous\n" | ||
39 | "\t4 - change the box's layout to vertical homogeneous\n" | ||
40 | "\t5 - change the box's layout to horizontal maximum size homogeneous\n" | ||
41 | "\t6 - change the box's layout to vertical maximum size homogeneous\n" | ||
42 | "\t7 - change the box's layout to horizontal flow\n" | ||
43 | "\t8 - change the box's layout to vertical flow\n" | ||
44 | "\t9 - change the box's layout to stack\n" | ||
45 | "\t0 - change the box's layout to a custom-made one\n" | ||
46 | "\tCtrl + NUMBER - insert a new child object at that position in the box\n" | ||
47 | "\tShift + NUMBER - remove the child object at that position in the box\n" | ||
48 | "\th - print help\n"; | ||
49 | |||
50 | struct exemple_data | ||
51 | { | ||
52 | Ecore_Evas *ee; | ||
53 | Evas *evas; | ||
54 | Evas_Object *bg, *box, *border; | ||
55 | }; | ||
56 | |||
57 | static struct exemple_data d; | ||
58 | |||
59 | static void /* custom 'diagonal' layout */ | ||
60 | _custom_layout(Evas_Object *o, | ||
61 | Evas_Object_Box_Data *p, | ||
62 | void *data __UNUSED__) | ||
63 | { | ||
64 | int x, y, w, h; | ||
65 | int xx, yy, ww, hh; | ||
66 | int count; | ||
67 | Eina_List *l; | ||
68 | Evas_Object_Box_Option *opt; | ||
69 | |||
70 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
71 | count = eina_list_count(p->children); | ||
72 | ww = w / (count ? : 1); | ||
73 | hh = h / (count ? : 1); | ||
74 | if (ww < 1) ww = 1; | ||
75 | if (hh < 1) hh = 1; | ||
76 | |||
77 | xx = x; | ||
78 | yy = y; | ||
79 | EINA_LIST_FOREACH(p->children, l, opt) | ||
80 | { | ||
81 | evas_object_move(opt->obj, xx, yy); | ||
82 | xx += ww; | ||
83 | yy += hh; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | static Evas_Object * /* new rectangle to be put in the box */ | ||
88 | _new_rectangle_add(Evas *e) | ||
89 | { | ||
90 | Evas_Object *o; | ||
91 | |||
92 | o = evas_object_rectangle_add(e); | ||
93 | evas_object_resize(o, 10, 10); | ||
94 | evas_object_color_set(o, 0, 255, 0, 255); | ||
95 | evas_object_show(o); | ||
96 | |||
97 | return o; | ||
98 | } | ||
99 | |||
100 | /* use the following commands to interact with this example - 'h' is | ||
101 | * the key for help */ | ||
102 | static void | ||
103 | _on_keydown(void *data __UNUSED__, | ||
104 | Evas *evas __UNUSED__, | ||
105 | Evas_Object *o __UNUSED__, | ||
106 | void *einfo) | ||
107 | { | ||
108 | Evas_Event_Key_Down *ev = einfo; | ||
109 | const Evas_Modifier *mods = evas_key_modifier_get(evas); | ||
110 | |||
111 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
112 | { | ||
113 | fprintf(stdout, commands); | ||
114 | return; | ||
115 | } | ||
116 | |||
117 | if (evas_key_modifier_is_set(mods, "Shift")) | ||
118 | { | ||
119 | int pos; | ||
120 | Eina_Bool ret; | ||
121 | Evas_Object *obj; | ||
122 | Eina_List *children; | ||
123 | |||
124 | pos = atoi(ev->keyname); | ||
125 | children = evas_object_box_children_get(d.box); | ||
126 | |||
127 | obj = eina_list_nth(children, pos); | ||
128 | if (!obj) goto list_free; | ||
129 | |||
130 | ret = evas_object_box_remove_at(d.box, pos); | ||
131 | if (ret) evas_object_del(obj); | ||
132 | |||
133 | list_free: | ||
134 | eina_list_free(children); | ||
135 | return; | ||
136 | } | ||
137 | |||
138 | if (evas_key_modifier_is_set(mods, "Control")) | ||
139 | { | ||
140 | Evas_Object *o; | ||
141 | int pos; | ||
142 | pos = atoi(ev->keyname); | ||
143 | o = _new_rectangle_add(d.evas); | ||
144 | if (!evas_object_box_insert_at(d.box, o, pos)) | ||
145 | evas_object_box_append(d.box, o); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | if (strcmp(ev->keyname, "a") == 0) | ||
150 | { | ||
151 | double h, v; | ||
152 | |||
153 | evas_object_box_align_get(d.box, &h, &v); | ||
154 | |||
155 | if (h == 0.5) | ||
156 | h = v = 1.0; | ||
157 | else if (h == 1.0) | ||
158 | h = v = -1.0; | ||
159 | else if (h == -1.0) | ||
160 | h = v = 0.0; | ||
161 | else if (h == 0.0) | ||
162 | h = v = 0.5; | ||
163 | |||
164 | evas_object_box_align_set(d.box, h, v); | ||
165 | |||
166 | fprintf(stdout, "Applying new alignment values (%.1f, %.1f)" | ||
167 | " on the box\n", h, v); | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | if (strcmp(ev->keyname, "p") == 0) | ||
172 | { | ||
173 | int h, v; | ||
174 | |||
175 | evas_object_box_padding_get(d.box, &h, &v); | ||
176 | |||
177 | if (h == 0) | ||
178 | h = v = 50; | ||
179 | else | ||
180 | h = v = 0; | ||
181 | |||
182 | evas_object_box_padding_set(d.box, h, v); | ||
183 | |||
184 | fprintf(stdout, "Applying new padding values (%d, %d)" | ||
185 | " on the box\n", h, v); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | if (strcmp(ev->keyname, "1") == 0) | ||
190 | { | ||
191 | evas_object_box_layout_set( | ||
192 | d.box, evas_object_box_layout_horizontal, NULL, NULL); | ||
193 | |||
194 | fprintf(stdout, "Applying '%s' layout on the box\n", "horizontal"); | ||
195 | return; | ||
196 | } | ||
197 | |||
198 | if (strcmp(ev->keyname, "2") == 0) | ||
199 | { | ||
200 | evas_object_box_layout_set( | ||
201 | d.box, evas_object_box_layout_vertical, NULL, NULL); | ||
202 | |||
203 | fprintf(stdout, "Applying '%s' layout on the box\n", "vertical"); | ||
204 | return; | ||
205 | } | ||
206 | |||
207 | if (strcmp(ev->keyname, "3") == 0) | ||
208 | { | ||
209 | evas_object_box_layout_set( | ||
210 | d.box, evas_object_box_layout_homogeneous_horizontal, NULL, | ||
211 | NULL); | ||
212 | |||
213 | fprintf(stdout, "Applying '%s' layout on the box\n", | ||
214 | "horizontal homogeneous"); | ||
215 | return; | ||
216 | } | ||
217 | |||
218 | if (strcmp(ev->keyname, "4") == 0) | ||
219 | { | ||
220 | evas_object_box_layout_set( | ||
221 | d.box, evas_object_box_layout_homogeneous_vertical, NULL, NULL); | ||
222 | |||
223 | fprintf(stdout, "Applying '%s' layout on the box\n", | ||
224 | "vertical homogeneous"); | ||
225 | return; | ||
226 | } | ||
227 | |||
228 | if (strcmp(ev->keyname, "5") == 0) | ||
229 | { | ||
230 | evas_object_box_layout_set( | ||
231 | d.box, evas_object_box_layout_homogeneous_max_size_horizontal, | ||
232 | NULL, NULL); | ||
233 | |||
234 | fprintf(stdout, "Applying '%s' layout on the box\n", | ||
235 | "horizontal maximum size homogeneous"); | ||
236 | return; | ||
237 | } | ||
238 | |||
239 | if (strcmp(ev->keyname, "6") == 0) | ||
240 | { | ||
241 | evas_object_box_layout_set( | ||
242 | d.box, evas_object_box_layout_homogeneous_max_size_vertical, | ||
243 | NULL, NULL); | ||
244 | |||
245 | fprintf(stdout, "Applying '%s' layout on the box\n", | ||
246 | "vertical maximum size homogeneous"); | ||
247 | return; | ||
248 | } | ||
249 | |||
250 | if (strcmp(ev->keyname, "7") == 0) | ||
251 | { | ||
252 | evas_object_box_layout_set( | ||
253 | d.box, evas_object_box_layout_flow_horizontal, NULL, NULL); | ||
254 | |||
255 | fprintf(stdout, "Applying '%s' layout on the box\n", "horizontal flow"); | ||
256 | return; | ||
257 | } | ||
258 | |||
259 | if (strcmp(ev->keyname, "8") == 0) | ||
260 | { | ||
261 | evas_object_box_layout_set( | ||
262 | d.box, evas_object_box_layout_flow_vertical, NULL, NULL); | ||
263 | |||
264 | fprintf(stdout, "Applying '%s' layout on the box\n", "vertical flow"); | ||
265 | return; | ||
266 | } | ||
267 | |||
268 | if (strcmp(ev->keyname, "9") == 0) | ||
269 | { | ||
270 | evas_object_box_layout_set( | ||
271 | d.box, evas_object_box_layout_stack, NULL, NULL); | ||
272 | |||
273 | fprintf(stdout, "Applying '%s' layout on the box\n", "stack"); | ||
274 | return; | ||
275 | } | ||
276 | |||
277 | if (strcmp(ev->keyname, "0") == 0) | ||
278 | { | ||
279 | evas_object_box_layout_set(d.box, _custom_layout, NULL, NULL); | ||
280 | |||
281 | fprintf(stdout, "Applying '%s' layout on the box\n", "CUSTOM"); | ||
282 | return; | ||
283 | } | ||
284 | } | ||
285 | |||
286 | static void | ||
287 | _on_delete(Ecore_Evas *ee __UNUSED__) | ||
288 | { | ||
289 | ecore_main_loop_quit(); | ||
290 | } | ||
291 | |||
292 | static void /* adjust canvas' contents on resizes */ | ||
293 | _canvas_resize_cb(Ecore_Evas *ee) | ||
294 | { | ||
295 | int w, h; | ||
296 | |||
297 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
298 | |||
299 | evas_object_resize(d.bg, w, h); | ||
300 | |||
301 | evas_object_move(d.box, (w / 4), (h / 4)); | ||
302 | evas_object_resize(d.box, (w / 2), (h / 2)); | ||
303 | |||
304 | evas_object_move(d.border, (w / 4) - 2, (h / 4) - 2); | ||
305 | evas_object_resize(d.border, (w / 2) + 4, (h / 2) + 4); | ||
306 | } | ||
307 | |||
308 | int | ||
309 | main(void) | ||
310 | { | ||
311 | Evas_Object *last, *o; | ||
312 | int i; | ||
313 | |||
314 | srand(time(NULL)); | ||
315 | |||
316 | if (!ecore_evas_init()) | ||
317 | return EXIT_FAILURE; | ||
318 | |||
319 | /* this will give you a window with an Evas canvas under the first | ||
320 | * engine available */ | ||
321 | d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | ||
322 | if (!d.ee) | ||
323 | goto panic; | ||
324 | |||
325 | ecore_evas_callback_delete_request_set(d.ee, _on_delete); | ||
326 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
327 | ecore_evas_show(d.ee); | ||
328 | |||
329 | d.evas = ecore_evas_get(d.ee); | ||
330 | |||
331 | d.bg = evas_object_rectangle_add(d.evas); | ||
332 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
333 | evas_object_show(d.bg); | ||
334 | |||
335 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
336 | evas_object_event_callback_add( | ||
337 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
338 | |||
339 | d.box = evas_object_box_add(d.evas); | ||
340 | evas_object_show(d.box); | ||
341 | |||
342 | for (i = 1; i <= 5; i++) | ||
343 | { | ||
344 | o = last = evas_object_rectangle_add(d.evas); | ||
345 | evas_object_size_hint_min_set(o, 50, 50); | ||
346 | evas_object_color_set( | ||
347 | o, rand() % 256, rand() % 256, rand() % 256, 255); | ||
348 | evas_object_show(o); | ||
349 | |||
350 | if (!evas_object_box_append(d.box, o)) | ||
351 | { | ||
352 | fprintf(stderr, "Error appending child object on the box!\n"); | ||
353 | goto error; | ||
354 | } | ||
355 | } | ||
356 | |||
357 | /* this is a border around the box, container of the rectangles we | ||
358 | * are going to experiment with. this way you can see how the | ||
359 | * container relates to the children */ | ||
360 | d.border = evas_object_image_filled_add(d.evas); | ||
361 | evas_object_image_file_set(d.border, border_img_path, NULL); | ||
362 | evas_object_image_border_set(d.border, 2, 2, 2, 2); | ||
363 | evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); | ||
364 | evas_object_show(d.border); | ||
365 | |||
366 | fprintf(stdout, commands); | ||
367 | |||
368 | _canvas_resize_cb(d.ee); | ||
369 | ecore_main_loop_begin(); | ||
370 | ecore_evas_shutdown(); | ||
371 | return 0; | ||
372 | |||
373 | error: | ||
374 | ecore_evas_shutdown(); | ||
375 | return -1; | ||
376 | |||
377 | panic: | ||
378 | fprintf(stderr, "You got to have at least one evas engine built and linked" | ||
379 | " up to ecore-evas for this example to run properly.\n"); | ||
380 | return -2; | ||
381 | } | ||
382 | |||
diff --git a/libraries/evas/src/examples/evas-buffer-simple.c b/libraries/evas/src/examples/evas-buffer-simple.c new file mode 100644 index 0000000..6676ef1 --- /dev/null +++ b/libraries/evas/src/examples/evas-buffer-simple.c | |||
@@ -0,0 +1,228 @@ | |||
1 | /** | ||
2 | * Simple Evas example using the Buffer engine. | ||
3 | * | ||
4 | * You must have Evas compiled with the buffer engine, and have the | ||
5 | * evas-software-buffer pkg-config files installed. | ||
6 | * | ||
7 | * Compile with: | ||
8 | * | ||
9 | * @verbatim | ||
10 | * gcc -o evas-buffer-simple evas-buffer-simple.c `pkg-config --libs --cflags evas evas-software-buffer` | ||
11 | * @endverbatim | ||
12 | * | ||
13 | */ | ||
14 | #include <Evas.h> | ||
15 | #include <Evas_Engine_Buffer.h> | ||
16 | #include <stdio.h> | ||
17 | #include <errno.h> | ||
18 | |||
19 | #define WIDTH (320) | ||
20 | #define HEIGHT (240) | ||
21 | |||
22 | /* | ||
23 | * create_canvas(), destroy_canvas() and draw_scene() are support functions. | ||
24 | * | ||
25 | * They are only required to use raw Evas, but for real world usage, | ||
26 | * it is recommended to use ecore and its ecore-evas submodule, that | ||
27 | * provide convenience canvas creators, integration with main loop and | ||
28 | * automatic render of updates (draw_scene()) when system goes back to | ||
29 | * main loop. | ||
30 | */ | ||
31 | static Evas *create_canvas(int width, int height); | ||
32 | static void destroy_canvas(Evas *canvas); | ||
33 | static void draw_scene(Evas *canvas); | ||
34 | |||
35 | // support function to save scene as PPM image | ||
36 | static void save_scene(Evas *canvas, const char *dest); | ||
37 | |||
38 | int main(void) | ||
39 | { | ||
40 | Evas *canvas; | ||
41 | Evas_Object *bg, *r1, *r2, *r3; | ||
42 | |||
43 | evas_init(); | ||
44 | |||
45 | // create your canvas | ||
46 | // NOTE: consider using ecore_evas_buffer_new() instead! | ||
47 | canvas = create_canvas(WIDTH, HEIGHT); | ||
48 | if (!canvas) | ||
49 | return -1; | ||
50 | |||
51 | bg = evas_object_rectangle_add(canvas); | ||
52 | evas_object_color_set(bg, 255, 255, 255, 255); // white bg | ||
53 | evas_object_move(bg, 0, 0); // at origin | ||
54 | evas_object_resize(bg, WIDTH, HEIGHT); // covers full canvas | ||
55 | evas_object_show(bg); | ||
56 | |||
57 | puts("initial scene, with just background:"); | ||
58 | draw_scene(canvas); | ||
59 | |||
60 | r1 = evas_object_rectangle_add(canvas); | ||
61 | evas_object_color_set(r1, 255, 0, 0, 255); // 100% opaque red | ||
62 | evas_object_move(r1, 10, 10); | ||
63 | evas_object_resize(r1, 100, 100); | ||
64 | evas_object_show(r1); | ||
65 | |||
66 | // pay attention to transparency! Evas color values are pre-multiplied by | ||
67 | // alpha, so 50% opaque green is: | ||
68 | // non-premul: r=0, g=255, b=0 a=128 (50% alpha) | ||
69 | // premul: | ||
70 | // r_premul = r * a / 255 = 0 * 128 / 255 = 0 | ||
71 | // g_premul = g * a / 255 = 255 * 128 / 255 = 128 | ||
72 | // b_premul = b * a / 255 = 0 * 128 / 255 = 0 | ||
73 | // | ||
74 | // this 50% green is over a red background, so it will show in the | ||
75 | // final output as yellow (green + red = yellow) | ||
76 | r2 = evas_object_rectangle_add(canvas); | ||
77 | evas_object_color_set(r2, 0, 128, 0, 128); // 50% opaque green | ||
78 | evas_object_move(r2, 10, 10); | ||
79 | evas_object_resize(r2, 50, 50); | ||
80 | evas_object_show(r2); | ||
81 | |||
82 | r3 = evas_object_rectangle_add(canvas); | ||
83 | evas_object_color_set(r3, 0, 128, 0, 255); // 100% opaque dark green | ||
84 | evas_object_move(r3, 60, 60); | ||
85 | evas_object_resize(r3, 50, 50); | ||
86 | evas_object_show(r3); | ||
87 | |||
88 | puts("final scene (note updates):"); | ||
89 | draw_scene(canvas); | ||
90 | save_scene(canvas, "/tmp/evas-buffer-simple-render.ppm"); | ||
91 | |||
92 | // NOTE: use ecore_evas_buffer_new() and here ecore_evas_free() | ||
93 | destroy_canvas(canvas); | ||
94 | |||
95 | evas_shutdown(); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static Evas *create_canvas(int width, int height) | ||
101 | { | ||
102 | Evas *canvas; | ||
103 | Evas_Engine_Info_Buffer *einfo; | ||
104 | int method; | ||
105 | void *pixels; | ||
106 | |||
107 | method = evas_render_method_lookup("buffer"); | ||
108 | if (method <= 0) | ||
109 | { | ||
110 | fputs("ERROR: evas was not compiled with 'buffer' engine!\n", stderr); | ||
111 | return NULL; | ||
112 | } | ||
113 | |||
114 | canvas = evas_new(); | ||
115 | if (!canvas) | ||
116 | { | ||
117 | fputs("ERROR: could not instantiate new evas canvas.\n", stderr); | ||
118 | return NULL; | ||
119 | } | ||
120 | |||
121 | evas_output_method_set(canvas, method); | ||
122 | evas_output_size_set(canvas, width, height); | ||
123 | evas_output_viewport_set(canvas, 0, 0, width, height); | ||
124 | |||
125 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); | ||
126 | if (!einfo) | ||
127 | { | ||
128 | fputs("ERROR: could not get evas engine info!\n", stderr); | ||
129 | evas_free(canvas); | ||
130 | return NULL; | ||
131 | } | ||
132 | |||
133 | // ARGB32 is sizeof(int), that is 4 bytes, per pixel | ||
134 | pixels = malloc(width * height * sizeof(int)); | ||
135 | if (!pixels) | ||
136 | { | ||
137 | fputs("ERROR: could not allocate canvas pixels!\n", stderr); | ||
138 | evas_free(canvas); | ||
139 | return NULL; | ||
140 | } | ||
141 | |||
142 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
143 | einfo->info.dest_buffer = pixels; | ||
144 | einfo->info.dest_buffer_row_bytes = width * sizeof(int); | ||
145 | einfo->info.use_color_key = 0; | ||
146 | einfo->info.alpha_threshold = 0; | ||
147 | einfo->info.func.new_update_region = NULL; | ||
148 | einfo->info.func.free_update_region = NULL; | ||
149 | evas_engine_info_set(canvas, (Evas_Engine_Info *)einfo); | ||
150 | |||
151 | return canvas; | ||
152 | } | ||
153 | |||
154 | static void destroy_canvas(Evas *canvas) | ||
155 | { | ||
156 | Evas_Engine_Info_Buffer *einfo; | ||
157 | |||
158 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); | ||
159 | if (!einfo) | ||
160 | { | ||
161 | fputs("ERROR: could not get evas engine info!\n", stderr); | ||
162 | evas_free(canvas); | ||
163 | return; | ||
164 | } | ||
165 | |||
166 | free(einfo->info.dest_buffer); | ||
167 | evas_free(canvas); | ||
168 | } | ||
169 | |||
170 | static void draw_scene(Evas *canvas) | ||
171 | { | ||
172 | Eina_List *updates, *n; | ||
173 | Eina_Rectangle *update; | ||
174 | |||
175 | // render and get the updated rectangles: | ||
176 | updates = evas_render_updates(canvas); | ||
177 | |||
178 | // informative only here, just print the updated areas: | ||
179 | EINA_LIST_FOREACH(updates, n, update) | ||
180 | printf("UPDATED REGION: pos: %3d, %3d size: %3dx%3d\n", | ||
181 | update->x, update->y, update->w, update->h); | ||
182 | |||
183 | // free list of updates | ||
184 | evas_render_updates_free(updates); | ||
185 | } | ||
186 | |||
187 | static void save_scene(Evas *canvas, const char *dest) | ||
188 | { | ||
189 | Evas_Engine_Info_Buffer *einfo; | ||
190 | const unsigned int *pixels, *pixels_end; | ||
191 | int width, height; | ||
192 | FILE *f; | ||
193 | |||
194 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(canvas); | ||
195 | if (!einfo) | ||
196 | { | ||
197 | fputs("ERROR: could not get evas engine info!\n", stderr); | ||
198 | return; | ||
199 | } | ||
200 | evas_output_size_get(canvas, &width, &height); | ||
201 | |||
202 | f = fopen(dest, "wb+"); | ||
203 | if (!f) | ||
204 | { | ||
205 | fprintf(stderr, "ERROR: could not open for writing '%s': %s\n", | ||
206 | dest, strerror(errno)); | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | pixels = einfo->info.dest_buffer; | ||
211 | pixels_end = pixels + (width * height); | ||
212 | |||
213 | // PPM P6 format is dead simple to write: | ||
214 | fprintf(f, "P6\n%d %d\n255\n", width, height); | ||
215 | for (; pixels < pixels_end; pixels++) | ||
216 | { | ||
217 | int r, g, b; | ||
218 | |||
219 | r = ((*pixels) & 0xff0000) >> 16; | ||
220 | g = ((*pixels) & 0x00ff00) >> 8; | ||
221 | b = (*pixels) & 0x0000ff; | ||
222 | |||
223 | fprintf(f, "%c%c%c", r, g, b); | ||
224 | } | ||
225 | |||
226 | fclose(f); | ||
227 | printf("saved scene as '%s'\n", dest); | ||
228 | } | ||
diff --git a/libraries/evas/src/examples/evas-events.c b/libraries/evas/src/examples/evas-events.c new file mode 100644 index 0000000..28b22ed --- /dev/null +++ b/libraries/evas/src/examples/evas-events.c | |||
@@ -0,0 +1,413 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating how to interact with canvas' (and | ||
3 | * its objects') events and other canvas operations. | ||
4 | * | ||
5 | * You'll need at least one engine built for it (excluding the buffer | ||
6 | * one) and the png image loader also built. See stdout/stderr for | ||
7 | * output. | ||
8 | * | ||
9 | * @verbatim | ||
10 | * gcc -o evas-events evas-events.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
11 | * @endverbatim | ||
12 | */ | ||
13 | |||
14 | #ifdef HAVE_CONFIG_H | ||
15 | |||
16 | #include "config.h" | ||
17 | #else | ||
18 | |||
19 | #define PACKAGE_EXAMPLES_DIR "." | ||
20 | #define __UNUSED__ | ||
21 | |||
22 | #endif | ||
23 | |||
24 | #include <Ecore.h> | ||
25 | #include <Ecore_Evas.h> | ||
26 | #include <stdio.h> | ||
27 | #include <errno.h> | ||
28 | |||
29 | #define WIDTH (320) | ||
30 | #define HEIGHT (240) | ||
31 | |||
32 | static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; | ||
33 | |||
34 | static const char *commands = \ | ||
35 | "commands are:\n" | ||
36 | "\ta - toggle animation timer\n" | ||
37 | "\tc - cycle between focus and key grabs for key input\n" | ||
38 | "\td - delete canvas callbacks\n" | ||
39 | "\tf - freeze input for 3 seconds\n" | ||
40 | "\tp - toggle precise point collision detection on image\n" | ||
41 | "\tControl + o - add an obscured rectangle\n" | ||
42 | "\th - print help\n"; | ||
43 | |||
44 | struct test_data | ||
45 | { | ||
46 | Ecore_Evas *ee; | ||
47 | Evas *canvas; | ||
48 | Evas_Object *img, *bg; | ||
49 | Ecore_Timer *resize_timer, *freeze_timer; | ||
50 | Eina_Bool obscured, focus; | ||
51 | }; | ||
52 | |||
53 | static struct test_data d = {0}; | ||
54 | |||
55 | /* here to keep our example's window size and background image's | ||
56 | * size in synchrony */ | ||
57 | static void | ||
58 | _canvas_resize_cb(Ecore_Evas *ee) | ||
59 | { | ||
60 | int w, h; | ||
61 | |||
62 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
63 | evas_object_resize(d.bg, w, h); | ||
64 | } | ||
65 | |||
66 | /* called when our rectangle gets focus */ | ||
67 | static void | ||
68 | _object_focus_in_cb(void *data __UNUSED__, | ||
69 | Evas *e, | ||
70 | void *event_info) | ||
71 | { | ||
72 | fprintf(stdout, "An object got focused: %s\n", | ||
73 | evas_object_name_get(event_info)); | ||
74 | |||
75 | fprintf(stdout, "Let's recheck it: %s\n", | ||
76 | evas_object_name_get(evas_focus_get(e))); | ||
77 | |||
78 | fprintf(stdout, "And again: %s\n", evas_object_focus_get(event_info) ? | ||
79 | "OK!" : "Oops, something is bad."); | ||
80 | } | ||
81 | |||
82 | /* render flush callback */ | ||
83 | static void | ||
84 | _render_flush_cb(void *data __UNUSED__, | ||
85 | Evas *e __UNUSED__, | ||
86 | void *event_info __UNUSED__) | ||
87 | { | ||
88 | fprintf(stdout, "Canvas is about to flush its rendering pipeline!\n"); | ||
89 | } | ||
90 | |||
91 | /* put some action in the canvas */ | ||
92 | static Eina_Bool | ||
93 | _resize_cb(void *data __UNUSED__) | ||
94 | { | ||
95 | int w, h, cw, ch; | ||
96 | |||
97 | evas_object_geometry_get(d.img, NULL, NULL, &w, &h); | ||
98 | ecore_evas_geometry_get(d.ee, NULL, NULL, &cw, &ch); | ||
99 | |||
100 | if (w < cw) | ||
101 | evas_object_resize(d.img, cw, ch); | ||
102 | else | ||
103 | evas_object_resize(d.img, cw / 2, ch / 2); | ||
104 | |||
105 | return EINA_TRUE; /* re-issue the timer */ | ||
106 | } | ||
107 | |||
108 | /* let's have our events back */ | ||
109 | static Eina_Bool | ||
110 | _thaw_cb(void *data __UNUSED__) | ||
111 | { | ||
112 | fprintf(stdout, "Canvas was frozen %d times, now thawing.\n", | ||
113 | evas_event_freeze_get(d.canvas)); | ||
114 | evas_event_thaw(d.canvas); | ||
115 | return EINA_FALSE; /* do not re-issue the timer */ | ||
116 | } | ||
117 | |||
118 | /* mouse enters the object's area */ | ||
119 | static void | ||
120 | _on_mouse_in(void *data __UNUSED__, | ||
121 | Evas *evas __UNUSED__, | ||
122 | Evas_Object *o __UNUSED__, | ||
123 | void *einfo __UNUSED__) | ||
124 | { | ||
125 | fprintf(stdout, "Enlightenment logo has had the mouse in.\n"); | ||
126 | } | ||
127 | |||
128 | static void | ||
129 | _on_mouse_out(void *data __UNUSED__, | ||
130 | Evas *evas __UNUSED__, | ||
131 | Evas_Object *o __UNUSED__, | ||
132 | void *einfo __UNUSED__) | ||
133 | { | ||
134 | fprintf(stdout, "Enlightenment logo has had the mouse out.\n"); | ||
135 | } /* mouse exits the object's area */ | ||
136 | |||
137 | /* examine the keys pressed */ | ||
138 | static void | ||
139 | _on_keydown(void *data __UNUSED__, | ||
140 | Evas *evas, | ||
141 | Evas_Object *o __UNUSED__, | ||
142 | void *einfo) | ||
143 | { | ||
144 | const Evas_Modifier *mods; | ||
145 | Evas_Event_Key_Down *ev = einfo; | ||
146 | |||
147 | fprintf(stdout, "We've got key input: %s\n", ev->keyname); | ||
148 | fprintf(stdout, "It actually came from %s\n", d.focus ? | ||
149 | "focus" : "key grab"); | ||
150 | |||
151 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
152 | { | ||
153 | fprintf(stdout, commands); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | if (strcmp(ev->keyname, "a") == 0) /* toggle animation timer */ | ||
158 | { | ||
159 | if (d.resize_timer != NULL) | ||
160 | { | ||
161 | fprintf(stdout, "Stopping animation timer\n"); | ||
162 | ecore_timer_del(d.resize_timer); | ||
163 | d.resize_timer = NULL; | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | fprintf(stdout, "Re-issuing animation timer\n"); | ||
168 | d.resize_timer = ecore_timer_add(2, _resize_cb, NULL); | ||
169 | } | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (strcmp(ev->keyname, "c") == 0) /* cycle between focus and key | ||
174 | * grabs for key input */ | ||
175 | { | ||
176 | Eina_Bool ret; | ||
177 | Evas_Modifier_Mask mask = | ||
178 | evas_key_modifier_mask_get(d.canvas, "Control"); | ||
179 | |||
180 | fprintf(stdout, "Switching to %s for key input\n", d.focus ? | ||
181 | "key grabs" : "focus"); | ||
182 | |||
183 | if (d.focus) | ||
184 | { | ||
185 | evas_object_focus_set(d.bg, EINA_FALSE); | ||
186 | fprintf(stdout, "Focused object is now %s\n", | ||
187 | evas_focus_get(d.canvas) ? | ||
188 | "still valid! Something went wrong." : "none."); | ||
189 | |||
190 | ret = evas_object_key_grab(d.bg, "a", 0, 0, EINA_TRUE); | ||
191 | if (!ret) | ||
192 | { | ||
193 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
194 | goto c_end; | ||
195 | } | ||
196 | ret = evas_object_key_grab(d.bg, "c", 0, 0, EINA_TRUE); | ||
197 | if (!ret) | ||
198 | { | ||
199 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
200 | goto c_end; | ||
201 | } | ||
202 | ret = evas_object_key_grab(d.bg, "d", 0, 0, EINA_TRUE); | ||
203 | if (!ret) | ||
204 | { | ||
205 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
206 | goto c_end; | ||
207 | } | ||
208 | ret = evas_object_key_grab(d.bg, "f", 0, 0, EINA_TRUE); | ||
209 | if (!ret) | ||
210 | { | ||
211 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
212 | goto c_end; | ||
213 | } | ||
214 | ret = evas_object_key_grab(d.bg, "p", 0, 0, EINA_TRUE); | ||
215 | if (!ret) | ||
216 | { | ||
217 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
218 | goto c_end; | ||
219 | } | ||
220 | ret = evas_object_key_grab(d.bg, "o", mask, 0, EINA_TRUE); | ||
221 | if (!ret) | ||
222 | { | ||
223 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
224 | goto c_end; | ||
225 | } | ||
226 | ret = evas_object_key_grab(d.bg, "h", 0, 0, EINA_TRUE); | ||
227 | if (!ret) | ||
228 | { | ||
229 | fprintf(stdout, "Something went wrong with key grabs.\n"); | ||
230 | goto c_end; | ||
231 | } | ||
232 | } | ||
233 | else /* got here by key grabs */ | ||
234 | { | ||
235 | evas_object_key_ungrab(d.bg, "a", 0, 0); | ||
236 | evas_object_key_ungrab(d.bg, "c", 0, 0); | ||
237 | evas_object_key_ungrab(d.bg, "d", 0, 0); | ||
238 | evas_object_key_ungrab(d.bg, "f", 0, 0); | ||
239 | evas_object_key_ungrab(d.bg, "p", 0, 0); | ||
240 | evas_object_key_ungrab(d.bg, "o", mask, 0); | ||
241 | evas_object_key_ungrab(d.bg, "h", 0, 0); | ||
242 | |||
243 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
244 | } | ||
245 | |||
246 | c_end: | ||
247 | d.focus = !d.focus; | ||
248 | |||
249 | return; | ||
250 | } | ||
251 | |||
252 | if (strcmp(ev->keyname, "d") == 0) /* delete canvas' callbacks */ | ||
253 | { | ||
254 | fprintf(stdout, "Deleting canvas event callbacks\n"); | ||
255 | evas_event_callback_del_full(evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, | ||
256 | _render_flush_cb, NULL); | ||
257 | evas_event_callback_del_full( | ||
258 | evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, | ||
259 | _object_focus_in_cb, NULL); | ||
260 | return; | ||
261 | } | ||
262 | |||
263 | if (strcmp(ev->keyname, "f") == 0) /* freeze input for 3 seconds */ | ||
264 | { | ||
265 | fprintf(stdout, "Freezing input for 3 seconds\n"); | ||
266 | evas_event_freeze(evas); | ||
267 | d.freeze_timer = ecore_timer_add(3, _thaw_cb, NULL); | ||
268 | return; | ||
269 | } | ||
270 | |||
271 | if (strcmp(ev->keyname, "p") == 0) /* toggle precise point | ||
272 | * collision detection */ | ||
273 | { | ||
274 | Eina_Bool precise = evas_object_precise_is_inside_get(d.img); | ||
275 | |||
276 | fprintf(stdout, "Toggling precise point collision detection %s on" | ||
277 | " Enlightenment logo\n", precise ? "off" : "on"); | ||
278 | evas_object_precise_is_inside_set(d.img, !precise); | ||
279 | |||
280 | return; | ||
281 | } | ||
282 | |||
283 | mods = evas_key_modifier_get(evas); | ||
284 | if (evas_key_modifier_is_set(mods, "Control") && | ||
285 | (strcmp(ev->keyname, "o") == 0)) /* add an obscured | ||
286 | * rectangle to the middle | ||
287 | * of the canvas */ | ||
288 | { | ||
289 | fprintf(stdout, "Toggling obscured rectangle on canvas\n"); | ||
290 | if (!d.obscured) | ||
291 | { | ||
292 | int w, h; | ||
293 | evas_output_viewport_get(evas, NULL, NULL, &w, &h); | ||
294 | evas_obscured_rectangle_add(evas, w / 4, h / 4, w / 2, h / 2); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | int w, h; | ||
299 | Eina_Rectangle *rect; | ||
300 | Eina_List *updates, *l; | ||
301 | |||
302 | evas_output_viewport_get(evas, NULL, NULL, &w, &h); | ||
303 | evas_obscured_clear(evas); | ||
304 | |||
305 | /* we have to flag a damage region here because | ||
306 | * evas_obscured_clear() doesn't change the canvas' | ||
307 | * state. we'd have to wait for an animation step, for | ||
308 | * example, to get the result, without it */ | ||
309 | evas_damage_rectangle_add(evas, 0, 0, w, h); | ||
310 | |||
311 | updates = evas_render_updates(evas); | ||
312 | |||
313 | EINA_LIST_FOREACH(updates, l, rect) | ||
314 | { | ||
315 | fprintf(stdout, "Rectangle (%d, %d, %d, %d) on canvas got a" | ||
316 | " rendering update.\n", rect->x, rect->y, | ||
317 | rect->w, | ||
318 | rect->h); | ||
319 | } | ||
320 | evas_render_updates_free(updates); | ||
321 | } | ||
322 | d.obscured = !d.obscured; | ||
323 | } /* end of obscured region command */ | ||
324 | } | ||
325 | |||
326 | int | ||
327 | main(void) | ||
328 | { | ||
329 | int err; | ||
330 | |||
331 | if (!ecore_evas_init()) | ||
332 | return EXIT_FAILURE; | ||
333 | |||
334 | /* this will give you a window with an Evas canvas under the first | ||
335 | * engine available */ | ||
336 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
337 | if (!d.ee) | ||
338 | goto error; | ||
339 | |||
340 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
341 | ecore_evas_show(d.ee); | ||
342 | |||
343 | /* the canvas pointer, de facto */ | ||
344 | d.canvas = ecore_evas_get(d.ee); | ||
345 | |||
346 | evas_event_callback_add(d.canvas, EVAS_CALLBACK_RENDER_FLUSH_PRE, | ||
347 | _render_flush_cb, NULL); | ||
348 | if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) | ||
349 | { | ||
350 | fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); | ||
351 | goto panic; | ||
352 | } | ||
353 | |||
354 | evas_event_callback_add(d.canvas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, | ||
355 | _object_focus_in_cb, NULL); | ||
356 | if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) | ||
357 | { | ||
358 | fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); | ||
359 | goto panic; | ||
360 | } /* two canvas event callbacks */ | ||
361 | |||
362 | d.bg = evas_object_rectangle_add(d.canvas); | ||
363 | evas_object_name_set(d.bg, "our dear rectangle"); | ||
364 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
365 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
366 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
367 | evas_object_show(d.bg); | ||
368 | |||
369 | evas_object_focus_set(d.bg, EINA_TRUE); /* so we get input events */ | ||
370 | d.focus = EINA_TRUE; | ||
371 | |||
372 | evas_object_event_callback_add( | ||
373 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
374 | if (evas_alloc_error() != EVAS_ALLOC_ERROR_NONE) | ||
375 | { | ||
376 | fprintf(stderr, "ERROR: Callback registering failed! Aborting.\n"); | ||
377 | goto panic; | ||
378 | } | ||
379 | |||
380 | d.img = evas_object_image_filled_add(d.canvas); | ||
381 | evas_object_image_file_set(d.img, img_path, NULL); | ||
382 | err = evas_object_image_load_error_get(d.img); | ||
383 | if (err != EVAS_LOAD_ERROR_NONE) | ||
384 | { | ||
385 | goto panic; | ||
386 | } | ||
387 | else | ||
388 | { | ||
389 | evas_object_move(d.img, 0, 0); | ||
390 | evas_object_resize(d.img, WIDTH, HEIGHT); | ||
391 | evas_object_show(d.img); | ||
392 | evas_object_event_callback_add( | ||
393 | d.img, EVAS_CALLBACK_MOUSE_IN, _on_mouse_in, NULL); | ||
394 | evas_object_event_callback_add( | ||
395 | d.img, EVAS_CALLBACK_MOUSE_OUT, _on_mouse_out, NULL); | ||
396 | } | ||
397 | |||
398 | d.resize_timer = ecore_timer_add(2, _resize_cb, NULL); | ||
399 | |||
400 | fprintf(stdout, commands); | ||
401 | ecore_main_loop_begin(); | ||
402 | |||
403 | ecore_evas_free(d.ee); | ||
404 | ecore_evas_shutdown(); | ||
405 | return 0; | ||
406 | |||
407 | error: | ||
408 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
409 | " up to ecore-evas for this example to run properly.\n"); | ||
410 | panic: | ||
411 | ecore_evas_shutdown(); | ||
412 | return -1; | ||
413 | } | ||
diff --git a/libraries/evas/src/examples/evas-hints.c b/libraries/evas/src/examples/evas-hints.c new file mode 100644 index 0000000..c42444c --- /dev/null +++ b/libraries/evas/src/examples/evas-hints.c | |||
@@ -0,0 +1,375 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating <b>alignment, minimum size, maximum | ||
3 | * size, padding and weight</b> hints on objects. | ||
4 | * | ||
5 | * To exemplify those hints, whe use the Evas box object, one of the | ||
6 | * managers using size hints to layout its children. | ||
7 | * | ||
8 | * You'll need at least one engine built for it (excluding the buffer | ||
9 | * one) and the png image loader also built. See stdout/stderr for | ||
10 | * output. | ||
11 | * | ||
12 | * @verbatim | ||
13 | * gcc -o evas-events evas-events.c `pkg-config --libs --cflags ecore-evas` | ||
14 | * @endverbatim | ||
15 | */ | ||
16 | |||
17 | #ifdef HAVE_CONFIG_H | ||
18 | #include "config.h" | ||
19 | #endif | ||
20 | |||
21 | #include <Ecore.h> | ||
22 | #include <Ecore_Evas.h> | ||
23 | |||
24 | #include <stdlib.h> | ||
25 | #include <stdio.h> | ||
26 | #include <string.h> | ||
27 | |||
28 | #define WIDTH 320 | ||
29 | #define HEIGHT 480 | ||
30 | |||
31 | static const char commands[] = \ | ||
32 | "commands are:\n" | ||
33 | "\tShift + a - change alignment hints on top rectangle\n" | ||
34 | "\tShift + m - change min. size hint on top rectangle\n" | ||
35 | "\tShift + n - change max. size hint on top rectangle\n" | ||
36 | "\tShift + p - change padding hints on top rectangle\n" | ||
37 | "\tShift + w - change weight hints on top rectangle\n\n" | ||
38 | "\tControl + a - change alignment hints on bottom rectangle\n" | ||
39 | "\tControl + m - change min. size hint on bottom rectangle\n" | ||
40 | "\tControl + n - change max. size hint on bottom rectangle\n" | ||
41 | "\tControl + p - change padding hints on bottom rectangle\n" | ||
42 | "\tControl + w - change weight hints on bottom rectangle\n\n" | ||
43 | "\ts - print current hints information\n" | ||
44 | "\th - print help\n"; | ||
45 | |||
46 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
47 | |||
48 | struct coord_tuple | ||
49 | { | ||
50 | Evas_Coord w, h; | ||
51 | }; | ||
52 | |||
53 | struct weight_tuple | ||
54 | { | ||
55 | double x, y; | ||
56 | }; | ||
57 | |||
58 | struct padding_tuple | ||
59 | { | ||
60 | Evas_Coord l, r, t, b; | ||
61 | }; | ||
62 | |||
63 | struct rect_data | ||
64 | { | ||
65 | struct coord_tuple *min_ptr; | ||
66 | struct coord_tuple min[4]; | ||
67 | |||
68 | struct coord_tuple *max_ptr; | ||
69 | struct coord_tuple max[4]; | ||
70 | |||
71 | struct weight_tuple *align_ptr; | ||
72 | struct weight_tuple align[3]; | ||
73 | |||
74 | struct weight_tuple *weight_ptr; | ||
75 | struct weight_tuple weight[3]; | ||
76 | |||
77 | struct padding_tuple *padding_ptr; | ||
78 | struct padding_tuple padding[3]; | ||
79 | }; | ||
80 | |||
81 | struct test_data | ||
82 | { | ||
83 | Ecore_Evas *ee; | ||
84 | Evas *canvas; | ||
85 | struct rect_data t_data, b_data; | ||
86 | Evas_Object *bg, *box, *t_rect, *b_rect, *border; | ||
87 | }; | ||
88 | |||
89 | static struct test_data d = {0}; | ||
90 | |||
91 | /* here just to keep our example's window size and background image's | ||
92 | * size in synchrony */ | ||
93 | static void | ||
94 | _canvas_resize_cb(Ecore_Evas *ee) | ||
95 | { | ||
96 | int w, h; | ||
97 | |||
98 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
99 | evas_object_resize(d.bg, w, h); | ||
100 | |||
101 | evas_object_move(d.box, (w / 4), (h / 4)); | ||
102 | evas_object_resize(d.box, (w / 2), (h / 2)); | ||
103 | |||
104 | evas_object_move(d.border, (w / 4) - 3, (h / 4) - 3); | ||
105 | evas_object_resize(d.border, (w / 2) + 6, (h / 2) + 6); | ||
106 | } | ||
107 | |||
108 | static void | ||
109 | _print_rect_stats(Evas_Object *rect) | ||
110 | { | ||
111 | Evas_Coord w, h, l, r, t, b; | ||
112 | double x, y; | ||
113 | |||
114 | evas_object_size_hint_align_get(rect, &x, &y); | ||
115 | fprintf(stdout, "\talign hints: h(%f), v(%f)\n", x, y); | ||
116 | |||
117 | evas_object_size_hint_min_get(rect, &w, &h); | ||
118 | fprintf(stdout, "\tmin. size hints: h(%d), v(%d)\n", w, h); | ||
119 | |||
120 | evas_object_size_hint_max_get(rect, &w, &h); | ||
121 | fprintf(stdout, "\tmax. size hints: h(%d), v(%d)\n", w, h); | ||
122 | |||
123 | evas_object_size_hint_padding_get(rect, &l, &r, &t, &b); | ||
124 | fprintf(stdout, "\tpadding hints: l(%d), r(%d), t(%d), b(%d)\n", | ||
125 | l, r, t, b); | ||
126 | |||
127 | evas_object_size_hint_weight_get(rect, &x, &y); | ||
128 | fprintf(stdout, "\tweight hints: h(%f), v(%f)\n", x, y); | ||
129 | } | ||
130 | |||
131 | /* use the following commands to interact with this example - 'h' is | ||
132 | * the key for help */ | ||
133 | static void | ||
134 | _on_keydown(void *data __UNUSED__, | ||
135 | Evas *evas __UNUSED__, | ||
136 | Evas_Object *o __UNUSED__, | ||
137 | void *einfo) | ||
138 | { | ||
139 | Evas_Event_Key_Down *ev = einfo; | ||
140 | struct rect_data *r_data = NULL; | ||
141 | const Evas_Modifier *mods; | ||
142 | Evas_Object *rect = NULL; | ||
143 | const char *name = NULL; | ||
144 | |||
145 | mods = evas_key_modifier_get(evas); | ||
146 | if (evas_key_modifier_is_set(mods, "Shift")) | ||
147 | { | ||
148 | rect = d.t_rect; | ||
149 | r_data = &d.t_data; | ||
150 | name = "top"; | ||
151 | } | ||
152 | else if (evas_key_modifier_is_set(mods, "Control")) | ||
153 | { | ||
154 | rect = d.b_rect; | ||
155 | r_data = &d.b_data; | ||
156 | name = "bottom"; | ||
157 | } | ||
158 | else if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
159 | { | ||
160 | fprintf(stdout, commands); | ||
161 | return; | ||
162 | } | ||
163 | else if (strcmp(ev->keyname, "s") == 0) /* get aspect status of the | ||
164 | * rectangles WRT size | ||
165 | * hints */ | ||
166 | { | ||
167 | fprintf(stdout, "Top rectangle:\n"); | ||
168 | _print_rect_stats(d.t_rect); | ||
169 | |||
170 | fprintf(stdout, "\nBottom rectangle:\n"); | ||
171 | _print_rect_stats(d.b_rect); | ||
172 | |||
173 | return; | ||
174 | } | ||
175 | |||
176 | if (!rect) return; | ||
177 | |||
178 | if (strcmp(ev->keyname, "a") == 0) /* alignment hints */ | ||
179 | { | ||
180 | (r_data->align_ptr)++; | ||
181 | |||
182 | if ((unsigned) | ||
183 | (((void *)(r_data->align_ptr)) - ((void *)(r_data->align))) >= | ||
184 | sizeof(r_data->align)) | ||
185 | r_data->align_ptr = r_data->align; | ||
186 | |||
187 | evas_object_size_hint_align_set( | ||
188 | rect, r_data->align_ptr->x, r_data->align_ptr->y); | ||
189 | |||
190 | fprintf(stdout, "Changing align hints for %s rect. to (%f, %f)\n", | ||
191 | name, r_data->align_ptr->x, r_data->align_ptr->y); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | if (strcmp(ev->keyname, "m") == 0) /* min. size hints */ | ||
196 | { | ||
197 | (r_data->min_ptr)++; | ||
198 | |||
199 | if ((unsigned) | ||
200 | (((void *)(r_data->min_ptr)) - ((void *)(r_data->min))) >= | ||
201 | sizeof(r_data->min)) | ||
202 | r_data->min_ptr = r_data->min; | ||
203 | |||
204 | evas_object_size_hint_min_set( | ||
205 | rect, r_data->min_ptr->w, r_data->min_ptr->h); | ||
206 | |||
207 | fprintf(stdout, "Changing min. size hints for %s rect. to (%d, %d)\n", | ||
208 | name, r_data->min_ptr->w, r_data->min_ptr->h); | ||
209 | return; | ||
210 | } | ||
211 | |||
212 | if (strcmp(ev->keyname, "n") == 0) /* max. size hints */ | ||
213 | { | ||
214 | (r_data->max_ptr)++; | ||
215 | |||
216 | if ((unsigned) | ||
217 | (((void *)(r_data->max_ptr)) - ((void *)(r_data->max))) >= | ||
218 | sizeof(r_data->max)) | ||
219 | r_data->max_ptr = r_data->max; | ||
220 | |||
221 | evas_object_size_hint_max_set( | ||
222 | rect, r_data->max_ptr->w, r_data->max_ptr->h); | ||
223 | |||
224 | fprintf(stdout, "Changing max. size hints for %s rect. to (%d, %d)\n", | ||
225 | name, r_data->max_ptr->w, r_data->max_ptr->h); | ||
226 | return; | ||
227 | } | ||
228 | |||
229 | if (strcmp(ev->keyname, "p") == 0) /* padding size hints */ | ||
230 | { | ||
231 | (r_data->padding_ptr)++; | ||
232 | |||
233 | if ((unsigned) | ||
234 | (((void *)(r_data->padding_ptr)) - ((void *)(r_data->padding))) >= | ||
235 | sizeof(r_data->padding)) | ||
236 | r_data->padding_ptr = r_data->padding; | ||
237 | |||
238 | evas_object_size_hint_padding_set( | ||
239 | rect, r_data->padding_ptr->l, r_data->padding_ptr->r, | ||
240 | r_data->padding_ptr->t, r_data->padding_ptr->b); | ||
241 | |||
242 | fprintf(stdout, "Changing padding size hints for %s rect." | ||
243 | " to (%d, %d, %d, %d)\n", | ||
244 | name, r_data->padding_ptr->l, r_data->padding_ptr->r, | ||
245 | r_data->padding_ptr->t, r_data->padding_ptr->b); | ||
246 | return; | ||
247 | } | ||
248 | |||
249 | /* experiment with weights here. keep in mind that, for the box | ||
250 | * object, only if all the children have non zero weights this hint | ||
251 | * will have an effect */ | ||
252 | if (strcmp(ev->keyname, "w") == 0) /* weight hints */ | ||
253 | { | ||
254 | (r_data->weight_ptr)++; | ||
255 | |||
256 | if ((unsigned) | ||
257 | (((void *)(r_data->weight_ptr)) - ((void *)(r_data->weight))) >= | ||
258 | sizeof(r_data->weight)) | ||
259 | r_data->weight_ptr = r_data->weight; | ||
260 | |||
261 | evas_object_size_hint_weight_set( | ||
262 | rect, r_data->weight_ptr->x, r_data->weight_ptr->y); | ||
263 | |||
264 | fprintf(stdout, "Changing weight hints for %s rect. to (%f, %f)\n", | ||
265 | name, r_data->weight_ptr->x, r_data->weight_ptr->y); | ||
266 | return; | ||
267 | } | ||
268 | } | ||
269 | |||
270 | static void | ||
271 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
272 | { | ||
273 | ecore_main_loop_quit(); | ||
274 | } | ||
275 | |||
276 | int | ||
277 | main(void) | ||
278 | { | ||
279 | if (!ecore_evas_init()) | ||
280 | return EXIT_FAILURE; | ||
281 | |||
282 | /* init values one is going to cycle through while running this | ||
283 | * example */ | ||
284 | struct rect_data init_data = \ | ||
285 | { | ||
286 | .min = {{0, 0}, {30, 30}, {100, 70}, {200, 200}}, | ||
287 | .max = {{0, 0}, {100, 100}, {100, 70}, {300, 300}}, | ||
288 | .align = {{0.0, 0.0}, {0.5, 0.5}, {1.0, 0.5}}, | ||
289 | .weight = {{0.0, 0.0}, {3, 6}, {10, 100}}, | ||
290 | .padding = {{0, 0, 0, 0}, {3, 6, 9, 12}, {10, 20, 0, 30}} | ||
291 | }; | ||
292 | |||
293 | d.t_data = init_data; | ||
294 | |||
295 | d.t_data.min_ptr = d.t_data.min + 1; | ||
296 | d.t_data.max_ptr = d.t_data.max + 1; | ||
297 | d.t_data.align_ptr = d.t_data.align; | ||
298 | d.t_data.weight_ptr = d.t_data.weight; | ||
299 | d.t_data.padding_ptr = d.t_data.padding; | ||
300 | |||
301 | d.b_data = init_data; | ||
302 | |||
303 | d.b_data.min_ptr = d.b_data.min + 1; | ||
304 | d.b_data.max_ptr = d.b_data.max + 1; | ||
305 | d.b_data.align_ptr = d.b_data.align; | ||
306 | d.b_data.weight_ptr = d.b_data.weight; | ||
307 | d.b_data.padding_ptr = d.b_data.padding; | ||
308 | |||
309 | /* this will give you a window with an Evas canvas under the first | ||
310 | * engine available */ | ||
311 | d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | ||
312 | if (!d.ee) | ||
313 | goto error; | ||
314 | |||
315 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
316 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
317 | ecore_evas_show(d.ee); | ||
318 | |||
319 | /* the canvas pointer, de facto */ | ||
320 | d.canvas = ecore_evas_get(d.ee); | ||
321 | |||
322 | d.bg = evas_object_rectangle_add(d.canvas); | ||
323 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
324 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
325 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
326 | evas_object_show(d.bg); | ||
327 | |||
328 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
329 | evas_object_event_callback_add( | ||
330 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
331 | |||
332 | /* Evas box with vertical layout */ | ||
333 | d.box = evas_object_box_add(d.canvas); | ||
334 | evas_object_box_layout_set( | ||
335 | d.box, evas_object_box_layout_vertical, NULL, NULL); | ||
336 | evas_object_show(d.box); | ||
337 | |||
338 | /* this is a border around the box, container of the rectangles we | ||
339 | * are going to experiment with (changing some size hints). this | ||
340 | * way you can see how the container relates to the children */ | ||
341 | d.border = evas_object_image_filled_add(d.canvas); | ||
342 | evas_object_image_file_set(d.border, border_img_path, NULL); | ||
343 | evas_object_image_border_set(d.border, 3, 3, 3, 3); | ||
344 | evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); | ||
345 | evas_object_show(d.border); | ||
346 | |||
347 | d.t_rect = evas_object_rectangle_add(d.canvas); | ||
348 | evas_object_color_set(d.t_rect, 0, 0, 255, 255); | ||
349 | |||
350 | evas_object_size_hint_min_set( | ||
351 | d.t_rect, d.t_data.min_ptr->w, d.t_data.min_ptr->h); | ||
352 | evas_object_show(d.t_rect); | ||
353 | evas_object_box_append(d.box, d.t_rect); | ||
354 | |||
355 | d.b_rect = evas_object_rectangle_add(d.canvas); | ||
356 | evas_object_color_set(d.b_rect, 0, 255, 0, 255); | ||
357 | |||
358 | evas_object_size_hint_min_set( | ||
359 | d.b_rect, d.b_data.min_ptr->w, d.b_data.min_ptr->h); | ||
360 | evas_object_show(d.b_rect); | ||
361 | evas_object_box_append(d.box, d.b_rect); | ||
362 | |||
363 | _canvas_resize_cb(d.ee); | ||
364 | |||
365 | fprintf(stdout, commands); | ||
366 | ecore_main_loop_begin(); | ||
367 | ecore_evas_shutdown(); | ||
368 | return 0; | ||
369 | |||
370 | error: | ||
371 | fprintf(stderr, "You got to have at least one evas engine built and linked" | ||
372 | " up to ecore-evas for this example to run properly.\n"); | ||
373 | return -1; | ||
374 | } | ||
375 | |||
diff --git a/libraries/evas/src/examples/evas-images.c b/libraries/evas/src/examples/evas-images.c new file mode 100644 index 0000000..a8cf3c4 --- /dev/null +++ b/libraries/evas/src/examples/evas-images.c | |||
@@ -0,0 +1,353 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating some image objects functions | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one) and the png image loader also built. See stdout/stderr for | ||
6 | * output. | ||
7 | * | ||
8 | * @verbatim | ||
9 | * gcc -o evas-images evas-images.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
10 | * @endverbatim | ||
11 | */ | ||
12 | |||
13 | #ifdef HAVE_CONFIG_H | ||
14 | |||
15 | #include "config.h" | ||
16 | #else | ||
17 | |||
18 | #define PACKAGE_EXAMPLES_DIR "." | ||
19 | #define __UNUSED__ | ||
20 | |||
21 | #endif | ||
22 | |||
23 | #include <Ecore.h> | ||
24 | #include <Ecore_Evas.h> | ||
25 | #include <stdio.h> | ||
26 | #include <errno.h> | ||
27 | |||
28 | #define WIDTH (320) | ||
29 | #define HEIGHT (240) | ||
30 | |||
31 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
32 | static const char *valid_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; | ||
33 | static const char *bogus_path = "/tmp/non-existent-220986.png"; | ||
34 | static const char *commands = \ | ||
35 | "commands are:\n" | ||
36 | "\tx - change image's x fill coordinate\n" | ||
37 | "\ty - change image's y fill coordinate\n" | ||
38 | "\tw - change image's w fill size\n" | ||
39 | "\te - change image's h fill size\n" | ||
40 | "\tf - toggle image filled property (overrides fill)\n" | ||
41 | "\ta - toggle image's alpha channel usage\n" | ||
42 | "\tm - toggle border's smooth scaling\n" | ||
43 | "\tt - change border's thickness\n" | ||
44 | "\tb - change border's center region aspect\n" | ||
45 | "\tc - change border's scaling factor\n" | ||
46 | "\ts - print image's fill property status\n" | ||
47 | "\th - print help\n"; | ||
48 | |||
49 | struct test_data | ||
50 | { | ||
51 | Ecore_Evas *ee; | ||
52 | Evas *evas; | ||
53 | Evas_Object *img1, *img2, *bg, *border; | ||
54 | }; | ||
55 | |||
56 | static struct test_data d = {0}; | ||
57 | |||
58 | static void | ||
59 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
60 | { | ||
61 | ecore_main_loop_quit(); | ||
62 | } | ||
63 | |||
64 | /* here just to keep our example's window size and background image's | ||
65 | * size in synchrony */ | ||
66 | static void | ||
67 | _canvas_resize_cb(Ecore_Evas *ee) | ||
68 | { | ||
69 | int w, h; | ||
70 | |||
71 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
72 | evas_object_resize(d.bg, w, h); | ||
73 | } | ||
74 | |||
75 | static const char * | ||
76 | _border_fill_mode_to_str(Evas_Border_Fill_Mode mode) | ||
77 | { | ||
78 | switch (mode) | ||
79 | { | ||
80 | case EVAS_BORDER_FILL_NONE: | ||
81 | return "none"; | ||
82 | |||
83 | case EVAS_BORDER_FILL_DEFAULT: | ||
84 | return "default"; | ||
85 | |||
86 | case EVAS_BORDER_FILL_SOLID: | ||
87 | return "solid"; | ||
88 | |||
89 | default: | ||
90 | return "invalid"; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | static void | ||
95 | _on_keydown(void *data __UNUSED__, | ||
96 | Evas *evas __UNUSED__, | ||
97 | Evas_Object *o __UNUSED__, | ||
98 | void *einfo) | ||
99 | { | ||
100 | Evas_Event_Key_Down *ev = einfo; | ||
101 | |||
102 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
103 | { | ||
104 | fprintf(stdout, commands); | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | if (strcmp(ev->keyname, "m") == 0) /* toggle border image's smooth scaling */ | ||
109 | { | ||
110 | Eina_Bool smooth_scale = evas_object_image_smooth_scale_get(d.border); | ||
111 | |||
112 | evas_object_image_smooth_scale_set(d.border, !smooth_scale); | ||
113 | |||
114 | fprintf(stdout, "Image's border is now %s smooth scaling\n", | ||
115 | smooth_scale ? "without" : "with"); | ||
116 | |||
117 | return; | ||
118 | } | ||
119 | |||
120 | if (strcmp(ev->keyname, "t") == 0) /* change border's thickness */ | ||
121 | { | ||
122 | int l, r, t, b; | ||
123 | |||
124 | evas_object_image_border_get(d.border, &l, &r, &t, &b); | ||
125 | |||
126 | l = (l + 3) % 9; | ||
127 | r = (r + 3) % 9; | ||
128 | t = (t + 3) % 9; | ||
129 | b = (b + 3) % 9; | ||
130 | |||
131 | evas_object_image_border_set(d.border, l, r, t, b); | ||
132 | |||
133 | fprintf(stdout, "Image's border thickness is now %d\n", l); | ||
134 | |||
135 | return; | ||
136 | } | ||
137 | |||
138 | if (strcmp(ev->keyname, "c") == 0) /* change border's scaling factor */ | ||
139 | { | ||
140 | double scale = evas_object_image_border_scale_get(d.border); | ||
141 | |||
142 | scale *= 2; | ||
143 | if (scale > 4.0) scale = 1.0; | ||
144 | |||
145 | evas_object_image_border_scale_set(d.border, scale); | ||
146 | |||
147 | fprintf(stdout, "Image's border scaling factor is now %f\n", scale); | ||
148 | |||
149 | return; | ||
150 | } | ||
151 | |||
152 | if (strcmp(ev->keyname, "b") == 0) /* change border's center | ||
153 | * region's aspect */ | ||
154 | { | ||
155 | Eina_Bool fill = \ | ||
156 | evas_object_image_border_center_fill_get(d.border); | ||
157 | |||
158 | fill = (fill + 1) % 3; | ||
159 | |||
160 | evas_object_image_border_center_fill_set(d.border, fill); | ||
161 | |||
162 | fprintf(stdout, "Image's border center region aspect is now \"%s\"\n", | ||
163 | _border_fill_mode_to_str(fill)); | ||
164 | |||
165 | return; | ||
166 | } | ||
167 | |||
168 | if (strcmp(ev->keyname, "a") == 0) /* toggle alpha channel usage */ | ||
169 | { | ||
170 | Eina_Bool alpha = evas_object_image_alpha_get(d.img1); | ||
171 | |||
172 | evas_object_image_alpha_set(d.img1, !alpha); | ||
173 | |||
174 | fprintf(stdout, "Image's alpha channel is now %s\n", | ||
175 | alpha ? "off" : "on"); | ||
176 | |||
177 | return; | ||
178 | } | ||
179 | |||
180 | if (strcmp(ev->keyname, "f") == 0) /* toggle filled property */ | ||
181 | { | ||
182 | Eina_Bool filled = evas_object_image_filled_get(d.img1); | ||
183 | |||
184 | evas_object_image_filled_set(d.img1, !filled); | ||
185 | |||
186 | fprintf(stdout, "Image's x filled property is now %s\n", | ||
187 | filled ? "off" : "on"); | ||
188 | |||
189 | return; | ||
190 | } | ||
191 | |||
192 | if (strcmp(ev->keyname, "x") == 0) /* change x fill coordinate */ | ||
193 | { | ||
194 | Evas_Coord x, y, w, h; | ||
195 | |||
196 | evas_object_image_fill_get(d.img1, &x, &y, &w, &h); | ||
197 | x = (x + 20) % (WIDTH / 2); | ||
198 | evas_object_image_fill_set(d.img1, x, y, w, h); | ||
199 | |||
200 | fprintf(stdout, "Image's x fill coordinate changed to %d\n", x); | ||
201 | |||
202 | return; | ||
203 | } | ||
204 | |||
205 | if (strcmp(ev->keyname, "y") == 0) /* change y fill coordinate */ | ||
206 | { | ||
207 | Evas_Coord x, y, w, h; | ||
208 | |||
209 | evas_object_image_fill_get(d.img1, &x, &y, &w, &h); | ||
210 | y = (y + 20) % (HEIGHT / 2); | ||
211 | evas_object_image_fill_set(d.img1, x, y, w, h); | ||
212 | |||
213 | fprintf(stdout, "Image's y fill coordinate changed to %d\n", y); | ||
214 | |||
215 | return; | ||
216 | } | ||
217 | |||
218 | if (strcmp(ev->keyname, "w") == 0) /* change w fill size */ | ||
219 | { | ||
220 | Evas_Coord x, y, w, h; | ||
221 | |||
222 | evas_object_image_fill_get(d.img1, &x, &y, &w, &h); | ||
223 | if (w == (WIDTH / 4)) w = (WIDTH / 2); | ||
224 | else if (w == WIDTH / 2) w = WIDTH; | ||
225 | else w = (WIDTH / 4); | ||
226 | evas_object_image_fill_set(d.img1, x, y, w, h); | ||
227 | |||
228 | fprintf(stdout, "Image's w fill size changed to %d\n", w); | ||
229 | |||
230 | return; | ||
231 | } | ||
232 | |||
233 | if (strcmp(ev->keyname, "e") == 0) /* change h fill size */ | ||
234 | { | ||
235 | Evas_Coord x, y, w, h; | ||
236 | |||
237 | evas_object_image_fill_get(d.img1, &x, &y, &w, &h); | ||
238 | if (h == (HEIGHT / 4)) h = (HEIGHT / 2); | ||
239 | else if (h == HEIGHT / 2) h = HEIGHT; | ||
240 | else h = (HEIGHT / 4); | ||
241 | evas_object_image_fill_set(d.img1, x, y, w, h); | ||
242 | |||
243 | fprintf(stdout, "Image's h fill size changed to %d\n", h); | ||
244 | |||
245 | return; | ||
246 | } | ||
247 | |||
248 | if (strcmp(ev->keyname, "s") == 0) /* status */ | ||
249 | { | ||
250 | Evas_Coord x, y, w, h; | ||
251 | |||
252 | evas_object_image_fill_get(d.img1, &x, &y, &w, &h); | ||
253 | |||
254 | fprintf(stdout, "Image has fill properties set to: %d, %d, %d, %d\n", | ||
255 | x, y, w, h); | ||
256 | |||
257 | return; | ||
258 | } | ||
259 | } | ||
260 | |||
261 | int | ||
262 | main(void) | ||
263 | { | ||
264 | int err; | ||
265 | |||
266 | if (!ecore_evas_init()) | ||
267 | return EXIT_FAILURE; | ||
268 | |||
269 | /* this will give you a window with an Evas canvas under the first | ||
270 | * engine available */ | ||
271 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
272 | if (!d.ee) | ||
273 | goto error; | ||
274 | |||
275 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
276 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
277 | ecore_evas_show(d.ee); | ||
278 | |||
279 | /* the canvas pointer, de facto */ | ||
280 | d.evas = ecore_evas_get(d.ee); | ||
281 | |||
282 | d.bg = evas_object_rectangle_add(d.evas); | ||
283 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
284 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
285 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
286 | evas_object_show(d.bg); | ||
287 | |||
288 | d.img1 = evas_object_image_add(d.evas); | ||
289 | evas_object_image_file_set(d.img1, valid_path, NULL); | ||
290 | err = evas_object_image_load_error_get(d.img1); | ||
291 | if (err != EVAS_LOAD_ERROR_NONE) | ||
292 | { | ||
293 | fprintf(stderr, "could not load image '%s'. error string is \"%s\"\n", | ||
294 | valid_path, evas_load_error_str(err)); | ||
295 | } | ||
296 | else | ||
297 | { | ||
298 | fprintf(stdout, | ||
299 | "loaded image '%s' with succes! error string is \"%s\"\n", | ||
300 | valid_path, evas_load_error_str(err)); | ||
301 | |||
302 | evas_object_move(d.img1, 3, 3); | ||
303 | evas_object_image_fill_set(d.img1, 0, 0, WIDTH / 2, HEIGHT / 2); | ||
304 | evas_object_resize(d.img1, WIDTH / 2, HEIGHT / 2); | ||
305 | evas_object_show(d.img1); | ||
306 | |||
307 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
308 | evas_object_event_callback_add( | ||
309 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
310 | } | ||
311 | |||
312 | /* this is a border around the image above, here just to emphasize | ||
313 | * its geometry */ | ||
314 | d.border = evas_object_image_filled_add(d.evas); | ||
315 | evas_object_image_file_set(d.border, border_img_path, NULL); | ||
316 | evas_object_image_border_set(d.border, 3, 3, 3, 3); | ||
317 | evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); | ||
318 | |||
319 | evas_object_move(d.border, 0, 0); | ||
320 | evas_object_resize(d.border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); | ||
321 | evas_object_show(d.border); | ||
322 | |||
323 | /* image loading will fail for this one -- unless one cheats and | ||
324 | * puts a valid image on that path */ | ||
325 | d.img2 = evas_object_image_add(d.evas); | ||
326 | evas_object_image_file_set(d.img2, bogus_path, NULL); | ||
327 | err = evas_object_image_load_error_get(d.img2); | ||
328 | if (err != EVAS_LOAD_ERROR_NONE) | ||
329 | { | ||
330 | fprintf(stderr, "could not load image '%s': error string is \"%s\"\n", | ||
331 | bogus_path, evas_load_error_str(err)); | ||
332 | } | ||
333 | else | ||
334 | { | ||
335 | evas_object_move(d.img2, WIDTH / 2, HEIGHT / 2); | ||
336 | evas_object_image_fill_set(d.img2, 0, 0, WIDTH / 2, HEIGHT / 2); | ||
337 | evas_object_resize(d.img2, WIDTH / 2, HEIGHT / 2); | ||
338 | evas_object_show(d.img2); | ||
339 | } | ||
340 | |||
341 | fprintf(stdout, commands); | ||
342 | ecore_main_loop_begin(); | ||
343 | |||
344 | ecore_evas_free(d.ee); | ||
345 | ecore_evas_shutdown(); | ||
346 | return 0; | ||
347 | |||
348 | error: | ||
349 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
350 | " up to ecore-evas for this example to run properly.\n"); | ||
351 | ecore_evas_shutdown(); | ||
352 | return -1; | ||
353 | } | ||
diff --git a/libraries/evas/src/examples/evas-images2.c b/libraries/evas/src/examples/evas-images2.c new file mode 100644 index 0000000..ba7766c --- /dev/null +++ b/libraries/evas/src/examples/evas-images2.c | |||
@@ -0,0 +1,204 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating some image objects functions | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one) and the png image loader/saver also built. See stdout/stderr | ||
6 | * for output. | ||
7 | * | ||
8 | * @verbatim | ||
9 | * gcc -o evas-images2 evas-images2.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
10 | * @endverbatim | ||
11 | */ | ||
12 | |||
13 | #ifdef HAVE_CONFIG_H | ||
14 | |||
15 | #include "config.h" | ||
16 | #else | ||
17 | |||
18 | #define PACKAGE_EXAMPLES_DIR "." | ||
19 | #define __UNUSED__ | ||
20 | |||
21 | #endif | ||
22 | |||
23 | #include <Ecore.h> | ||
24 | #include <Ecore_Evas.h> | ||
25 | #include <stdio.h> | ||
26 | #include <errno.h> | ||
27 | |||
28 | #define WIDTH (320) | ||
29 | #define HEIGHT (240) | ||
30 | |||
31 | static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; | ||
32 | static const char *commands = \ | ||
33 | "commands are:\n" | ||
34 | "\tp - change proxy image's source\n" | ||
35 | "\ts - print noise image's stride value\n" | ||
36 | "\ta - save noise image to disk (/tmp dir)\n" | ||
37 | "\th - print help\n"; | ||
38 | |||
39 | const char *file_path = "/tmp/evas-images2-example.png"; | ||
40 | const char *quality_str = "quality=100"; | ||
41 | |||
42 | struct test_data | ||
43 | { | ||
44 | Ecore_Evas *ee; | ||
45 | Evas *evas; | ||
46 | Evas_Object *logo, *noise_img, *proxy_img, *bg; | ||
47 | }; | ||
48 | |||
49 | static struct test_data d = {0}; | ||
50 | |||
51 | static void | ||
52 | _on_preloaded(void *data __UNUSED__, | ||
53 | Evas *e __UNUSED__, | ||
54 | Evas_Object *obj __UNUSED__, | ||
55 | void *event_info __UNUSED__) | ||
56 | { | ||
57 | fprintf(stdout, "Image has been pre-loaded!\n"); | ||
58 | } | ||
59 | |||
60 | static void | ||
61 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
62 | { | ||
63 | ecore_main_loop_quit(); | ||
64 | } | ||
65 | |||
66 | /* here just to keep our example's window size and background image's | ||
67 | * size in synchrony */ | ||
68 | static void | ||
69 | _canvas_resize_cb(Ecore_Evas *ee) | ||
70 | { | ||
71 | int w, h; | ||
72 | |||
73 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
74 | evas_object_resize(d.bg, w, h); | ||
75 | } | ||
76 | |||
77 | static void | ||
78 | _on_keydown(void *data __UNUSED__, | ||
79 | Evas *evas __UNUSED__, | ||
80 | Evas_Object *o __UNUSED__, | ||
81 | void *einfo) | ||
82 | { | ||
83 | Evas_Event_Key_Down *ev = einfo; | ||
84 | |||
85 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
86 | { | ||
87 | fprintf(stdout, commands); | ||
88 | return; | ||
89 | } | ||
90 | |||
91 | if (strcmp(ev->keyname, "s") == 0) /* print proxy image' stride value */ | ||
92 | { | ||
93 | int stride = evas_object_image_stride_get(d.noise_img); | ||
94 | |||
95 | fprintf(stdout, "Image has row stride value of %d, which accounts" | ||
96 | " for %d pixels\n", stride, stride / 4); | ||
97 | |||
98 | return; | ||
99 | } | ||
100 | |||
101 | if (strcmp(ev->keyname, "p") == 0) /* change proxy's source */ | ||
102 | { | ||
103 | Evas_Object *source = evas_object_image_source_get(d.proxy_img); | ||
104 | |||
105 | if (source == d.logo) source = d.noise_img; | ||
106 | else source = d.logo; | ||
107 | |||
108 | evas_object_image_source_set(d.proxy_img, source); | ||
109 | |||
110 | fprintf(stdout, "Proxy image's source changed\n"); | ||
111 | |||
112 | return; | ||
113 | } | ||
114 | |||
115 | if (strcmp(ev->keyname, "a") == 0) /* save noise image to disk */ | ||
116 | { | ||
117 | if (!evas_object_image_save(d.noise_img, file_path, NULL, quality_str)) | ||
118 | fprintf(stderr, "Cannot save image to '%s' (flags '%s')\n", | ||
119 | file_path, quality_str); | ||
120 | else | ||
121 | fprintf(stdout, "Image saved to '%s' (flags '%s'), check it out with " | ||
122 | "an image viewer\n", file_path, quality_str); | ||
123 | |||
124 | return; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | int | ||
129 | main(void) | ||
130 | { | ||
131 | unsigned int i; | ||
132 | unsigned int pixels[(WIDTH / 4) * (HEIGHT / 4)]; | ||
133 | |||
134 | srand(time(NULL)); | ||
135 | |||
136 | if (!ecore_evas_init()) | ||
137 | return EXIT_FAILURE; | ||
138 | |||
139 | /* this will give you a window with an Evas canvas under the first | ||
140 | * engine available */ | ||
141 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
142 | if (!d.ee) | ||
143 | goto error; | ||
144 | |||
145 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
146 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
147 | ecore_evas_show(d.ee); | ||
148 | |||
149 | /* the canvas pointer, de facto */ | ||
150 | d.evas = ecore_evas_get(d.ee); | ||
151 | |||
152 | d.bg = evas_object_rectangle_add(d.evas); | ||
153 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
154 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
155 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
156 | evas_object_show(d.bg); | ||
157 | |||
158 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
159 | evas_object_event_callback_add( | ||
160 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
161 | |||
162 | d.logo = evas_object_image_filled_add(d.evas); | ||
163 | |||
164 | evas_object_event_callback_add( | ||
165 | d.logo, EVAS_CALLBACK_IMAGE_PRELOADED, _on_preloaded, NULL); | ||
166 | evas_object_image_preload(d.logo, EINA_TRUE); | ||
167 | |||
168 | evas_object_image_file_set(d.logo, img_path, NULL); | ||
169 | evas_object_resize(d.logo, WIDTH / 2, HEIGHT / 2); | ||
170 | evas_object_show(d.logo); | ||
171 | |||
172 | /* creating noise image */ | ||
173 | for (i = 0; i < sizeof(pixels) / sizeof(pixels[0]); i++) | ||
174 | pixels[i] = rand(); | ||
175 | |||
176 | d.noise_img = evas_object_image_add(d.evas); | ||
177 | evas_object_image_size_set(d.noise_img, WIDTH / 4, HEIGHT / 4); | ||
178 | evas_object_image_data_set(d.noise_img, pixels); | ||
179 | evas_object_image_filled_set(d.noise_img, EINA_TRUE); | ||
180 | evas_object_move(d.noise_img, (WIDTH * 3) / 4, 0); | ||
181 | evas_object_resize(d.noise_img, WIDTH / 4, HEIGHT / 4); | ||
182 | evas_object_show(d.noise_img); | ||
183 | fprintf(stdout, "Creating noise image with size %d, %d\n", | ||
184 | WIDTH / 4, HEIGHT / 4); | ||
185 | |||
186 | d.proxy_img = evas_object_image_filled_add(d.evas); | ||
187 | evas_object_image_source_set(d.proxy_img, d.logo); | ||
188 | evas_object_move(d.proxy_img, WIDTH / 4, HEIGHT / 2); | ||
189 | evas_object_resize(d.proxy_img, WIDTH / 2, HEIGHT / 2); | ||
190 | evas_object_show(d.proxy_img); | ||
191 | |||
192 | fprintf(stdout, commands); | ||
193 | ecore_main_loop_begin(); | ||
194 | |||
195 | ecore_evas_free(d.ee); | ||
196 | ecore_evas_shutdown(); | ||
197 | return 0; | ||
198 | |||
199 | error: | ||
200 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
201 | " up to ecore-evas for this example to run properly.\n"); | ||
202 | ecore_evas_shutdown(); | ||
203 | return -1; | ||
204 | } | ||
diff --git a/libraries/evas/src/examples/evas-init-shutdown.c b/libraries/evas/src/examples/evas-init-shutdown.c new file mode 100644 index 0000000..a7508d8 --- /dev/null +++ b/libraries/evas/src/examples/evas-init-shutdown.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /** | ||
2 | * Simple example illustrating usage of evas_init() and | ||
3 | * evas_shutdown(). Usually one would instantiate a canvas to have | ||
4 | * something useful out of Evas. For an example of this kind, see the | ||
5 | * @ref Example_Evas_Buffer_Simple. | ||
6 | * | ||
7 | * Here, we are just listing the engine Evas was compiled with support | ||
8 | * to. | ||
9 | * | ||
10 | * @verbatim | ||
11 | * gcc -o evas-init-shutdown evas-init-shutdown.c `pkg-config --libs \ | ||
12 | * --cflags evas` | ||
13 | * @endverbatim | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #include <Evas.h> | ||
18 | #include <stdio.h> | ||
19 | #include <errno.h> | ||
20 | |||
21 | /* | ||
22 | * Simple example illustrating usage of evas_init() and | ||
23 | * evas_shutdown(). Usually one would instantiate a canvas to have | ||
24 | * something useful out of Evas. For an example of this kind, see the | ||
25 | * evas-buffer-simple.c, which requires the buffer engine module | ||
26 | * compiled in Evas. | ||
27 | * | ||
28 | * Here, we are just listing the engine Evas was compiled with support | ||
29 | * to. | ||
30 | */ | ||
31 | |||
32 | int | ||
33 | main(void) | ||
34 | { | ||
35 | Eina_List *engine_list, *l; | ||
36 | char *engine_name; | ||
37 | |||
38 | evas_init(); | ||
39 | |||
40 | engine_list = evas_render_method_list(); | ||
41 | if (!engine_list) | ||
42 | { | ||
43 | fprintf(stderr, "ERROR: Evas supports no engines! Exit.\n"); | ||
44 | exit(-1); | ||
45 | } | ||
46 | |||
47 | printf("Available Evas Engines:\n"); | ||
48 | EINA_LIST_FOREACH(engine_list, l, engine_name) | ||
49 | printf("%s\n", engine_name); | ||
50 | |||
51 | evas_render_method_list_free(engine_list); | ||
52 | |||
53 | evas_shutdown(); | ||
54 | return 0; | ||
55 | } | ||
56 | |||
diff --git a/libraries/evas/src/examples/evas-map-utils.c b/libraries/evas/src/examples/evas-map-utils.c new file mode 100644 index 0000000..2d15882 --- /dev/null +++ b/libraries/evas/src/examples/evas-map-utils.c | |||
@@ -0,0 +1,321 @@ | |||
1 | /* | ||
2 | * gcc -o evas-map-utils evas-map-utils.c `pkg-config --cflags --libs evas ecore ecore-evas` | ||
3 | */ | ||
4 | #ifdef HAVE_CONFIG_H | ||
5 | #include "config.h" | ||
6 | #else | ||
7 | #define __UNUSED__ | ||
8 | #endif | ||
9 | |||
10 | #include <Ecore.h> | ||
11 | #include <Ecore_Evas.h> | ||
12 | |||
13 | #include <stdlib.h> | ||
14 | #include <stdio.h> | ||
15 | #include <string.h> | ||
16 | #include <math.h> | ||
17 | |||
18 | #define WIDTH 480 | ||
19 | #define HEIGHT 480 | ||
20 | |||
21 | typedef struct | ||
22 | { | ||
23 | Ecore_Evas *ee; | ||
24 | Evas *canvas; | ||
25 | struct { | ||
26 | int r, g, b, a; | ||
27 | } colors[6]; | ||
28 | int colors_index; | ||
29 | int frame; | ||
30 | Eina_Bool alpha : 1; | ||
31 | Eina_Bool smooth : 1; | ||
32 | Eina_Bool backface_culling : 1; | ||
33 | Eina_Bool apply_perspective : 1; | ||
34 | Eina_Bool apply_lighting : 1; | ||
35 | } App_Data; | ||
36 | |||
37 | static const char *help_string = | ||
38 | "Valid commands:\n" | ||
39 | "\ta - toggle alpha for maps\n" | ||
40 | "\ts - toggle smooth for maps\n" | ||
41 | "\tc - switch map color\n" | ||
42 | "\tb - toggle backface culling\n" | ||
43 | "\tp - toggle perspective\n" | ||
44 | "\tl - toggle lighting\n" | ||
45 | "\th - prints this help\n"; | ||
46 | |||
47 | static Eina_Bool | ||
48 | _anim_cb(void *data) | ||
49 | { | ||
50 | App_Data *ad = data; | ||
51 | Evas_Map *m; | ||
52 | const Evas_Map *old_map; | ||
53 | Evas_Object *o; | ||
54 | int r, g, b, a; | ||
55 | int win_w, win_h, img_w, img_h; | ||
56 | Evas_Coord x, y, w, h; | ||
57 | |||
58 | evas_output_size_get(ad->canvas, &win_w, &win_h); | ||
59 | |||
60 | m = evas_map_new(4); | ||
61 | evas_map_smooth_set(m, ad->smooth); | ||
62 | evas_map_alpha_set(m, ad->alpha); | ||
63 | |||
64 | r = ad->colors[ad->colors_index].r; | ||
65 | g = ad->colors[ad->colors_index].g; | ||
66 | b = ad->colors[ad->colors_index].b; | ||
67 | a = ad->colors[ad->colors_index].a; | ||
68 | evas_map_util_points_color_set(m, r, g, b, a); | ||
69 | |||
70 | o = evas_object_name_find(ad->canvas, "obj1"); | ||
71 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
72 | |||
73 | evas_map_util_points_populate_from_object(m, o); | ||
74 | evas_map_util_rotate(m, 3 * ad->frame, x + (w / 2), y + (h / 2)); | ||
75 | evas_object_map_set(o, m); | ||
76 | evas_object_map_enable_set(o, EINA_TRUE); | ||
77 | |||
78 | o = evas_object_name_find(ad->canvas, "obj2"); | ||
79 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
80 | evas_object_image_size_get(o, &img_w, &img_h); | ||
81 | |||
82 | evas_map_util_points_populate_from_object_full(m, o, 100); | ||
83 | evas_map_point_image_uv_set(m, 0, 0, 0); | ||
84 | evas_map_point_image_uv_set(m, 1, img_w, 0); | ||
85 | evas_map_point_image_uv_set(m, 2, img_w, img_h); | ||
86 | evas_map_point_image_uv_set(m, 3, 0, img_h); | ||
87 | evas_map_util_3d_rotate(m, ad->frame * 6, ad->frame * 6, ad->frame * 6, | ||
88 | x + (w / 3), y + 10, 0); | ||
89 | if (ad->apply_lighting) | ||
90 | evas_map_util_3d_lighting(m, win_w / 2, win_h / 2, -100, | ||
91 | 255, 255, 255, 0, 0, 0); | ||
92 | evas_object_map_set(o, m); | ||
93 | evas_object_map_enable_set(o, EINA_TRUE); | ||
94 | |||
95 | o = evas_object_name_find(ad->canvas, "obj3"); | ||
96 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
97 | evas_object_image_size_get(o, &img_w, &img_h); | ||
98 | |||
99 | evas_map_util_points_populate_from_geometry(m, x, y + (h / 2), w, h, -20); | ||
100 | evas_map_point_image_uv_set(m, 0, 0, 0); | ||
101 | evas_map_point_image_uv_set(m, 1, img_w, 0); | ||
102 | evas_map_point_image_uv_set(m, 2, img_w, img_h); | ||
103 | evas_map_point_image_uv_set(m, 3, 0, img_h); | ||
104 | evas_map_util_3d_rotate(m, 20, ad->frame * 6, 0, | ||
105 | x + (w / 2), y + (w / 2), w / 2); | ||
106 | |||
107 | if (ad->apply_perspective) | ||
108 | evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 256); | ||
109 | if (ad->apply_lighting) | ||
110 | { | ||
111 | Evas_Coord mx, my; | ||
112 | evas_pointer_canvas_xy_get(ad->canvas, &mx, &my); | ||
113 | evas_map_util_3d_lighting(m, mx, my, -256, | ||
114 | 255, 255, 255, 0, 0, 0); | ||
115 | } | ||
116 | if (ad->backface_culling) | ||
117 | { | ||
118 | if (evas_map_util_clockwise_get(m)) | ||
119 | evas_object_show(o); | ||
120 | else | ||
121 | evas_object_hide(o); | ||
122 | } | ||
123 | else | ||
124 | evas_object_show(o); | ||
125 | evas_object_map_set(o, m); | ||
126 | evas_object_map_enable_set(o, EINA_TRUE); | ||
127 | |||
128 | evas_map_free(m); | ||
129 | |||
130 | o = evas_object_name_find(ad->canvas, "obj4"); | ||
131 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
132 | evas_object_image_size_get(evas_object_image_source_get(o), &img_w, &img_h); | ||
133 | |||
134 | m = evas_map_new(4); | ||
135 | evas_map_point_coord_set(m, 0, x, y + h, 0); | ||
136 | evas_map_point_coord_set(m, 1, x + w, y + h, 0); | ||
137 | evas_map_point_coord_set(m, 2, win_w - 10, win_h - 30, 0); | ||
138 | evas_map_point_coord_set(m, 3, (win_w / 2) + 10, win_h - 30, 0); | ||
139 | evas_map_point_image_uv_set(m, 0, 0, img_h); | ||
140 | evas_map_point_image_uv_set(m, 1, img_w, img_h); | ||
141 | evas_map_point_image_uv_set(m, 2, img_w, 2 * (img_h / 3)); | ||
142 | evas_map_point_image_uv_set(m, 3, 0, 2 * (img_h / 3)); | ||
143 | evas_map_point_color_set(m, 0, 200, 200, 200, 150); | ||
144 | evas_map_point_color_set(m, 1, 200, 200, 200, 150); | ||
145 | evas_map_point_color_set(m, 2, 0, 0, 0, 0); | ||
146 | evas_map_point_color_set(m, 3, 0, 0, 0, 0); | ||
147 | evas_object_map_set(o, m); | ||
148 | evas_object_map_enable_set(o, EINA_TRUE); | ||
149 | |||
150 | evas_map_free(m); | ||
151 | |||
152 | ad->frame = (ad->frame + 1) % 60; | ||
153 | |||
154 | return EINA_TRUE; | ||
155 | } | ||
156 | |||
157 | static void | ||
158 | _on_keydown(void *data, Evas *e, Evas_Object *o, void *event) | ||
159 | { | ||
160 | App_Data *ad = data; | ||
161 | Evas_Event_Key_Down *ev = event; | ||
162 | const Evas_Modifier *mods; | ||
163 | |||
164 | mods = evas_key_modifier_get(ad->canvas); | ||
165 | switch (ev->keyname[0]) | ||
166 | { | ||
167 | case 'a': | ||
168 | ad->alpha = !ad->alpha; | ||
169 | break; | ||
170 | case 's': | ||
171 | ad->smooth = !ad->smooth; | ||
172 | break; | ||
173 | case 'c': | ||
174 | ad->colors_index = (ad->colors_index + 1) % 6; | ||
175 | break; | ||
176 | case 'b': | ||
177 | ad->backface_culling = !ad->backface_culling; | ||
178 | break; | ||
179 | case 'p': | ||
180 | ad->apply_perspective = !ad->apply_perspective; | ||
181 | break; | ||
182 | case 'l': | ||
183 | ad->apply_lighting = !ad->apply_lighting; | ||
184 | break; | ||
185 | case 'h': | ||
186 | puts(help_string); | ||
187 | break; | ||
188 | default: | ||
189 | break; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | static void | ||
194 | _objs_fit(Evas *e) | ||
195 | { | ||
196 | Evas_Object *o; | ||
197 | int w, h; | ||
198 | |||
199 | evas_output_size_get(e, &w, &h); | ||
200 | w /= 2; | ||
201 | h /= 2; | ||
202 | |||
203 | o = evas_object_name_find(e, "obj1"); | ||
204 | evas_object_move(o, w / 4, h / 4); | ||
205 | evas_object_resize(o, w / 2, h / 2); | ||
206 | |||
207 | o = evas_object_name_find(e, "obj2"); | ||
208 | evas_object_move(o, 5 * w / 4, h / 4); | ||
209 | evas_object_resize(o, w / 2, h / 2); | ||
210 | |||
211 | o = evas_object_name_find(e, "obj3"); | ||
212 | evas_object_move(o, w / 4, 5 * h / 4); | ||
213 | evas_object_resize(o, w / 2, h / 2); | ||
214 | |||
215 | o = evas_object_name_find(e, "obj4_source"); | ||
216 | evas_object_move(o, 5 * w / 4, 5 * h / 4); | ||
217 | evas_object_resize(o, w / 2, h / 2); | ||
218 | |||
219 | o = evas_object_name_find(e, "obj4"); | ||
220 | evas_object_move(o, 5 * w / 4, 5 * h / 4); | ||
221 | evas_object_resize(o, w / 2, h / 2); | ||
222 | } | ||
223 | |||
224 | static void | ||
225 | _on_resize(void *data __UNUSED__, Evas *e, Evas_Object *o __UNUSED__, void *event __UNUSED__) | ||
226 | { | ||
227 | _objs_fit(e); | ||
228 | } | ||
229 | |||
230 | static void | ||
231 | _on_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event __UNUSED__) | ||
232 | { | ||
233 | ecore_main_loop_quit(); | ||
234 | } | ||
235 | |||
236 | int | ||
237 | main(void) | ||
238 | { | ||
239 | Evas_Object *bg, *o, *osrc; | ||
240 | static App_Data d = { | ||
241 | .ee = NULL, | ||
242 | .canvas = NULL, | ||
243 | .colors = { | ||
244 | { 255, 255, 255, 255 }, | ||
245 | { 128, 128, 0, 128 }, | ||
246 | { 255, 0, 0, 255 }, | ||
247 | { 64, 128, 255, 255 }, | ||
248 | { 11, 23, 58, 132 }, | ||
249 | { 0, 0, 0, 255 } | ||
250 | }, | ||
251 | .colors_index = 0, | ||
252 | .frame = 0, | ||
253 | .alpha = EINA_FALSE, | ||
254 | .smooth = EINA_FALSE, | ||
255 | .backface_culling = EINA_FALSE, | ||
256 | .apply_perspective = EINA_TRUE, | ||
257 | .apply_lighting = EINA_TRUE | ||
258 | }; | ||
259 | |||
260 | if (!ecore_evas_init()) | ||
261 | return EXIT_FAILURE; | ||
262 | |||
263 | d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | ||
264 | if (!d.ee) | ||
265 | goto error; | ||
266 | |||
267 | d.canvas = ecore_evas_get(d.ee); | ||
268 | |||
269 | bg = evas_object_image_filled_add(d.canvas); | ||
270 | evas_object_image_file_set(bg, "cube1.png", NULL); | ||
271 | ecore_evas_object_associate(d.ee, bg, 0); | ||
272 | evas_object_focus_set(bg, EINA_TRUE); | ||
273 | evas_object_move(bg, 0, 0); | ||
274 | evas_object_resize(bg, WIDTH, HEIGHT); | ||
275 | evas_object_show(bg); | ||
276 | |||
277 | o = evas_object_rectangle_add(d.canvas); | ||
278 | evas_object_name_set(o, "obj1"); | ||
279 | evas_object_color_set(o, 128, 0, 200, 200); | ||
280 | evas_object_show(o); | ||
281 | |||
282 | o = evas_object_image_filled_add(d.canvas); | ||
283 | evas_object_name_set(o, "obj2"); | ||
284 | evas_object_image_file_set(o, "enlightenment.png", NULL); | ||
285 | evas_object_show(o); | ||
286 | |||
287 | o = evas_object_image_filled_add(d.canvas); | ||
288 | evas_object_name_set(o, "obj3"); | ||
289 | evas_object_image_file_set(o, "enlightenment.png", NULL); | ||
290 | evas_object_show(o); | ||
291 | |||
292 | osrc = evas_object_image_filled_add(d.canvas); | ||
293 | evas_object_image_file_set(osrc, "im1.png", NULL); | ||
294 | evas_object_name_set(osrc, "obj4_source"); | ||
295 | evas_object_show(osrc); | ||
296 | |||
297 | o = evas_object_image_filled_add(d.canvas); | ||
298 | evas_object_image_source_set(o, osrc); | ||
299 | evas_object_name_set(o, "obj4"); | ||
300 | evas_object_show(o); | ||
301 | |||
302 | _objs_fit(d.canvas); | ||
303 | |||
304 | evas_object_event_callback_add(bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, &d); | ||
305 | evas_object_event_callback_add(bg, EVAS_CALLBACK_RESIZE, _on_resize, NULL); | ||
306 | evas_object_event_callback_add(bg, EVAS_CALLBACK_FREE, _on_free, NULL); | ||
307 | |||
308 | ecore_animator_add(_anim_cb, &d); | ||
309 | |||
310 | ecore_main_loop_begin(); | ||
311 | |||
312 | ecore_evas_shutdown(); | ||
313 | return 0; | ||
314 | |||
315 | error: | ||
316 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
317 | " up to ecore-evas for this example to run properly.\n"); | ||
318 | panic: | ||
319 | ecore_evas_shutdown(); | ||
320 | return -1; | ||
321 | } | ||
diff --git a/libraries/evas/src/examples/evas-object-manipulation.c b/libraries/evas/src/examples/evas-object-manipulation.c new file mode 100644 index 0000000..e9c9442 --- /dev/null +++ b/libraries/evas/src/examples/evas-object-manipulation.c | |||
@@ -0,0 +1,235 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating basic objects manipulation. | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one) and the png image loader also built. See stdout/stderr for | ||
6 | * output. | ||
7 | * | ||
8 | * @verbatim | ||
9 | * gcc -o evas-object-manipulation evas-object-manipulation.c `pkg-config --libs --cflags ecore evas ecore-evas` | ||
10 | * @endverbatim | ||
11 | */ | ||
12 | |||
13 | #ifdef HAVE_CONFIG_H | ||
14 | |||
15 | #include "config.h" | ||
16 | #else | ||
17 | |||
18 | #define PACKAGE_EXAMPLES_DIR "." | ||
19 | #define __UNUSED__ | ||
20 | |||
21 | #endif | ||
22 | |||
23 | #include <Ecore.h> | ||
24 | #include <Ecore_Evas.h> | ||
25 | #include <stdio.h> | ||
26 | #include <errno.h> | ||
27 | |||
28 | #define WIDTH (320) | ||
29 | #define HEIGHT (240) | ||
30 | |||
31 | static const char *img_path = PACKAGE_EXAMPLES_DIR "/enlightenment.png"; | ||
32 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
33 | |||
34 | struct test_data | ||
35 | { | ||
36 | Ecore_Evas *ee; | ||
37 | Evas *canvas; | ||
38 | Evas_Object *img, *bg, *clipper, *clipper_border, *text; | ||
39 | }; | ||
40 | |||
41 | static struct test_data d = {0}; | ||
42 | |||
43 | /* here just to keep our example's window size and background image's | ||
44 | * size in synchrony */ | ||
45 | static void | ||
46 | _canvas_resize_cb(Ecore_Evas *ee) | ||
47 | { | ||
48 | int w, h; | ||
49 | |||
50 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
51 | evas_object_resize(d.bg, w, h); | ||
52 | } | ||
53 | |||
54 | static void | ||
55 | _on_keydown(void *data __UNUSED__, | ||
56 | Evas *evas __UNUSED__, | ||
57 | Evas_Object *o __UNUSED__, | ||
58 | void *einfo) | ||
59 | { | ||
60 | Evas_Event_Key_Down *ev = einfo; | ||
61 | |||
62 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
63 | { | ||
64 | fprintf(stdout, "commands are:\n" | ||
65 | "\to - change clipper's opacity\n" | ||
66 | "\tr - toggle clipper's color between red and white\n" | ||
67 | "\tc - toggle clipper's clipping function\n" | ||
68 | "\tv - toggle clipper's visibility\n"); | ||
69 | return; | ||
70 | } | ||
71 | |||
72 | if (strcmp(ev->keyname, "o") == 0) /* change clipper's opacity */ | ||
73 | { | ||
74 | int alpha, r, g, b; | ||
75 | |||
76 | evas_object_color_get(d.clipper, &r, &g, &b, &alpha); | ||
77 | alpha -= 20; | ||
78 | if (alpha < 0) | ||
79 | alpha = 255; | ||
80 | |||
81 | evas_object_color_set(d.clipper, r, g, b, alpha); | ||
82 | |||
83 | fprintf(stdout, "Changing clipper's opacity: %d%%\n", | ||
84 | (int)((alpha / 255.0) * 100)); | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | if (strcmp(ev->keyname, "r") == 0) /* toggle clipper's color | ||
89 | * between red and white */ | ||
90 | { | ||
91 | int alpha, r, g, b; | ||
92 | |||
93 | fprintf(stdout, "Changing clipper's color to"); | ||
94 | |||
95 | evas_object_color_get(d.clipper, &r, &g, &b, &alpha); | ||
96 | if (g > 0) | ||
97 | { | ||
98 | fprintf(stdout, "red\n"); | ||
99 | g = b = 0; | ||
100 | } | ||
101 | else | ||
102 | { | ||
103 | fprintf(stdout, "white\n"); | ||
104 | g = b = 255; | ||
105 | } | ||
106 | |||
107 | evas_object_color_set(d.clipper, r, g, b, alpha); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | if (strcmp(ev->keyname, "c") == 0) /* toggle clipper's clipping function */ | ||
112 | { | ||
113 | fprintf(stdout, "Toggling clipping "); | ||
114 | |||
115 | if (evas_object_clip_get(d.img) == d.clipper) | ||
116 | { | ||
117 | evas_object_clip_unset(d.img); | ||
118 | fprintf(stdout, "off\n"); | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | evas_object_clip_set(d.img, d.clipper); | ||
123 | fprintf(stdout, "on\n"); | ||
124 | } | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | if (strcmp(ev->keyname, "v") == 0) /* toggle clipper's visibility */ | ||
129 | { | ||
130 | fprintf(stdout, "Clipper is now "); | ||
131 | |||
132 | if (evas_object_visible_get(d.clipper)) | ||
133 | { | ||
134 | evas_object_hide(d.clipper); | ||
135 | fprintf(stdout, "hidden\n"); | ||
136 | } | ||
137 | else | ||
138 | { | ||
139 | evas_object_show(d.clipper); | ||
140 | fprintf(stdout, "visible\n"); | ||
141 | } | ||
142 | return; | ||
143 | } | ||
144 | } | ||
145 | |||
146 | int | ||
147 | main(void) | ||
148 | { | ||
149 | int err; | ||
150 | |||
151 | if (!ecore_evas_init()) | ||
152 | return EXIT_FAILURE; | ||
153 | |||
154 | /* this will give you a window with an Evas canvas under the first | ||
155 | * engine available */ | ||
156 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
157 | if (!d.ee) | ||
158 | goto error; | ||
159 | |||
160 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
161 | ecore_evas_show(d.ee); | ||
162 | |||
163 | /* the canvas pointer, de facto */ | ||
164 | d.canvas = ecore_evas_get(d.ee); | ||
165 | |||
166 | d.bg = evas_object_rectangle_add(d.canvas); | ||
167 | evas_object_name_set(d.bg, "background rectangle"); | ||
168 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
169 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
170 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
171 | evas_object_show(d.bg); | ||
172 | |||
173 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
174 | evas_object_event_callback_add( | ||
175 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
176 | |||
177 | d.img = evas_object_image_filled_add(d.canvas); | ||
178 | evas_object_image_file_set(d.img, img_path, NULL); | ||
179 | err = evas_object_image_load_error_get(d.img); | ||
180 | if (err != EVAS_LOAD_ERROR_NONE) | ||
181 | { | ||
182 | goto panic; | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | evas_object_move(d.img, 0, 0); | ||
187 | evas_object_resize(d.img, WIDTH, HEIGHT); | ||
188 | evas_object_show(d.img); | ||
189 | |||
190 | fprintf(stdout, "Image object added, type is: %s\n", | ||
191 | evas_object_type_get(d.img)); | ||
192 | } | ||
193 | |||
194 | /* border on the image's clipper, here just to emphasize its position */ | ||
195 | d.clipper_border = evas_object_image_filled_add(d.canvas); | ||
196 | evas_object_image_file_set(d.clipper_border, border_img_path, NULL); | ||
197 | err = evas_object_image_load_error_get(d.clipper_border); | ||
198 | if (err != EVAS_LOAD_ERROR_NONE) | ||
199 | { | ||
200 | goto panic; | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | evas_object_image_border_set(d.clipper_border, 3, 3, 3, 3); | ||
205 | evas_object_image_border_center_fill_set( | ||
206 | d.clipper_border, EVAS_BORDER_FILL_NONE); | ||
207 | evas_object_move(d.clipper_border, (WIDTH / 4) - 3, (HEIGHT / 4) - 3); | ||
208 | evas_object_resize( | ||
209 | d.clipper_border, (WIDTH / 2) + 6, (HEIGHT / 2) + 6); | ||
210 | evas_object_show(d.clipper_border); | ||
211 | } | ||
212 | |||
213 | /* solid white clipper (note that it's the default color for a | ||
214 | * rectangle) - it won't change clippees' colors, then (multiplying | ||
215 | * by 255) */ | ||
216 | d.clipper = evas_object_rectangle_add(d.canvas); | ||
217 | evas_object_move(d.clipper, WIDTH / 4, HEIGHT / 4); | ||
218 | evas_object_resize(d.clipper, WIDTH / 2, HEIGHT / 2); | ||
219 | evas_object_clip_set(d.img, d.clipper); | ||
220 | evas_object_show(d.clipper); | ||
221 | |||
222 | ecore_main_loop_begin(); | ||
223 | |||
224 | ecore_evas_free(d.ee); | ||
225 | ecore_evas_shutdown(); | ||
226 | return 0; | ||
227 | |||
228 | error: | ||
229 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
230 | " up to ecore-evas for this example to run properly.\n"); | ||
231 | panic: | ||
232 | ecore_evas_free(d.ee); | ||
233 | ecore_evas_shutdown(); | ||
234 | return -1; | ||
235 | } | ||
diff --git a/libraries/evas/src/examples/evas-smart-object.c b/libraries/evas/src/examples/evas-smart-object.c new file mode 100644 index 0000000..8a36b62 --- /dev/null +++ b/libraries/evas/src/examples/evas-smart-object.c | |||
@@ -0,0 +1,708 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating a custom Evas smart object | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one). See stdout/stderr for output. | ||
6 | * | ||
7 | * @verbatim | ||
8 | * gcc -o evas-smart-object evas-smart-object.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
9 | * @endverbatim | ||
10 | */ | ||
11 | |||
12 | #ifdef HAVE_CONFIG_H | ||
13 | |||
14 | #include "config.h" | ||
15 | #else | ||
16 | |||
17 | #define PACKAGE_EXAMPLES_DIR "." | ||
18 | #define __UNUSED__ | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #include <Ecore.h> | ||
23 | #include <Ecore_Evas.h> | ||
24 | #include <stdio.h> | ||
25 | #include <errno.h> | ||
26 | |||
27 | #define WIDTH (320) | ||
28 | #define HEIGHT (240) | ||
29 | |||
30 | static const char *commands = \ | ||
31 | "commands are:\n" | ||
32 | "\tl - insert child rectangle on the left\n" | ||
33 | "\tr - insert child rectangle on the right\n" | ||
34 | "\tw - remove and delete all members from the smart object\n" | ||
35 | "\tright arrow - move smart object to the right\n" | ||
36 | "\tleft arrow - move smart object to the left\n" | ||
37 | "\tup arrow - move smart object up\n" | ||
38 | "\tdown arrow - move smart object down\n" | ||
39 | "\td - decrease smart object's size\n" | ||
40 | "\ti - increase smart object's size\n" | ||
41 | "\tc - change smart object's clipper color\n" | ||
42 | "\th - print help\n"; | ||
43 | |||
44 | #define WHITE {255, 255, 255, 255} | ||
45 | #define RED {255, 0, 0, 255} | ||
46 | #define GREEN {0, 255, 0, 255} | ||
47 | #define BLUE {0, 0, 255, 255} | ||
48 | |||
49 | struct test_data | ||
50 | { | ||
51 | Ecore_Evas *ee; | ||
52 | Evas *evas; | ||
53 | Evas_Object *smt, *bg, *clipper, *rects[2]; | ||
54 | }; | ||
55 | |||
56 | struct color_tuple | ||
57 | { | ||
58 | int r, g, b, a; | ||
59 | } clipper_colors[4] = {WHITE, RED, GREEN, BLUE}; | ||
60 | int cur_color = 0; | ||
61 | |||
62 | static const char * | ||
63 | _index_to_color(int i) | ||
64 | { | ||
65 | switch (i) | ||
66 | { | ||
67 | case 0: | ||
68 | return "WHITE (default)"; | ||
69 | |||
70 | case 1: | ||
71 | return "RED"; | ||
72 | |||
73 | case 2: | ||
74 | return "GREEN"; | ||
75 | |||
76 | case 3: | ||
77 | return "BLUE"; | ||
78 | |||
79 | default: | ||
80 | return "other"; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static struct test_data d = {0}; | ||
85 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
86 | |||
87 | #define _evas_smart_example_type "Evas_Smart_Example" | ||
88 | #define EVT_CHILDREN_NUMBER_CHANGED "children,changed" | ||
89 | |||
90 | static const Evas_Smart_Cb_Description _smart_callbacks[] = | ||
91 | { | ||
92 | {EVT_CHILDREN_NUMBER_CHANGED, "i"}, | ||
93 | {NULL, NULL} | ||
94 | }; | ||
95 | |||
96 | typedef struct _Evas_Smart_Example_Data Evas_Smart_Example_Data; | ||
97 | /* | ||
98 | * This structure augments clipped smart object's instance data, | ||
99 | * providing extra members required by our example smart object's | ||
100 | * implementation. | ||
101 | */ | ||
102 | struct _Evas_Smart_Example_Data | ||
103 | { | ||
104 | Evas_Object_Smart_Clipped_Data base; | ||
105 | Evas_Object *children[2], *border; | ||
106 | int child_count; | ||
107 | }; | ||
108 | |||
109 | #define EVAS_SMART_EXAMPLE_DATA_GET(o, ptr) \ | ||
110 | Evas_Smart_Example_Data * ptr = evas_object_smart_data_get(o) | ||
111 | |||
112 | #define EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN(o, ptr) \ | ||
113 | EVAS_SMART_EXAMPLE_DATA_GET(o, ptr); \ | ||
114 | if (!ptr) \ | ||
115 | { \ | ||
116 | fprintf(stderr, "No widget data for object %p (%s)!", \ | ||
117 | o, evas_object_type_get(o)); \ | ||
118 | fflush(stderr); \ | ||
119 | abort(); \ | ||
120 | return; \ | ||
121 | } | ||
122 | |||
123 | #define EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, ptr, val) \ | ||
124 | EVAS_SMART_EXAMPLE_DATA_GET(o, ptr); \ | ||
125 | if (!ptr) \ | ||
126 | { \ | ||
127 | fprintf(stderr, "No widget data for object %p (%s)!", \ | ||
128 | o, evas_object_type_get(o)); \ | ||
129 | fflush(stderr); \ | ||
130 | abort(); \ | ||
131 | return val; \ | ||
132 | } | ||
133 | |||
134 | EVAS_SMART_SUBCLASS_NEW(_evas_smart_example_type, _evas_smart_example, | ||
135 | Evas_Smart_Class, Evas_Smart_Class, | ||
136 | evas_object_smart_clipped_class_get, _smart_callbacks); | ||
137 | |||
138 | static void | ||
139 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
140 | { | ||
141 | ecore_main_loop_quit(); | ||
142 | } | ||
143 | |||
144 | /* here just to keep our example's window size and background image's | ||
145 | * size in synchrony */ | ||
146 | static void | ||
147 | _canvas_resize_cb(Ecore_Evas *ee) | ||
148 | { | ||
149 | int w, h; | ||
150 | |||
151 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
152 | evas_object_resize(d.bg, w, h); | ||
153 | } | ||
154 | |||
155 | static void | ||
156 | _on_child_del(void *data, | ||
157 | Evas *evas __UNUSED__, | ||
158 | Evas_Object *o, | ||
159 | void *einfo __UNUSED__) | ||
160 | { | ||
161 | Evas_Object *example_smart = data; | ||
162 | int index; | ||
163 | |||
164 | EVAS_SMART_EXAMPLE_DATA_GET(example_smart, priv); | ||
165 | |||
166 | index = (int)evas_object_data_get(o, "index"); | ||
167 | index--; | ||
168 | |||
169 | priv->children[index] = NULL; | ||
170 | |||
171 | evas_object_smart_member_del(o); | ||
172 | evas_object_smart_changed(example_smart); | ||
173 | } | ||
174 | |||
175 | static void | ||
176 | _evas_smart_example_child_callbacks_unregister(Evas_Object *obj) | ||
177 | { | ||
178 | evas_object_data_set(obj, "index", NULL); | ||
179 | evas_object_event_callback_del(obj, EVAS_CALLBACK_FREE, _on_child_del); | ||
180 | } | ||
181 | |||
182 | static void | ||
183 | _evas_smart_example_child_callbacks_register(Evas_Object *o, | ||
184 | Evas_Object *child, | ||
185 | int index) | ||
186 | { | ||
187 | evas_object_event_callback_add(child, EVAS_CALLBACK_FREE, _on_child_del, o); | ||
188 | evas_object_data_set(child, "index", (void *)(++index)); | ||
189 | } | ||
190 | |||
191 | /* create and setup a new example smart object's internals */ | ||
192 | static void | ||
193 | _evas_smart_example_smart_add(Evas_Object *o) | ||
194 | { | ||
195 | EVAS_SMART_DATA_ALLOC(o, Evas_Smart_Example_Data); | ||
196 | |||
197 | /* this is a border around the smart object's area, delimiting it */ | ||
198 | priv->border = evas_object_image_filled_add(evas_object_evas_get(o)); | ||
199 | evas_object_image_file_set(priv->border, border_img_path, NULL); | ||
200 | evas_object_image_border_set(priv->border, 3, 3, 3, 3); | ||
201 | evas_object_image_border_center_fill_set( | ||
202 | priv->border, EVAS_BORDER_FILL_NONE); | ||
203 | evas_object_smart_member_add(priv->border, o); | ||
204 | |||
205 | _evas_smart_example_parent_sc->add(o); | ||
206 | } | ||
207 | |||
208 | static void | ||
209 | _evas_smart_example_smart_del(Evas_Object *o) | ||
210 | { | ||
211 | EVAS_SMART_EXAMPLE_DATA_GET(o, priv); | ||
212 | |||
213 | if (priv->children[0]) | ||
214 | { | ||
215 | _evas_smart_example_child_callbacks_unregister(priv->children[0]); | ||
216 | priv->children[0] = NULL; | ||
217 | } | ||
218 | |||
219 | if (priv->children[1]) | ||
220 | { | ||
221 | _evas_smart_example_child_callbacks_unregister(priv->children[1]); | ||
222 | priv->children[1] = NULL; | ||
223 | } | ||
224 | |||
225 | _evas_smart_example_parent_sc->del(o); | ||
226 | } | ||
227 | |||
228 | static void | ||
229 | _evas_smart_example_smart_show(Evas_Object *o) | ||
230 | { | ||
231 | EVAS_SMART_EXAMPLE_DATA_GET(o, priv); | ||
232 | |||
233 | if (priv->children[0]) evas_object_show(priv->children[0]); | ||
234 | if (priv->children[1]) evas_object_show(priv->children[1]); | ||
235 | evas_object_show(priv->border); | ||
236 | |||
237 | _evas_smart_example_parent_sc->show(o); | ||
238 | } | ||
239 | |||
240 | static void | ||
241 | _evas_smart_example_smart_hide(Evas_Object *o) | ||
242 | { | ||
243 | EVAS_SMART_EXAMPLE_DATA_GET(o, priv); | ||
244 | |||
245 | if (priv->children[0]) evas_object_hide(priv->children[0]); | ||
246 | if (priv->children[1]) evas_object_hide(priv->children[1]); | ||
247 | evas_object_hide(priv->border); | ||
248 | |||
249 | _evas_smart_example_parent_sc->hide(o); | ||
250 | } | ||
251 | |||
252 | static void | ||
253 | _evas_smart_example_smart_resize(Evas_Object *o, | ||
254 | Evas_Coord w, | ||
255 | Evas_Coord h) | ||
256 | { | ||
257 | Evas_Coord ow, oh; | ||
258 | evas_object_geometry_get(o, NULL, NULL, &ow, &oh); | ||
259 | if ((ow == w) && (oh == h)) return; | ||
260 | |||
261 | /* this will trigger recalculation */ | ||
262 | evas_object_smart_changed(o); | ||
263 | } | ||
264 | |||
265 | /* act on child objects' properties, before rendering */ | ||
266 | static void | ||
267 | _evas_smart_example_smart_calculate(Evas_Object *o) | ||
268 | { | ||
269 | Evas_Coord x, y, w, h; | ||
270 | |||
271 | EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN(o, priv); | ||
272 | evas_object_geometry_get(o, &x, &y, &w, &h); | ||
273 | |||
274 | evas_object_resize(priv->border, w, h); | ||
275 | evas_object_move(priv->border, x, y); | ||
276 | |||
277 | if (priv->children[0]) | ||
278 | { | ||
279 | evas_object_move(priv->children[0], x + 3, y + 3); | ||
280 | evas_object_resize(priv->children[0], (w / 2) - 3, (h / 2) - 3); | ||
281 | } | ||
282 | |||
283 | if (priv->children[1]) | ||
284 | { | ||
285 | evas_object_move(priv->children[1], x + (w / 2), y + (h / 2)); | ||
286 | evas_object_resize(priv->children[1], (w / 2) - 3, (h / 2) - 3); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | /* setting our smart interface */ | ||
291 | static void | ||
292 | _evas_smart_example_smart_set_user(Evas_Smart_Class *sc) | ||
293 | { | ||
294 | /* specializing these two */ | ||
295 | sc->add = _evas_smart_example_smart_add; | ||
296 | sc->del = _evas_smart_example_smart_del; | ||
297 | sc->show = _evas_smart_example_smart_show; | ||
298 | sc->hide = _evas_smart_example_smart_hide; | ||
299 | |||
300 | /* clipped smart object has no hook on resizes or calculations */ | ||
301 | sc->resize = _evas_smart_example_smart_resize; | ||
302 | sc->calculate = _evas_smart_example_smart_calculate; | ||
303 | } | ||
304 | |||
305 | /* BEGINS example smart object's own interface */ | ||
306 | |||
307 | /* add a new example smart object to a canvas */ | ||
308 | Evas_Object * | ||
309 | evas_smart_example_add(Evas *evas) | ||
310 | { | ||
311 | return evas_object_smart_add(evas, _evas_smart_example_smart_class_new()); | ||
312 | } | ||
313 | |||
314 | static void | ||
315 | _evas_smart_example_remove_do(Evas_Smart_Example_Data *priv, | ||
316 | Evas_Object *child, | ||
317 | int index) | ||
318 | { | ||
319 | priv->children[index] = NULL; | ||
320 | priv->child_count--; | ||
321 | _evas_smart_example_child_callbacks_unregister(child); | ||
322 | evas_object_smart_member_del(child); | ||
323 | } | ||
324 | |||
325 | /* remove a child element, return its pointer (or NULL on errors) */ | ||
326 | Evas_Object * | ||
327 | evas_smart_example_remove(Evas_Object *o, | ||
328 | Evas_Object *child) | ||
329 | { | ||
330 | int index; | ||
331 | |||
332 | EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | ||
333 | |||
334 | if (priv->children[0] != child && priv->children[1] != child) | ||
335 | { | ||
336 | fprintf(stderr, "You are trying to remove something not belonging to" | ||
337 | " the example smart object!\n"); | ||
338 | return NULL; | ||
339 | } | ||
340 | |||
341 | index = (int)evas_object_data_get(child, "index"); | ||
342 | index--; | ||
343 | |||
344 | _evas_smart_example_remove_do(priv, child, index); | ||
345 | |||
346 | evas_object_smart_callback_call( | ||
347 | o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); | ||
348 | evas_object_smart_changed(o); | ||
349 | |||
350 | return child; | ||
351 | } | ||
352 | |||
353 | /* set to return any previous object set to the left position of the | ||
354 | * smart object or NULL, if any (or on errors) */ | ||
355 | Evas_Object * | ||
356 | evas_smart_example_set_left(Evas_Object *o, | ||
357 | Evas_Object *child) | ||
358 | { | ||
359 | Evas_Object *ret = NULL; | ||
360 | |||
361 | EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | ||
362 | if (!child) | ||
363 | return NULL; | ||
364 | |||
365 | if (priv->children[1] == child) | ||
366 | { | ||
367 | fprintf(stderr, "You mustn't place a child on both slots of" | ||
368 | " the example smart object!\n"); | ||
369 | return NULL; | ||
370 | } | ||
371 | |||
372 | if (priv->children[0]) | ||
373 | { | ||
374 | if (priv->children[0] != child) | ||
375 | { | ||
376 | ret = priv->children[0]; | ||
377 | _evas_smart_example_remove_do(priv, priv->children[0], 0); | ||
378 | } | ||
379 | else return child; | ||
380 | } | ||
381 | |||
382 | priv->children[0] = child; | ||
383 | _evas_smart_example_child_callbacks_register(o, child, 0); | ||
384 | evas_object_smart_member_add(child, o); | ||
385 | evas_object_smart_changed(o); | ||
386 | |||
387 | priv->child_count++; | ||
388 | if (!ret) | ||
389 | { | ||
390 | evas_object_smart_callback_call( | ||
391 | o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); | ||
392 | } | ||
393 | |||
394 | return ret; | ||
395 | } | ||
396 | |||
397 | /* set to return any previous object set to the right position of the | ||
398 | * smart object or NULL, if any (or on errors) */ | ||
399 | Evas_Object * | ||
400 | evas_smart_example_set_right(Evas_Object *o, | ||
401 | Evas_Object *child) | ||
402 | { | ||
403 | Evas_Object *ret = NULL; | ||
404 | |||
405 | EVAS_SMART_EXAMPLE_DATA_GET_OR_RETURN_VAL(o, priv, NULL); | ||
406 | if (!child) | ||
407 | return NULL; | ||
408 | |||
409 | if (priv->children[0] == child) | ||
410 | { | ||
411 | fprintf(stderr, "You mustn't place a child on both slots of" | ||
412 | " the example smart object!\n"); | ||
413 | return NULL; | ||
414 | } | ||
415 | |||
416 | if (priv->children[1]) | ||
417 | { | ||
418 | if (priv->children[1] != child) | ||
419 | { | ||
420 | ret = priv->children[1]; | ||
421 | _evas_smart_example_remove_do(priv, priv->children[1], 1); | ||
422 | } | ||
423 | else return child; | ||
424 | } | ||
425 | |||
426 | priv->children[1] = child; | ||
427 | _evas_smart_example_child_callbacks_register(o, child, 1); | ||
428 | evas_object_smart_member_add(child, o); | ||
429 | evas_object_smart_changed(o); | ||
430 | |||
431 | priv->child_count++; | ||
432 | if (!ret) | ||
433 | { | ||
434 | evas_object_smart_callback_call( | ||
435 | o, EVT_CHILDREN_NUMBER_CHANGED, (void *)priv->child_count); | ||
436 | } | ||
437 | |||
438 | return ret; | ||
439 | } | ||
440 | |||
441 | /* END OF example smart object's own interface */ | ||
442 | |||
443 | static void | ||
444 | _on_keydown(void *data __UNUSED__, | ||
445 | Evas *evas __UNUSED__, | ||
446 | Evas_Object *o __UNUSED__, | ||
447 | void *einfo) | ||
448 | { | ||
449 | Evas_Event_Key_Down *ev = einfo; | ||
450 | |||
451 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
452 | { | ||
453 | fprintf(stdout, commands); | ||
454 | return; | ||
455 | } | ||
456 | |||
457 | if (strcmp(ev->keyname, "w") == 0) /* clear out smart object (WRT members) */ | ||
458 | { | ||
459 | if (d.rects[0]) | ||
460 | { | ||
461 | evas_smart_example_remove(d.smt, d.rects[0]); | ||
462 | evas_object_del(d.rects[0]); | ||
463 | } | ||
464 | if (d.rects[1]) | ||
465 | { | ||
466 | evas_smart_example_remove(d.smt, d.rects[1]); | ||
467 | evas_object_del(d.rects[1]); | ||
468 | } | ||
469 | |||
470 | memset(d.rects, 0, sizeof(d.rects)); | ||
471 | |||
472 | fprintf(stdout, "Deleting all members of the smart object.\n"); | ||
473 | |||
474 | return; | ||
475 | } | ||
476 | |||
477 | if (strcmp(ev->keyname, "l") == 0) /* insert random colored | ||
478 | * rectangle on the left */ | ||
479 | { | ||
480 | Evas_Object *rect = evas_object_rectangle_add(d.evas), *prev; | ||
481 | evas_object_color_set( | ||
482 | rect, rand() % 255, rand() % 255, rand() % 255, 255); | ||
483 | evas_object_show(rect); | ||
484 | |||
485 | prev = evas_smart_example_set_left(d.smt, rect); | ||
486 | d.rects[0] = rect; | ||
487 | |||
488 | fprintf(stdout, "Setting smart object's left spot with a new" | ||
489 | " rectangle.\n"); | ||
490 | fprintf(stdout, "Checking its new smart object parent: %s\n", | ||
491 | evas_object_smart_parent_get(rect) == d.smt ? "OK!" : | ||
492 | "Failure!"); | ||
493 | if (prev) | ||
494 | { | ||
495 | int r, g, b; | ||
496 | |||
497 | evas_object_color_get(prev, &r, &g, &b, NULL); | ||
498 | fprintf(stdout, "Deleting previous left child," | ||
499 | " which had colors (%d, %d, %d)\n", r, g, b); | ||
500 | evas_object_del(prev); | ||
501 | } | ||
502 | |||
503 | return; | ||
504 | } | ||
505 | |||
506 | if (strcmp(ev->keyname, "r") == 0) /* insert random colored | ||
507 | * rectangle on the right */ | ||
508 | { | ||
509 | Evas_Object *rect = evas_object_rectangle_add(d.evas), *prev; | ||
510 | evas_object_color_set( | ||
511 | rect, rand() % 255, rand() % 255, rand() % 255, 255); | ||
512 | evas_object_show(rect); | ||
513 | |||
514 | prev = evas_smart_example_set_right(d.smt, rect); | ||
515 | d.rects[1] = rect; | ||
516 | |||
517 | fprintf(stdout, "Setting smart object's right spot with a new" | ||
518 | " rectangle.\n"); | ||
519 | fprintf(stdout, "Checking its new smart object parent: %s\n", | ||
520 | evas_object_smart_parent_get(rect) == d.smt ? "OK!" : | ||
521 | "Failure!"); | ||
522 | if (prev) | ||
523 | { | ||
524 | int r, g, b; | ||
525 | |||
526 | evas_object_color_get(prev, &r, &g, &b, NULL); | ||
527 | fprintf(stdout, "Deleting previous right child," | ||
528 | " which had colors (%d, %d, %d)\n", r, g, b); | ||
529 | evas_object_del(prev); | ||
530 | } | ||
531 | |||
532 | return; | ||
533 | } | ||
534 | |||
535 | /* move smart object along the canvas */ | ||
536 | if (strcmp(ev->keyname, "Right") == 0 || strcmp(ev->keyname, "Left") == 0 || | ||
537 | strcmp(ev->keyname, "Up") == 0 || strcmp(ev->keyname, "Down") == 0) | ||
538 | { | ||
539 | Evas_Coord x, y; | ||
540 | |||
541 | evas_object_geometry_get(d.smt, &x, &y, NULL, NULL); | ||
542 | |||
543 | switch (ev->keyname[0]) | ||
544 | { | ||
545 | case 'R': | ||
546 | x += 20; | ||
547 | break; | ||
548 | |||
549 | case 'L': | ||
550 | x -= 20; | ||
551 | break; | ||
552 | |||
553 | case 'U': | ||
554 | y -= 20; | ||
555 | break; | ||
556 | |||
557 | case 'D': | ||
558 | y += 20; | ||
559 | break; | ||
560 | } | ||
561 | |||
562 | evas_object_move(d.smt, x, y); | ||
563 | |||
564 | return; | ||
565 | } | ||
566 | |||
567 | /* increase smart object's size */ | ||
568 | if (strcmp(ev->keyname, "i") == 0) | ||
569 | { | ||
570 | Evas_Coord w, h; | ||
571 | |||
572 | evas_object_geometry_get(d.smt, NULL, NULL, &w, &h); | ||
573 | |||
574 | w *= 1.1; | ||
575 | h *= 1.1; | ||
576 | |||
577 | evas_object_resize(d.smt, w, h); | ||
578 | |||
579 | return; | ||
580 | } | ||
581 | |||
582 | /* decrease smart object's size */ | ||
583 | if (strcmp(ev->keyname, "d") == 0) | ||
584 | { | ||
585 | Evas_Coord w, h; | ||
586 | |||
587 | evas_object_geometry_get(d.smt, NULL, NULL, &w, &h); | ||
588 | |||
589 | w *= 0.9; | ||
590 | h *= 0.9; | ||
591 | |||
592 | evas_object_resize(d.smt, w, h); | ||
593 | |||
594 | return; | ||
595 | } | ||
596 | |||
597 | /* change smart object's clipper color */ | ||
598 | if (strcmp(ev->keyname, "c") == 0) | ||
599 | { | ||
600 | cur_color = (cur_color + 1) % 4; | ||
601 | |||
602 | evas_object_color_set( | ||
603 | d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g, | ||
604 | clipper_colors[cur_color].b, clipper_colors[cur_color].a); | ||
605 | |||
606 | fprintf (stderr, "Changing clipper's color to %s\n", | ||
607 | _index_to_color(cur_color)); | ||
608 | |||
609 | return; | ||
610 | } | ||
611 | } | ||
612 | |||
613 | static void /* callback on number of member objects changed */ | ||
614 | _on_example_smart_object_child_num_change(void *data __UNUSED__, | ||
615 | Evas_Object *obj __UNUSED__, | ||
616 | void *event_info) | ||
617 | { | ||
618 | fprintf(stdout, "Number of child members on our example smart" | ||
619 | " object changed to %d\n", (int)event_info); | ||
620 | } | ||
621 | |||
622 | int | ||
623 | main(void) | ||
624 | { | ||
625 | const Evas_Smart_Cb_Description **descriptions; | ||
626 | unsigned int count; | ||
627 | Eina_Bool ret; | ||
628 | |||
629 | srand(time(NULL)); | ||
630 | |||
631 | if (!ecore_evas_init()) | ||
632 | return EXIT_FAILURE; | ||
633 | |||
634 | /* this will give you a window with an Evas canvas under the first | ||
635 | * engine available */ | ||
636 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
637 | if (!d.ee) | ||
638 | goto error; | ||
639 | |||
640 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
641 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
642 | ecore_evas_show(d.ee); | ||
643 | |||
644 | /* the canvas pointer, de facto */ | ||
645 | d.evas = ecore_evas_get(d.ee); | ||
646 | |||
647 | d.bg = evas_object_rectangle_add(d.evas); | ||
648 | evas_object_color_set(d.bg, 255, 255, 255, 255); | ||
649 | evas_object_move(d.bg, 0, 0); | ||
650 | evas_object_resize(d.bg, WIDTH, HEIGHT); | ||
651 | evas_object_show(d.bg); | ||
652 | |||
653 | d.smt = evas_smart_example_add(d.evas); | ||
654 | evas_object_move(d.smt, WIDTH / 4, HEIGHT / 4); | ||
655 | evas_object_resize(d.smt, WIDTH / 2, HEIGHT / 2); | ||
656 | evas_object_show(d.smt); | ||
657 | |||
658 | ret = evas_object_smart_type_check(d.smt, _evas_smart_example_type); | ||
659 | fprintf(stdout, "Adding smart object of type \"%s\" to the canvas: %s.\n", | ||
660 | _evas_smart_example_type, ret ? "success" : "failure"); | ||
661 | |||
662 | d.clipper = evas_object_smart_clipped_clipper_get(d.smt); | ||
663 | fprintf(stdout, "Checking if clipped smart object's clipper is a " | ||
664 | "\"static\" one: %s\n", evas_object_static_clip_get( | ||
665 | d.clipper) ? "yes" : "no"); | ||
666 | |||
667 | evas_object_color_set( | ||
668 | d.clipper, clipper_colors[cur_color].r, clipper_colors[cur_color].g, | ||
669 | clipper_colors[cur_color].b, clipper_colors[cur_color].a); | ||
670 | |||
671 | evas_object_smart_callbacks_descriptions_get( | ||
672 | d.smt, &descriptions, &count, NULL, NULL); | ||
673 | |||
674 | for (; *descriptions; descriptions++) | ||
675 | { | ||
676 | fprintf(stdout, "We've found a smart callback on the smart object!" | ||
677 | "\n\tname: %s\n\ttype: %s\n", (*descriptions)->name, | ||
678 | (*descriptions)->type); | ||
679 | |||
680 | if (strcmp((*descriptions)->type, "i")) continue; | ||
681 | /* we know we don't have other types of smart callbacks | ||
682 | * here, just playing with it */ | ||
683 | |||
684 | /* for now, we know the only one callback is the one | ||
685 | * reporting number of member objects changed on the | ||
686 | * example smart object */ | ||
687 | evas_object_smart_callback_add( | ||
688 | d.smt, (*descriptions)->name, | ||
689 | _on_example_smart_object_child_num_change, NULL); | ||
690 | } | ||
691 | |||
692 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
693 | evas_object_event_callback_add( | ||
694 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
695 | |||
696 | fprintf(stdout, commands); | ||
697 | ecore_main_loop_begin(); | ||
698 | |||
699 | ecore_evas_free(d.ee); | ||
700 | ecore_evas_shutdown(); | ||
701 | return 0; | ||
702 | |||
703 | error: | ||
704 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
705 | " up to ecore-evas for this example to run properly.\n"); | ||
706 | ecore_evas_shutdown(); | ||
707 | return -1; | ||
708 | } | ||
diff --git a/libraries/evas/src/examples/evas-stacking.c b/libraries/evas/src/examples/evas-stacking.c new file mode 100644 index 0000000..49fc819 --- /dev/null +++ b/libraries/evas/src/examples/evas-stacking.c | |||
@@ -0,0 +1,329 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating <b>objects stacking</b> and | ||
3 | * <b>canvas layers</b>. | ||
4 | * | ||
5 | * You'll need at least one engine built for it (excluding the buffer | ||
6 | * one) and the png image loader also built. See stdout/stderr for | ||
7 | * output. | ||
8 | * | ||
9 | * @verbatim | ||
10 | * gcc -o evas-stacking evas-stacking.c `pkg-config --libs --cflags evas ecore ecore-evas edje` | ||
11 | * @endverbatim | ||
12 | */ | ||
13 | |||
14 | #ifdef HAVE_CONFIG_H | ||
15 | #include "config.h" | ||
16 | #else | ||
17 | |||
18 | #define __UNUSED__ | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #include <Ecore.h> | ||
23 | #include <Ecore_Evas.h> | ||
24 | |||
25 | #include <stdlib.h> | ||
26 | #include <stdio.h> | ||
27 | #include <string.h> | ||
28 | |||
29 | #define WIDTH 320 | ||
30 | #define HEIGHT 320 | ||
31 | |||
32 | struct test_data | ||
33 | { | ||
34 | Ecore_Evas *ee; | ||
35 | Evas *canvas; | ||
36 | Evas_Object *bg; | ||
37 | Evas_Object *rects[3]; /* red, green, blue */ | ||
38 | int layers[3]; /* default, below it, above it */ | ||
39 | int cur_rect, cur_layer; | ||
40 | }; | ||
41 | |||
42 | static struct test_data d = {0}; | ||
43 | |||
44 | static const char *commands = \ | ||
45 | "commands are:\n" | ||
46 | "\tc - change the target rectangle to operate on\n" | ||
47 | "\ta - stack target rectangle one level above\n" | ||
48 | "\tb - stack target rectangle one level below\n" | ||
49 | "\tt - stack target rectangle up to the top of its layer\n" | ||
50 | "\tm - stack target rectangle down to the bottom of its layer\n" | ||
51 | "\tp - toggle target rectangle's 'pass events' property\n" | ||
52 | "\tr - toggle target rectangle's 'repeat events' property\n" | ||
53 | "\ts - print current stacking information\n" | ||
54 | "\tl - change background rectangle's layer\n" | ||
55 | "\th - print help\n"; | ||
56 | |||
57 | static void | ||
58 | _on_mouse_down(void *data __UNUSED__, | ||
59 | Evas *evas __UNUSED__, | ||
60 | Evas_Object *o, | ||
61 | void *einfo __UNUSED__) | ||
62 | { | ||
63 | fprintf(stdout, "Mouse down on rectangle %s!\n", evas_object_name_get(o)); | ||
64 | } | ||
65 | |||
66 | /* here just to keep our example's window size and background image's | ||
67 | * size in synchrony */ | ||
68 | static void | ||
69 | _canvas_resize_cb(Ecore_Evas *ee) | ||
70 | { | ||
71 | int w, h; | ||
72 | |||
73 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
74 | evas_object_resize(d.bg, w, h); | ||
75 | } | ||
76 | |||
77 | /* use the following commands to interact with this example - 'h' is | ||
78 | * the key for help */ | ||
79 | static void | ||
80 | _on_keydown(void *data __UNUSED__, | ||
81 | Evas *evas __UNUSED__, | ||
82 | Evas_Object *o __UNUSED__, | ||
83 | void *einfo) | ||
84 | { | ||
85 | Evas_Event_Key_Down *ev = einfo; | ||
86 | const char *name = evas_object_name_get(d.rects[d.cur_rect]); | ||
87 | |||
88 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
89 | { | ||
90 | fprintf(stdout, commands); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | if (strcmp(ev->keyname, "s") == 0) /* get status of the | ||
95 | * rectangles WRT size | ||
96 | * hints */ | ||
97 | { | ||
98 | Evas_Object *rect; | ||
99 | |||
100 | fprintf(stdout, "Order of stacking, from top to bottom, is: "); | ||
101 | |||
102 | rect = evas_object_top_get(evas); | ||
103 | fprintf(stdout, "%s", evas_object_name_get(rect)); | ||
104 | |||
105 | rect = evas_object_below_get(rect); | ||
106 | while (rect) | ||
107 | { | ||
108 | fprintf(stdout, ", %s", evas_object_name_get(rect)); | ||
109 | rect = evas_object_below_get(rect); | ||
110 | } | ||
111 | |||
112 | fprintf(stdout, ".\n"); | ||
113 | |||
114 | fprintf(stdout, "Current target rectangle is %s\n", | ||
115 | evas_object_name_get(d.rects[d.cur_rect])); | ||
116 | |||
117 | fprintf(stdout, "Background rectangle's layer is %d\n", | ||
118 | evas_object_layer_get(d.bg)); | ||
119 | |||
120 | return; | ||
121 | } | ||
122 | |||
123 | if (strcmp(ev->keyname, "l") == 0) /* change background rectangle's layer */ | ||
124 | { | ||
125 | d.cur_layer = (d.cur_layer + 1) % 3; | ||
126 | evas_object_layer_set(d.bg, d.layers[d.cur_layer]); | ||
127 | |||
128 | fprintf(stdout, "Changing background rectangle's layer to %d\n", | ||
129 | d.layers[d.cur_layer]); | ||
130 | return; | ||
131 | } | ||
132 | |||
133 | if (strcmp(ev->keyname, "c") == 0) /* change rectangle to operate on */ | ||
134 | { | ||
135 | d.cur_rect = (d.cur_rect + 1) % 3; | ||
136 | |||
137 | fprintf(stdout, "Changing target rectangle to the %s one\n", | ||
138 | evas_object_name_get(d.rects[d.cur_rect])); | ||
139 | return; | ||
140 | } | ||
141 | |||
142 | if (strcmp(ev->keyname, "t") == 0) /* bring target to top */ | ||
143 | { | ||
144 | Evas_Object *neighbour; | ||
145 | |||
146 | evas_object_raise(d.rects[d.cur_rect]); | ||
147 | |||
148 | fprintf(stdout, "%s rectangle was re-stacked to the top if its layer\n", | ||
149 | name); | ||
150 | |||
151 | neighbour = evas_object_below_get(d.rects[d.cur_rect]); | ||
152 | fprintf(stdout, "Below of %s rect is %s\n", name, | ||
153 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
154 | return; | ||
155 | } | ||
156 | |||
157 | if (strcmp(ev->keyname, "m") == 0) /* bring target to bottom */ | ||
158 | { | ||
159 | Evas_Object *neighbour; | ||
160 | |||
161 | evas_object_lower(d.rects[d.cur_rect]); | ||
162 | |||
163 | fprintf(stdout, | ||
164 | "%s rectangle was re-stacked to the bottom if its layer\n", | ||
165 | name); | ||
166 | |||
167 | neighbour = evas_object_below_get(d.rects[d.cur_rect]); | ||
168 | fprintf(stdout, "Below of %s rect is %s\n", name, | ||
169 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (strcmp(ev->keyname, "p") == 0) /* toggle pass events */ | ||
174 | { | ||
175 | Eina_Bool pass = evas_object_pass_events_get(d.rects[d.cur_rect]); | ||
176 | |||
177 | evas_object_pass_events_set(d.rects[d.cur_rect], !pass); | ||
178 | |||
179 | fprintf(stdout, "%s rectangle is now set to%s pass (ignore) events\n", | ||
180 | name, pass ? " NOT" : ""); | ||
181 | |||
182 | return; | ||
183 | } | ||
184 | |||
185 | if (strcmp(ev->keyname, "r") == 0) /* toggle repeat events */ | ||
186 | { | ||
187 | Eina_Bool repeat = evas_object_repeat_events_get(d.rects[d.cur_rect]); | ||
188 | |||
189 | evas_object_repeat_events_set(d.rects[d.cur_rect], !repeat); | ||
190 | |||
191 | fprintf(stdout, "%s rectangle is now set to%s repeat events\n", | ||
192 | name, repeat ? " NOT" : ""); | ||
193 | |||
194 | return; | ||
195 | } | ||
196 | |||
197 | if (strcmp(ev->keyname, "a") == 0) /* stack target above */ | ||
198 | { | ||
199 | Evas_Object *neighbour = evas_object_above_get(d.rects[d.cur_rect]); | ||
200 | |||
201 | if (!neighbour || (evas_object_layer_get(d.rects[d.cur_rect]) != | ||
202 | evas_object_layer_get(neighbour))) | ||
203 | return; | ||
204 | |||
205 | evas_object_stack_above(d.rects[d.cur_rect], neighbour); | ||
206 | |||
207 | fprintf(stdout, "%s rectangle was re-stacked one level above\n", name); | ||
208 | |||
209 | neighbour = evas_object_above_get(d.rects[d.cur_rect]); | ||
210 | fprintf(stdout, "Above of %s rect is %s\n", name, | ||
211 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
212 | |||
213 | neighbour = evas_object_below_get(d.rects[d.cur_rect]); | ||
214 | fprintf(stdout, "Below of %s rect is %s\n", name, | ||
215 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
216 | return; | ||
217 | } | ||
218 | |||
219 | if (strcmp(ev->keyname, "b") == 0) /* stack target below */ | ||
220 | { | ||
221 | Evas_Object *neighbour = evas_object_below_get(d.rects[d.cur_rect]); | ||
222 | |||
223 | if (!neighbour || (evas_object_layer_get(d.rects[d.cur_rect]) != | ||
224 | evas_object_layer_get(neighbour))) | ||
225 | return; | ||
226 | |||
227 | evas_object_stack_below(d.rects[d.cur_rect], neighbour); | ||
228 | |||
229 | fprintf(stdout, "%s rectangle was re-stacked one level below\n", name); | ||
230 | |||
231 | neighbour = evas_object_above_get(d.rects[d.cur_rect]); | ||
232 | fprintf(stdout, "Above of %s rect is %s\n", name, | ||
233 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
234 | |||
235 | neighbour = evas_object_below_get(d.rects[d.cur_rect]); | ||
236 | |||
237 | fprintf(stdout, "Below of %s rect is %s\n", name, | ||
238 | neighbour ? evas_object_name_get(neighbour) : "no object"); | ||
239 | return; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | static void | ||
244 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
245 | { | ||
246 | ecore_main_loop_quit(); | ||
247 | } | ||
248 | |||
249 | int | ||
250 | main(void) | ||
251 | { | ||
252 | if (!ecore_evas_init()) | ||
253 | return EXIT_FAILURE; | ||
254 | |||
255 | /* this will give you a window with an Evas canvas under the first | ||
256 | * engine available */ | ||
257 | d.ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); | ||
258 | if (!d.ee) | ||
259 | goto error; | ||
260 | |||
261 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
262 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
263 | ecore_evas_show(d.ee); | ||
264 | |||
265 | /* the canvas pointer, de facto */ | ||
266 | d.canvas = ecore_evas_get(d.ee); | ||
267 | |||
268 | d.bg = evas_object_rectangle_add(d.canvas); | ||
269 | evas_object_name_set(d.bg, "background"); /* white bg */ | ||
270 | evas_object_color_set(d.bg, 255, 255, 255, 255); | ||
271 | evas_object_move(d.bg, 0, 0); | ||
272 | evas_object_resize(d.bg, WIDTH, HEIGHT); | ||
273 | |||
274 | d.layers[0] = evas_object_layer_get(d.bg); | ||
275 | d.layers[1] = d.layers[0] - 1; | ||
276 | d.layers[2] = d.layers[0] + 1; | ||
277 | |||
278 | d.cur_layer = 1; | ||
279 | evas_object_layer_set(d.bg, d.layers[d.cur_layer]); /* let's start with it | ||
280 | * below the default | ||
281 | * layer */ | ||
282 | |||
283 | evas_object_show(d.bg); | ||
284 | |||
285 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
286 | evas_object_event_callback_add( | ||
287 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
288 | |||
289 | d.rects[2] = evas_object_rectangle_add(d.canvas); | ||
290 | evas_object_name_set(d.rects[2], "blue"); | ||
291 | evas_object_color_set(d.rects[2], 0, 0, 255, 255); | ||
292 | |||
293 | evas_object_resize(d.rects[2], WIDTH / 2.2, WIDTH / 2.2); | ||
294 | evas_object_move(d.rects[2], WIDTH / 6, WIDTH / 4.5); | ||
295 | evas_object_show(d.rects[2]); | ||
296 | evas_object_event_callback_add( | ||
297 | d.rects[2], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); | ||
298 | |||
299 | d.rects[1] = evas_object_rectangle_add(d.canvas); | ||
300 | evas_object_name_set(d.rects[1], "green"); | ||
301 | evas_object_color_set(d.rects[1], 0, 255, 0, 255); | ||
302 | |||
303 | evas_object_resize(d.rects[1], WIDTH / 2.2, WIDTH / 2.2); | ||
304 | evas_object_move(d.rects[1], WIDTH / 2.5, WIDTH / 7); | ||
305 | evas_object_show(d.rects[1]); | ||
306 | evas_object_event_callback_add( | ||
307 | d.rects[1], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); | ||
308 | |||
309 | d.rects[0] = evas_object_rectangle_add(d.canvas); | ||
310 | evas_object_name_set(d.rects[0], "red"); | ||
311 | evas_object_color_set(d.rects[0], 255, 0, 0, 255); | ||
312 | |||
313 | evas_object_resize(d.rects[0], WIDTH / 2.2, WIDTH / 2.2); | ||
314 | evas_object_move(d.rects[0], WIDTH / 3, WIDTH / 2.5); | ||
315 | evas_object_show(d.rects[0]); | ||
316 | evas_object_event_callback_add( | ||
317 | d.rects[0], EVAS_CALLBACK_MOUSE_DOWN, _on_mouse_down, NULL); | ||
318 | |||
319 | fprintf(stdout, commands); | ||
320 | ecore_main_loop_begin(); | ||
321 | |||
322 | ecore_evas_shutdown(); | ||
323 | return 0; | ||
324 | |||
325 | error: | ||
326 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
327 | " up to ecore-evas for this example to run properly.\n"); | ||
328 | return -1; | ||
329 | } | ||
diff --git a/libraries/evas/src/examples/evas-text.c b/libraries/evas/src/examples/evas-text.c new file mode 100644 index 0000000..ba55662 --- /dev/null +++ b/libraries/evas/src/examples/evas-text.c | |||
@@ -0,0 +1,411 @@ | |||
1 | /** | ||
2 | * Simple Evas example illustrating text objects | ||
3 | * | ||
4 | * You'll need at least one engine built for it (excluding the buffer | ||
5 | * one). See stdout/stderr for output. | ||
6 | * | ||
7 | * @verbatim | ||
8 | * gcc -o evas-text evas-text.c `pkg-config --libs --cflags evas ecore ecore-evas` | ||
9 | * @endverbatim | ||
10 | */ | ||
11 | |||
12 | #ifdef HAVE_CONFIG_H | ||
13 | |||
14 | #include "config.h" | ||
15 | #else | ||
16 | |||
17 | #define PACKAGE_EXAMPLES_DIR "." | ||
18 | #define __UNUSED__ | ||
19 | |||
20 | #endif | ||
21 | |||
22 | #include <Ecore.h> | ||
23 | #include <Ecore_Evas.h> | ||
24 | #include <stdio.h> | ||
25 | #include <errno.h> | ||
26 | |||
27 | #define WIDTH (320) | ||
28 | #define HEIGHT (240) | ||
29 | |||
30 | #define GREY {190, 190, 190, 255} | ||
31 | #define BLACK {0, 0, 0, 255} | ||
32 | #define WHITE {255, 255, 255, 255} | ||
33 | #define RED {255, 0, 0, 255} | ||
34 | #define GREEN {0, 255, 0, 255} | ||
35 | #define BLUE {0, 0, 255, 255} | ||
36 | |||
37 | #define POINTER_CYCLE(_ptr, _array) \ | ||
38 | do \ | ||
39 | { \ | ||
40 | if ((unsigned)(((void *)(_ptr)) - ((void *)(_array))) >= \ | ||
41 | sizeof(_array)) \ | ||
42 | _ptr = _array; \ | ||
43 | } \ | ||
44 | while(0) | ||
45 | |||
46 | static const char *commands = \ | ||
47 | "commands are:\n" | ||
48 | "\tt - change text's current style\n" | ||
49 | "\tz - change text's font size\n" | ||
50 | "\tf - change text's font family\n" | ||
51 | "\tb - change text's base color\n" | ||
52 | "\ts - change text's \'shadow\' color\n" | ||
53 | "\to - change text's \'outline\' color\n" | ||
54 | "\tw - change text's \'glow\' color\n" | ||
55 | "\tg - change text's \'glow 2\' color\n" | ||
56 | "\th - print help\n"; | ||
57 | |||
58 | static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; | ||
59 | |||
60 | struct color_tuple | ||
61 | { | ||
62 | int r, g, b, a; | ||
63 | }; | ||
64 | |||
65 | struct text_preset_data | ||
66 | { | ||
67 | const char **font_ptr; | ||
68 | const char *font[3]; | ||
69 | |||
70 | struct color_tuple *text_ptr; | ||
71 | struct color_tuple text[6]; | ||
72 | |||
73 | struct color_tuple *shadow_ptr; | ||
74 | struct color_tuple shadow[4]; | ||
75 | |||
76 | struct color_tuple *outline_ptr; | ||
77 | struct color_tuple outline[4]; | ||
78 | |||
79 | struct color_tuple *glow_ptr; | ||
80 | struct color_tuple glow[4]; | ||
81 | |||
82 | struct color_tuple *glow2_ptr; | ||
83 | struct color_tuple glow2[4]; | ||
84 | }; | ||
85 | |||
86 | struct test_data | ||
87 | { | ||
88 | Ecore_Evas *ee; | ||
89 | Evas *evas; | ||
90 | struct text_preset_data t_data; | ||
91 | Evas_Object *text, *bg, *border; | ||
92 | }; | ||
93 | |||
94 | static struct test_data d = {0}; | ||
95 | |||
96 | static void | ||
97 | _on_destroy(Ecore_Evas *ee __UNUSED__) | ||
98 | { | ||
99 | ecore_main_loop_quit(); | ||
100 | } | ||
101 | |||
102 | /* here just to keep our example's window size and background image's | ||
103 | * size in synchrony */ | ||
104 | static void | ||
105 | _canvas_resize_cb(Ecore_Evas *ee) | ||
106 | { | ||
107 | int w, h; | ||
108 | |||
109 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | ||
110 | evas_object_resize(d.bg, w, h); | ||
111 | } | ||
112 | |||
113 | static const char * | ||
114 | _text_style_type_to_str(Evas_Text_Style_Type mode) | ||
115 | { | ||
116 | switch (mode) | ||
117 | { | ||
118 | case EVAS_TEXT_STYLE_PLAIN: | ||
119 | return "plain"; | ||
120 | |||
121 | case EVAS_TEXT_STYLE_SHADOW: | ||
122 | return "shadow"; | ||
123 | |||
124 | case EVAS_TEXT_STYLE_OUTLINE: | ||
125 | return "outline"; | ||
126 | |||
127 | case EVAS_TEXT_STYLE_SOFT_OUTLINE: | ||
128 | return "soft outline"; | ||
129 | |||
130 | case EVAS_TEXT_STYLE_GLOW: | ||
131 | return "glow"; | ||
132 | |||
133 | case EVAS_TEXT_STYLE_OUTLINE_SHADOW: | ||
134 | return "outline shadow"; | ||
135 | |||
136 | case EVAS_TEXT_STYLE_FAR_SHADOW: | ||
137 | return "far shadow"; | ||
138 | |||
139 | case EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW: | ||
140 | return "outline soft shadow"; | ||
141 | |||
142 | case EVAS_TEXT_STYLE_SOFT_SHADOW: | ||
143 | return "soft shadow"; | ||
144 | |||
145 | case EVAS_TEXT_STYLE_FAR_SOFT_SHADOW: | ||
146 | return "far soft shadow"; | ||
147 | |||
148 | default: | ||
149 | return "invalid"; | ||
150 | } | ||
151 | } | ||
152 | |||
153 | static void | ||
154 | _on_keydown(void *data __UNUSED__, | ||
155 | Evas *evas __UNUSED__, | ||
156 | Evas_Object *o __UNUSED__, | ||
157 | void *einfo) | ||
158 | { | ||
159 | Evas_Event_Key_Down *ev = einfo; | ||
160 | |||
161 | if (strcmp(ev->keyname, "h") == 0) /* print help */ | ||
162 | { | ||
163 | fprintf(stdout, commands); | ||
164 | return; | ||
165 | } | ||
166 | |||
167 | if (strcmp(ev->keyname, "t") == 0) /* change text's current style */ | ||
168 | { | ||
169 | Evas_Text_Style_Type type = evas_object_text_style_get(d.text); | ||
170 | |||
171 | type = (type + 1) % 10; | ||
172 | |||
173 | evas_object_text_style_set(d.text, type); | ||
174 | |||
175 | fprintf(stdout, "Changing text's style to \'%s\'\n", | ||
176 | _text_style_type_to_str(type)); | ||
177 | |||
178 | return; | ||
179 | } | ||
180 | |||
181 | if (strcmp(ev->keyname, "f") == 0) /* change text's font */ | ||
182 | { | ||
183 | int sz; | ||
184 | |||
185 | (d.t_data.font_ptr)++; | ||
186 | |||
187 | evas_object_text_font_get(d.text, NULL, &sz); | ||
188 | |||
189 | POINTER_CYCLE(d.t_data.font_ptr, d.t_data.font); | ||
190 | |||
191 | evas_object_text_font_set(d.text, *d.t_data.font_ptr, sz); | ||
192 | |||
193 | fprintf(stdout, "Changing text's font to %s\n", *d.t_data.font_ptr); | ||
194 | |||
195 | return; | ||
196 | } | ||
197 | |||
198 | if (strcmp(ev->keyname, "b") == 0) /* change text's base color */ | ||
199 | { | ||
200 | (d.t_data.text_ptr)++; | ||
201 | |||
202 | POINTER_CYCLE(d.t_data.text_ptr, d.t_data.text); | ||
203 | |||
204 | evas_object_color_set( | ||
205 | d.text, d.t_data.text_ptr->r, d.t_data.text_ptr->g, | ||
206 | d.t_data.text_ptr->b, d.t_data.text_ptr->a); | ||
207 | |||
208 | fprintf(stdout, "Changing base color for text to (%d, %d, %d, %d)\n", | ||
209 | d.t_data.text_ptr->r, d.t_data.text_ptr->g, | ||
210 | d.t_data.text_ptr->b, d.t_data.text_ptr->a); | ||
211 | |||
212 | return; | ||
213 | } | ||
214 | |||
215 | if (strcmp(ev->keyname, "g") == 0) /* change text's glow 2 color */ | ||
216 | { | ||
217 | (d.t_data.glow2_ptr)++; | ||
218 | |||
219 | POINTER_CYCLE(d.t_data.glow2_ptr, d.t_data.glow2); | ||
220 | |||
221 | evas_object_text_glow2_color_set( | ||
222 | d.text, d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, | ||
223 | d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); | ||
224 | |||
225 | fprintf(stdout, "Changing glow 2 color for text to (%d, %d, %d, %d)\n", | ||
226 | d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, | ||
227 | d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); | ||
228 | |||
229 | return; | ||
230 | } | ||
231 | |||
232 | if (strcmp(ev->keyname, "w") == 0) /* change text's glow color */ | ||
233 | { | ||
234 | (d.t_data.glow_ptr)++; | ||
235 | |||
236 | POINTER_CYCLE(d.t_data.glow_ptr, d.t_data.glow); | ||
237 | |||
238 | evas_object_text_glow_color_set( | ||
239 | d.text, d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, | ||
240 | d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); | ||
241 | |||
242 | fprintf(stdout, "Changing glow color for text to (%d, %d, %d, %d)\n", | ||
243 | d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, | ||
244 | d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); | ||
245 | |||
246 | return; | ||
247 | } | ||
248 | |||
249 | if (strcmp(ev->keyname, "o") == 0) /* change text's outline color */ | ||
250 | { | ||
251 | (d.t_data.outline_ptr)++; | ||
252 | |||
253 | POINTER_CYCLE(d.t_data.outline_ptr, d.t_data.outline); | ||
254 | |||
255 | evas_object_text_outline_color_set( | ||
256 | d.text, d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, | ||
257 | d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); | ||
258 | |||
259 | fprintf(stdout, "Changing outline color for text to (%d, %d, %d, %d)\n", | ||
260 | d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, | ||
261 | d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); | ||
262 | |||
263 | return; | ||
264 | } | ||
265 | |||
266 | if (strcmp(ev->keyname, "s") == 0) /* change text's shadow color */ | ||
267 | { | ||
268 | (d.t_data.shadow_ptr)++; | ||
269 | |||
270 | POINTER_CYCLE(d.t_data.shadow_ptr, d.t_data.shadow); | ||
271 | |||
272 | evas_object_text_shadow_color_set( | ||
273 | d.text, d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, | ||
274 | d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); | ||
275 | |||
276 | fprintf(stdout, "Changing shadow color for text to (%d, %d, %d, %d)\n", | ||
277 | d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, | ||
278 | d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); | ||
279 | |||
280 | return; | ||
281 | } | ||
282 | |||
283 | if (strcmp(ev->keyname, "z") == 0) /* change text's font size */ | ||
284 | { | ||
285 | const char *font; | ||
286 | int size; | ||
287 | |||
288 | evas_object_text_font_get(d.text, &font, &size); | ||
289 | |||
290 | size = (size + 10) % 50; | ||
291 | if (!size) size = 10; | ||
292 | |||
293 | evas_object_text_font_set(d.text, font, size); | ||
294 | |||
295 | fprintf(stdout, "Changing text's font size to %d\n", size); | ||
296 | |||
297 | return; | ||
298 | } | ||
299 | } | ||
300 | |||
301 | int | ||
302 | main(void) | ||
303 | { | ||
304 | int size; | ||
305 | const char *font; | ||
306 | |||
307 | if (!ecore_evas_init()) | ||
308 | return EXIT_FAILURE; | ||
309 | |||
310 | /* init values one is going to cycle through while running this | ||
311 | * example */ | ||
312 | struct text_preset_data init_data = | ||
313 | { | ||
314 | .font = {"DejaVu", "Courier", "Utopia"}, | ||
315 | .text = {BLACK, WHITE, GREY, RED, GREEN, BLUE}, | ||
316 | .shadow = {WHITE, BLUE, GREEN, RED}, | ||
317 | .outline = {WHITE, RED, GREEN, BLUE}, | ||
318 | .glow = {WHITE, BLUE, GREEN, RED}, | ||
319 | .glow2 = {WHITE, RED, BLUE, GREEN} | ||
320 | }; | ||
321 | |||
322 | d.t_data = init_data; | ||
323 | d.t_data.font_ptr = d.t_data.font; | ||
324 | d.t_data.text_ptr = d.t_data.text; | ||
325 | d.t_data.glow_ptr = d.t_data.glow; | ||
326 | d.t_data.glow2_ptr = d.t_data.glow2; | ||
327 | d.t_data.outline_ptr = d.t_data.outline; | ||
328 | d.t_data.shadow_ptr = d.t_data.shadow; | ||
329 | |||
330 | /* this will give you a window with an Evas canvas under the first | ||
331 | * engine available */ | ||
332 | d.ee = ecore_evas_new(NULL, 10, 10, WIDTH, HEIGHT, NULL); | ||
333 | if (!d.ee) | ||
334 | goto error; | ||
335 | |||
336 | ecore_evas_callback_destroy_set(d.ee, _on_destroy); | ||
337 | ecore_evas_callback_resize_set(d.ee, _canvas_resize_cb); | ||
338 | ecore_evas_show(d.ee); | ||
339 | |||
340 | /* the canvas pointer, de facto */ | ||
341 | d.evas = ecore_evas_get(d.ee); | ||
342 | |||
343 | d.bg = evas_object_rectangle_add(d.evas); | ||
344 | evas_object_color_set(d.bg, 255, 255, 255, 255); /* white bg */ | ||
345 | evas_object_move(d.bg, 0, 0); /* at canvas' origin */ | ||
346 | evas_object_resize(d.bg, WIDTH, HEIGHT); /* covers full canvas */ | ||
347 | evas_object_show(d.bg); | ||
348 | |||
349 | evas_object_focus_set(d.bg, EINA_TRUE); | ||
350 | evas_object_event_callback_add( | ||
351 | d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); | ||
352 | |||
353 | d.text = evas_object_text_add(d.evas); | ||
354 | evas_object_text_style_set(d.text, EVAS_TEXT_STYLE_PLAIN); | ||
355 | |||
356 | /* let the pre-set thingies be enforced */ | ||
357 | evas_object_color_set( | ||
358 | d.text, d.t_data.text_ptr->r, d.t_data.text_ptr->g, | ||
359 | d.t_data.text_ptr->b, d.t_data.text_ptr->a); | ||
360 | |||
361 | evas_object_text_glow_color_set( | ||
362 | d.text, d.t_data.glow_ptr->r, d.t_data.glow_ptr->g, | ||
363 | d.t_data.glow_ptr->b, d.t_data.glow_ptr->a); | ||
364 | |||
365 | evas_object_text_glow2_color_set( | ||
366 | d.text, d.t_data.glow2_ptr->r, d.t_data.glow2_ptr->g, | ||
367 | d.t_data.glow2_ptr->b, d.t_data.glow2_ptr->a); | ||
368 | |||
369 | evas_object_text_outline_color_set( | ||
370 | d.text, d.t_data.outline_ptr->r, d.t_data.outline_ptr->g, | ||
371 | d.t_data.outline_ptr->b, d.t_data.outline_ptr->a); | ||
372 | |||
373 | evas_object_text_shadow_color_set( | ||
374 | d.text, d.t_data.shadow_ptr->r, d.t_data.shadow_ptr->g, | ||
375 | d.t_data.shadow_ptr->b, d.t_data.shadow_ptr->a); | ||
376 | |||
377 | evas_object_text_font_set(d.text, *d.t_data.font_ptr, 30); | ||
378 | evas_object_text_text_set(d.text, "sample text"); | ||
379 | |||
380 | evas_object_resize(d.text, (3 * WIDTH) / 4, HEIGHT / 4); | ||
381 | evas_object_move(d.text, WIDTH / 8, (3 * HEIGHT) / 8); | ||
382 | evas_object_show(d.text); | ||
383 | |||
384 | evas_object_text_font_get(d.text, &font, &size); | ||
385 | fprintf(stdout, "Adding text object with font %s, size %d\n", font, size); | ||
386 | |||
387 | /* this is a border around the text object above, here just to | ||
388 | * emphasize its geometry */ | ||
389 | d.border = evas_object_image_filled_add(d.evas); | ||
390 | evas_object_image_file_set(d.border, border_img_path, NULL); | ||
391 | evas_object_image_border_set(d.border, 3, 3, 3, 3); | ||
392 | evas_object_image_border_center_fill_set(d.border, EVAS_BORDER_FILL_NONE); | ||
393 | |||
394 | evas_object_resize(d.border, ((3 * WIDTH) / 4) + 3, (HEIGHT / 4) + 3); | ||
395 | evas_object_move(d.border, (WIDTH / 8) - 3, ((3 * HEIGHT) / 8) - 3); | ||
396 | evas_object_show(d.border); | ||
397 | |||
398 | fprintf(stdout, commands); | ||
399 | ecore_main_loop_begin(); | ||
400 | |||
401 | ecore_evas_free(d.ee); | ||
402 | ecore_evas_shutdown(); | ||
403 | return 0; | ||
404 | |||
405 | error: | ||
406 | fprintf(stderr, "you got to have at least one evas engine built and linked" | ||
407 | " up to ecore-evas for this example to run properly.\n"); | ||
408 | ecore_evas_shutdown(); | ||
409 | return -1; | ||
410 | } | ||
411 | |||
diff --git a/libraries/evas/src/examples/im1.png b/libraries/evas/src/examples/im1.png new file mode 100644 index 0000000..aa37869 --- /dev/null +++ b/libraries/evas/src/examples/im1.png | |||
Binary files differ | |||
diff --git a/libraries/evas/src/examples/red.png b/libraries/evas/src/examples/red.png new file mode 100644 index 0000000..dd03528 --- /dev/null +++ b/libraries/evas/src/examples/red.png | |||
Binary files differ | |||