static void
_list_item_cb2(void *data, Evas_Object *obj, void *event_info)
{
   Evas_Object *ctxpopup;
   Elm_Object_Item *it;
   Evas_Coord x,y;

   if (list_mouse_down > 0) return;

   ctxpopup = elm_ctxpopup_add(obj);
   evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed_cb, NULL);
   elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE);

   item_new(ctxpopup, NULL, "home");
   item_new(ctxpopup, NULL, "file");
   item_new(ctxpopup, NULL, "delete");
   item_new(ctxpopup, NULL, "folder");
   it = item_new(ctxpopup, NULL, "edit");
   elm_object_item_disabled_set(it, EINA_TRUE);
   item_new(ctxpopup, NULL, "clock");

   evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
   evas_object_move(ctxpopup, x, y);
   evas_object_show(ctxpopup);

   elm_list_item_selected_set(event_info, EINA_FALSE);
}
void ActivityScheduleScenarioView::showTimeRangePopup()
{
    pager_popup = elm_naviframe_add(parent);
    evas_object_show(pager_popup);

    spin_start_hours = spin_start_min = spin_start_sec = NULL;
    spin_end_hours = spin_end_min = spin_end_sec = NULL;

    createTimeSelectTypeList(NULL, NULL, "", "");

    //create popup
    popup = elm_ctxpopup_add(parent);
    elm_object_content_set(popup, pager_popup);
    elm_object_style_set(popup, "calaos");
    elm_ctxpopup_direction_priority_set(popup,
                                        ELM_CTXPOPUP_DIRECTION_DOWN,
                                        ELM_CTXPOPUP_DIRECTION_RIGHT,
                                        ELM_CTXPOPUP_DIRECTION_LEFT,
                                        ELM_CTXPOPUP_DIRECTION_UP);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);
}
Example #3
0
File: main.c Project: jiezh/h5vcc
static Eina_Bool
zoom_level_set(Evas_Object *webview, int level)
{
    if (level < 0  || level >= sizeof(zoomLevels) / sizeof(float))
        return EINA_FALSE;

    Evas_Coord ox, oy, mx, my, cx, cy;
    evas_pointer_canvas_xy_get(evas_object_evas_get(webview), &mx, &my); // Get current mouse position on window.
    evas_object_geometry_get(webview, &ox, &oy, NULL, NULL); // Get webview's position on window.
    cx = mx - ox; // current x position = mouse x position - webview x position
    cy = my - oy; // current y position = mouse y position - webview y position

    Eina_Bool result = ewk_view_scale_set(webview, zoomLevels[level], cx, cy);
    return result;
}
void ApplicationController::onMenuRebootClick()
{
    Evas_Object *table = createPaddingTable(evas, layout, 260, 200);

    Evas_Object *glist = elm_genlist_add(layout);
    elm_object_style_set(glist, "calaos");
    elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
    evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(glist);

    Evas_Object *popup = elm_ctxpopup_add(layout);
    elm_object_style_set(popup, "calaos");
    evas_object_size_hint_min_set(popup, 300, 240);

    GenlistItemSimple *item;

    item = new GenlistItemSimple(evas, glist, _("Restart application only"), true);
    item->Append(glist);
    item->item_selected.connect([this, popup](void *)
    {
        elm_ctxpopup_dismiss(popup);
        menuView->CloseLinkMenu();

        system("systemctl restart calaos-home");
    });

    item = new GenlistItemSimple(evas, glist, _("Reboot machine"), true);
    item->Append(glist);
    item->item_selected.connect([this, popup](void *)
    {
        elm_ctxpopup_dismiss(popup);
        menuView->CloseLinkMenu();

        system("sync");
        system("reboot");
    });

    elm_table_pack(table, glist, 1, 1, 1, 1);

    elm_object_content_set(popup, table);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);
}
static int 
_elitaire_card_dragged_cb(void * data)
{
    Elitaire_Card_Job * job;
    Evas_Object * card;
    Elitaire_Card * eli_card;
    Evas_Coord mx, my;
    Evas * evas;

    job = (Elitaire_Card_Job *) data;
    card = job->card;
    eli_card = (Elitaire_Card *) evas_object_smart_data_get(card);

    evas = evas_object_evas_get(card);
    evas_pointer_canvas_xy_get(evas, &mx, &my);

    if ((evas_pointer_button_down_mask_get(evas) - 1) % 2) {
        /* Job now ends */
        Evas_Coord to_x, to_y, x, y, w, h;
        Elitaire *eli;
        int clstack, moved = 0;

        eli = elitaire_card_elitaire_get(card);
        evas_object_geometry_get(card, &x, &y, &w, &h);

        clstack = elitaire_clicked_stack_get(eli, x + w / 2, y + h / 2);

        if (clstack >= 0)
            moved =
                eli->game->move(elitaire_card_playingCard_get(card), clstack);
        if (!moved) {
            if (eli->animate) {
                elitaire_card_xy_get(card, &to_x, &to_y);
                if (!(x == to_x && y == to_y))
                    elitaire_card_slide(card, to_x, to_y);
            }
            else
                elitaire_reinit(eli);
        }
        elitaire_job_del(eli_card->jobs, data);
        return 0;
    }

    evas_object_move(card, mx - job->x.ec, my - job->y.ec);

    return 1;
}
Example #6
0
static void _elitaire_stack_mouse_up_cb(void * data, Evas * e, Evas_Object * obj,
                                 void * event_info)
{

    Evas_Coord x, y;
    int clstack;
    Evas_Event_Mouse_Up * ev = (Evas_Event_Mouse_Up *) event_info;
    Elitaire * eli = (Elitaire *) data;

    if (eli) {
        if (ev->button == 1) {
            evas_pointer_canvas_xy_get(e, &x, &y);

            clstack = elitaire_clicked_stack_get(eli, x, y);

            if (clstack < 0) return;
            eli->game->clickOn(clstack);
        }
    }
}
void ApplicationController::onMenuAddWidgetClick()
{
    Evas_Object *table = createPaddingTable(evas, layout, 260, 200);

    Evas_Object *glist = elm_genlist_add(layout);
    elm_object_style_set(glist, "calaos");
    elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
    evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(glist);

    Evas_Object *popup = elm_ctxpopup_add(layout);
    elm_object_style_set(popup, "calaos");
    evas_object_size_hint_min_set(popup, 300, 240);

    vector<ModuleDef> mods = ModuleManager::Instance().getAvailableModules();

    for (uint i = 0;i < mods.size();i++)
    {
        ModuleDef def = mods[i];
        GenlistItemWidget *item = new GenlistItemWidget(evas, glist, def);
        item->Append(glist);
        item->item_selected.connect([this,i,popup](void *)
        {
            vector<ModuleDef> m = ModuleManager::Instance().getAvailableModules();
            widgetsController->AddWidget(m[i], 200, 200);
            elm_ctxpopup_dismiss(popup);
            menuView->CloseLinkMenu();
        });
    }

    elm_table_pack(table, glist, 1, 1, 1, 1);

    elm_object_content_set(popup, table);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);
}
static void
_btn_clicked(void *data, Evas_Object *obj, void *event_info)
{
    Evas_Object *win = data;
    Evas_Object *ctxpopup;
    Evas_Coord x,y;

    ctxpopup = elm_ctxpopup_add(win);

    elm_object_style_set(ctxpopup, "1text.1icon");
    elm_object_signal_emit(ctxpopup, "elm,action,focus", "elm");
    item_new(ctxpopup, "Text List1", "home");
    item_new(ctxpopup, "Text List2", "file");
    item_new(ctxpopup, "Text List3", "delete");

    switch (dir) {
        case 0:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_UP, 0, 0, 0);
            break;
        case 1:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_DOWN, 0, 0, 0);
            break;
        case 2:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_LEFT, 0, 0, 0);
            break;
        case 3:
            elm_ctxpopup_direction_priority_set(ctxpopup,
                                                ELM_CTXPOPUP_DIRECTION_RIGHT, 0, 0, 0);
            break;
    }

    evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
    evas_object_move(ctxpopup, x, y);
    evas_object_show(ctxpopup);
    eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, _ctxpopup_back_key_cb, NULL);
}
void 
elitaire_card_dragged(Evas_Object * card)
{
    Elitaire_Card_Job * job;
    Evas * e;
    Evas_Coord mx, my, x, y;
    Elitaire_Card * ecard;

    ecard = (Elitaire_Card *) evas_object_smart_data_get(card);
    e = evas_object_evas_get(card);

    evas_object_geometry_get(card, &x, &y, NULL, NULL);
    evas_pointer_canvas_xy_get(e, &mx, &my);

    job = _elitaire_card_job_new(card);
    job->x.ec = mx - x;
    job->y.ec = my - y;

    _elitaire_card_drag(card);
    elitaire_job_add(ecard->jobs, _elitaire_card_job_dragged, 
		    				ELITAIRE_JOB_SYNC_WAIT, job);
    
    if (!ecard->eli->shadow) _elitaire_card_drop(card);
}
Example #10
0
static Eina_Bool
_anim_cb(void *data)
{
   App_Data *ad = data;
   Evas_Object *o;
   int r, g, b, a, x, y, w, h, f;
   int win_w, win_h, mx, my;

   f = ad->frame;
   r = ad->colors[ad->colors_index].r;
   g = ad->colors[ad->colors_index].g;
   b = ad->colors[ad->colors_index].b;
   a = ad->colors[ad->colors_index].a;
   evas_output_size_get(ad->canvas, &win_w, &win_h);

   o = evas_object_name_find(ad->canvas, "obj1");
   efl_gfx_map_reset(o);
   efl_gfx_map_rotate(o, 3 * f, NULL, 0.5, 0.5);
   efl_gfx_map_smooth_set(o, ad->smooth);
   efl_gfx_map_alpha_set(o, ad->alpha);
   efl_gfx_map_color_set(o, -1, r, g, b, a);


   o = evas_object_name_find(ad->canvas, "obj2");
   efl_gfx_size_get(o, NULL, &h);
   efl_gfx_map_reset(o);
   efl_gfx_map_smooth_set(o, ad->smooth);
   efl_gfx_map_alpha_set(o, ad->alpha);
   efl_gfx_map_color_set(o, -1, r, g, b, a);
   efl_gfx_map_translate(o, 0, 0, 100);
   efl_gfx_map_rotate_3d(o, f * 6, f * 6, f * 6, NULL, 1./3., 10. / h, 0);
   if (ad->apply_lighting)
     {
        efl_gfx_map_lightning_3d(o, ad->canvas, 0.5, 0.5, -100.,
                                 255, 255, 255, 0, 0, 0);
     }


   o = evas_object_name_find(ad->canvas, "obj3");
   efl_gfx_size_get(o, &w, &h);
   efl_gfx_map_reset(o);
   efl_gfx_map_smooth_set(o, ad->smooth);
   efl_gfx_map_alpha_set(o, ad->alpha);
   efl_gfx_map_color_set(o, -1, r, g, b, a);
   efl_gfx_map_translate(o, 0, h/2, -20);
   efl_gfx_map_rotate_3d(o, 20, f * 6, 0, NULL, 0.5, 0.5, w / 2);
   if (ad->apply_perspective)
     efl_gfx_map_perspective_3d(o, NULL, 0.5, 0.5, 0, 256);
   if (ad->apply_lighting)
     {
        evas_pointer_canvas_xy_get(ad->canvas, &mx, &my);
        efl_gfx_map_lightning_3d(o, ad->canvas,
                                 (double) mx / win_w, (double) my / win_h,
                                 -256, 255, 255, 255, 0, 0, 0);
     }
   if (ad->backface_culling)
     efl_gfx_visible_set(o, efl_gfx_map_clockwise_get(o));
   else
     efl_gfx_visible_set(o, 1);


   o = evas_object_name_find(ad->canvas, "obj4");
   efl_gfx_geometry_get(o, &x, &y, &w, &h);
   efl_gfx_map_reset(o);
   efl_gfx_map_smooth_set(o, ad->smooth);
   efl_gfx_map_alpha_set(o, ad->alpha);
   efl_gfx_map_coord_absolute_set(o, 0, x, y + h, 0);
   efl_gfx_map_coord_absolute_set(o, 1, x + w, y + h, 0);
   efl_gfx_map_coord_absolute_set(o, 2, win_w - 10, win_h - 30, 0);
   efl_gfx_map_coord_absolute_set(o, 3, (win_w / 2) + 10, win_h - 30, 0);
   efl_gfx_map_uv_set(o, 0, 0, 1);
   efl_gfx_map_uv_set(o, 1, 1, 1);
   efl_gfx_map_uv_set(o, 2, 1, 2. / 3.);
   efl_gfx_map_uv_set(o, 3, 0, 2. / 3.);
   efl_gfx_map_color_set(o, 0, 200, 200, 200, 150);
   efl_gfx_map_color_set(o, 1, 200, 200, 200, 150);
   efl_gfx_map_color_set(o, 2, 0, 0, 0, 0);
   efl_gfx_map_color_set(o, 3, 0, 0, 0, 0);


   ad->frame = (ad->frame + 1) % 60;

   return EINA_TRUE;
}
void ActivityScenariosView::buttonPressed(void *data, Evas_Object *_edje, std::string emission, std::string source)
{
    if (source == "button.calendar")
    {
        Evas_Object *table = createPaddingTable(evas, parent, 330, 300, 10, 10);

        calendar = elm_calendar_add(parent);
        elm_object_style_set(calendar, "calaos");

        elm_calendar_first_day_of_week_set(calendar, ELM_DAY_MONDAY);

        const char *weekdays[] = { "DIM", "LUN", "MAR", "MER", "JEU", "VEN", "SAM" };
        elm_calendar_weekdays_names_set(calendar, weekdays);

        evas_object_smart_callback_add(calendar, "changed", _calendar_cb, this);

        //Mark sundays
        struct tm sunday = { 0, 0, 12, 7, 0, 0, 6, 0, -1, 0, NULL };
        elm_calendar_mark_add(calendar, "checked", &sunday, ELM_CALENDAR_WEEKLY);
        elm_calendar_marks_draw(calendar);

        evas_object_size_hint_fill_set(calendar, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(calendar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_show(calendar);

        elm_table_pack(table, calendar, 1, 1, 1, 1);

        Evas_Object *popup = elm_ctxpopup_add(parent);
        elm_object_content_set(popup, table);
        elm_object_style_set(popup, "calaos");
        elm_ctxpopup_direction_priority_set(popup,
                                            ELM_CTXPOPUP_DIRECTION_DOWN,
                                            ELM_CTXPOPUP_DIRECTION_LEFT,
                                            ELM_CTXPOPUP_DIRECTION_RIGHT,
                                            ELM_CTXPOPUP_DIRECTION_UP);

        Evas_Coord x,y;
        evas_pointer_canvas_xy_get(evas, &x, &y);
        evas_object_move(popup, x, y);
        evas_object_show(popup);
    }
    else if (source == "button.calendar.today")
    {
        tzset(); //Force reload of timezone data
        time_t t = time(0);
        currDate = *localtime(&t);
        reloadCalendar();
    }
    else if (source == "button.create")
    {
        buttonCreatePressed.emit();
    }
    else if (source == "button.list.all")
    {
        view_mode = VIEW_MODE_ALL;
        loadScenarioList();
    }
    else if (source == "button.list.light")
    {
        view_mode = VIEW_MODE_LIGHT;
        loadScenarioList();
    }
    else if (source == "button.list.shutters")
    {
        view_mode = VIEW_MODE_SHUTTER;
        loadScenarioList();
    }
    else if (source == "button.list.schedule")
    {
        view_mode = VIEW_MODE_SCHEDULE;
        loadScenarioList();
    }
}
Example #12
0
static Eina_Bool
_anim_cb(void *data)
{
   App_Data *ad = data;
   Evas_Map *m;
   Evas_Object *o;
   int r, g, b, a;
   int win_w, win_h, img_w, img_h;
   Evas_Coord x, y, w, h;

   evas_output_size_get(ad->canvas, &win_w, &win_h);

   m = evas_map_new(4);
   evas_map_smooth_set(m, ad->smooth);
   evas_map_alpha_set(m, ad->alpha);

   r = ad->colors[ad->colors_index].r;
   g = ad->colors[ad->colors_index].g;
   b = ad->colors[ad->colors_index].b;
   a = ad->colors[ad->colors_index].a;
   evas_map_util_points_color_set(m, r, g, b, a);

   o = evas_object_name_find(ad->canvas, "obj1");
   evas_object_geometry_get(o, &x, &y, &w, &h);

   evas_map_util_points_populate_from_object(m, o);
   evas_map_util_rotate(m, 3 * ad->frame, x + (w / 2), y + (h / 2));
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   o = evas_object_name_find(ad->canvas, "obj2");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   evas_map_util_points_populate_from_object_full(m, o, 100);
   evas_map_point_image_uv_set(m, 0, 0, 0);
   evas_map_point_image_uv_set(m, 1, img_w, 0);
   evas_map_point_image_uv_set(m, 2, img_w, img_h);
   evas_map_point_image_uv_set(m, 3, 0, img_h);
   evas_map_util_3d_rotate(m, ad->frame * 6, ad->frame * 6, ad->frame * 6,
                           x + (w / 3), y + 10, 0);
   if (ad->apply_lighting)
     evas_map_util_3d_lighting(m, win_w / 2, win_h / 2, -100,
                               255, 255, 255, 0, 0, 0);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   o = evas_object_name_find(ad->canvas, "obj3");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   evas_map_util_points_populate_from_geometry(m, x, y + (h / 2), w, h, -20);
   evas_map_point_image_uv_set(m, 0, 0, 0);
   evas_map_point_image_uv_set(m, 1, img_w, 0);
   evas_map_point_image_uv_set(m, 2, img_w, img_h);
   evas_map_point_image_uv_set(m, 3, 0, img_h);
   evas_map_util_3d_rotate(m, 20, ad->frame * 6, 0,
                           x + (w / 2), y + (w / 2), w / 2);

   if (ad->apply_perspective)
     evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 256);
   if (ad->apply_lighting)
     {
        Evas_Coord mx, my;
        evas_pointer_canvas_xy_get(ad->canvas, &mx, &my);
        evas_map_util_3d_lighting(m, mx, my, -256,
                                  255, 255, 255, 0, 0, 0);
     }
   if (ad->backface_culling)
     {
        if (evas_map_util_clockwise_get(m))
          evas_object_show(o);
        else
          evas_object_hide(o);
     }
   else
     evas_object_show(o);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   evas_map_free(m);

   o = evas_object_name_find(ad->canvas, "obj4");
   evas_object_geometry_get(o, &x, &y, &w, &h);
   evas_object_image_size_get(o, &img_w, &img_h);

   m = evas_map_new(4);
   evas_map_point_coord_set(m, 0, x, y + h, 0);
   evas_map_point_coord_set(m, 1, x + w, y + h, 0);
   evas_map_point_coord_set(m, 2, win_w - 10, win_h - 30, 0);
   evas_map_point_coord_set(m, 3, (win_w / 2) + 10, win_h - 30, 0);
   evas_map_point_image_uv_set(m, 0, 0, img_h);
   evas_map_point_image_uv_set(m, 1, img_w, img_h);
   evas_map_point_image_uv_set(m, 2, img_w, 2 * (img_h / 3));
   evas_map_point_image_uv_set(m, 3, 0, 2 * (img_h / 3));
   evas_map_point_color_set(m, 0, 200, 200, 200, 150);
   evas_map_point_color_set(m, 1, 200, 200, 200, 150);
   evas_map_point_color_set(m, 2, 0, 0, 0, 0);
   evas_map_point_color_set(m, 3, 0, 0, 0, 0);
   evas_object_map_set(o, m);
   evas_object_map_enable_set(o, EINA_TRUE);

   evas_map_free(m);

   ad->frame = (ad->frame + 1) % 60;

   return EINA_TRUE;
}
void ActivityScheduleScenarioView::reloadTimeRanges()
{
    elm_genlist_clear(schedule_list);

    vector<TimeRange> trange_sorted;
    auto sortTimeRange = [&trange_sorted](vector<TimeRange> &range, int day)
    {
        for (TimeRange &t: range)
        {
            auto it = std::find(trange_sorted.begin(), trange_sorted.end(), t);
            if (it != trange_sorted.end())
            {
                //timerange already in trange_sorted, add the day of week flag
                it->dayOfWeek.set(day);
            }
            else
            {
                TimeRange newtr = t;
                newtr.dayOfWeek.reset();
                newtr.dayOfWeek.set(day);
                trange_sorted.push_back(newtr);
            }
        }
    };

    sortTimeRange(range_infos.range_monday, 0);
    sortTimeRange(range_infos.range_tuesday, 1);
    sortTimeRange(range_infos.range_wednesday, 2);
    sortTimeRange(range_infos.range_thursday, 3);
    sortTimeRange(range_infos.range_friday, 4);
    sortTimeRange(range_infos.range_saturday, 5);
    sortTimeRange(range_infos.range_sunday, 6);

    for (TimeRange &t: trange_sorted)
    {
        GenlistItemScenarioScheduleTime *item = new GenlistItemScenarioScheduleTime(evas, parent, t);
        item->Append(schedule_list);
        item->edit_click.connect([=]()
        {
            is_edit = true;
            old_range = t;
            edit_range = t;
            editState = EDIT_START_TYPE;
            showTimeRangePopup();
        });
        item->del_click.connect([=]()
        {
            Evas_Object *table = createPaddingTable(evas, parent, 280, 260);

            Evas_Object *glist = elm_genlist_add(table);
            elm_object_style_set(glist, "calaos");
            elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
            evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
            evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
            evas_object_show(glist);

            string title_label = _("Confirmation");
            title_label += "<br><small><light_blue>";
            title_label += _("Are you sure to delete this schedule?");
            title_label +=  "</light_blue></small>";
            GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
            header->Append(glist);

            Evas_Object *popup_del = elm_ctxpopup_add(parent);

            GenlistItemSimple *_item = new GenlistItemSimple(evas, parent, _("Yes, delete this schedule"), true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                deleteTimeRange(t);
                elm_ctxpopup_dismiss(popup_del);
                reloadTimeRanges();
            });

            _item = new GenlistItemSimple(evas, parent, "Non", true);
            _item->Append(glist, header);
            _item->item_selected.connect([=](void *)
            {
                elm_ctxpopup_dismiss(popup_del);
            });

            elm_table_pack(table, glist, 1, 1, 1, 1);

            elm_object_content_set(popup_del, table);
            elm_object_style_set(popup_del, "calaos");
            elm_ctxpopup_direction_priority_set(popup_del,
                                                ELM_CTXPOPUP_DIRECTION_DOWN,
                                                ELM_CTXPOPUP_DIRECTION_UP,
                                                ELM_CTXPOPUP_DIRECTION_LEFT,
                                                ELM_CTXPOPUP_DIRECTION_RIGHT);

            Evas_Coord x,y;
            evas_pointer_canvas_xy_get(evas, &x, &y);
            evas_object_move(popup_del, x, y);
            evas_object_show(popup_del);
        });
    }

    //reload months
    if (range_infos.range_months.all())
    {
        //all months are selected

        item_all->setSelected(true);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(false);
    }
    else
    {
        item_all->setSelected(false);
        for (uint i = 0;i < items_months.size();i++)
            items_months[i]->setSelected(range_infos.range_months.test(i));
    }
}
void GenlistItemScenarioSchedule::buttonClickMore()
{
    if (!scenario) return;

    Evas_Object *table = createPaddingTable(evas, parent, 280, 260);

    Evas_Object *glist = elm_genlist_add(table);
    elm_object_style_set(glist, "calaos");
    elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
    evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
    evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_show(glist);

    string title_label = _("Scenario parameters<br><small><light_blue>Modify, add or delete a schedule.</light_blue></small>");
    GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
    header->Append(glist);

    GenlistItemSimple *_item;

    _item = new GenlistItemSimple(evas, glist, _("Modify the scenario"), true);
    _item->setIcon("calaos/icons/genlist/edit");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioModify));

    _item = new GenlistItemSimple(evas, glist, _("Delete the scenario"), true);
    _item->setIcon("calaos/icons/genlist/trash");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioDelete));

    _item = new GenlistItemSimple(evas, glist, _("Run the scenario now"), true);
    _item->setIcon("calaos/icons/genlist/play");
    _item->Append(glist, header);
    _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scenarioPlay));

    if (scenario->scenario_data.params["schedule"] == "false")
    {
        _item = new GenlistItemSimple(evas, glist, _("Add a schedule"), true);
        _item->setIcon("calaos/icons/genlist/plus");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleAdd));
    }
    else
    {
        _item = new GenlistItemSimple(evas, glist, _("Schedule modification"), true);
        _item->setIcon("calaos/icons/genlist/clock");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleModify));

        _item = new GenlistItemSimple(evas, glist, _("Delete schedule"), true);
        _item->setIcon("calaos/icons/genlist/trash");
        _item->Append(glist, header);
        _item->item_selected.connect(sigc::mem_fun(*this, &GenlistItemScenarioSchedule::scheduleDelete));
    }

    elm_table_pack(table, glist, 1, 1, 1, 1);

    pager_popup = elm_naviframe_add(parent);
    evas_object_show(pager_popup);

    popup = elm_ctxpopup_add(parent);
    elm_object_content_set(popup, pager_popup);
    elm_object_style_set(popup, "calaos");
    elm_ctxpopup_direction_priority_set(popup,
                                        ELM_CTXPOPUP_DIRECTION_DOWN,
                                        ELM_CTXPOPUP_DIRECTION_UP,
                                        ELM_CTXPOPUP_DIRECTION_LEFT,
                                        ELM_CTXPOPUP_DIRECTION_RIGHT);

    Evas_Coord x,y;
    evas_pointer_canvas_xy_get(evas, &x, &y);
    evas_object_move(popup, x, y);
    evas_object_show(popup);

    elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos");
}
Example #15
0
void GenlistItemTrack::buttonClickMore()
{
        Evas_Object *table = createPaddingTable(evas, parent, 260, 200);

        Evas_Object *glist = elm_genlist_add(parent);
        elm_object_style_set(glist, "calaos");
        elm_genlist_select_mode_set(glist, ELM_OBJECT_SELECT_MODE_ALWAYS);
        evas_object_size_hint_fill_set(glist, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(glist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_show(glist);

        string title_label = "Info de la <light_blue>piste #" + Utils::to_string(item_id + 1) + "</light_blue><br><small>Détails de la piste.</small>";
        GenlistItemBase *header = new GenlistItemSimpleHeader(evas, glist, title_label);
        header->Append(glist);

        string infolabel;
        if (item_infos["artist"] != "")
        {
                infolabel = item_infos["artist"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Artiste :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["album"] != "")
        {
                infolabel = item_infos["album"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Album :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["title"] != "")
        {
                infolabel = item_infos["title"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Titre :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["duration"] != "")
        {
                double dur;
                from_string(item_infos["duration"], dur);
                infolabel = Utils::time2string_digit((long)dur);
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Durée :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["genre"] != "")
        {
                infolabel = item_infos["genre"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Genre :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["type"] != "")
        {
                infolabel = item_infos["type"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Type de flux :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["bitrate"] != "")
        {
                infolabel = item_infos["bitrate"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Débit :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["filesize"] != "")
        {
                long int s;
                from_string(item_infos["filesize"], s);
                s /= 1024;
                s /= 1024;
                infolabel = Utils::to_string(s) + " Mo";
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Taille :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["samplerate"] != "")
        {
                infolabel = item_infos["samplerate"] + " Hz";
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Echantillonage :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["tagversion"] != "")
        {
                infolabel = item_infos["tagversion"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Version du tag :", infolabel);
                it->Append(glist, header);
        }
        if (item_infos["comment"] != "")
        {
                infolabel = item_infos["comment"];
                GenlistItemSimpleKeyValue *it = new GenlistItemSimpleKeyValue(evas, glist, "Commentaire :", infolabel);
                it->Append(glist, header);
        }

        elm_table_pack(table, glist, 1, 1, 1, 1);

        Evas_Object *popup_position = elm_ctxpopup_add(parent);
        elm_object_style_set(popup_position, "calaos");
        evas_object_size_hint_min_set(popup_position, 300, 240);

        elm_object_content_set(popup_position, table);

        Evas_Coord x,y;
        evas_pointer_canvas_xy_get(evas, &x, &y);
        evas_object_move(popup_position, x, y);
        evas_object_show(popup_position);
}