コード例 #1
0
void ActivityScheduleScenarioView::selectTimeType(void *data)
{
    int *user_data = reinterpret_cast<int *>(data);

    if (editState == EDIT_START_TYPE)
    {
        editStatesHist.push(editState);
        edit_range.start_type = *user_data;
        if (edit_range.start_type == TimeRange::HTYPE_NORMAL)
            editState = EDIT_START_TIME;
        else
            editState = EDIT_START_OFFSET;
    }
    else if (editState == EDIT_END_TYPE)
    {
        edit_range.end_type = *user_data;
        editStatesHist.push(editState);
        if (edit_range.end_type == TimeRange::HTYPE_NORMAL)
            editState = EDIT_END_TIME;
        else
            editState = EDIT_END_OFFSET;
    }

    if (editState == EDIT_END_TIME ||
        editState == EDIT_START_TIME)
    {
        if (editState == EDIT_END_TIME)
            edit_range.end_type = TimeRange::HTYPE_NORMAL;
        else
            edit_range.start_type = TimeRange::HTYPE_NORMAL;
        showTimeSelection(NULL);
    }
    else
    {
        Evas_Object *table = createPaddingTable(evas, parent, 300, 300);

        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 = _("<b>Offset time</b><br><light_blue><small>You can choose to shift the sun time</small></light_blue>");
        GenlistItemSimpleHeader *header = new GenlistItemSimpleHeader(evas, glist, title_label, "navigation_back");
        header->Append(glist);
        header->setButtonLabel("button.back", "Début");
        header->button_click.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonHeaderBackClick));

        GenlistItemSimple *item = NULL;

        for (int i = 0;i < 3;i++)
        {
            switch (i)
            {
            case 0: item = new GenlistItemSimple(evas, glist, _("Use the exact sun time"), true, false, new int(i)); break;
            case 1: item = new GenlistItemSimple(evas, glist, _("Add time"), true, false, new int(i)); break;
            case 2: item = new GenlistItemSimple(evas, glist, _("Substract time"), true, false, new int(i)); break;
            default: break;
            }

            item->Append(glist, header);
            item->setAutoDeleteUserData(new DeletorT<int *>);
            item->item_selected.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::showTimeSelection));
        }

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

        elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos");
    }
}
コード例 #2
0
void ActivityScheduleScenarioView::createTimeSelectTypeList(void *data, Evas_Object *edje_object, string emission, string source)
{
    if ((editState == EDIT_START_TIME || editState == EDIT_START_TIME_OFFSET) && cycle)
    {
        editStatesHist.push(editState);
        editState = EDIT_END_TYPE;
    }

    if (editState == EDIT_END_TYPE)
    {
        if (edit_range.start_type == TimeRange::HTYPE_NORMAL ||
            edit_range.start_offset != 0)
        {
            edit_range.shour = Utils::to_string(elm_spinner_value_get(spin_start_hours));
            edit_range.smin = Utils::to_string(elm_spinner_value_get(spin_start_min));
            edit_range.ssec = Utils::to_string(elm_spinner_value_get(spin_start_sec));
        }
        else
        {
            edit_range.shour = "0";
            edit_range.smin = "0";
            edit_range.ssec = "0";
        }
    }

    Evas_Object *table = createPaddingTable(evas, parent, 320, 300);

    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;
    GenlistItemSimpleHeader *header = NULL;
    if (editState == EDIT_START_TYPE)
    {
        title_label = _("Start of schedulling<br><small><light_blue>Start time of the scenario</light_blue></small>");
        header = new GenlistItemSimpleHeader(evas, glist, title_label);
        header->Append(glist);
    }
    else
    {
        title_label = _("End of schedulling<br><small><light_blue>End time of the scenario</light_blue></small>");
        header = new GenlistItemSimpleHeader(evas, glist, title_label, "navigation_back");
        header->Append(glist);
        header->setButtonLabel("button.back", _("Start"));
        header->button_click.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::buttonHeaderBackClick));
    }

    GenlistItemSimple *item = nullptr;

    for (int i = 0;i < 4;i++)
    {
        switch (i)
        {
        case 0: item = new GenlistItemSimple(evas, glist, _("Use a fixed time"), true, false, new int(TimeRange::HTYPE_NORMAL)); break;
        case 1: item = new GenlistItemSimple(evas, glist, _("Use the sunrise"), true, false, new int(TimeRange::HTYPE_SUNRISE)); break;
        case 2: item = new GenlistItemSimple(evas, glist, _("Use the sunset"), true, false, new int(TimeRange::HTYPE_SUNSET)); break;
        case 3: item = new GenlistItemSimple(evas, glist, _("Use the midday sun"), true, false, new int(TimeRange::HTYPE_NOON)); break;
        default: break;
        }

        item->Append(glist, header);
        item->setAutoDeleteUserData(new DeletorT<int *>);
        item->item_selected.connect(sigc::mem_fun(*this, &ActivityScheduleScenarioView::selectTimeType));
    }

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

    elm_naviframe_item_push(pager_popup, NULL, NULL, NULL, table, "calaos");
}