aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin/test_multibuttonentry.c
diff options
context:
space:
mode:
authorMike McCormack <mj.mccormack@samsung.com>2011-11-24 01:06:36 +0000
committerMike McCormack <mikem@ring3k.org>2011-11-24 01:06:36 +0000
commit905f9ec84a94ec83f06c49e4f18fdb98f74181c1 (patch)
tree95db90eea348cbc1f9222f96f6ed2152288aa289 /legacy/elementary/src/bin/test_multibuttonentry.c
parentelementary: Add multibuttonentry widget (diff)
downloadefl-905f9ec84a94ec83f06c49e4f18fdb98f74181c1.tar.gz
elementary: Fix warnings in multibuttonentry
test_multibuttonentry.c: In function ‘_item_selected_cb’: test_multibuttonentry.c:7:37: warning: unused parameter ‘data’ test_multibuttonentry.c:7:56: warning: unused parameter ‘obj’ test_multibuttonentry.c: In function ‘_item_added_cb’: test_multibuttonentry.c:15:34: warning: unused parameter ‘data’ test_multibuttonentry.c:15:53: warning: unused parameter ‘obj’ test_multibuttonentry.c: In function ‘_item_deleted_cb’: test_multibuttonentry.c:22:36: warning: unused parameter ‘data’ test_multibuttonentry.c:22:55: warning: unused parameter ‘obj’ test_multibuttonentry.c:22:66: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_item_clicked_cb’: test_multibuttonentry.c:28:37: warning: unused parameter ‘data’ test_multibuttonentry.c:28:56: warning: unused parameter ‘obj’ test_multibuttonentry.c: In function ‘_mbe_clicked_cb’: test_multibuttonentry.c:34:36: warning: unused parameter ‘data’ test_multibuttonentry.c:34:66: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_mbe_unfocused_cb’: test_multibuttonentry.c:54:38: warning: unused parameter ‘data’ test_multibuttonentry.c:54:68: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_mbe_focused_cb’: test_multibuttonentry.c:61:36: warning: unused parameter ‘data’ test_multibuttonentry.c:61:55: warning: unused parameter ‘obj’ test_multibuttonentry.c:61:66: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_expanded_cb’: test_multibuttonentry.c:67:32: warning: unused parameter ‘data’ test_multibuttonentry.c:67:51: warning: unused parameter ‘obj’ test_multibuttonentry.c:67:62: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_shrank_cb’: test_multibuttonentry.c:73:30: warning: unused parameter ‘data’ test_multibuttonentry.c:73:49: warning: unused parameter ‘obj’ test_multibuttonentry.c:73:60: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_shrink_state_changed_cb’: test_multibuttonentry.c:79:44: warning: unused parameter ‘data’ test_multibuttonentry.c:79:63: warning: unused parameter ‘obj’ test_multibuttonentry.c:79:74: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘_item_filter_cb’: test_multibuttonentry.c:85:47: warning: unused parameter ‘obj’ test_multibuttonentry.c:85:82: warning: unused parameter ‘item_data’ test_multibuttonentry.c:85:99: warning: unused parameter ‘data’ test_multibuttonentry.c: In function ‘_button_clicked_cb’: test_multibuttonentry.c:92:38: warning: unused parameter ‘data’ test_multibuttonentry.c:92:57: warning: unused parameter ‘obj’ test_multibuttonentry.c:92:68: warning: unused parameter ‘event_info’ test_multibuttonentry.c: In function ‘test_multibuttonentry’: test_multibuttonentry.c:161:38: warning: unused variable ‘bx2’ Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 65549
Diffstat (limited to '')
-rw-r--r--legacy/elementary/src/bin/test_multibuttonentry.c192
1 files changed, 192 insertions, 0 deletions
diff --git a/legacy/elementary/src/bin/test_multibuttonentry.c b/legacy/elementary/src/bin/test_multibuttonentry.c
new file mode 100644
index 0000000000..ea0b9d89ad
--- /dev/null
+++ b/legacy/elementary/src/bin/test_multibuttonentry.c
@@ -0,0 +1,192 @@
+#include <Elementary.h>
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#ifndef ELM_LIB_QUICKLAUNCH
+
+static void _item_selected_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)event_info;
+ printf("\n selected item = %s\n", elm_multibuttonentry_item_label_get(item));
+
+}
+
+// "item,added" smart callback of multibuttonentry.
+static void _item_added_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
+{
+ Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)event_info;
+ printf("\n added item = %s\n", elm_multibuttonentry_item_label_get(item));
+}
+
+// "item,deleted" smart callback
+static void _item_deleted_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ printf("\n deleted item \n");
+}
+
+// "item,clicked" smart callback
+static void _item_clicked_cb( void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info )
+{
+ Elm_Multibuttonentry_Item *item = (Elm_Multibuttonentry_Item *)event_info;
+ printf("\n clicked item = %s \n", elm_multibuttonentry_item_label_get(item));
+}
+
+static void _mbe_clicked_cb( void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__ )
+{
+ //Unset the multibuttonentry to contracted mode of single line
+ elm_multibuttonentry_shrink_mode_set(obj, 0);
+ printf("\n A multibuttonentry is clicked! \n");
+ Evas_Object *entry;
+ entry = elm_multibuttonentry_entry_get(obj);
+ if (!entry)
+ {
+ printf("%s entry is NULL\n", __func__);
+ }
+
+ Evas_Coord x, y, w, h;
+ Evas_Coord mbe_x, mbe_y, mbe_w, mbe_h;
+ evas_object_geometry_get(obj, &mbe_x, &mbe_y, &mbe_w, &mbe_h);
+ evas_object_geometry_get(entry, &x, &y, &w, &h);
+ printf("%s mbe x :%d y:%d w :%d h:%d\n", __func__, mbe_x, mbe_y, mbe_w, mbe_h);
+ printf("%s wd->entry x :%d y:%d w :%d h:%d\n", __func__, x, y, w, h);
+}
+
+static void _mbe_unfocused_cb( void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__ )
+{
+ //Set the multibuttonentry to contracted mode of single line
+ elm_multibuttonentry_shrink_mode_set(obj, 1);
+ printf("\n A multibuttonentry is unfocused! \n");
+}
+
+static void _mbe_focused_cb( void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__ )
+{
+ printf("\n A multibuttonentry is focused! \n");
+}
+
+// "expanded" smart callback
+static void _expanded_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ printf("\n expanded! \n");
+}
+
+// "contracted" smart callback
+static void _shrank_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ printf("\n contracted! \n");
+}
+
+// "contracted,state,changed" smart callback
+static void _shrink_state_changed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ printf("\n contracted state changed! \n");
+}
+
+// "item verified" confirm callback
+static Eina_Bool _item_filter_cb(Evas_Object *obj __UNUSED__, const char* item_label, void *item_data __UNUSED__, void *data __UNUSED__)
+{
+ printf("%s, label: %s\n", __func__, item_label);
+
+ return EINA_TRUE;
+}
+
+static void _button_clicked_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ printf("%s button is clicked\n", __func__);
+}
+
+static Evas_Object* _add_multibuttonentry(Evas_Object *parent)
+{
+ Evas_Object *scr = NULL;
+ Evas_Object *mbe = NULL;
+ void *data = NULL;
+
+ scr = elm_scroller_add(parent);
+ elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE);
+ elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF,ELM_SCROLLER_POLICY_AUTO);
+ evas_object_show(scr);
+
+ mbe = elm_multibuttonentry_add(parent);
+ elm_multibuttonentry_label_set(mbe, "To: ");
+ elm_multibuttonentry_guide_text_set(mbe, "Tap to add recipient");
+ evas_object_size_hint_weight_set(mbe, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(mbe, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_content_set(scr, mbe);
+
+ // Add item verify callback to Multibuttonentry
+ elm_multibuttonentry_item_filter_append(mbe, _item_filter_cb, data);
+
+ //Add "item,selected","item,added", "item,deleted", "clicked", "unfocused", "expanded", "contracted" and "contracted,state,changed" smart callback
+ evas_object_smart_callback_add(mbe, "item,selected", _item_selected_cb, NULL);
+ evas_object_smart_callback_add(mbe, "item,added", _item_added_cb, NULL);
+ evas_object_smart_callback_add(mbe, "item,deleted", _item_deleted_cb, NULL);
+ evas_object_smart_callback_add(mbe, "item,clicked", _item_clicked_cb, NULL);
+
+ evas_object_smart_callback_add(mbe, "clicked", _mbe_clicked_cb, NULL);
+ evas_object_smart_callback_add(mbe, "focused", _mbe_focused_cb, NULL);
+ evas_object_smart_callback_add(mbe, "unfocused", _mbe_unfocused_cb, NULL);
+
+ evas_object_smart_callback_add(mbe, "expanded", _expanded_cb, NULL);
+ evas_object_smart_callback_add(mbe, "shrank", _shrank_cb, NULL);
+ evas_object_smart_callback_add(mbe, "shrink,state,changed", _shrink_state_changed_cb, NULL);
+
+ evas_object_resize(mbe, 220, 300);
+ elm_object_focus_set(mbe, EINA_TRUE);
+
+ return scr;
+}
+
+static Evas_Object* _add_buttons(Evas_Object *parent)
+{
+ Evas_Object *bx = NULL;
+ Evas_Object *btn;
+
+ bx = elm_box_add(parent);
+ elm_box_horizontal_set(bx, EINA_TRUE);
+ elm_box_homogeneous_set(bx, EINA_TRUE);
+
+ btn = elm_button_add(parent);
+ evas_object_smart_callback_add(btn, "clicked", _button_clicked_cb, NULL);
+ elm_object_text_set(btn, "click");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.0);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(bx, btn);
+ evas_object_show(btn);
+
+ return bx;
+}
+
+void
+test_multibuttonentry(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *win, *bg, *sc, *bx;
+ Evas_Object *ly;
+ char buf[PATH_MAX];
+
+ win = elm_win_add(NULL, "Multibuttonentry", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Multibuttonentry");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ bg = elm_bg_add(win);
+ elm_win_resize_object_add(win, bg);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(bg);
+
+ ly = elm_layout_add(win);
+ snprintf(buf, sizeof(buf), "%s/objects/multibuttonentry.edj", elm_app_data_dir_get());
+ elm_layout_file_set(ly, buf, "multibuttonentry_test");
+ evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, ly);
+ evas_object_show(ly);
+
+ sc = _add_multibuttonentry(ly);
+ elm_object_part_content_set(ly, "multibuttonentry", sc);
+
+ bx = _add_buttons(ly);
+ elm_object_part_content_set(ly, "box", bx);
+
+ evas_object_resize(win, 320, 480);
+ evas_object_show(win);
+ elm_object_focus_set(sc, EINA_TRUE);
+
+}
+#endif