找回密码
 立即注册
查看: 2597|回复: 0

tizen如何使用基本ctxpopup小部件的代码

[复制链接]
发表于 2015-8-15 19:43:30 | 显示全部楼层 |阅读模式
这个代码片段演示了如何使用基本ctxpopup小部件。
  1. static void ctxpopup_item_cb(void *data, Evas_Object *obj, void *event_info) {
  2.         printf("item selected: %s\n", elm_object_item_text_get(event_info));
  3. }

  4. static void dismissed_cb(void *data, Evas_Object *obj, void *event_info) {
  5.         evas_object_del(obj);
  6. }

  7. static void show_ctx_popup(void *data, Evas_Object *obj, void *event_info) {
  8.         appdata_s *ad = (appdata_s *) data;

  9.         Evas_Object *ctxpopup = elm_ctxpopup_add(ad->win);
  10.         elm_object_style_set(ctxpopup, "dropdown/list");
  11.         eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);
  12.         evas_object_smart_callback_add(ctxpopup, "dismissed", dismissed_cb, NULL);

  13.         //add list of 3 items
  14.         elm_ctxpopup_item_append(ctxpopup, "Item 1", NULL, ctxpopup_item_cb, NULL);
  15.         elm_ctxpopup_item_append(ctxpopup, "Item 2", NULL, ctxpopup_item_cb, NULL);
  16.         elm_ctxpopup_item_append(ctxpopup, "Item 3", NULL, ctxpopup_item_cb, NULL);
  17.         elm_ctxpopup_direction_priority_set(ctxpopup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN,
  18.                         ELM_CTXPOPUP_DIRECTION_UNKNOWN, ELM_CTXPOPUP_DIRECTION_UNKNOWN);

  19.         //change position
  20.         Evas_Coord x, y;
  21.         evas_pointer_canvas_xy_get(evas_object_evas_get(ad->win), &x, &y);
  22.         evas_object_move(ctxpopup, x, y);
  23.         
  24.         evas_object_show(ctxpopup);
  25. }

  26. static void ctx_popup_test(appdata_s *ad) {
  27.         Evas_Object *button;
  28.         button = elm_button_add(ad->win);
  29.         elm_object_text_set(button, "Show ctx popup");
  30.         evas_object_smart_callback_add(button, "clicked", show_ctx_popup, ad);
  31.         evas_object_resize(button, 480, 100);
  32.         evas_object_show(button);
  33. }
复制代码

欢迎来到泰泽网:http://www.tizennet.com/ 泰泽论坛:http://bbs.tizennet.com/ 好没有内涵哦,快到设置中更改这个无聊的签名吧!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|泰泽应用|泰泽论坛|泰泽网|小黑屋|Archiver|手机版|泰泽邮箱|泰泽网 ( 蜀ICP备13024062号-1 )

GMT+8, 2024-11-24 02:53 , Processed in 0.084951 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表