/**
 * @brief Positive test case of elm_segment_control_item_del()
 */
static void utc_UIFW_elm_segment_control_item_del_func_01(void)
{
   Elm_Object_Item *item = NULL;
   Elm_Object_Item *it = NULL;
   Evas_Object *segment = NULL;

   segment = elm_segment_control_add(main_win);
   evas_object_show(segment);
   item = elm_segment_control_item_add(segment, NULL, "All");
   elm_segment_control_item_del(item);
   it = elm_segment_control_item_get(segment,0);
   if (it) {
      tet_infoline("elm_segment_control_item_del() failed in positive test case");
      tet_result(TET_FAIL);
      return;
   }
   tet_result(TET_PASS);
}
/**
 * @brief Implementation AtkObject->ref_child callback
 *
 * ATK doc says:\n
 * Gets a reference to the specified accessible child of the object. The
 * accessible children are 0-based so the first accessible child is at index 0,
 * the second at index 1 and so on.
 *
 * @returns an AtkObject representing the specified accessible child of the
 * accessible.
 */
static AtkObject *
eail_segment_control_ref_child(AtkObject *obj, gint i)
{
   AtkObject *child = NULL;
   Evas_Object *widget = NULL;

   widget = eail_widget_get_widget(EAIL_WIDGET(obj));
   if (!widget) return NULL;

   if (elm_segment_control_item_count_get(widget) > i)
     {
        child = eail_item_new(obj, ATK_ROLE_LIST_ITEM);
        atk_object_initialize(child, elm_segment_control_item_get(widget, i));

        g_object_ref(child);
     }

   return child;
}
PREFIX value ml_elm_segment_control_item_get(value v_obj, value v_i)
{
        return copy_Elm_Object_Item_opt(elm_segment_control_item_get(
                Evas_Object_val(v_obj), Int_val(v_i)));
}
Esempio n. 4
0
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   Evas_Object *win, *bg, *sc, *ic;
   Elm_Object_Item *seg_it;
   int count, idx;

   win = elm_win_add(NULL, "segment_control", ELM_WIN_BASIC);
   elm_win_title_set(win, "Segment Control Example");
   evas_object_smart_callback_add(win, "delete,request", _on_done, NULL);

   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);

   sc = elm_segment_control_add(win);
   evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
   elm_win_resize_object_add(win, sc);
   evas_object_show(sc);

   elm_segment_control_item_add(sc, NULL, "only text");

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, "close");
   elm_segment_control_item_add(sc, ic, NULL);

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, "home");
   elm_segment_control_item_add(sc, ic, "Home");

   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, "close");
   elm_segment_control_item_add(sc, ic, "");

   count = elm_segment_control_item_count_get(sc);
   elm_segment_control_item_insert_at(sc, NULL, "Inserted at", count - 1);

   seg_it = elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
   elm_object_item_del(seg_it);

   elm_segment_control_item_insert_at(sc, NULL, "To be deleted", 2);
   elm_segment_control_item_del_at(sc, 2);

   seg_it = elm_segment_control_item_get(sc, 0);
   elm_object_item_text_set(seg_it, "Only Text");

   count = elm_segment_control_item_count_get(sc);
   seg_it = elm_segment_control_item_get(sc, count / 2);
   elm_segment_control_item_selected_set(seg_it, EINA_TRUE);
   seg_it = elm_segment_control_item_selected_get(sc);
   idx = elm_segment_control_item_index_get(seg_it);
   printf("Item selected: %i\n", idx);

   evas_object_show(win);

   elm_run();
   elm_shutdown();

   return 0;
}