aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/edje/src/examples/edje-text.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2013-01-13 17:29:19 +1000
committerDavid Walter Seikel2013-01-13 17:29:19 +1000
commit07274513e984f0b5544586c74508ccd16e7dcafa (patch)
treeb32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/edje/src/examples/edje-text.c
parentAdded Irrlicht 1.8, but without all the Windows binaries. (diff)
downloadSledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2
SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz
Remove EFL, since it's been released now.
Diffstat (limited to '')
-rw-r--r--libraries/edje/src/examples/edje-text.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/libraries/edje/src/examples/edje-text.c b/libraries/edje/src/examples/edje-text.c
deleted file mode 100644
index 5f801a2..0000000
--- a/libraries/edje/src/examples/edje-text.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/**
2 * Simple Edje example illustrating text functions.
3 *
4 * You'll need at least one Evas engine built for it (excluding the
5 * buffer one). See stdout/stderr for output.
6 *
7 * @verbatim
8 * edje_cc text.edc && gcc -o edje-text edje-text.c `pkg-config --libs --cflags ecore-evas edje`
9 * @endverbatim
10 */
11
12#ifdef HAVE_CONFIG_H
13# include "config.h"
14#else
15# define __UNUSED__
16#endif
17
18#include <Ecore.h>
19#include <Ecore_Evas.h>
20#include <Edje.h>
21
22#define WIDTH (300)
23#define HEIGHT (300)
24
25static void
26_on_delete(Ecore_Evas *ee __UNUSED__)
27{
28 ecore_main_loop_quit();
29}
30
31static void
32_on_text_change(void *data __UNUSED__, Evas_Object *obj, const char *part)
33{
34 printf("text: %s\n", edje_object_part_text_unescaped_get(obj, part));
35}
36
37int
38main(int argc __UNUSED__, char *argv[])
39{
40 char edje_file_path[PATH_MAX];
41 const char *edje_file = "text.edj";
42 Ecore_Evas *ee;
43 Evas *evas;
44 Evas_Object *bg;
45 Evas_Object *edje_obj;
46 Eina_Prefix *pfx;
47
48 if (!ecore_evas_init())
49 return EXIT_FAILURE;
50
51 if (!edje_init())
52 goto shutdown_ecore_evas;
53
54 pfx = eina_prefix_new(argv[0], main,
55 "EDJE_EXAMPLES",
56 "edje/examples",
57 edje_file,
58 PACKAGE_BIN_DIR,
59 PACKAGE_LIB_DIR,
60 PACKAGE_DATA_DIR,
61 PACKAGE_DATA_DIR);
62 if (!pfx)
63 goto shutdown_edje;
64
65 /* this will give you a window with an Evas canvas under the first
66 * engine available */
67 ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
68 if (!ee)
69 goto free_prefix;
70
71 ecore_evas_callback_delete_request_set(ee, _on_delete);
72 ecore_evas_title_set(ee, "Edje text Example");
73
74 evas = ecore_evas_get(ee);
75
76 bg = evas_object_rectangle_add(evas);
77 evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */
78 evas_object_move(bg, 0, 0); /* at canvas' origin */
79 evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */
80 evas_object_show(bg);
81 ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE);
82
83 edje_obj = edje_object_add(evas);
84
85 snprintf(edje_file_path, sizeof(edje_file_path),
86 "%s/examples/%s", eina_prefix_data_get(pfx), edje_file);
87 edje_object_file_set(edje_obj, edje_file_path, "example_group");
88 evas_object_move(edje_obj, 20, 20);
89 evas_object_resize(edje_obj, WIDTH - 40, HEIGHT - 40);
90 evas_object_show(edje_obj);
91
92 edje_object_text_change_cb_set(edje_obj, _on_text_change, NULL);
93 edje_object_part_text_set(edje_obj, "part_one", "one");
94 edje_object_part_text_set(edje_obj, "part_two", "<b>two");
95
96 edje_object_part_text_select_allow_set(edje_obj, "part_two", EINA_TRUE);
97 edje_object_part_text_select_all(edje_obj, "part_two");
98 printf("selection: %s\n", edje_object_part_text_selection_get(edje_obj, "part_two"));
99 edje_object_part_text_select_none(edje_obj, "part_two");
100 printf("selection: %s\n", edje_object_part_text_selection_get(edje_obj, "part_two"));
101
102 ecore_evas_show(ee);
103
104 ecore_main_loop_begin();
105
106 eina_prefix_free(pfx);
107 ecore_evas_free(ee);
108 ecore_evas_shutdown();
109 edje_shutdown();
110
111 return EXIT_SUCCESS;
112
113 free_prefix:
114 eina_prefix_free(pfx);
115 shutdown_edje:
116 edje_shutdown();
117 shutdown_ecore_evas:
118 ecore_evas_shutdown();
119
120 return EXIT_FAILURE;
121}