aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin/test_table.c
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2015-08-18 01:21:36 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2015-08-18 01:21:36 +0900
commit3214aad1293509dd29791b919415176f3cc6d5a8 (patch)
tree6fd772239a763bab2ea890c3dec5e3526b5ec86e /legacy/elementary/src/bin/test_table.c
parentpopup: Fix wrong since version in the doc. (diff)
downloadefl-3214aad1293509dd29791b919415176f3cc6d5a8.tar.gz
test_table: Add variable padding config in the padding test.
Diffstat (limited to 'legacy/elementary/src/bin/test_table.c')
-rw-r--r--legacy/elementary/src/bin/test_table.c91
1 files changed, 78 insertions, 13 deletions
diff --git a/legacy/elementary/src/bin/test_table.c b/legacy/elementary/src/bin/test_table.c
index dc2c759d17..76aa89f276 100644
--- a/legacy/elementary/src/bin/test_table.c
+++ b/legacy/elementary/src/bin/test_table.c
@@ -389,36 +389,77 @@ test_table7(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_show(win);
}
+static void
+_hor_sl_delay_changed_cb(void *data, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Coord h = 0;
+
+ elm_table_padding_get(data, NULL, &h);
+ elm_table_padding_set(data, elm_slider_value_get(obj), h);
+}
+
+static void
+_vert_sl_delay_changed_cb(void *data, Evas_Object *obj,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Coord w = 0;
+
+ elm_table_padding_get(data, &w, NULL);
+ elm_table_padding_set(data, w, elm_slider_value_get(obj));
+}
+
void
test_table8(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *tb, *bt;
+ Evas_Object *win, *bx, *tb_out, *tb, *bt, *bg, *sl;
win = elm_win_util_standard_add("table8", "Table Padding");
elm_win_autodel_set(win, EINA_TRUE);
- tb = elm_table_add(win);
+ bx = elm_box_add(win);
+ evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, bx);
+ evas_object_show(bx);
+
+ // outer table for the table alignment and background
+ tb_out = elm_table_add(bx);
+ evas_object_size_hint_weight_set(tb_out, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(tb_out, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, tb_out);
+ evas_object_show(tb_out);
+
+ // table background
+ bg = elm_bg_add(tb_out);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_table_pack(tb_out, bg, 0, 0, 1, 1);
+ elm_bg_color_set(bg, 255, 255, 0);
+ evas_object_show(bg);
+
+ // actual table for a padding test
+ tb = elm_table_add(tb_out);
elm_table_padding_set(tb, 10, 10);
- evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, tb);
+ evas_object_size_hint_align_set(tb_out, 0.5, 0.5);
+ elm_table_pack(tb_out, tb, 0, 0, 1, 1);
evas_object_show(tb);
// first row
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "colspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 0, 0, 1, 1);
evas_object_show(bt);
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "colspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 1, 0, 1, 1);
evas_object_show(bt);
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "colspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -426,7 +467,7 @@ test_table8(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_show(bt);
// second row
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "colspan 3");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -434,21 +475,21 @@ test_table8(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_show(bt);
// third row
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "rowspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 0, 2, 1, 1);
evas_object_show(bt);
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "rowspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 1, 2, 1, 1);
evas_object_show(bt);
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "rowspan 2");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -456,19 +497,43 @@ test_table8(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_show(bt);
// fourth row
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "rowspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 0, 3, 1, 1);
evas_object_show(bt);
- bt = elm_button_add(win);
+ bt = elm_button_add(tb);
elm_object_text_set(bt, "rowspan 1");
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_table_pack(tb, bt, 1, 3, 1, 1);
evas_object_show(bt);
+ // horizontal padding sliders
+ sl = elm_slider_add(bx);
+ elm_object_text_set(sl, "Horizontal Padding");
+ elm_slider_unit_format_set(sl, "%1.0f pixel");
+ elm_slider_min_max_set(sl, 0, 100);
+ elm_slider_value_set(sl, 10);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.0);
+ evas_object_smart_callback_add(sl, "delay,changed", _hor_sl_delay_changed_cb, tb);
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
+ // vertical padding sliders
+ sl = elm_slider_add(bx);
+ elm_object_text_set(sl, "Vertical Padding");
+ elm_slider_unit_format_set(sl, "%1.0f pixel");
+ elm_slider_min_max_set(sl, 0, 100);
+ elm_slider_value_set(sl, 10);
+ evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.0);
+ evas_object_smart_callback_add(sl, "delay,changed", _vert_sl_delay_changed_cb, tb);
+ elm_box_pack_end(bx, sl);
+ evas_object_show(sl);
+
evas_object_show(win);
}