summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-10-13 00:41:09 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-10-13 00:41:09 +0000
commitb2205f66f6515f06165721f2be4c8856f141b1ed (patch)
tree1792395cc31ab86125aac9be5c32e2254ceb601d /src
parentcf3104fd8d10d1b86a19136484b57d1b8c0131f7 (diff)
table widget wrapper - NOTE - NON-homogenous tables do NOT work. :) need to
fix that :) SVN revision: 17477
Diffstat (limited to 'src')
-rw-r--r--src/bin/Makefile.am4
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_test.c19
-rw-r--r--src/bin/e_widget_framelist.c2
-rw-r--r--src/bin/e_widget_frametable.c85
-rw-r--r--src/bin/e_widget_frametable.h14
6 files changed, 122 insertions, 3 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index f912f4c..f2dfdab 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -89,7 +89,8 @@ e_widget_radio.h \
89e_widget_framelist.h \ 89e_widget_framelist.h \
90e_widget_list.h \ 90e_widget_list.h \
91e_widget_button.h \ 91e_widget_button.h \
92e_widget_label.h 92e_widget_label.h \
93e_widget_frametable.h
93 94
94enlightenment_src = \ 95enlightenment_src = \
95e_user.c \ 96e_user.c \
@@ -161,6 +162,7 @@ e_widget_framelist.c \
161e_widget_list.c \ 162e_widget_list.c \
162e_widget_button.c \ 163e_widget_button.c \
163e_widget_label.c \ 164e_widget_label.c \
165e_widget_frametable.c \
164$(ENLIGHTENMENTHEADERS) 166$(ENLIGHTENMENTHEADERS)
165 167
166enlightenment_SOURCES = \ 168enlightenment_SOURCES = \
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index 0d6d8f0..bd8e0e0 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -71,3 +71,4 @@
71#include "e_widget_list.h" 71#include "e_widget_list.h"
72#include "e_widget_button.h" 72#include "e_widget_button.h"
73#include "e_widget_label.h" 73#include "e_widget_label.h"
74#include "e_widget_frametable.h"
diff --git a/src/bin/e_test.c b/src/bin/e_test.c
index 19b9236..0cc5914 100644
--- a/src/bin/e_test.c
+++ b/src/bin/e_test.c
@@ -307,7 +307,7 @@ _e_test_internal(E_Container *con)
307 e_win_centered_set(dia->win, 1); 307 e_win_centered_set(dia->win, 1);
308 e_dialog_show(dia); 308 e_dialog_show(dia);
309} 309}
310#elif 0 310#elif 1
311static int my_val = 0; 311static int my_val = 0;
312static int my_val2 = 0; 312static int my_val2 = 0;
313static int my_val3 = 0; 313static int my_val3 = 0;
@@ -365,6 +365,23 @@ _e_test_internal(E_Container *con)
365 365
366 e_widget_list_object_append(hb, o, 0, 0, 0.0); 366 e_widget_list_object_append(hb, o, 0, 0, 0.0);
367 367
368 o = e_widget_frametable_add(e, "My Frame Table", 1);
369
370 e_widget_frametable_object_append(o, e_widget_label_add(e, "Label 1"),
371 0, 0, 1, 1,
372 1, 1, 1, 1);
373 e_widget_frametable_object_append(o, e_widget_label_add(e, "Label 2"),
374 1, 0, 1, 1,
375 1, 1, 1, 1);
376 e_widget_frametable_object_append(o, e_widget_label_add(e, "Label 3"),
377 2, 0, 1, 1,
378 1, 1, 1, 1);
379 e_widget_frametable_object_append(o, e_widget_label_add(e, "Label 4"),
380 0, 1, 1, 1,
381 1, 1, 1, 1);
382
383 e_widget_list_object_append(hb, o, 0, 0, 0.5);
384
368 e_widget_list_object_append(ol, hb, 1, 1, 0.5); 385 e_widget_list_object_append(ol, hb, 1, 1, 0.5);
369 386
370 o = e_widget_button_add(e, "Button", "enlightenment/exit", NULL, NULL, NULL); 387 o = e_widget_button_add(e, "Button", "enlightenment/exit", NULL, NULL, NULL);
diff --git a/src/bin/e_widget_framelist.c b/src/bin/e_widget_framelist.c
index 73fa05e..5d06bd1 100644
--- a/src/bin/e_widget_framelist.c
+++ b/src/bin/e_widget_framelist.c
@@ -40,7 +40,7 @@ e_widget_framelist_add(Evas *evas, char *label, int horiz)
40 wd->o_box = o; 40 wd->o_box = o;
41 e_box_orientation_set(o, horiz); 41 e_box_orientation_set(o, horiz);
42 e_box_homogenous_set(o, 0); 42 e_box_homogenous_set(o, 0);
43 edje_object_part_swallow(o, "items", wd->o_box); 43 edje_object_part_swallow(wd->o_frame, "items", o);
44 e_widget_sub_object_add(obj, o); 44 e_widget_sub_object_add(obj, o);
45 evas_object_show(o); 45 evas_object_show(o);
46 46
diff --git a/src/bin/e_widget_frametable.c b/src/bin/e_widget_frametable.c
new file mode 100644
index 0000000..19b8f4f
--- /dev/null
+++ b/src/bin/e_widget_frametable.c
@@ -0,0 +1,85 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#include "e.h"
5
6typedef struct _E_Widget_Data E_Widget_Data;
7struct _E_Widget_Data
8{
9 Evas_Object *o_frame, *o_table;
10};
11
12static void _e_wid_del_hook(Evas_Object *obj);
13
14/* local subsystem functions */
15
16/* externally accessible functions */
17Evas_Object *
18e_widget_frametable_add(Evas *evas, char *label, int homogenous)
19{
20 Evas_Object *obj, *o;
21 E_Widget_Data *wd;
22 Evas_Coord mw, mh;
23
24 obj = e_widget_add(evas);
25
26 e_widget_del_hook_set(obj, _e_wid_del_hook);
27 wd = calloc(1, sizeof(E_Widget_Data));
28 e_widget_data_set(obj, wd);
29
30 o = edje_object_add(evas);
31 wd->o_frame = o;
32 e_theme_edje_object_set(o, "base/theme/widgets",
33 "widgets/frame");
34 edje_object_part_text_set(o, "label", label);
35 evas_object_show(o);
36 e_widget_sub_object_add(obj, o);
37 e_widget_resize_object_set(obj, o);
38
39 o = e_table_add(evas);
40 wd->o_table = o;
41 e_table_homogenous_set(o, homogenous);
42 edje_object_part_swallow(wd->o_frame, "items", o);
43 e_widget_sub_object_add(obj, o);
44 evas_object_show(o);
45
46 edje_object_size_min_calc(wd->o_frame, &mw, &mh);
47 e_widget_min_size_set(obj, mw, mh);
48
49 return obj;
50}
51
52void
53e_widget_frametable_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h)
54{
55 E_Widget_Data *wd;
56 Evas_Coord mw, mh;
57
58 wd = e_widget_data_get(obj);
59
60 e_table_pack(wd->o_table, sobj, col, row, colspan, rowspan);
61 e_widget_min_size_get(sobj, &mw, &mh);
62 e_table_pack_options_set(sobj,
63 fill_w, fill_h, /* fill */
64 expand_w, expand_h, /* expand */
65 0.5, 0.5, /* align */
66 mw, mh, /* min */
67 99999, 99999 /* max */
68 );
69 e_table_min_size_get(wd->o_table, &mw, &mh);
70 edje_extern_object_min_size_set(wd->o_table, mw, mh);
71 edje_object_part_swallow(wd->o_frame, "items", wd->o_table);
72 edje_object_size_min_calc(wd->o_frame, &mw, &mh);
73 e_widget_min_size_set(obj, mw, mh);
74 e_widget_sub_object_add(obj, sobj);
75 evas_object_show(sobj);
76}
77
78static void
79_e_wid_del_hook(Evas_Object *obj)
80{
81 E_Widget_Data *wd;
82
83 wd = e_widget_data_get(obj);
84 free(wd);
85}
diff --git a/src/bin/e_widget_frametable.h b/src/bin/e_widget_frametable.h
new file mode 100644
index 0000000..271f45c
--- /dev/null
+++ b/src/bin/e_widget_frametable.h
@@ -0,0 +1,14 @@
1/*
2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3 */
4#ifdef E_TYPEDEFS
5#else
6#ifndef E_WIDGET_FRAMETABLE_H
7#define E_WIDGET_FRAMETABLE_H
8
9EAPI Evas_Object *e_widget_frametable_add(Evas *evas, char *label, int homogenous);
10EAPI void e_widget_frametable_object_append(Evas_Object *obj, Evas_Object *sobj, int col, int row, int colspan, int rowspan, int fill_w, int fill_h, int expand_w, int expand_h);
11
12
13#endif
14#endif