summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2013-03-16 13:51:54 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2013-03-16 14:29:37 +0000
commitb13fcc1aac42779fbb58d6ae940396cced10c7de (patch)
treeaed9dc67306c0c6a4126725f2871a77d797c1421
exyz: Initial files for my private GTDFH app
-rw-r--r--Makefile.am10
-rwxr-xr-xautogen.sh6
-rw-r--r--configure.ac8
-rw-r--r--exyz.c340
4 files changed, 364 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..1437138
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,10 @@
1AUTOMAKE_OPTIONS = 1.4 foreign
2MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.h.in configure depcomp nstall-sh missing
3
4INCLUDES = -I$(top_srcdir)
5
6bin_PROGRAMS = exyz
7
8exyz_SOURCES = exyz.c
9exyz_LDADD = @ELEMENTARY_LIBS@
10exyz_CFLAGS = @ELEMENTARY_CFLAGS@
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..d6165e0
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,6 @@
1#!/bin/sh
2echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
3echo "Running autoheader..." ; autoheader || exit 1
4echo "Running autoconf..." ; autoconf || exit 1
5echo "Running automake..." ; automake --add-missing --copy --gnu || exit 1
6./configure "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..8c91741
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,8 @@
1AC_INIT(exyz, 0.0.0, stefan@datenfreihafen.org)
2AC_PREREQ(2.52)
3AC_CONFIG_SRCDIR(configure.ac)
4AM_CONFIG_HEADER(config.h)
5AC_PROG_CC
6AM_INIT_AUTOMAKE(1.6 dist-bzip2)
7PKG_CHECK_MODULES([ELEMENTARY], elementary)
8AC_OUTPUT(Makefile)
diff --git a/exyz.c b/exyz.c
new file mode 100644
index 0000000..5bd61eb
--- /dev/null
+++ b/exyz.c
@@ -0,0 +1,340 @@
1#include <Elementary.h>
2
3typedef struct _Testitem
4{
5 Elm_Object_Item *item;
6 int mode;
7 int onoff;
8 Eina_Bool checked;
9} Testitem;
10
11static void
12my_gl_update(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
13{
14 Testitem *tit = data;
15 tit->mode++;
16 elm_genlist_item_update(tit->item);
17}
18
19static void
20gl_sel(void *data, Evas_Object *obj, void *event_info)
21{
22 printf("sel item data [%p] on genlist obj [%p], item pointer [%p]\n", data, obj, event_info);
23}
24
25static void
26my_gl_item_check_changed2(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
27{
28 Testitem *tit = data;
29 tit->onoff = elm_check_state_get(obj);
30 printf("item %p onoff = %i\n", tit, tit->onoff);
31}
32
33static Elm_Genlist_Item_Class itc5;
34static Elm_Genlist_Item_Class itc_group;
35
36char *gll_text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *part)
37{
38 const Testitem *tit = data;
39 char buf[256];
40 if (!strcmp(part, "elm.text"))
41 {
42 snprintf(buf, sizeof(buf), "Item mode %i", tit->mode);
43 }
44 else if (!strcmp(part, "elm.text.sub"))
45 {
46 snprintf(buf, sizeof(buf), "%i bottles on the wall", tit->mode);
47 }
48 return strdup(buf);
49}
50
51Evas_Object *gll_content_get(void *data, Evas_Object *obj, const char *part)
52{
53 const Testitem *tit = data;
54 char buf[PATH_MAX];
55 if (!strcmp(part, "elm.swallow.end"))
56 {
57 Evas_Object *ck;
58 ck = elm_check_add(obj);
59 evas_object_propagate_events_set(ck, EINA_FALSE);
60 elm_check_state_set(ck, tit->onoff);
61 evas_object_smart_callback_add(ck, "changed", my_gl_item_check_changed2, data);
62 evas_object_show(ck);
63 return ck;
64 }
65 return NULL;
66}
67
68Eina_Bool gll_state_get(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, const char *part EINA_UNUSED)
69{
70 return EINA_FALSE;
71}
72
73static void
74item_drag_up(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
75{
76}
77
78static void
79item_drag_down(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
80{
81}
82
83static void
84item_drag_left(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
85{
86}
87
88static void
89item_drag_right(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
90{
91}
92
93static void
94scroll_top(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
95{
96}
97
98static void
99scroll_bottom(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
100{
101}
102
103static void
104scroll_left(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
105{
106}
107
108static void
109scroll_right(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
110{
111}
112
113static void
114item_drag(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
115{
116}
117
118static void
119item_drag_stop(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
120{
121}
122
123static void
124item_longpress(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
125{
126}
127
128Evas_Object *
129_content_new(Evas_Object *parent)
130{
131 Evas_Object *gl, *bx, *bx2, *bt, *nf = parent;
132 static Testitem tit[15];
133
134 bx = elm_box_add(nf);
135 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
136 elm_win_resize_object_add(nf, bx);
137 evas_object_show(bx);
138
139 gl = elm_genlist_add(nf);
140 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
141 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
142 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
143 evas_object_show(gl);
144
145 // Not needed
146 elm_genlist_homogeneous_set(gl, EINA_TRUE);
147
148 //itc5 = elm_genlist_item_class_new();
149 itc5.item_style = "double_label";
150 //itc5.item_style = "group_index";
151 itc5.func.text_get = gll_text_get;
152 itc5.func.content_get = gll_content_get;
153 itc5.func.state_get = gll_state_get;
154 itc5.func.del = NULL;
155
156 //itc_group = elm_genlist_item_class_new();
157 itc_group.item_style = "group_index";
158 itc_group.func.text_get = gll_text_get;
159 itc_group.func.content_get = NULL;
160 itc_group.func.state_get = NULL;
161 itc_group.func.del = NULL;
162
163 tit[0].mode = 0;
164 tit[0].item = elm_genlist_item_append(gl, &itc_group, &(tit[0]), NULL, ELM_GENLIST_ITEM_GROUP, gl_sel, NULL);
165 elm_genlist_item_select_mode_set(tit[0].item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
166 tit[1].mode = 1;
167 tit[1].item = elm_genlist_item_append(gl, &itc5, &(tit[1]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
168 tit[2].mode = 2;
169 tit[2].item = elm_genlist_item_append(gl, &itc5, &(tit[2]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
170 tit[3].mode = 3;
171 tit[3].item = elm_genlist_item_append(gl, &itc5, &(tit[3]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
172 tit[4].mode = 4;
173 tit[4].item = elm_genlist_item_append(gl, &itc5, &(tit[4]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
174 tit[5].mode = 5;
175 tit[5].item = elm_genlist_item_append(gl, &itc5, &(tit[5]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
176 tit[6].mode = 6;
177 tit[6].item = elm_genlist_item_append(gl, &itc5, &(tit[6]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
178 tit[7].mode = 7;
179 tit[7].item = elm_genlist_item_append(gl, &itc5, &(tit[7]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
180 tit[8].mode = 8;
181 tit[8].item = elm_genlist_item_append(gl, &itc5, &(tit[8]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
182 tit[9].mode = 9;
183 tit[9].item = elm_genlist_item_append(gl, &itc5, &(tit[9]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
184 tit[10].mode = 10;
185 tit[10].item = elm_genlist_item_append(gl, &itc_group, &(tit[10]), NULL, ELM_GENLIST_ITEM_GROUP, gl_sel, NULL);
186 elm_genlist_item_select_mode_set(tit[10].item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
187 tit[11].mode = 11;
188 tit[11].item = elm_genlist_item_append(gl, &itc5, &(tit[11]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
189 tit[12].mode = 12;
190 tit[12].item = elm_genlist_item_append(gl, &itc5, &(tit[12]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
191 tit[13].mode = 13;
192 tit[13].item = elm_genlist_item_append(gl, &itc5, &(tit[13]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
193 tit[14].mode = 14;
194 tit[14].item = elm_genlist_item_append(gl, &itc5, &(tit[14]), NULL, ELM_GENLIST_ITEM_NONE, gl_sel, NULL);
195
196 elm_box_pack_end(bx, gl);
197 evas_object_show(bx);
198
199 evas_object_smart_callback_add(gl, "drag,start,up", item_drag_up, NULL);
200 evas_object_smart_callback_add(gl, "drag,start,down", item_drag_down, NULL);
201 evas_object_smart_callback_add(gl, "drag,start,left", item_drag_left, NULL);
202 evas_object_smart_callback_add(gl, "drag,start,right", item_drag_right, NULL);
203 evas_object_smart_callback_add(gl, "scroll,edge,top", scroll_top, NULL);
204 evas_object_smart_callback_add(gl, "scroll,edge,bottom", scroll_bottom, NULL);
205 evas_object_smart_callback_add(gl, "scroll,edge,left", scroll_left, NULL);
206 evas_object_smart_callback_add(gl, "scroll,edge,right", scroll_right, NULL);
207 evas_object_smart_callback_add(gl, "drag", item_drag, NULL);
208 evas_object_smart_callback_add(gl, "drag,stop", item_drag_stop, NULL);
209 evas_object_smart_callback_add(gl, "longpressed", item_longpress, NULL);
210
211 bx2 = elm_box_add(nf);
212 elm_box_horizontal_set(bx2, EINA_TRUE);
213 elm_box_homogeneous_set(bx2, EINA_TRUE);
214 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
215 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
216
217 bt = elm_button_add(nf);
218 elm_object_text_set(bt, "Add itenm");
219 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
220 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
221 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
222 elm_box_pack_end(bx2, bt);
223 evas_object_show(bt);
224
225 bt = elm_button_add(nf);
226 elm_object_text_set(bt, "Edit itenm");
227 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[0]));
228 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
229 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
230 elm_box_pack_end(bx2, bt);
231 evas_object_show(bt);
232
233 bt = elm_button_add(nf);
234 elm_object_text_set(bt, "Add group");
235 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
236 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
237 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
238 elm_box_pack_end(bx2, bt);
239 evas_object_show(bt);
240
241 bt = elm_button_add(nf);
242 elm_object_text_set(bt, "Edit group");
243 evas_object_smart_callback_add(bt, "clicked", my_gl_update, &(tit[1]));
244 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
245 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
246 elm_box_pack_end(bx2, bt);
247 evas_object_show(bt);
248
249 elm_box_pack_end(bx, bx2);
250 evas_object_show(bx2);
251
252 return bx;
253}
254
255void
256_navi_pop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
257{
258 elm_naviframe_item_pop(data);
259}
260
261void
262_promote(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
263{
264 elm_naviframe_item_promote(data);
265}
266
267void
268_page3(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
269{
270 Evas_Object *bt, *content, *nf = data;
271 Elm_Object_Item *it;
272
273 bt = elm_button_add(nf);
274 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
275 evas_object_smart_callback_add(bt, "clicked", _navi_pop, nf);
276 elm_object_text_set(bt, "Next Actions");
277
278 content = _content_new(nf);
279 it = elm_naviframe_item_push(nf, "Projects", bt, NULL, content, NULL);
280 elm_object_item_part_text_set(it, "subtitle", "List with actions items for all projects");
281}
282
283void
284_page2(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
285{
286 Evas_Object *bt, *content, *bt2, *nf = data;
287 Elm_Object_Item *it;
288
289 bt = elm_button_add(nf);
290 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
291 evas_object_smart_callback_add(bt, "clicked", _promote,
292 evas_object_data_get(nf, "page1"));
293 elm_object_text_set(bt, "Journal");
294
295 bt2 = elm_button_add(nf);
296 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, EVAS_HINT_FILL);
297 evas_object_smart_callback_add(bt2, "clicked", _page3, nf);
298 elm_object_text_set(bt2, "Projects");
299
300 content = _content_new(nf);
301 it = elm_naviframe_item_push(nf, "Next Actions", bt, bt2, content, NULL);
302 elm_object_item_part_text_set(it, "subtitle", "Upcoming items");
303 evas_object_data_set(nf, "page2", it);
304}
305
306EAPI_MAIN int
307elm_main(int argc, char **argv)
308{
309 Evas_Object *win, *nf, *btn, *content;
310 Elm_Object_Item *it;
311
312 win = elm_win_util_standard_add("naviframe", "Naviframe");
313 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
314 elm_win_autodel_set(win, EINA_TRUE);
315
316 nf = elm_naviframe_add(win);
317 evas_object_size_hint_weight_set(nf, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
318 elm_win_resize_object_add(win, nf);
319 evas_object_show(nf);
320 //evas_object_smart_callback_add(nf, "title,clicked", _title_clicked, 0);
321
322 btn = elm_button_add(nf);
323 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
324 evas_object_smart_callback_add(btn, "clicked", _page2, nf);
325 elm_object_text_set(btn, "Next Actions");
326 evas_object_show(btn);
327
328 content = _content_new(nf);
329 it = elm_naviframe_item_push(nf, "Journal", NULL, btn, content, NULL);
330 evas_object_data_set(nf, "page1", it);
331 elm_object_item_part_text_set(it, "subtitle", "Chronological list with finished items");
332
333 evas_object_resize(win, 480, 700);
334 evas_object_show(win);
335
336 elm_run();
337 elm_shutdown();
338 return 0;
339}
340ELM_MAIN()