aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin/test_bg.c
diff options
context:
space:
mode:
Diffstat (limited to 'legacy/elementary/src/bin/test_bg.c')
-rw-r--r--legacy/elementary/src/bin/test_bg.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/legacy/elementary/src/bin/test_bg.c b/legacy/elementary/src/bin/test_bg.c
new file mode 100644
index 0000000000..d8056e60e7
--- /dev/null
+++ b/legacy/elementary/src/bin/test_bg.c
@@ -0,0 +1,54 @@
+#include <Elementary.h>
+
+void
+test_bg_plain(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg;
+
+ win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Bg Plain");
+ elm_win_autodel_set(win, 1);
+
+ bg = elm_bg_add(win);
+ /* allow bg to expand in x & y */
+ evas_object_size_hint_weight_set(bg, 1.0, 1.0);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ /* set size hints. a minimum size for the bg. this should propagate back
+ * to the window thus limiting its size based off the bg as the bg is one
+ * of the window's resize objects. */
+ evas_object_size_hint_min_set(bg, 160, 160);
+ /* and set a maximum size. not needed very often. normally used together
+ * with evas_object_size_hint_min_set() at the same size to make a
+ * window not resizable */
+ evas_object_size_hint_max_set(bg, 640, 640);
+ /* and now just resize the window to a size you want. normally widgets
+ * will determine the initial size though */
+ evas_object_resize(win, 320, 320);
+ /* and show the window */
+ evas_object_show(win);
+}
+
+void
+test_bg_image(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *win, *bg;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Bg Image");
+ elm_win_autodel_set(win, 1);
+
+ bg = elm_bg_add(win);
+ snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
+ elm_bg_file_set(bg, buf, NULL);
+ evas_object_size_hint_weight_set(bg, 1.0, 1.0);
+ elm_win_resize_object_add(win, bg);
+ evas_object_show(bg);
+
+ evas_object_size_hint_min_set(bg, 160, 160);
+ evas_object_size_hint_max_set(bg, 640, 640);
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+}